|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 Z% H z0 w, W6 }% ^
- [code]EDMA sample test application) B, M: v7 z1 r( s
- /*
u3 @$ G# V. B5 H0 D ?" o - * edma_test.c7 L( `' u1 g- {& r- R$ p
- *, } k `$ x9 h; Z
- * brief EDMA3 Test Application2 z0 e( Z3 K; D$ r$ R7 y
- *4 v4 N$ J# Y9 q1 d6 ]
- * This file contains EDMA3 Test code.9 ~! k3 }* ~4 C. S, r1 N$ F$ Y
- *; i* l ^8 x5 z% d$ b4 k: l/ h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ ~& {! a/ p H& H# \1 g, _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 y! h& s( O3 c3 q9 Y0 Z - * TO CHANGE.& b( I, w. p; {
- *7 ~2 o" x+ L* j& }2 Q" k: a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) I7 u2 Q! D6 Q- w - *9 R' \! q& w5 E( u
- * This program is free software; you can redistribute it and/or
: [6 V& S# J- x* C d/ I - * modify it under the terms of the GNU General Public License as& ]- s+ J: j5 P
- * published by the Free Software Foundation version 2." z/ G6 W& F9 K+ V
- *
" r6 K, ?4 |' x2 U& F0 j% H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! }8 F% z3 ^' G6 S% m# g! x - * kind, whether express or implied; without even the implied warranty
, p- f; _, R. f1 ]/ v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ]$ X$ X1 Y2 a, Y- C- {
- * GNU General Public License for more details.& F) d0 @/ ?1 Q C, F
- */2 O# v9 Y, m( `$ z6 J I3 V1 E
2 | p/ v1 F$ v8 {- #include <linux/module.h>8 B# }# d3 m7 k3 Z" A2 s! i& E
- #include <linux/init.h># L' d2 A3 c+ {$ \9 f3 m+ S
- #include <linux/errno.h>
: j- G' Y5 z) Q4 Y" } - #include <linux/types.h>; R0 R* e/ X2 h
- #include <linux/interrupt.h>
- M: D/ C2 j" C4 h' m - #include <asm/io.h>
, l) }( C3 e, ^: `1 w - #include <linux/moduleparam.h>& T/ f" ] [* e
- #include <linux/sysctl.h>, z$ o: Z2 l' }% q1 ~
- #include <linux/mm.h>
7 K& r( p' L, O, b! i - #include <linux/dma-mapping.h>+ m7 h1 {5 X2 x
- 9 R. b) _6 Z+ H$ K i- x
- #include <mach/memory.h> i" c2 p% ?. M; `4 H$ I2 K* f
- #include <mach/hardware.h>' Z% C/ ]3 y2 J! y( X0 C# f
- #include <mach/irqs.h>9 g0 T3 W! M/ W* J: ]
- #include <asm/hardware/edma.h>
2 }* ?- n, o6 s- k* v+ }3 g - " {! [& j# s2 ^0 k( b4 W8 A
- #undef EDMA3_DEBUG/ z/ q6 ?7 v! \7 O
- /*#define EDMA3_DEBUG*/1 L/ B+ M& m/ J3 Z
5 d' n2 l/ h9 T& h9 U- #ifdef EDMA3_DEBUG
* e: `/ l! ~% V R2 I. J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ a6 w& b5 }' r \% ^1 A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) q. G* w ? p/ w, m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 w, f4 H/ l3 a - #else
' M6 p$ z$ U0 n& d - #define DMA_PRINTK( x... )
! x% e4 R4 I* {6 s - #define DMA_FN_IN; ]3 c8 u) f" a" w6 y
- #define DMA_FN_OUT$ n+ a0 C* n' o$ s: o$ Z7 C: P
- #endif* o# ]& g' n% }) S2 r' A0 v
1 ^4 `: k- e0 ?5 H- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! n1 c9 Y5 A3 H2 K9 G/ a1 b5 s
- #define STATIC_SHIFT 3
7 L+ g8 T/ s$ R7 D* B - #define TCINTEN_SHIFT 20
+ A4 k2 K" E( X6 z2 h" u- F - #define ITCINTEN_SHIFT 21
, h8 K b# s% O! f - #define TCCHEN_SHIFT 22
0 C4 y6 ~& X4 E; ]$ R - #define ITCCHEN_SHIFT 23, r- e9 u9 l8 a4 _1 K8 Z n" v0 q, g7 R
( y3 }+ {! O" ]9 I, e: H: P4 a- static volatile int irqraised1 = 0;
' X$ p V4 C) P - static volatile int irqraised2 = 0;
& j) c* R/ p" ~% S7 W1 V ? - * Y" B, N2 x' }9 c! F- o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% P/ d' N& P5 S7 s. u/ P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; _2 i/ p: N* i) f, Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# B+ O4 M* W* N4 u4 H3 _+ T
- % k- K* R9 T9 X' C
- dma_addr_t dmaphyssrc1 = 0;
$ E }! r" s8 V8 W0 X- h" x - dma_addr_t dmaphyssrc2 = 0;. i5 m% D' h+ F- j
- dma_addr_t dmaphysdest1 = 0;
- v" u& z5 P% U$ n" B - dma_addr_t dmaphysdest2 = 0;
+ C0 }$ N" {4 @7 s) b
+ g( V: ~8 U& M- char *dmabufsrc1 = NULL;6 V7 ?; A: W9 T; E! V
- char *dmabufsrc2 = NULL;2 M9 P9 J' M1 y0 ]* ?" _$ B" F
- char *dmabufdest1 = NULL;* B8 i6 k: \3 u% S. P: c& a3 N; U* y
- char *dmabufdest2 = NULL;
* z/ w1 n# w" X* I r' c& U
3 k. C; r3 {: K) W5 N% Q- static int acnt = 512;
4 {! O; n7 K' d& e - static int bcnt = 8;
$ d# {0 F3 y+ P S ~. B. f0 c - static int ccnt = 8;& W" a+ ^+ w: @2 w0 a2 A; C7 U% l7 l
- ' p& ]6 b( |2 a. r# ?* F
- module_param(acnt, int, S_IRUGO);
7 \8 \( ?5 f6 x) D8 ?. g9 h( q - module_param(bcnt, int, S_IRUGO);
- ~ x5 L k/ W: X% m - module_param(ccnt, int, S_IRUGO);
复制代码 ' u' [. T7 u U' d
0 L& b, v4 x( ]$ P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 W% R/ U$ V* E2 N" Qarm-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 P8 U5 ^* b5 r/ l; h) E( z5 W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ f' F' o, U+ q! t2 j, t, W) j. ?9 C, j7 @* r. W: ~
9 ^4 [5 N/ ^+ r
|
|