|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 Y8 i0 H( f* L1 _" Y$ w- [code]EDMA sample test application. O1 {- Z+ X$ `+ A$ A
- /*3 Q, W, I3 D H7 e
- * edma_test.c, y; G8 O; X% G
- *1 U, S) R) z) o5 e* o
- * brief EDMA3 Test Application6 U( @2 W. M# B0 f R$ [6 t
- *: r& M6 S4 r% G
- * This file contains EDMA3 Test code.
9 A! _; ?. I* ?7 J$ ]" p" K - ** d0 C- D; r: U0 s0 l* k- |6 v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! ]- g9 o4 B, A1 L a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 {7 w4 Y- C) p Q - * TO CHANGE.: b0 s3 C+ D% j* p7 G) R3 Z- w
- *
; B* [6 z: C6 E# t! B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 l; _5 `4 L2 b9 j/ A - *
# K8 f0 z% N4 o/ \ - * This program is free software; you can redistribute it and/or! ~" r7 Q8 F5 }* f# X: o' A
- * modify it under the terms of the GNU General Public License as! Y# ?3 v; H! _, y# @
- * published by the Free Software Foundation version 2.
' g ?1 q; ^% p5 H2 K - *
/ T {# u4 f0 _, Q h$ h, Q* O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
i9 E) L* k+ Q6 d: ] b - * kind, whether express or implied; without even the implied warranty9 E; }9 s6 ]. v( W4 F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 ?4 R" J A0 S2 o
- * GNU General Public License for more details., o2 f. m! Q; T$ n: V3 k
- */ X E2 I) R y( G8 D& h9 g
) r! p2 n1 L0 d9 H' k" u- #include <linux/module.h>
7 L: d3 m; z$ W5 {5 B - #include <linux/init.h>/ h' t2 ~+ S; S$ b" ]( K3 C- C* J3 X& }
- #include <linux/errno.h>3 N6 m6 ]) \5 L
- #include <linux/types.h>: s( s: N# w; N
- #include <linux/interrupt.h>8 B. t5 v3 k& |$ D6 S
- #include <asm/io.h>9 g- q A- U% p- P; y% N$ \& O/ k
- #include <linux/moduleparam.h>) e% e0 B2 ~# o |# V7 D# i$ l. Y
- #include <linux/sysctl.h> w3 |9 ?) M( C6 Z& Y9 y
- #include <linux/mm.h>' o: g. K# u& {% h
- #include <linux/dma-mapping.h>
! Q" W. B: W. ~ - , N+ p [1 W2 Q( i [
- #include <mach/memory.h>
/ u! S* Z* J/ M1 }% W" p# g - #include <mach/hardware.h>- u, }0 [ v; {6 N/ o; z5 V
- #include <mach/irqs.h># f: p# T6 ^ e* x0 ?
- #include <asm/hardware/edma.h>
3 N( N1 d0 g! R$ `. j3 R M8 s( Y
' T; F; b* z6 A* {! ^- #undef EDMA3_DEBUG
+ H/ V F: m* X) r6 l& N - /*#define EDMA3_DEBUG*/
* @0 c' A1 e& a0 p3 ~" Z, X: d
; a5 E; N, x# f& v/ G9 ~2 V! c; n- #ifdef EDMA3_DEBUG: ]1 i: H {5 ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- t, Y4 L& X2 ]. W9 ?' g, X, y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 u% s9 C, a2 g* m! o, `3 l1 Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 K- w! i& W" c8 R) t+ S - #else. K5 b$ W' ]3 B8 g0 ^$ M1 f' v
- #define DMA_PRINTK( x... )8 s' X$ \/ O) P/ g |( n
- #define DMA_FN_IN
( z' y9 _& c, b0 K0 y - #define DMA_FN_OUT
$ p' ~& O1 `7 e( @) |, }' ] - #endif3 n- v; q) @, Z9 D4 f& C8 |$ N
- , l9 a+ ]1 l6 b# K1 U4 A+ |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) X" o4 v# ~2 T) [1 l
- #define STATIC_SHIFT 3
7 v; F) w( b: m6 m3 d# K - #define TCINTEN_SHIFT 20
2 o4 M9 P/ a6 { - #define ITCINTEN_SHIFT 219 {& q) l3 p9 Z# }: c& v6 \. ~/ I
- #define TCCHEN_SHIFT 22- L( d# g$ P+ k
- #define ITCCHEN_SHIFT 23
* {# y7 v- {- k; s0 l
' K% u2 N4 V+ `; n/ ~; L& h# p- static volatile int irqraised1 = 0;
( @4 ?7 ~2 {3 }7 H" ]; B/ z. z - static volatile int irqraised2 = 0;
# r% G) N+ `$ e4 ]7 a
1 K5 f8 o6 v) Z# r C! W! H. D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( y# T6 k y$ s3 |- o3 [2 R) }7 f2 k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 G7 Q! x% K0 T6 X0 e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 n/ Q: t* Z; D9 w8 d$ ~. |& t4 q - 1 \, I4 p- A K. W& P
- dma_addr_t dmaphyssrc1 = 0;2 W( X2 O* n+ M5 ~5 ~9 e/ D
- dma_addr_t dmaphyssrc2 = 0;7 ^9 s% P% M4 U Q8 ~1 c
- dma_addr_t dmaphysdest1 = 0;% |7 M% e1 q9 {$ C" J
- dma_addr_t dmaphysdest2 = 0;
+ {/ S* A( L W, O
0 M' I. l" N% d& f7 i- char *dmabufsrc1 = NULL;" K+ x; l6 m5 i6 N& _# g
- char *dmabufsrc2 = NULL;
) B& R" e5 D) F( j0 G# z6 ] - char *dmabufdest1 = NULL;5 j2 p/ {/ {2 T$ r5 G
- char *dmabufdest2 = NULL;
. n& ]# F& v. o& E- z* i n: W/ ]
+ c- Y D" u' V; P+ y- static int acnt = 512;: T# A4 Z8 D& Q
- static int bcnt = 8;
, m2 `6 A7 s/ v7 @1 M1 R - static int ccnt = 8; s \9 Z0 ~! W! G* \$ ?
- 4 L, X. w2 {1 i9 h0 b
- module_param(acnt, int, S_IRUGO);1 M6 Z1 g G, i* ^8 C( _/ D
- module_param(bcnt, int, S_IRUGO);
) J1 v/ I* p' X - module_param(ccnt, int, S_IRUGO);
复制代码
5 o5 i; m; b2 Z3 d( }
$ K& T) S5 G9 _' i) }) r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 v" a5 Q4 W" \4 q! r
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 O8 ^: ]! p% `- S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# l# H; E( F" R8 O' l! S3 b
" ^: q, p$ w5 }+ i# _" s
5 g( p# O7 P G8 D |
|