|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: h+ s' t% s K* U4 ^4 A" w- [code]EDMA sample test application
4 Q! m9 Z" W! R: f! E - /*6 n. T' J: A' S& J( T) {4 G& B
- * edma_test.c6 \6 D+ y6 W' c1 I$ A: |
- *: i& x' `# b$ C3 E
- * brief EDMA3 Test Application/ w* O9 `# y: `$ g1 ^
- *
& H5 X7 a0 H( g( y - * This file contains EDMA3 Test code.+ [/ J3 L. S7 H! J$ {! p
- *
3 t: ~9 Y/ t0 k6 v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' L. }- Y D0 R" r M5 f1 q+ y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 w1 s4 w) n5 ~+ M) Z5 E1 P3 m - * TO CHANGE.* y' A" `' s- E* G9 y8 X7 v8 y6 I
- */ S( k4 h' ^7 [% ?5 ^( }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: A% t# m( M# L3 e - ** T: e+ e' W7 _8 N' X
- * This program is free software; you can redistribute it and/or" J1 L) I0 t4 h$ p
- * modify it under the terms of the GNU General Public License as
4 u$ n3 T8 w h* R3 G' e - * published by the Free Software Foundation version 2.' O1 z1 l+ j& J' v5 k2 j) z5 v# i+ K
- *% X X" L! }! \5 @ l% C/ }# C9 y8 S" A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( m" `+ p* O1 E, R) y8 M8 t" k# q7 C4 M - * kind, whether express or implied; without even the implied warranty0 L% m0 b ^! t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 n7 F% B1 D6 Y; U/ R. \0 z
- * GNU General Public License for more details.
' n. Y1 J8 c8 @% E L. l$ _& S - */
/ q/ z% K2 e" d3 M/ Z! _, t& y& ?* T
8 D" V! ^3 {9 ]! L- #include <linux/module.h>
2 P0 n$ Z! p# r. A# e2 i5 j - #include <linux/init.h>
9 T/ R* H9 u4 m4 r" w' s - #include <linux/errno.h>1 ^- i# D! {9 J. }: B7 B" `
- #include <linux/types.h>
& W& e; p, ~3 M - #include <linux/interrupt.h>
, j. S/ t4 p+ W8 d% C - #include <asm/io.h>; L; O X- A G% G3 G5 L
- #include <linux/moduleparam.h>
1 z" q: s8 H0 S) } - #include <linux/sysctl.h>( {( {' b; E6 ^1 f
- #include <linux/mm.h>
8 s8 p3 ?! J" S) z+ i( H' A - #include <linux/dma-mapping.h>
. B; c0 e: ]1 e0 n+ h
/ D6 X4 J0 u) I" @- #include <mach/memory.h>
) [3 V7 Z9 s1 T* h' C3 Q - #include <mach/hardware.h>: o q' N7 d! v" u& G+ }3 P( N' r
- #include <mach/irqs.h>
- m$ n% j+ L1 J$ `' `( J: t9 D9 A3 g - #include <asm/hardware/edma.h>1 r3 S" V. e" C/ M' w
! y% F0 ~- i, x3 K2 K- #undef EDMA3_DEBUG
) T) ~* W' ^2 ?9 ~2 v4 j, n. X - /*#define EDMA3_DEBUG*/
' V7 z( i( U5 V1 Y& d2 I* I - / j& V: Z/ h& ~& W, u+ h2 W
- #ifdef EDMA3_DEBUG* g% }, U2 [4 a1 q$ m- V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& O% |1 k0 t1 b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! x: v0 |2 @2 N/ O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 _' B8 L& D0 d+ t$ P+ r
- #else
6 M. V) M; V8 t$ t - #define DMA_PRINTK( x... )% \% x/ i+ H- r9 H+ x
- #define DMA_FN_IN
! J7 G! @3 S0 G% f1 Q - #define DMA_FN_OUT
; u4 b- W: }! f6 \0 ^ - #endif
) a5 J( P9 W7 ?/ `
5 @: Q/ m/ @- {- f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* ~& J# z4 C$ Y' p
- #define STATIC_SHIFT 3
. m/ Y7 R& k& x' o2 m - #define TCINTEN_SHIFT 20
3 Y2 K& R! U; x0 r% V - #define ITCINTEN_SHIFT 216 F! Y+ G1 i! d5 a
- #define TCCHEN_SHIFT 22" ]' d) ?0 `1 s
- #define ITCCHEN_SHIFT 23% i7 c# r: o* I% \0 w
7 q' R8 ~ [/ c( E- static volatile int irqraised1 = 0;
/ @$ n7 C! d/ ~4 w0 H - static volatile int irqraised2 = 0;3 Y2 ^ O% y' ]+ A; {
; d- V0 a' F7 ]3 x& u, ?! u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, b( S0 O7 {0 w \; t- p. K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ l1 x% Q/ _7 N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) o7 m2 w" b! ?) \$ X2 R* u
- ; n ~7 S( Z: O9 b- U: e2 q
- dma_addr_t dmaphyssrc1 = 0;) h4 L: `7 R' g9 D a: ]
- dma_addr_t dmaphyssrc2 = 0;
/ }( {/ g- Y) {" r. _+ T - dma_addr_t dmaphysdest1 = 0;! E6 E. {) j/ ^' g" s/ R" B! a" {
- dma_addr_t dmaphysdest2 = 0;4 H4 K0 Y% M' v2 w+ F
- 6 C* Q% Z/ k- @, ?+ N' n$ V! Q
- char *dmabufsrc1 = NULL;: e! N1 I9 T8 \
- char *dmabufsrc2 = NULL;+ l o, m7 h2 \, f; n% |
- char *dmabufdest1 = NULL;
( P& x8 Z6 m7 C! M" `+ U5 v - char *dmabufdest2 = NULL;7 f' ]; a/ b: U, b8 Z! x
- ( h! j2 I( z( c8 F8 w* M- @
- static int acnt = 512;
8 s2 [' r2 Q& \7 p0 J) A - static int bcnt = 8;" D* S0 M) t4 `
- static int ccnt = 8;
/ J1 r2 p: T1 ]6 A* S% J7 ^ - ' t& e0 [, z: j) n- e: Q
- module_param(acnt, int, S_IRUGO);
- m1 w& d1 _: \+ I& U6 J - module_param(bcnt, int, S_IRUGO);$ [/ O( n8 N3 m, ~5 G! Q
- module_param(ccnt, int, S_IRUGO);
复制代码
2 G4 g) \' U+ ?
( q3 {/ f6 [- f9 }; d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 e& x) o% N6 C2 s; {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 L: n, |* h3 G9 `; x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 L; ]+ W; J( A6 q) A- @0 x2 p; S
# g& `+ s- u/ Z) J, J3 K
/ i( j9 M3 B& X4 F' V
|
|