|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' s4 @$ ~* A+ f4 _1 _- [code]EDMA sample test application
- j4 p: Q/ I% U! ~ - /*
# T* z& i1 A$ F9 G# `* U - * edma_test.c
! F% j7 J: `; ~! z0 a- R& M - *
, q4 o3 ?4 U2 G - * brief EDMA3 Test Application
) Y i5 m6 w8 `/ o$ W7 E) | - *) h$ e4 ]) f: g. D
- * This file contains EDMA3 Test code.: k7 c( v+ N7 h6 y" G C
- *
6 U+ k" d" w1 y c) h7 t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ I8 B% H. U0 \2 G* F8 Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ d: @- v/ h0 R2 ` - * TO CHANGE.
& Q& Z' L' C# f" j$ d. m - *) c9 H5 i; ]! E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( e; ^) F( x' Y
- *6 z8 n. M! D8 L
- * This program is free software; you can redistribute it and/or
& e+ ]' o1 O" d& r* r- V0 g - * modify it under the terms of the GNU General Public License as
/ r; a! @" f0 P: D! L2 O - * published by the Free Software Foundation version 2.9 ^0 {$ @# s* E
- *: Z" p; w: ?; c& |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. R9 t* y8 t4 p3 @
- * kind, whether express or implied; without even the implied warranty
4 p% x n* P" s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. t( H$ C* K/ Y: Q0 W; I+ D. M8 |
- * GNU General Public License for more details.
! m" o0 g; M# D( u - */
, K. E# b/ y8 d# C2 ^ - * f7 M4 t9 h) B# `* }
- #include <linux/module.h>% _' r: J% s7 F" ]4 @8 X! Y
- #include <linux/init.h>
9 l1 y/ B# X, r8 S+ i; \ - #include <linux/errno.h>
' F) Z; _/ m# Y - #include <linux/types.h>8 b1 [- Y' m5 S! M. I0 u
- #include <linux/interrupt.h>( u0 n! ?2 v0 D7 O
- #include <asm/io.h>
" i' s0 a. S* }6 g8 ]: M: {; F/ t7 H) O - #include <linux/moduleparam.h>' L, C6 i2 U; P5 g3 X5 T1 g! {+ b
- #include <linux/sysctl.h>1 o0 T2 B8 k$ M
- #include <linux/mm.h> c1 \; D& H- f
- #include <linux/dma-mapping.h>! G$ u2 |6 V9 j
- / c; L4 c( a; `2 l% ]; ?- C$ J4 E
- #include <mach/memory.h>' S$ C. }) p# {) G9 ]2 T8 A% ?
- #include <mach/hardware.h>
) _9 S8 |3 t0 y* W7 Q* u - #include <mach/irqs.h>
9 P' Q5 a" }# K: w3 G - #include <asm/hardware/edma.h>2 H% k; S; I* r! u' d2 e
0 \5 p n% B6 s! }( h T- #undef EDMA3_DEBUG
' V% S# O! L% ?$ S( Q - /*#define EDMA3_DEBUG*/3 ]2 H: F- I u1 J4 n/ W# F6 v
- 7 `/ U/ e+ r; C) B, ]. X- N9 ^
- #ifdef EDMA3_DEBUG% Z' q- L9 K0 I5 O! r( D( o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" \: _$ [( s! B+ u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; x+ z7 v8 |5 _7 X" ]% I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 z; y( q4 J9 G* f - #else% }: C v/ e& S( l5 F
- #define DMA_PRINTK( x... )
# l" l# f4 c: b! I - #define DMA_FN_IN
/ d/ O: Q& I( ?* k( v - #define DMA_FN_OUT
& ?* Y- O2 W, P. `1 N, T' c+ k0 G - #endif7 M0 t. M% E' a4 I j3 Q
- . u) E' R# ^) m5 a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; @ v$ Z0 w0 d2 L - #define STATIC_SHIFT 3
5 r8 J$ J6 P! e4 |# f' f! G6 Z' W - #define TCINTEN_SHIFT 20
. {$ c: O! W1 m" [ - #define ITCINTEN_SHIFT 21
; {' w3 |% v: _3 { - #define TCCHEN_SHIFT 22! G9 I1 a0 \1 V# ^
- #define ITCCHEN_SHIFT 23+ Q; ^* i, ]$ m$ _ ~
+ o; _2 O' t. g7 N0 m$ m- static volatile int irqraised1 = 0;
E' T% g, E* E/ T: x0 G - static volatile int irqraised2 = 0;
! H+ o. q% U! {5 \$ W - 3 M: y6 Q: k5 k4 L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# G8 q1 x, G4 u. j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' B& y0 @+ J6 N P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 M2 q' |) I3 W; X" m9 R - # ?7 R& S6 q! t6 X6 {0 G) l
- dma_addr_t dmaphyssrc1 = 0;4 O7 J5 w( M/ \3 n$ r
- dma_addr_t dmaphyssrc2 = 0;
8 `2 g: L% D7 c! V9 O/ z - dma_addr_t dmaphysdest1 = 0;
0 v. {; [8 ], q: f9 `: r1 ? - dma_addr_t dmaphysdest2 = 0;4 f; q, l# e7 b" X
- ; ]% F% Z+ @+ y g% F
- char *dmabufsrc1 = NULL;
0 K% N& H' d& q6 N - char *dmabufsrc2 = NULL;
# J' H% v5 b$ p, ^: t - char *dmabufdest1 = NULL;
9 _( ]; x J4 l5 C - char *dmabufdest2 = NULL;
( s4 }4 F, b6 u4 d% A - 9 w6 `) z. v' x* v6 _
- static int acnt = 512;- e- T' H( I, B, V% ]0 i
- static int bcnt = 8;
, w8 J2 S+ z* Z( U* u! O) E - static int ccnt = 8;1 u3 Q9 e: `/ x& x# M; C
- * h _& o5 } O. J- j
- module_param(acnt, int, S_IRUGO);; @2 H6 B1 q) x( d
- module_param(bcnt, int, S_IRUGO);. P' a0 w1 d: f% G3 _: J: p
- module_param(ccnt, int, S_IRUGO);
复制代码
/ q% a0 h/ H* G3 n! b% ` N
: f* s/ t3 e# y8 ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 F! z% R* A# z# a( w, {! P4 @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 f+ k4 I1 v4 D m' c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- ~+ {, r! ^ ]( e
. Q* X2 b/ v% J3 N3 l
( f# K# D. z+ [5 T' L; @' F |
|