|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; p% r2 t0 X& t; h, q- [code]EDMA sample test application
, g# ~! n# {( k9 U - /*
5 l, o$ C0 ~6 n6 q, p2 n - * edma_test.c# r- V" X8 P2 B8 y
- *
) y6 B0 K8 M2 E; t9 Z9 r' R. G - * brief EDMA3 Test Application
: h) d1 H; j$ {: s9 Q - *
. D% F6 m- }; ] - * This file contains EDMA3 Test code., c4 u1 e1 e/ H. ~$ R0 U7 T
- *
2 F$ s7 j$ g1 w+ B, k2 z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ V1 m0 ?+ D% F& x; D& T7 R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# Z: W. _- \3 k1 V" l/ a2 J1 G( r - * TO CHANGE.; e6 ]* v8 ^9 r1 K3 C" g
- *' p) }$ u8 O+ ]( g# }; {0 P9 e3 i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 H. ]" `" J K. }) m9 k/ S - *
/ F$ E2 \" e( o1 P1 j - * This program is free software; you can redistribute it and/or
: Y) s V* ]" V. H1 s5 c. y1 { - * modify it under the terms of the GNU General Public License as: d2 l# c0 ^ D+ ^' r. H! s2 G7 i
- * published by the Free Software Foundation version 2.$ u: o/ m& r; N0 N) O$ `
- *$ P; ]0 w* L) S8 s2 g& x1 _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: ?7 m8 x- ^ E1 u: e! l( e* k
- * kind, whether express or implied; without even the implied warranty) i% Z) x) T. M" r4 c2 s. j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
z" x6 M. |6 o* G' D& R7 e - * GNU General Public License for more details.! N' K1 S6 k! q) L3 S0 R& C' U
- */
, r4 [* K7 Q$ \2 Z; |8 k3 q D
7 T7 _% u" | i. _: j- #include <linux/module.h>7 I: H6 i' B0 J; l
- #include <linux/init.h>, m9 x b, Z" R0 K P/ ~# ^
- #include <linux/errno.h>
5 B5 }! ^7 W$ _( n' Z3 O - #include <linux/types.h>) x6 F5 E% e% n/ T. N$ q
- #include <linux/interrupt.h>
' P, A# i" O1 w# A, Q - #include <asm/io.h>8 w, M: q& K9 d, D3 l; f- N
- #include <linux/moduleparam.h>
8 I: r8 C. [1 f: E, Q; q) | - #include <linux/sysctl.h>
0 ?2 J1 r( Z0 x1 d) U - #include <linux/mm.h>
1 a1 Z2 b! L) @* l1 Q* H! m: A# U, t7 s - #include <linux/dma-mapping.h>: m4 X! r3 d5 H$ Y
! K- r0 ]; c6 I2 r2 Z- #include <mach/memory.h>$ f% t# M1 i3 @
- #include <mach/hardware.h>
8 ? `) M& x6 W" ~ - #include <mach/irqs.h>
+ v. E/ @; {% }6 R% o- c; | - #include <asm/hardware/edma.h>6 v( E9 H5 A- o1 |( h$ s' G
4 l# s" [ q/ H4 S7 ^) Z0 D5 H. @- #undef EDMA3_DEBUG! }/ v: M) V7 k& c" V7 z- C) l
- /*#define EDMA3_DEBUG*/
7 v2 X4 c+ `) b- e
) s2 q" _- P9 ]- C0 p6 s! Z" j, D- #ifdef EDMA3_DEBUG3 h3 z! b3 Q5 v- \+ U; Y, L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* U' s/ c7 b! k5 F& {
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 s- n) [# S( Y6 @ O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 f4 {% n2 Z! l
- #else8 v8 p6 M$ F5 W+ p# Q
- #define DMA_PRINTK( x... )
- b/ R/ s5 i+ D7 ]3 ]; Z6 l* t - #define DMA_FN_IN
+ q! i( W$ Y" G3 ~, u7 g8 @ - #define DMA_FN_OUT! }' W; N' y x) |# z* E
- #endif
9 C: O7 b8 H" U' n - & E: a% c0 `' `& O, l" S: @/ t l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& ]5 [9 A1 K9 J( r5 @. ~
- #define STATIC_SHIFT 39 G( e; u0 M8 `+ A" |0 R! E; R
- #define TCINTEN_SHIFT 207 w2 n* b8 u/ M! N- A1 q
- #define ITCINTEN_SHIFT 211 w3 S, `1 `% J! u/ d
- #define TCCHEN_SHIFT 226 _, ~( W- @, T8 f
- #define ITCCHEN_SHIFT 235 n7 m' |1 L) c; r( r
" E, o% a; q1 m. q- static volatile int irqraised1 = 0;
3 {1 y1 I& F3 E - static volatile int irqraised2 = 0;; W5 y8 x1 e% ^. `' F7 `
0 I# B' B* t3 H; l B A# p: ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% o) W; V, X7 d# P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# K9 j2 y' }( e" Q7 S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 I* Q: X- r. O! P
- $ d! b: N$ A6 A* _
- dma_addr_t dmaphyssrc1 = 0;
, `3 o/ \* x: G, \5 } - dma_addr_t dmaphyssrc2 = 0;
. y/ t% f7 ~' r0 p6 h. J# W - dma_addr_t dmaphysdest1 = 0;
3 [( b+ R$ A( h8 p8 u1 a" A - dma_addr_t dmaphysdest2 = 0;
3 O: O% v7 M+ C) {) S. Q
: W/ B* w' Y. J% X q3 V5 Z- char *dmabufsrc1 = NULL;
; T& K. p' a4 ^1 I8 M# H# y% H - char *dmabufsrc2 = NULL;
) e+ D9 F6 k4 a; d. f! {) d, c - char *dmabufdest1 = NULL;3 Z+ F P- d$ H# {* S0 Q( G
- char *dmabufdest2 = NULL;7 _4 t& _* W& T! I) q7 L6 X
$ f8 t! T2 L$ @ ^3 r8 `' H8 v- static int acnt = 512;
# g* E- d$ _+ p2 i9 {3 ~& b5 h - static int bcnt = 8;! z1 w# y' r8 s( _
- static int ccnt = 8;
- o7 k5 S O3 V2 V/ V$ ^
3 f- Q% \" O- c# ~2 ? z. q- module_param(acnt, int, S_IRUGO);
! m, z& n Q! c& G3 d - module_param(bcnt, int, S_IRUGO);+ l; |7 D8 `% ]5 _
- module_param(ccnt, int, S_IRUGO);
复制代码
. F! `: o' f5 `# b: D! O$ y5 Q; I7 @, E0 @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% Y) p! q) K) y
arm-none-linux-gnueabi-gcc -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 F3 o9 l4 V8 V2 m( { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- x# M1 ?; V2 C( x5 k
7 g8 p+ S* N; Z9 d- N4 n& l' a5 s: d: o" a& L, ]; D/ E$ p& E
|
|