|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" w# E+ `$ T& [/ X- [code]EDMA sample test application
X& K! q9 S" P& @ - /*
4 z8 F1 T4 d6 [ - * edma_test.c( j" r* N5 L9 q: I6 w
- *$ d0 u( u0 [; h/ L8 h5 p6 h; _
- * brief EDMA3 Test Application+ U( V" j3 k2 r. C; \; |, X
- *
' v3 H- \) N- G0 I/ W8 t( s; C8 W - * This file contains EDMA3 Test code.
9 |- m6 z+ p/ @& C: j0 N - *3 P: L# u4 @9 N$ y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 M& J. |* M, h3 D- J' O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 ]4 J# D. | B8 E8 S+ J/ b
- * TO CHANGE.
: Z& [$ U2 ^! A4 g. V$ i) q( ` - *
' `6 M! p0 M/ h) W6 J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. |( r5 m) [- T; o8 W2 E- ]3 Y, u0 j
- *
3 h3 E7 M+ w" I v4 W - * This program is free software; you can redistribute it and/or
" I, j; M9 }6 P1 r; ` - * modify it under the terms of the GNU General Public License as
( }2 T: V. @& m% t - * published by the Free Software Foundation version 2.9 I E3 Q6 u; Q% p) `1 G
- *
& z6 J: A, C1 n! Q- k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; a5 O$ t# E, C5 q/ c - * kind, whether express or implied; without even the implied warranty
* I$ C) S9 a2 @/ V6 `* z& | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. {4 R1 o7 E& i; I' Q - * GNU General Public License for more details.
- O0 H1 n% W& q. @ - */
! ~# n! D4 K$ [! S; V/ n7 S
2 O, G: }" n) _3 e" s- #include <linux/module.h>
8 I% {3 m9 x" x" F" j& z5 K4 b4 m - #include <linux/init.h>
j9 E- H. Y9 K f7 g- f9 r6 j - #include <linux/errno.h>
" e/ j3 o `+ F/ w - #include <linux/types.h>
- q/ O& ^ x4 R4 a! _ - #include <linux/interrupt.h> p9 p+ w5 N; {) W' |% _
- #include <asm/io.h>
$ C% s6 Z! H; v7 Y) \8 E* M - #include <linux/moduleparam.h>8 v& d- f4 |0 s
- #include <linux/sysctl.h>3 n; l$ ^7 r: c* J9 }& T7 f O# Z
- #include <linux/mm.h>
/ w, p% y6 t/ G7 \2 C% H! I - #include <linux/dma-mapping.h>
) r+ G0 |( k& q9 `) O: c% ?- G - $ D0 ^* \$ ?$ i, L! O) Z+ i
- #include <mach/memory.h>
* G( B' t0 _# H0 Y& u - #include <mach/hardware.h>0 \: x& T; T a7 X R8 T) v5 d
- #include <mach/irqs.h>7 z6 g ^! [+ R+ k* }% V
- #include <asm/hardware/edma.h>' Z. K" B6 y- |% \: }2 u7 P+ z
- * E! s8 e( v. u4 b: o: e4 ^$ P
- #undef EDMA3_DEBUG3 F6 T1 V5 d( ^4 s$ x
- /*#define EDMA3_DEBUG*/: G; K, V9 }' u% p7 h
5 W' N2 I+ b) _" F2 G: R3 J5 x$ {+ R- #ifdef EDMA3_DEBUG
) e- l4 ]' V9 C5 Z, g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 K: }' h; M. L- \- n, I( p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; P5 |' Y. p& s$ ^/ X9 S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ z9 \# _* n7 s; |' n
- #else
* ^: k! ~! l4 N+ Z5 l3 _ - #define DMA_PRINTK( x... )& R2 }) J/ }. Q0 N# G
- #define DMA_FN_IN' Z) B+ Z4 n$ g
- #define DMA_FN_OUT
5 N" F X" A, L2 m( Q - #endif1 ~' W7 X0 ]+ y s
- , i( M7 P; J& _% \2 o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 M2 ]2 L% j4 {+ b' G
- #define STATIC_SHIFT 3' t) z0 p9 q* @% ]% H$ B2 \
- #define TCINTEN_SHIFT 202 s! W* a8 k7 N) Y3 p9 b7 `
- #define ITCINTEN_SHIFT 21
+ ?( j s9 u; s& }( r! D - #define TCCHEN_SHIFT 22! p) n% s+ i8 K) Z
- #define ITCCHEN_SHIFT 23) w( ^% H8 Q# A7 V. f, t
- ( W$ p/ c0 }6 f5 l$ w
- static volatile int irqraised1 = 0;; B N. Y0 m3 e: n
- static volatile int irqraised2 = 0;+ o6 G& c$ v: V8 l5 L
- - Q# n7 F$ X0 A& N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 t: z* L. R# G. a {- d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 @, `- d8 x: v3 Q' a- J/ \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- Z- F6 P7 H( j( V# a - 9 ^8 w- g- @, p7 P
- dma_addr_t dmaphyssrc1 = 0;
|, C# P8 Z, k2 d% q - dma_addr_t dmaphyssrc2 = 0;+ r$ b: s, y1 @8 D! w# |9 a" j
- dma_addr_t dmaphysdest1 = 0;
: {" y" z5 Y6 G - dma_addr_t dmaphysdest2 = 0;
: }. \6 M5 N, J1 O+ u! U1 i/ t
& ^) x7 Z3 T) }8 F3 P$ Y+ a- char *dmabufsrc1 = NULL;6 V) o2 D1 D# }) ^: f* k3 l& w
- char *dmabufsrc2 = NULL;: F+ U4 z+ u: N& G
- char *dmabufdest1 = NULL;- A. H! L9 u8 b4 @ S
- char *dmabufdest2 = NULL;
' `. f7 w8 ~0 T
0 @$ Y* u, Y o9 L9 {- static int acnt = 512; ?5 a' P) G2 [3 U! s0 }1 n
- static int bcnt = 8;2 ~1 L$ v9 @4 |$ D L5 X/ ^
- static int ccnt = 8;
6 n- C( D0 }: O6 L% D. l" } - 9 s# Q, @% G6 c2 i3 _3 Q
- module_param(acnt, int, S_IRUGO);
3 S" \( z( _; Q, e2 C" y; r& [% a - module_param(bcnt, int, S_IRUGO);+ {; s* x4 i7 @1 ?) G. W
- module_param(ccnt, int, S_IRUGO);
复制代码
, c/ h/ U* R- u# F) o0 w- G& L5 K( a& r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) |4 o- d7 ^$ N/ M; v7 X" Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' V8 T) L9 L( L2 F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' i2 F$ w: `- v* [7 _4 e& e8 c. e. o/ T
+ z6 G9 S* }0 P* c) k |
|