|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " p( h- d$ Q4 u8 n
- [code]EDMA sample test application3 Y8 o( Y$ r' H, O( v9 C z
- /*
1 f* j6 Y6 L" U+ { - * edma_test.c6 v% [$ V) p6 o# K
- *
% v% F# z0 c" L+ [ - * brief EDMA3 Test Application' d( P5 E, {6 U# x
- *
0 \* k+ o+ R* e2 B$ d - * This file contains EDMA3 Test code.$ J" g0 o+ T( _+ {2 H, g1 G' a
- *
" `& d6 X q, |- P, Y0 w$ ~2 O/ Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! P- X- @3 T; ~7 s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 v% {5 T3 ]5 x' O3 G# U% ^; g
- * TO CHANGE.
?( W& i% M% b) |2 O - *
$ K7 ]4 j! \* s& X( i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 k1 R o6 s* k0 L$ N ]8 { - *
' R; t6 h2 x# p- k, J - * This program is free software; you can redistribute it and/or) h# ?3 H. h- E+ Q' X$ N( T2 v
- * modify it under the terms of the GNU General Public License as
8 K7 O2 {8 j6 f - * published by the Free Software Foundation version 2.
. F- i- r3 y/ m; [+ h/ s' \ - *
l1 R' ]* a8 {* b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 D" D- I0 h4 T/ s7 X" g - * kind, whether express or implied; without even the implied warranty- d/ \* p {8 x% V+ |5 T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) G! a; Q. [6 L3 U1 E3 ^$ Z/ O1 R# _
- * GNU General Public License for more details.
" g4 K. w: i- s( R - */
* G4 h. w: n& [ k) k - # z9 D; ~! ^ Z* [- x% `2 w4 i
- #include <linux/module.h>, ?; g' |5 j& d3 I" L: ?. h
- #include <linux/init.h>9 C0 T. F& ]1 C H& M8 q# f
- #include <linux/errno.h>
( T9 T: |$ c) w - #include <linux/types.h>$ S8 u" q5 \( L8 w! T: O
- #include <linux/interrupt.h>
* l6 E! X& d& a: _7 e$ }2 s - #include <asm/io.h>: }5 R3 j, G# S8 R2 s* `& i. @
- #include <linux/moduleparam.h>& w# z' A6 U& e+ [0 d4 J
- #include <linux/sysctl.h>
0 b. R+ F+ t: h' O1 S4 p" @& s* {5 Y - #include <linux/mm.h>3 J8 q, d6 P$ r4 `$ S2 z( y, R9 D, C
- #include <linux/dma-mapping.h>$ a- L" a" v$ a' n
- l# d: j! e$ l; J- #include <mach/memory.h>. X& k# I+ A1 b/ ^
- #include <mach/hardware.h>% Y, u# K9 J9 ~* B( T4 ?
- #include <mach/irqs.h>; H& {2 D) u3 G9 P' v! K# \2 N
- #include <asm/hardware/edma.h>% Z3 l* R1 ^4 M( L# J+ F% T
3 a; _) i+ p2 q- #undef EDMA3_DEBUG
9 V( [$ p$ L7 |# m1 m, Q8 L - /*#define EDMA3_DEBUG*/
" Z# W$ v; @" k2 n - 4 f0 P9 g2 n! ~) d5 n
- #ifdef EDMA3_DEBUG+ d5 H5 t& T+ [& Y2 \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; @- i, h# n# f6 e# m& A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* y# Q+ i5 J* M. }) t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 v6 l( x8 T6 o/ T8 x& @9 q R8 [
- #else
2 z8 M3 }: K1 ~2 ? - #define DMA_PRINTK( x... )
* d5 Y4 n5 W/ @5 q2 H' E$ J - #define DMA_FN_IN
# d b9 E9 t1 R9 l - #define DMA_FN_OUT6 V2 t: [2 V J6 Q2 F7 J) T
- #endif
6 [" P$ T2 B$ M( h
' n7 D3 C8 ^2 O' `# ]( H- #define MAX_DMA_TRANSFER_IN_BYTES (32768); b6 ?, F' Q- F9 ~- l
- #define STATIC_SHIFT 3. h9 `( P1 t5 V! \. p8 N' i
- #define TCINTEN_SHIFT 209 e: k2 X+ f# ^! g, p m& m3 i
- #define ITCINTEN_SHIFT 21' Q5 U: U. \9 X1 J. R0 e7 O) c
- #define TCCHEN_SHIFT 22
9 i: g& I7 T; d. w" D& K - #define ITCCHEN_SHIFT 23+ N. G- `# g8 l5 y
4 q+ l% h: ~- N! a7 H5 w0 q/ }- static volatile int irqraised1 = 0;0 p7 B& z, p3 s# O
- static volatile int irqraised2 = 0;
c- w+ c7 Z* B- r4 E, c& D' e
+ r+ k6 x; v5 G# f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ O! m/ e7 W$ r+ n2 V: i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" e# t: M/ z( q2 H' e/ R* u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* w) ?( A! o& w- q3 K6 s
* I3 L9 C: h, N+ q" R9 P- dma_addr_t dmaphyssrc1 = 0;1 z0 M) q% A6 K5 K
- dma_addr_t dmaphyssrc2 = 0;
8 E v n d2 l* H2 z9 R - dma_addr_t dmaphysdest1 = 0;! P& ]4 Y% ]: e; C M( J
- dma_addr_t dmaphysdest2 = 0;# p" ]2 }; |# E5 q6 h
- $ [( k A. } Z
- char *dmabufsrc1 = NULL;
: N& _7 c( T2 D8 u7 B - char *dmabufsrc2 = NULL;( q, s9 f! \- T
- char *dmabufdest1 = NULL;
# |! ^0 Q3 D+ L - char *dmabufdest2 = NULL;
2 [4 q/ N) i5 m) C* O: J - * c6 D0 l+ ~% o8 s g' K
- static int acnt = 512;
" S+ C4 v9 j1 C9 G" |1 C. o" r) E - static int bcnt = 8;, |' W. H: \8 K) b* N! [
- static int ccnt = 8;" H: ~1 f7 I- p2 [
- ; A" `, S3 j2 o A' h0 [
- module_param(acnt, int, S_IRUGO);
8 I$ v' I d1 a9 }, {4 {8 g, T - module_param(bcnt, int, S_IRUGO);
/ ]* _; f" W' J5 b( L2 ] - module_param(ccnt, int, S_IRUGO);
复制代码
) Y5 w9 P1 l$ }7 I( O
}8 B- {4 Z: z4 G3 K* _+ Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, t1 s2 {$ Y0 warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* \* p+ H1 k! M" n- j6 p1 m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 a. l5 k) q# a6 Y) t9 D2 d+ \
( a* ^% P+ k5 }3 s2 e- `$ e( b7 I
. q- B: c, T2 O8 s) {1 L1 c3 ^ |
|