|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 A; o; `4 W6 ] p9 A/ [
- [code]EDMA sample test application
" i" O6 ]7 m/ }/ O: n, y- b, l7 m2 n8 s - /*
; n, b1 Z3 Z4 d6 a - * edma_test.c4 s) v% j0 s0 _' _
- *
! q' K" c p6 K1 _- W - * brief EDMA3 Test Application0 c0 Y! A7 V( [1 c' T
- *
$ D8 d z. @6 a- B! L" | - * This file contains EDMA3 Test code.$ j' w2 r& [; U" s2 E, H
- ** q1 g- i3 ~# F1 ]( O9 S# O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( y) r; V0 V8 `) d8 c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) n# S! v- J, b9 a( h i0 p3 b: T
- * TO CHANGE.
/ [6 @4 \+ e- |: s - *
1 \8 u; i$ o/ E7 t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 f" p+ |, d* E( E: ?# i
- *
' { s, y* `; K4 m0 W3 j& f - * This program is free software; you can redistribute it and/or: a: `$ g# u6 q( c% v& N) G2 T
- * modify it under the terms of the GNU General Public License as
. p! F- }/ J6 i/ L - * published by the Free Software Foundation version 2.
6 D0 O( i' n* _6 B2 O) e - *
! W1 y6 R$ X4 h- A4 { p- k% m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ Q% E( y* W0 }6 U
- * kind, whether express or implied; without even the implied warranty; ^( w! t3 v; P1 I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 R0 ^( R/ z5 \' y2 U$ d3 l6 u - * GNU General Public License for more details.
4 u' o% c3 T% A* ]6 Z% V* w$ q - */
. k! d: [* R$ O4 Y" v* c - . `0 e2 v. I7 _* J4 { s- @
- #include <linux/module.h>& b6 B( u: X' t4 u. B
- #include <linux/init.h>+ z; B* K/ M8 h: j3 m5 ~3 ]0 `+ J
- #include <linux/errno.h>
' g/ u4 q" O5 R! V0 O% C* a - #include <linux/types.h>. q/ v i" ^5 A
- #include <linux/interrupt.h>$ \8 x: m }/ S' v% k
- #include <asm/io.h>
1 V0 D" g* n8 A" Q# k/ T# D - #include <linux/moduleparam.h>% m6 p' f6 ]' d7 Z C
- #include <linux/sysctl.h>
: Z5 y* r9 G; C2 A6 W - #include <linux/mm.h>
# p6 r- Z ~. t9 C- X& [ - #include <linux/dma-mapping.h>" T3 L% G0 }' v& H4 B( b
( x8 _4 w4 z6 l4 V1 j- #include <mach/memory.h>
( K L6 H% Z$ d5 S( H0 z - #include <mach/hardware.h>6 L, l. V0 f( @- b. d
- #include <mach/irqs.h>
, s; F i" n. t7 j) A - #include <asm/hardware/edma.h>1 Z0 `* x" R1 g. M2 z
- ' F7 U+ A" U0 f
- #undef EDMA3_DEBUG* d- y8 F. S/ B+ b: }
- /*#define EDMA3_DEBUG*/) V' d ?( A5 f* n
- 3 X1 y0 u' O% t% G
- #ifdef EDMA3_DEBUG( E* \% m& m# L* W; `# T! S I4 D% U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ |- y) c3 w6 I1 d4 y! a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 G( x. N* Y3 U& s# S1 ~2 S8 R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) r( z8 p M8 Z2 }" `7 n% O
- #else
7 z2 s4 _5 N4 j9 n6 Y9 ~ - #define DMA_PRINTK( x... )
) h E. O1 A5 h; W - #define DMA_FN_IN
- e3 C7 Z" p$ A, W) A+ G) w - #define DMA_FN_OUT7 c' n. ^: M1 G* I
- #endif2 N5 u" x7 q5 \- o- h
" ]. N! W1 }3 I: l( x( k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 _( A! E; R( q2 y# ]4 c$ A, K
- #define STATIC_SHIFT 36 C, p. \9 r, E E: ]: h
- #define TCINTEN_SHIFT 20
5 r" u3 m. w5 F - #define ITCINTEN_SHIFT 210 F3 n$ Y, M {6 W/ f
- #define TCCHEN_SHIFT 22
8 Z3 O/ z( L6 N [ - #define ITCCHEN_SHIFT 23+ N: u8 Z% i& g
- 2 P7 o+ _/ N7 U; a% W& r/ l
- static volatile int irqraised1 = 0;
% R( M: b" o7 B( D- ~) R n6 Q - static volatile int irqraised2 = 0;
3 V% K7 y. |! @" Q* a4 _0 g f - 2 @* }5 Q' P' K2 k0 f) A/ ]% z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 H2 C3 a8 [* |$ I$ P: M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, S+ W/ Y9 e, P+ R9 k+ K; U3 }4 Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 X9 t- e/ l: ?* o
4 o+ f/ w2 ^( _: w- dma_addr_t dmaphyssrc1 = 0;0 ^8 b" m% o* u% s
- dma_addr_t dmaphyssrc2 = 0;5 e! j' f' ~, C6 c/ ?
- dma_addr_t dmaphysdest1 = 0;' `% y* O( N! |/ H ]) O
- dma_addr_t dmaphysdest2 = 0;& j, z8 o1 F Z4 w0 m: B; u
- 1 M3 w( v/ p$ z+ Z3 i
- char *dmabufsrc1 = NULL;5 @5 O/ Q$ m# Q) i$ l7 l! \
- char *dmabufsrc2 = NULL;
' K5 V7 K6 g1 H+ m; ], @9 p+ r* j6 m - char *dmabufdest1 = NULL;
! w6 `+ f6 n& Q3 x, @9 X7 u - char *dmabufdest2 = NULL;3 C# D( { V$ I6 k Q
% V. x& D1 N; s5 i- static int acnt = 512;
+ m% Y1 _* |# M* | - static int bcnt = 8;
. J2 X5 |3 w& K- j9 a. U T - static int ccnt = 8;2 |8 p7 ^" i3 N" w" Q& W
( H' ^6 w% s0 X7 c7 ^- module_param(acnt, int, S_IRUGO);
4 |! n3 b" V0 \3 Y- v - module_param(bcnt, int, S_IRUGO);+ b) x# P0 F) H) L& V2 g* @
- module_param(ccnt, int, S_IRUGO);
复制代码 0 Q, ?$ `. O% v3 O
) S1 F7 W7 ~+ @' l: I. E, }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& _ E6 K6 p5 Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 I9 g& w9 I* J/ s O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 H3 p) h: U: J4 _# Z; Y. V
) v$ i$ N# l# ?/ y/ v* |# S% t6 F$ A& T: [3 e
|
|