|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 L! G$ [4 q+ W, n2 m, D
- [code]EDMA sample test application# ^3 r* D2 o6 s! @) p
- /*+ J: j. i9 z0 l& w% q7 Y% g
- * edma_test.c6 a- a; y/ A4 s- V* m4 Q* |
- *6 _8 D1 ?! Z2 ^
- * brief EDMA3 Test Application8 c! d0 a. Y- X5 o; M9 k& I
- *' G7 h6 y* f2 Z0 P" D6 x
- * This file contains EDMA3 Test code.! C" F; v! X2 `2 w* s
- *& \0 i+ D9 c: {/ k0 X+ d0 Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' K3 H. v3 `% c4 G0 r4 a, w( F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( {" I/ U3 V. g7 [. J8 T3 O7 ^
- * TO CHANGE.* \. L6 e. L: F: n
- *
; m; n# @2 H* U5 A1 \$ w/ j t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# g( p/ y+ p& \
- *
& w' H+ Z$ M' f ^; X - * This program is free software; you can redistribute it and/or8 [$ p7 x: V( z! t' E# Y# S# N
- * modify it under the terms of the GNU General Public License as
1 \- k* O$ y5 \ - * published by the Free Software Foundation version 2./ T3 S, f) R, T! K6 o
- * U. B$ N4 v G1 [6 W: E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( h2 V% r! A. g; w/ U$ ?( m - * kind, whether express or implied; without even the implied warranty- |' U- e8 G% G- L3 @( g3 x+ W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ {+ B Y. }: ]) ]- o- A3 |+ S - * GNU General Public License for more details.# m+ B& t7 {3 v4 P; P( V4 ]
- */
+ A, c& Z, C. |5 l6 H7 ^4 B# s/ F - ' `3 Y. n, B& w, Y
- #include <linux/module.h>. J& {1 V8 D! |7 K6 w
- #include <linux/init.h>- Q' _0 k0 d# L4 @- u
- #include <linux/errno.h>
1 @" I- a3 Z) U% z" ]; w n - #include <linux/types.h>, f* E8 Q6 b$ v$ }( w2 T$ r: e
- #include <linux/interrupt.h>
, I6 Y* V8 z. s1 B) s - #include <asm/io.h>( o2 |% S |4 M1 F
- #include <linux/moduleparam.h>2 T. ]3 }: W! r0 w" ?
- #include <linux/sysctl.h>
- ?' d. v5 q) M ?+ a" ` - #include <linux/mm.h>. K: T. c9 Q& f) D/ I
- #include <linux/dma-mapping.h>* |% O+ Z0 d5 P* [4 U
- 1 ^2 W1 b( ?, b
- #include <mach/memory.h>
5 U# V) @7 g) j7 e6 z - #include <mach/hardware.h>7 J8 F6 N8 K! ^
- #include <mach/irqs.h>
' v8 A. y" n& F: K# ~ - #include <asm/hardware/edma.h>, ~( Z( V- Z, j W$ j
/ @* |" f2 u6 }4 h2 k- #undef EDMA3_DEBUG
/ D/ x# e# G2 o* r" @ - /*#define EDMA3_DEBUG*/
% \& p% \. }& y) ?
; O! ~0 e0 z6 E1 \/ e- #ifdef EDMA3_DEBUG2 q1 i& E/ v8 R. s" i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): U& I$ j5 O9 ?0 x/ u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' C. s, ~2 G) f) y: Q8 Z! W. x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 S8 y w" D* a2 b - #else
4 e, D6 d: c4 w: e2 q/ t# U - #define DMA_PRINTK( x... )
, E k- \8 V* ]6 M8 u- i! y - #define DMA_FN_IN8 y$ |; l s) Y6 p
- #define DMA_FN_OUT
& p0 V" ^" N$ h) p8 ` - #endif: `4 a. e2 _& I( j1 U4 | X4 h- U
- 9 C4 X) Q$ U: n7 S. i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% U6 Q' _5 H; b+ o2 H& ]0 `. r( R" r/ x - #define STATIC_SHIFT 3 a/ j* i0 Z1 L
- #define TCINTEN_SHIFT 20+ _* A3 ^/ M1 M) i$ u0 r5 T
- #define ITCINTEN_SHIFT 21
# h; D) R/ T. G7 ?$ q - #define TCCHEN_SHIFT 22
8 }' D2 V" i5 p - #define ITCCHEN_SHIFT 23
; b% y9 O, m) I1 |4 n3 y; e/ F; e
- {/ G( b8 c- X& a; N, \- static volatile int irqraised1 = 0; @; n- T; R8 {3 j2 y" S
- static volatile int irqraised2 = 0;' |8 G& B& Z9 R" I; l2 ], j
- 2 P* F1 E8 k( B/ @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 d8 I3 M3 i8 M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- l2 O5 J0 \2 l, ^* W2 ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# \% q( ^5 H1 A: ~- Y' v - + F1 G+ R8 U5 T. {+ D; L! C4 r: W
- dma_addr_t dmaphyssrc1 = 0;% p- z/ x' q9 a8 R
- dma_addr_t dmaphyssrc2 = 0;- \0 n2 i- \+ U% C" V
- dma_addr_t dmaphysdest1 = 0;) x; C' e$ n+ r* a7 y5 T3 b% I; u" J
- dma_addr_t dmaphysdest2 = 0;1 f( y- I# @" S* i7 l x
, B4 D+ v$ `: v. Y l/ ~- char *dmabufsrc1 = NULL;7 v# X2 z: i- y+ R% l4 y5 \9 T7 k' c
- char *dmabufsrc2 = NULL;+ p4 O4 G1 }1 H
- char *dmabufdest1 = NULL;
# _9 e* z$ U9 B8 x- N+ Q - char *dmabufdest2 = NULL;
; ^+ w6 x( t9 a) l+ K/ a2 `
9 m! O. h) T' R: l0 i0 X- static int acnt = 512;
; u4 a' B$ F# d t2 Q - static int bcnt = 8;. {2 ^. |: M1 f# r. K7 b
- static int ccnt = 8;" T: e3 v9 c1 N9 s; l/ y$ h
- . `, x+ R0 Q" X- @( _0 {. c
- module_param(acnt, int, S_IRUGO);4 i% N q: l; f$ g. ]" }: Q
- module_param(bcnt, int, S_IRUGO);
, Y- U, F/ q- C! p+ X5 A) `+ e - module_param(ccnt, int, S_IRUGO);
复制代码 7 l) {& Z* s5 p9 U
G1 O, I) o. V6 ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- X* L) ]: u9 X9 U' iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 F8 |2 }4 ~/ t1 | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ g1 w; u. O; Q2 n
( e3 U' p4 O8 O" g6 k3 `1 c
( r/ g; D3 g4 x" I9 h |
|