|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 y p: a1 p- K0 i; D+ G3 I
- [code]EDMA sample test application
9 S- x; p+ s: x$ Z9 c - /*/ ], |$ u! P2 r6 ^6 Y, k5 j) i8 ?
- * edma_test.c. X2 `5 q+ S, h& J* w, C% ~- O/ K
- *0 e1 Q* R- U* ?
- * brief EDMA3 Test Application
8 B7 w% ^( B: h' J - *
# z( x F* b; F7 S- x3 p - * This file contains EDMA3 Test code.
. h2 p# ]9 V6 K' X3 \& H - *' h+ \. ^; V3 j# z; H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. e$ ]: V. l7 D9 L3 q, v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: V j9 o9 o& m5 @& H - * TO CHANGE.& ~3 E( O4 l. J7 b" _; S$ I
- *" ]' C* }9 t. T4 @+ O/ v/ T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. c6 G' E( E/ D, U' Z( c' T+ o - *; j! \- T" m5 {5 E
- * This program is free software; you can redistribute it and/or' W. Z. p: N+ e O2 C n4 o; X' U
- * modify it under the terms of the GNU General Public License as7 d+ Z9 [+ p; {' F5 M# V: S4 L
- * published by the Free Software Foundation version 2.7 l$ T+ I' f, }* F) w
- *
, ~+ F. U: Q8 O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) D8 [: V3 S5 g - * kind, whether express or implied; without even the implied warranty
' G' u# ]- Q a, B x: i; b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 j1 A2 Y& N: k! a - * GNU General Public License for more details.
4 w; @' g5 P7 w% o, a - */
$ e* X. [8 ^3 {! ?
6 Q1 n- j& o2 T1 q0 @- #include <linux/module.h>
7 c k) a4 V8 e# Z* S - #include <linux/init.h>
0 Y- u. N" V7 S6 s& x+ V' \ - #include <linux/errno.h>. K+ U z/ Q. @1 t
- #include <linux/types.h>9 _" \1 W" h* T& v
- #include <linux/interrupt.h>: }* V5 s9 G4 t" ]) }7 T; ^7 ~
- #include <asm/io.h>! l1 r- n% h C, o% J
- #include <linux/moduleparam.h>5 w P* ?% A$ D4 Z- B) v3 r1 G
- #include <linux/sysctl.h>
# D; M8 x5 l$ L- Z+ {' w: G - #include <linux/mm.h>0 m4 v' N" Q3 J
- #include <linux/dma-mapping.h>
% D" [1 O' ]- s5 }$ k
4 ~) ?5 R1 `4 X& ], |- #include <mach/memory.h>
/ J- i% Q4 Q [; u2 `+ o - #include <mach/hardware.h>$ r; q% x& H6 O) l
- #include <mach/irqs.h>
! }$ c- n3 t! a$ k: h R - #include <asm/hardware/edma.h>$ y+ F4 o* j! T: x' q/ b( i
- : C' m6 s v) g! T5 M: g; i
- #undef EDMA3_DEBUG' ^% n4 u2 T. @& a9 H* v( f0 A' `% m
- /*#define EDMA3_DEBUG*/1 |3 |& e$ @% N% J' U+ a8 M
2 k4 e: q$ N! e, N R- #ifdef EDMA3_DEBUG
) q( y9 N2 F. ]) n, A5 S. ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 E! r, |- N: P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, S6 G8 Y. M% T- p/ Y4 i0 P- ^( K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ l" M8 Q: M3 f/ K4 E3 i
- #else9 U' M# h0 o. ?5 r! x
- #define DMA_PRINTK( x... )% p S7 k8 d* m% x
- #define DMA_FN_IN, m4 A8 P" U& r% n; A ^
- #define DMA_FN_OUT
3 z/ j4 G' |2 \# I" @/ v! i- [$ P - #endif" `6 {! G' W1 p6 A
- 2 S$ g u7 ]2 v5 H0 w6 s0 g/ Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- T; |3 p2 u% ]3 L- g2 E - #define STATIC_SHIFT 3
v9 u( R0 h0 R7 X - #define TCINTEN_SHIFT 20
, N6 ?3 c7 k2 Y( u - #define ITCINTEN_SHIFT 21
7 a0 P8 ?3 W% @, o - #define TCCHEN_SHIFT 22
8 K3 S' G! t. m- j - #define ITCCHEN_SHIFT 23$ p9 j4 d! I$ N) g. e
- / U0 F* z s% R1 d* G4 Z' Z9 x0 Q
- static volatile int irqraised1 = 0;# _5 I/ N: z( b0 a' g
- static volatile int irqraised2 = 0;* {6 W; z! j0 w4 o
t+ P# D: h2 M: Z& K1 ]9 H5 f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 _$ n" W1 @: e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, t; p2 n+ _; m5 { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& k/ W3 m S$ v) Q
" I+ x) y( c. B1 v+ b- dma_addr_t dmaphyssrc1 = 0;8 T- i7 O0 W" z @
- dma_addr_t dmaphyssrc2 = 0;1 r9 |1 X' p; B4 p2 g3 |' F: T) R
- dma_addr_t dmaphysdest1 = 0;
, J" u _0 z( J5 n - dma_addr_t dmaphysdest2 = 0;
1 _% l8 ]: }7 [% E5 W3 e8 O4 H: S - 7 w V- {2 y- q+ O2 B8 K5 E" ?
- char *dmabufsrc1 = NULL;
2 V/ ?4 T) w. F# w+ H- R1 F - char *dmabufsrc2 = NULL;
" o8 f: e9 R& T- R R - char *dmabufdest1 = NULL;
2 t, X8 a/ l- e0 G$ u - char *dmabufdest2 = NULL;
7 K& Y, y9 E) H0 X
7 k( j8 P8 u/ o- static int acnt = 512;
! _, \) T+ e( K1 ]% H4 |2 T5 S - static int bcnt = 8;
' Y0 R* V9 w+ e& G - static int ccnt = 8;& N! Y& [/ J6 }1 |; P
4 R2 S$ ]! t2 }" a6 l3 h. C- module_param(acnt, int, S_IRUGO);
+ x" y i) b' T- C; D - module_param(bcnt, int, S_IRUGO);$ j' x8 j- O# K* H ]
- module_param(ccnt, int, S_IRUGO);
复制代码
6 C9 [" `/ T6 d4 l$ J& X/ [; \" ^. e2 F: E V+ r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! J: Q- ~; P$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ `( E# Z* u. K0 w5 ]% j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* b. R; D* ^" V8 q
, V3 U& a2 l$ E1 t
6 r% Q3 a2 B9 T ^" y# u( C& S |
|