|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 G% W, O% {% X% e5 x2 f- [code]EDMA sample test application
+ {$ T& m5 H1 } - /*# d% v& p% S4 t3 P5 L6 M
- * edma_test.c! T" b) D% J" W6 g
- *1 U. s, t/ Q+ `+ { d. Z% L1 G; c
- * brief EDMA3 Test Application
$ E$ G% r" n7 P' I - *
( O1 d* r1 R% M; y6 d( T - * This file contains EDMA3 Test code.3 I K3 Z+ l" |9 b8 q P" j. w- l
- *
\# D9 ?. e7 n" X- r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" o2 [& Y5 r3 k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, A% F4 a) w, f: X7 L. E
- * TO CHANGE.. N; k& b3 T* k+ n6 N+ }: ?
- *9 f! Z2 t& W" `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ u) M4 R% d( D( Y# v& Z0 Z
- *# q( l y4 d/ }9 H
- * This program is free software; you can redistribute it and/or
+ d- m0 Q X- S' C* l' n - * modify it under the terms of the GNU General Public License as. |0 n! M- Q; r7 {1 O s- y
- * published by the Free Software Foundation version 2., J1 E4 i1 J2 d
- *3 N2 j+ _3 e( Y2 a5 k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( U# Q. ^2 i. a6 V - * kind, whether express or implied; without even the implied warranty
6 q% I; Z; M$ K. ]: a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# r" ]7 S3 r0 J0 L
- * GNU General Public License for more details.
# z8 R- g: p# L6 o0 f - */
) T3 R9 i4 I0 N
) `( s5 j! @* p0 g8 `- #include <linux/module.h>
5 V9 H# C' i3 a- f- A8 `0 X - #include <linux/init.h>' S0 K' y0 _- c( z2 J7 [& E
- #include <linux/errno.h>1 O7 A6 g7 j* z. O6 p
- #include <linux/types.h>- I1 q6 N$ F& ]7 l- w: J
- #include <linux/interrupt.h>
' Q# @9 F% Q0 I - #include <asm/io.h>/ {% T) d; ]. L2 \
- #include <linux/moduleparam.h>
/ l) a v1 F: A - #include <linux/sysctl.h>
, i. A# _" t! W; O - #include <linux/mm.h>
; A5 c5 }+ \! C: U% q - #include <linux/dma-mapping.h>
& M( Y% P$ [6 t/ G4 A% \ - ! H3 U* @! R1 Z) ]% N
- #include <mach/memory.h>
5 l- T6 l% i. {1 S Q* c6 ?% \ - #include <mach/hardware.h>
1 z- |9 {, f# G: @, U+ Q - #include <mach/irqs.h>% e# r8 p0 ~! O4 ?. \
- #include <asm/hardware/edma.h>5 H" Q f% |% s8 e4 `2 g1 D
" v' Z: H; d1 a8 U- #undef EDMA3_DEBUG/ @+ a/ O- h7 ?
- /*#define EDMA3_DEBUG*/
4 E1 i0 T0 o$ S$ J
; q$ n8 } b- ] Y; s* f, o- #ifdef EDMA3_DEBUG6 T% _* K. j* O4 S8 \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( U3 H5 h, L& Y' z; z' w# k* C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( g) s" Y5 o7 [ h6 I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). M) x1 q( }5 t) x4 u; Z" `
- #else
: F2 [6 e5 ]$ t3 \/ E; b' ~ - #define DMA_PRINTK( x... )# g; y! `$ h' \8 B2 Y1 t
- #define DMA_FN_IN
& z) n( Y+ i: ~ - #define DMA_FN_OUT
5 H7 V7 ~) J; f- l* t4 l# Z/ L - #endif; x; e: D7 P1 q5 q* Y
' ]' }' w. Y' y" s- p2 A/ O8 h: I' z/ r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 o& t/ N- l4 I( @- u - #define STATIC_SHIFT 3
5 C8 @4 f' }- G - #define TCINTEN_SHIFT 20
C. X7 b9 d: p6 e5 \ - #define ITCINTEN_SHIFT 21* l" T( M5 c% F3 W/ U
- #define TCCHEN_SHIFT 22. h6 e% Q& o* V& y
- #define ITCCHEN_SHIFT 23) s9 Z/ j0 m" B
- 2 Q5 {2 _: [: j. C' y# r2 T- J
- static volatile int irqraised1 = 0;
( p0 e1 N. L: | - static volatile int irqraised2 = 0;& ^( u0 B$ r3 |* ^ ]4 J
; y5 Y6 ^9 P. }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 r# U0 P5 A' c4 O( S" `2 J& F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" p. _5 M! o4 Z+ n) |% b, K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 F$ O% m H! e. m) p; }
6 a) n7 _' A7 ~! X' _- dma_addr_t dmaphyssrc1 = 0;5 ]$ j. o& U' c7 t" [; _$ R
- dma_addr_t dmaphyssrc2 = 0;
, D1 C9 }, N i6 g4 s5 H - dma_addr_t dmaphysdest1 = 0;/ ]1 H. }/ x a6 i
- dma_addr_t dmaphysdest2 = 0;
% v0 ?% A- {. q* O - ' B' K9 @! {2 f* w
- char *dmabufsrc1 = NULL;1 v. K2 a) `% l, K3 r$ V: g
- char *dmabufsrc2 = NULL;# {& w9 \$ G+ D/ L! T; ]
- char *dmabufdest1 = NULL;
1 D7 K' n" k) H4 W2 L( v - char *dmabufdest2 = NULL;8 H0 e5 b: s* r. Q
- # X0 R6 E4 h, |/ C: H' S* T; o* B
- static int acnt = 512;
$ s9 p Y9 y2 G1 f7 U2 R! A- C - static int bcnt = 8;- e I/ h. L3 q. v) E* X M
- static int ccnt = 8;- l+ _1 k$ E8 [% G+ D/ P
- 8 T1 R3 Q+ ?) ^, F" q
- module_param(acnt, int, S_IRUGO);
: q2 Q7 u/ |! t" h# Q+ E' x ~* U - module_param(bcnt, int, S_IRUGO);
+ p' ^5 X/ i* K# d" Z - module_param(ccnt, int, S_IRUGO);
复制代码 & ]1 n8 v+ [) B' b, W& h( y
W' s5 n F# p0 P D& x5 p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) c, \/ W) e5 \( P8 `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 p" K, y; y, M9 p8 f( c3 M% ]; k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ n* I4 G$ o" S4 E: Q. r
- B, D& D0 n8 }" s+ j
( l( ?: u7 p5 | |
|