|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) L& {7 e' u: {# f# |
- [code]EDMA sample test application
+ c2 h4 P8 n, n - /*
9 Q: _6 @4 z) @, j _ - * edma_test.c- ^. v* c4 }4 v$ e5 Z$ f6 R2 {0 m
- *
8 n& K) N' M" C/ L2 S1 r! _ - * brief EDMA3 Test Application
' k& n1 w3 C6 Q5 G# O - *
1 L( T' D% P4 s - * This file contains EDMA3 Test code.3 d7 l3 g4 t: c+ m. y& \: y' X
- *) [( Z* T& j7 ~; O+ ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) R3 f1 Z' ]# Z( \, [+ A7 g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 N/ p d/ i4 j8 ~9 Z; W
- * TO CHANGE.8 E, i7 ?; \, \- ]: |3 r
- *
" w# G3 H7 [/ j) R" ]" O" V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 z4 {0 E3 R: J: H - *
+ O* o B& M$ P# g! |! [ - * This program is free software; you can redistribute it and/or
+ z8 w8 `; H. a - * modify it under the terms of the GNU General Public License as
( ~4 c5 {4 d, |% r0 Y' s) M: E - * published by the Free Software Foundation version 2./ W. G' j/ C8 U7 ~, v2 R8 V+ x+ E K
- *2 I0 ?3 N! l( ]" o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 N" f. `- v1 R5 V4 A& }* m; b. f
- * kind, whether express or implied; without even the implied warranty
9 k( a! A, Q1 a9 l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 }1 A$ } E, n3 \8 R* v
- * GNU General Public License for more details.3 ^) }- H' j* k2 [! Z
- */
2 H4 p+ R: W% I! T - : ~8 Q& g7 g( q3 }* S- C
- #include <linux/module.h>
- D+ |8 V' _& k u& A. {5 { - #include <linux/init.h>
9 m1 R5 v: ?0 ~( y% N& O4 f( G& x$ Q - #include <linux/errno.h>
$ U: p3 w; C; P/ o+ } - #include <linux/types.h>
; o9 e2 p- E5 o+ r! m6 [' N - #include <linux/interrupt.h>
4 o0 @2 P! n' ~* w - #include <asm/io.h>
' v a1 X6 z8 n+ s# L7 w - #include <linux/moduleparam.h>, F+ i: J4 a! V/ V* T
- #include <linux/sysctl.h>
& @7 U" O* ]7 x+ k3 Q' ] - #include <linux/mm.h>$ ?7 _3 G, L0 I
- #include <linux/dma-mapping.h>
7 i$ l5 M" e3 c3 f+ n1 M7 A0 f
4 T4 G3 m5 B5 c* U- k8 q# A- #include <mach/memory.h>
+ V, D) g4 ?# W+ s6 |% D - #include <mach/hardware.h>
- D2 m; m4 h) j1 ~6 m# w3 d; Q - #include <mach/irqs.h>
@( O: o/ X4 u# E' J' k% O( ? - #include <asm/hardware/edma.h>' b- j ~. G' b2 w/ P/ h
% K/ i6 F5 J( i& k% o. ]- #undef EDMA3_DEBUG
. B7 B1 U% Z3 e" Q" }! w - /*#define EDMA3_DEBUG*/8 Y# q% b9 F. L4 w( O; A
/ `( E1 M2 U: E+ j. \2 o# n* D" [- #ifdef EDMA3_DEBUG5 p" s! v6 x7 m' d+ I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# d) F y1 ~, S4 R+ Z4 n7 ~3 o" H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! y4 [5 q3 }2 A# m3 z: y0 S# J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 b' ~: ^# y. D8 V$ Y, Q
- #else
; E! G; F: |3 J" a0 e y4 k - #define DMA_PRINTK( x... )
& b/ S( S' I( o3 u - #define DMA_FN_IN) o' O3 Y' m8 c5 c# q% R7 i8 q
- #define DMA_FN_OUT
9 w0 Y+ r/ Y& s - #endif: v! f6 u) G/ j3 u: n
& ^3 h3 D! p1 O! W1 g9 i2 Q/ R" E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# ]( s" N/ P) Q! \* W% O* @
- #define STATIC_SHIFT 3% P! ]( w. R* F! Z9 x3 d# u- w
- #define TCINTEN_SHIFT 20
; {5 r3 m; }" t7 b% L4 c3 C* M - #define ITCINTEN_SHIFT 21 Q/ C: T$ _( x O
- #define TCCHEN_SHIFT 22: `. |% @' c c! s' H' K5 P5 P
- #define ITCCHEN_SHIFT 23! H2 _. z* r% M5 C
- " i+ D. b5 Q! F' D4 @- |5 Y( n9 A
- static volatile int irqraised1 = 0;
, `7 N& A8 D3 l) ^# n V# H2 f4 r - static volatile int irqraised2 = 0;3 K5 V+ c- M9 [ q' P( H9 f+ n
; ?1 Q O) ^2 ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( M5 i' c( [" w, Z: C. U1 @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; m( \* ^5 w5 q5 E v0 R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 E8 K5 N- U% d [+ z0 U; m. T
- " Q0 J8 j) _7 ?& U) I
- dma_addr_t dmaphyssrc1 = 0;6 L" c/ ]1 j! ?- p. L
- dma_addr_t dmaphyssrc2 = 0;
0 N+ T$ ^4 c5 O* i: {& I6 g - dma_addr_t dmaphysdest1 = 0;
# }) z7 j/ m! v5 ?& a - dma_addr_t dmaphysdest2 = 0;: c2 ]% O9 R; a3 ?/ E9 t0 A8 N
- ) N" t P& P: W( p2 A
- char *dmabufsrc1 = NULL; Q& i: U7 [7 J5 i5 r" R
- char *dmabufsrc2 = NULL;
' g5 C, o0 J7 F) {. d( r+ ` - char *dmabufdest1 = NULL;- b: d2 t5 [3 x- z2 x3 B4 v1 X, r
- char *dmabufdest2 = NULL;
' W& i) E6 K5 Z' I v+ v2 I
/ g% n' ~4 |: |) r7 M- static int acnt = 512;7 ^( \7 n+ f2 w2 j, |
- static int bcnt = 8;
" n5 S8 Z6 K. k4 g# i& T - static int ccnt = 8;
/ k" m( u0 H. _( c& W0 E6 G
; S2 ?4 ~* w. M$ O3 p- module_param(acnt, int, S_IRUGO);
, K: T- x: c8 P/ B+ N. _ - module_param(bcnt, int, S_IRUGO);
+ U l! y) J/ i6 f - module_param(ccnt, int, S_IRUGO);
复制代码 " z0 s* | r0 c% l8 x3 h
W# d( y2 ^; T1 m% @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: C+ j! U, J8 w) V" p0 R( G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ N+ @& u6 a" w5 o% h* \) C# x" @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 ]- `8 N& n, a4 f" J- O; ?0 G1 e- e/ W" O
8 {: B& t7 ?. d5 a
|
|