|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , h7 z$ P K) h- F: u) H8 n# W
- [code]EDMA sample test application
$ m/ f( {" K. A/ Q0 k9 n - /*/ U3 x2 B+ P- A
- * edma_test.c+ A+ o: n% I+ ~* c! g
- *3 W' w {+ k1 Q; i- L! M
- * brief EDMA3 Test Application
$ i0 E! z" V; f5 s0 S" F) R+ f& s - *5 D8 l- C+ ~1 [8 g; }% q& ?
- * This file contains EDMA3 Test code.5 y5 E6 U5 f( O0 I; m
- *
0 j5 E0 F& e; _$ q$ ]) [' C4 V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ {7 V; `& y) W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 H! A( M' n ?( _& f! f; ~ - * TO CHANGE.
1 q# r2 ? W0 H5 Z5 C/ ?% ~ - *
y. F* Y; h% K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ Q0 [! ?% `, ]. z C
- *
( D: Z4 m0 J @$ U- B2 `1 ^' x - * This program is free software; you can redistribute it and/or" g( c# w+ O r( F1 ~8 V
- * modify it under the terms of the GNU General Public License as$ |% [* U8 f, [" W- i
- * published by the Free Software Foundation version 2.8 T- o( t5 t! G2 }8 q
- */ n. a" k& p# A0 L }( k V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ Y r+ w6 L4 O& [4 H, y& x
- * kind, whether express or implied; without even the implied warranty7 t% M+ f: |; G4 v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
B% A" ~$ B8 i/ X+ z1 C - * GNU General Public License for more details.! {/ I3 j6 o3 x
- */
0 c0 v, F1 g' o2 h" `
0 r# i" y" \* z# `2 l, T. X- H- #include <linux/module.h>9 `) \0 n7 H* r9 S8 ^9 D. ?
- #include <linux/init.h>% P# u5 A3 x/ [6 p, }: Q
- #include <linux/errno.h>1 D8 @; E) X- Y' J7 h
- #include <linux/types.h>% q3 H8 g/ b. X1 ]7 Q$ ~: e; M
- #include <linux/interrupt.h>9 o4 E: S8 ` h, o9 L
- #include <asm/io.h> O6 O) W5 h8 K" [1 f: ?% s; ^4 y- b
- #include <linux/moduleparam.h>+ s8 n# P3 Z* O
- #include <linux/sysctl.h>
9 h' L: P( j+ z; ?' o- |* v - #include <linux/mm.h># [' c( i) A6 P6 I2 d
- #include <linux/dma-mapping.h>
2 g* c: a5 z, d1 }8 p& J - + U# @' t& U/ s. K+ ]
- #include <mach/memory.h>
! c1 k/ b) W& P# z" Z' M - #include <mach/hardware.h>" W$ V9 x7 z9 o
- #include <mach/irqs.h>
- ]( c; v& u" P# n8 J: m" I - #include <asm/hardware/edma.h>4 f; I Y( s# c, A: w2 z
6 ~2 v* o$ @9 w8 K0 n+ `- #undef EDMA3_DEBUG( K* Q2 N9 |% f, x V, A+ i
- /*#define EDMA3_DEBUG*/
5 a' ?( B. I: e9 S# C" e - 5 g6 L3 N* K, T; W( w# @( p
- #ifdef EDMA3_DEBUG0 @: e& [0 }' c2 I$ u3 U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ M. O. n/ O) ^" M7 |6 R. z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 @& a2 z0 J5 R; b8 t: }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 `! V4 U# b) ]2 q
- #else
0 u3 Z& i; \- N9 |) W* Y9 T* ] - #define DMA_PRINTK( x... )
! j7 T9 N, p2 _* w" Y - #define DMA_FN_IN% L/ l+ p/ k! q! d" R* B' U
- #define DMA_FN_OUT
4 m" e+ i- J6 j! k0 I, I4 @ - #endif8 n# ~8 D9 g* A& M; R
- . r& z7 y7 r+ P6 l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 [, t6 u5 L+ i1 V+ j6 b
- #define STATIC_SHIFT 3* I+ |# Q) T7 m9 P% B$ \
- #define TCINTEN_SHIFT 20
7 `" H! G/ t" h# K2 N* T5 c - #define ITCINTEN_SHIFT 219 ^) t- X( Z: H t( Z
- #define TCCHEN_SHIFT 22' c+ K1 K5 J6 `& Z: g- D. L- X# F
- #define ITCCHEN_SHIFT 233 O; J( n7 Q: B3 A1 J
- ' N# y( n% q! b0 O7 U
- static volatile int irqraised1 = 0;
9 L8 }; Y+ t# ?1 w R6 @" R# C2 i - static volatile int irqraised2 = 0;$ t) j3 _0 S7 C* e: c
: y0 q: k0 X3 G7 N% j) J& ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ b5 }+ z5 w# U9 C" ?3 o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, L" T* C# Q9 Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- B/ F. y5 L& o. M7 Z" d5 ~
: ^6 h; \/ d2 ] X8 d% I) D$ I3 Y- dma_addr_t dmaphyssrc1 = 0;
5 ^: ^4 ~- \) i' U5 }6 o+ G. m9 O - dma_addr_t dmaphyssrc2 = 0;
) H( l! y' o' ^: B - dma_addr_t dmaphysdest1 = 0;
- K% Q+ e7 I+ \+ P - dma_addr_t dmaphysdest2 = 0;- i& U# W& I; y
" S; f9 ?* |8 \- char *dmabufsrc1 = NULL;
/ o* u# ]3 w4 a- ` - char *dmabufsrc2 = NULL;
& T$ d5 Y4 E4 {- W* `/ H - char *dmabufdest1 = NULL;
9 d, O% C4 M7 F7 I - char *dmabufdest2 = NULL;
: Q9 h* A3 R# \2 a& c0 q1 m! V- L - 3 ~2 |0 R2 d, v
- static int acnt = 512;+ t2 u* I6 v' U/ A
- static int bcnt = 8;
* g+ E) ^! ^! N8 ~! y - static int ccnt = 8;
0 ~" C2 V- M$ P2 y# I( s0 j% i - 1 o8 J6 ~6 J& b( J1 ^
- module_param(acnt, int, S_IRUGO);
* d9 P) z/ [0 @% } - module_param(bcnt, int, S_IRUGO);
- o( g" O. S( N - module_param(ccnt, int, S_IRUGO);
复制代码
0 R2 t$ j, Q5 n& X- }
0 ^: Y& }+ V1 e: B; A9 \' ^$ W3 B& d/ D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ D; |- ] S3 O; U8 v2 x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( i& p4 R [: j; V8 d* R! W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 g. M- _. o5 e3 d9 b9 ]) G
& g& ]# X5 G2 w. | E* T4 W/ V# a5 t
|
|