|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& ^0 T5 x2 s- |9 Z- [code]EDMA sample test application
0 r: i1 ]2 k2 U4 ? - /*
1 ]+ {+ h% Z7 X' @ Y' s. c - * edma_test.c
! s, H9 J6 }0 _! x - *
- P# G# }7 y# K3 E - * brief EDMA3 Test Application" c$ c/ }- K4 G. g/ F+ W1 ^8 L
- *8 Z m `/ n/ C4 U" n* l c
- * This file contains EDMA3 Test code.
% s6 H% H! Y& _! Y; Q& I - ** r: c3 k2 @& U$ T2 t, b$ f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ P7 W" G1 b3 n/ K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 k7 o( C& _' {+ @8 ]3 |; L
- * TO CHANGE.0 s0 x2 f8 H1 g) ~2 x# e* V
- *
& ]$ m( H4 G4 m& @. L+ b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! p0 E+ u( ^7 u - *
2 m0 ], V0 L ^& U$ p6 S - * This program is free software; you can redistribute it and/or
. ~) s( }" _8 p - * modify it under the terms of the GNU General Public License as) p3 V9 Q! y" l& m1 B3 w
- * published by the Free Software Foundation version 2.
4 G/ N6 a( `: V a/ _5 k - *4 p% A3 U3 z* f1 D9 S8 q; M9 f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 ~0 T, D+ V) n: r! [
- * kind, whether express or implied; without even the implied warranty
1 T7 n+ ~) k+ I; L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; M4 E4 ~' p- p7 N. I - * GNU General Public License for more details.1 k3 a9 Y- e: @! c7 K( F
- */
1 J* X# y v) v
& g3 p7 O5 D' k. Y: U- #include <linux/module.h>7 Z' _9 ^3 J4 x+ F3 Z% _# o; m
- #include <linux/init.h>
+ y- t/ m& b, O/ n7 a! k4 q; } - #include <linux/errno.h>' l5 ]# s5 m$ e9 E; z9 y8 G2 T R/ p* h- I
- #include <linux/types.h>
* V2 \% b1 o4 h4 p% L - #include <linux/interrupt.h>
9 k: W! p0 x0 P3 R( M& ?" g - #include <asm/io.h>' E/ W" `- R: @6 F
- #include <linux/moduleparam.h>: A" @ r& g. o& u4 Z3 d8 G
- #include <linux/sysctl.h>
% C# b& T7 P- s% N' B; Z - #include <linux/mm.h>; |1 c& z* H2 ^3 D" M
- #include <linux/dma-mapping.h>- I! l$ k/ Z, c: a H# w
- ( @' a/ ?2 ~ I- C b
- #include <mach/memory.h>
! s1 u1 }( r+ u1 z' O8 S2 U3 B - #include <mach/hardware.h>
: R& _- W, }9 ~6 d0 f9 j - #include <mach/irqs.h>/ g7 L# J. }% e, `
- #include <asm/hardware/edma.h>
# o) `0 r: Z0 e4 |9 P - 7 X- V+ P1 Y& Z( ]
- #undef EDMA3_DEBUG
6 v& \' h7 }( k, C( R - /*#define EDMA3_DEBUG*/
; ^9 }. W# {" {4 Y0 @" L - 1 E2 O; k1 ]8 ]. L
- #ifdef EDMA3_DEBUG
1 R% W# l* r1 b7 T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 H3 ]2 N) { u7 V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 x8 E& r# _( p) g- F$ @8 {% M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ r/ Y/ t0 f* P
- #else
& G5 I0 @8 D4 r% u; J - #define DMA_PRINTK( x... )
: I5 y0 }7 z* t* f4 u - #define DMA_FN_IN
. x' L) I% d! \, r" _& Q - #define DMA_FN_OUT/ f# c _8 g" L! R6 F; t; q. M
- #endif* A5 u0 e: z: c9 j' f, m
, ^" n- P2 I2 e" i) c% ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 C' S1 c" ?: K- F, L3 A& f, W( Y - #define STATIC_SHIFT 3
% ]1 M" [; z K - #define TCINTEN_SHIFT 204 Y) r# u1 @' U5 y
- #define ITCINTEN_SHIFT 21, B5 n s, z- `# ]! m3 o- v0 Z
- #define TCCHEN_SHIFT 22
$ |5 u! }1 Q4 L. e+ H' u - #define ITCCHEN_SHIFT 23 S( ?' b9 g$ I9 p
* \2 z( V( u: H- static volatile int irqraised1 = 0; f7 \& ?, t s6 N
- static volatile int irqraised2 = 0;
; P* t7 e8 q# Y _
( T1 d+ n& A# `. `" E1 W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 C. w4 r0 n1 \; O( P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- n {4 B0 ?; U) l8 }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& y& D4 O) U! Z8 E0 {" H& o
: L* i, s+ r8 s9 z8 j1 h$ _* {) V- dma_addr_t dmaphyssrc1 = 0;
) d& p% D0 ?9 V/ T$ @ - dma_addr_t dmaphyssrc2 = 0;7 [; g" s, d0 d, m$ v R. b. }
- dma_addr_t dmaphysdest1 = 0;- q2 a( C+ }/ h5 U* u. g
- dma_addr_t dmaphysdest2 = 0;
7 [( ]0 o1 k7 \) f6 ?. m - 9 M' S a, ^# y; }( t: _) o
- char *dmabufsrc1 = NULL;
0 r8 Y- W; D! s - char *dmabufsrc2 = NULL;
8 _- G" i5 S9 q5 Z - char *dmabufdest1 = NULL;
2 b+ Y; P1 E" G# |8 I c% a - char *dmabufdest2 = NULL;6 `( c; \ O. ]; W: q7 T
/ y/ @6 z' |% e1 m- static int acnt = 512;
0 g% e: v1 `' v - static int bcnt = 8;3 q: T8 Q" e" ^! M* O
- static int ccnt = 8;
8 y0 c# q" T" a/ s
3 M, g2 P1 R. b7 u+ y; c- module_param(acnt, int, S_IRUGO);- Y( h- ]" V$ q% W0 x) D$ R6 P
- module_param(bcnt, int, S_IRUGO);
$ Z4 }! e! O2 q& G! u - module_param(ccnt, int, S_IRUGO);
复制代码
+ h O: B; M. M, I. H" [
4 `# G9 c' i0 w0 |0 }; q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ r- h$ n2 p+ j: {! U" y# b% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 {8 O( y* D2 H. b; H1 k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. R+ M; P" ?0 a3 j6 {& v' t8 x1 y2 p2 G( s& m
8 c' ]$ O2 O0 S
|
|