|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 j) x+ R& ?9 W3 g+ Z- [code]EDMA sample test application
) V' _3 z/ J% h$ Y4 H& O, {6 S - /*; U+ @4 X7 C2 w$ v! z' C
- * edma_test.c6 k3 {2 P% ]3 X$ A) O# q% f# x
- *
6 I0 Y# r# q5 P' E& }4 s! h - * brief EDMA3 Test Application: Q, P! w, W. |# ^5 U
- *
# P8 n5 M3 F' ?2 A4 [ - * This file contains EDMA3 Test code.5 \ K; S5 G- I4 F" I
- ** p% u5 ` x3 t+ K( L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 u1 i$ A- ^' ?+ n! U# F: b% D- L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 `7 G' j, f; U. J( X; d2 f5 G - * TO CHANGE.3 t* U$ s( p" X+ V/ o$ f
- * o" T2 f x$ M9 v% k( Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 m! d# T0 A/ w; t; ]0 p
- *
% ] T+ V% [3 U- o6 j1 Y( v - * This program is free software; you can redistribute it and/or
5 Q. K2 ]. Z( f6 G' x - * modify it under the terms of the GNU General Public License as
1 W& w) K$ l1 P! I, K6 t7 W" L - * published by the Free Software Foundation version 2.4 R% |& U d; ?) U D* h
- *
0 f2 f1 g( N8 k- p6 k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 y0 }& t6 R ` A9 s1 D3 U, G" r
- * kind, whether express or implied; without even the implied warranty m' O3 w$ d9 Y8 v( v5 [% Y1 e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; l( ?. Y9 |- U: i - * GNU General Public License for more details.
( p9 G" Q$ t* c+ I - */
% S' r) D9 j* H0 v2 U6 s& q
1 E9 o, t# M2 ~ Q# G) s& z- #include <linux/module.h>! F. \% Z+ g% f- S
- #include <linux/init.h>
8 H+ }0 G4 |8 I% D% w9 H8 Q5 R - #include <linux/errno.h>
3 M* M" q v1 _( z - #include <linux/types.h>: e$ @) C) s2 |
- #include <linux/interrupt.h>+ \$ Q" J3 b( y$ o5 P% @
- #include <asm/io.h>' j1 _$ o' C; y& I# o5 v
- #include <linux/moduleparam.h>' s5 ^2 ]7 U' v- z4 i7 T% O
- #include <linux/sysctl.h># w) o$ a# u2 z E: U5 X
- #include <linux/mm.h>
% ~0 ?, W( p; D6 [2 }# ^ - #include <linux/dma-mapping.h>
6 R: F, t# B6 z) K
% A0 X. ], G5 y; |0 O% B* E- #include <mach/memory.h>
) v& A U* d; L5 C: W& k - #include <mach/hardware.h>- @7 w x; Q" d( H7 I+ P! ?4 Z3 N
- #include <mach/irqs.h>1 G& j) n6 V" G$ R
- #include <asm/hardware/edma.h>' t+ v" k0 L+ m) k. { A
X _9 q& ]5 K* t- #undef EDMA3_DEBUG; P( ~( D }4 W6 O; E3 }
- /*#define EDMA3_DEBUG*/
$ q1 o" ~% E$ f3 t" t - " E; C/ J, `6 X& }
- #ifdef EDMA3_DEBUG
1 Z% F# ~8 f& h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 R% h5 ]: }" c- Q: n4 n0 Z2 b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 t7 z! o, I8 g& I: y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ~" U2 W* X6 \7 A) }: E2 f5 d* j9 B) e
- #else: `+ E6 f4 p; |5 w8 v9 Q
- #define DMA_PRINTK( x... )
2 d+ z, C: w1 b2 ?" v0 S# Z - #define DMA_FN_IN, H9 ~1 E3 i* G# c- e: c! a, c9 f
- #define DMA_FN_OUT
& {) d4 q8 i+ E% z# H2 A; z9 c+ f - #endif
1 H4 Y% X& C% N5 ]
) e' H5 `) c6 D r* ~1 y8 C- #define MAX_DMA_TRANSFER_IN_BYTES (32768); ^5 s9 v2 w, V, @/ C
- #define STATIC_SHIFT 3" H2 `' X: b) \; b
- #define TCINTEN_SHIFT 20/ L; ~9 B8 B" |6 }; z4 `2 C# D
- #define ITCINTEN_SHIFT 21: g" J% N i* M3 s3 t4 g
- #define TCCHEN_SHIFT 22 R7 @# \- O+ c) }
- #define ITCCHEN_SHIFT 23' @. M' C( i* y
" d5 ?( M$ `$ M% L. R% x) Y9 ~- static volatile int irqraised1 = 0;8 ~* S% O' j* ?+ P
- static volatile int irqraised2 = 0;
' [/ Z8 Y8 I( X3 r0 d
: H5 i9 k6 q T! Y' e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ T) ~9 b3 C1 A& L3 E! ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, H, J9 q9 @: A4 ]1 [9 n: ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% d1 J- j3 e2 W
- # @9 d+ M! w& [- \. l
- dma_addr_t dmaphyssrc1 = 0;
+ h$ J. ^7 j9 e% t3 _- @$ e/ u - dma_addr_t dmaphyssrc2 = 0;
6 o' Y9 u) f% z - dma_addr_t dmaphysdest1 = 0;2 {- `( |* [( t) t: k M+ A
- dma_addr_t dmaphysdest2 = 0;
1 U: l2 X; M+ ]+ v4 h& M X
1 j. s: P O7 I/ c- char *dmabufsrc1 = NULL;5 j9 ^: l" a2 g# f6 n4 p. Z- k: S8 L
- char *dmabufsrc2 = NULL;
% a* p1 j- r! q4 C - char *dmabufdest1 = NULL;
; j! R+ I* @0 q* L2 F4 ?5 K5 h* c - char *dmabufdest2 = NULL;
5 k+ ]% h( Q: p* p& U
% u7 V5 H K6 ?/ R, b- static int acnt = 512;
( @& u! Q" L& O F( ^9 c8 M - static int bcnt = 8;
0 ~( X8 V' \1 P2 L4 `: v8 t6 ] - static int ccnt = 8;
6 p( w) A G8 H - 8 S# M& } s7 ?2 ` U3 c
- module_param(acnt, int, S_IRUGO);& H+ r. T+ l+ w5 e. F0 G& x
- module_param(bcnt, int, S_IRUGO);! i4 e( d4 ]1 q5 P. z8 b$ `: e
- module_param(ccnt, int, S_IRUGO);
复制代码 # ~' W. ~+ [! x" X+ P$ e
/ i8 ^. M6 C. S; w* ]( n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% K; _9 s% g b; Y1 marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" I) ^7 S7 ~7 W4 Z5 I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( \- |; n8 D& \' f/ p2 ]0 ]$ Z# N+ h9 n
/ B2 |7 b9 I2 H
d; L/ e! L. n$ `% o/ y8 ] |
|