|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% h* G7 c8 M. v4 `0 {4 U [' M- [code]EDMA sample test application& G; A9 K4 B0 Y9 I f
- /*
3 P( G+ U" Z7 p+ o - * edma_test.c: B) B+ B2 t4 k7 ]5 i+ [& O, G
- *
9 y; G6 _. n R/ S. M, _, ^4 h - * brief EDMA3 Test Application
/ l9 v$ k7 Y: c8 _0 ^# C - *
1 d# B! x0 r' ?5 }( y - * This file contains EDMA3 Test code.
$ X2 J/ F% e0 X- e- a - *( k! ~2 E6 ~/ P' o2 P: S1 o2 l. p; x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; ]1 v) T: z4 k6 z! Y' ~8 g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* y3 e1 d/ e" ^3 X8 j o9 P - * TO CHANGE.
9 O- t7 }0 M5 g9 | - *
7 R8 f9 ~8 R) W( W% @1 g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 t/ |" h! `- _4 b - *
6 h i: \4 S. F* x e! f, @ - * This program is free software; you can redistribute it and/or
, s* i1 P5 ~+ f/ m+ t - * modify it under the terms of the GNU General Public License as
; v; e. O' r/ q; P+ [ - * published by the Free Software Foundation version 2.
& _! \! ?1 h4 ?$ B - ** o$ s8 [2 |: R/ [* A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' D. K2 H7 @$ u' x4 z - * kind, whether express or implied; without even the implied warranty- B$ W& l& x- }, h; b* E0 R" H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# k3 `) p$ u+ r) U0 }$ M - * GNU General Public License for more details.$ J! |$ I' B) l
- */; F! Z2 u3 s3 t: [- F2 A" C
* e4 C h0 e# j. ~% k0 \3 Y2 _- #include <linux/module.h>
- e1 L8 ]6 j4 i2 d+ e' p - #include <linux/init.h>0 }# I9 J0 F5 q6 N' E
- #include <linux/errno.h>+ r- E% G# X. {8 B$ I: }0 z& n2 q
- #include <linux/types.h>
6 U& b- W; m) ?) S& n. A: q# D4 Z7 v1 n - #include <linux/interrupt.h>7 H, I# l5 h4 y% z
- #include <asm/io.h>
+ r9 k+ E2 B j9 P# V8 E7 n* i1 X - #include <linux/moduleparam.h>
7 f0 e+ P7 c/ G; v - #include <linux/sysctl.h>
8 m; Z1 N$ Y4 |, y! ~: v& H - #include <linux/mm.h>6 ?) z, N7 Q/ c' b4 X+ _# d1 D
- #include <linux/dma-mapping.h>
5 X; a7 A3 E1 _, E0 p
' Y9 s3 Q! t! j+ b/ T: P5 h- #include <mach/memory.h>
- I" W- ?( x9 | - #include <mach/hardware.h>
) m9 H) b, |, |, g% H; Z4 ^3 Z. ? - #include <mach/irqs.h>
3 G0 l- V' G' i - #include <asm/hardware/edma.h>0 w% \* w9 Z" [ J) z! U, m1 b
- $ ]/ M) Q7 R# g6 j/ }: j0 v/ @! k
- #undef EDMA3_DEBUG, c8 r0 |" y9 k$ |2 W
- /*#define EDMA3_DEBUG*/
0 f+ T$ m- f x) c: A' D
1 O0 I9 i, }) a' e- #ifdef EDMA3_DEBUG
* R y9 @6 j5 q7 G* M" t; | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): O% t* b% t! a) I' b1 o+ l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( H' f3 E I4 M7 R6 y) M$ z* {+ g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 |& C; Y: }; h/ E8 u3 h- v - #else1 G5 ~- I% h: M2 k
- #define DMA_PRINTK( x... )
f" _# [/ I, U6 P! o - #define DMA_FN_IN
! i. Q* ]+ G( [1 W) s' m9 P2 ` - #define DMA_FN_OUT
7 ~% o+ }) O" E5 l - #endif6 H) ~5 M6 n. g; Q; _% v& \
1 j( m. x5 ^2 O& m3 J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ U0 Z( P( E* v0 b! o; M
- #define STATIC_SHIFT 3+ o, s' D, c8 C: t
- #define TCINTEN_SHIFT 20
- [. Q/ W. [3 e. Y/ c - #define ITCINTEN_SHIFT 21
% k* Z7 K+ ]* r0 p5 a - #define TCCHEN_SHIFT 22
6 B3 E: S0 H# c4 J6 I, a - #define ITCCHEN_SHIFT 23
0 T9 ^8 ^) r, [3 f+ s: N
; B1 N1 \% ]0 w/ p- static volatile int irqraised1 = 0;1 ^4 A5 Q$ @" e+ i( _- w1 _' L
- static volatile int irqraised2 = 0;
1 K7 s$ A& C( b& A& W% ` - 3 K R4 |3 X7 Z; A! Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ z. g! ^3 q" r# c! w( c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 n( h I, m- c" l/ h* y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* f, {- o% U! B6 Q6 `6 o - 5 E8 {$ d1 r9 J7 I% {6 ~1 m& |+ l& v
- dma_addr_t dmaphyssrc1 = 0;! t2 ~/ V9 o- K) k9 X
- dma_addr_t dmaphyssrc2 = 0;
7 g: ?) y5 s* S - dma_addr_t dmaphysdest1 = 0;4 v/ g- w# D( b+ ^. d& J
- dma_addr_t dmaphysdest2 = 0;' b8 C6 d% L- G
- & q0 x/ d/ h+ C" m q7 o
- char *dmabufsrc1 = NULL;
- v" n1 q: y: z; a- P1 \ - char *dmabufsrc2 = NULL;. I, D7 A8 ]+ k2 c$ [$ V
- char *dmabufdest1 = NULL;* B" i9 N, J4 a0 Q% O; N+ g
- char *dmabufdest2 = NULL;' S% o# r2 C8 K
" k1 w2 i5 w9 O3 h) u( H: g- static int acnt = 512;$ V2 H( X# O4 `
- static int bcnt = 8;! ^3 `- k9 {& d. z i0 W
- static int ccnt = 8;
. d ]! q/ i/ C
% F3 `* J* h7 ^+ s! D' y- module_param(acnt, int, S_IRUGO);
- b8 }+ n, Q# j3 V: q - module_param(bcnt, int, S_IRUGO);# l( ?( x. x& Q) N5 H+ `
- module_param(ccnt, int, S_IRUGO);
复制代码
6 Y8 _0 n( I* M1 {$ s+ T0 _
' U" I5 o* I- E3 E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ U, l3 J3 i' l
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 @' O* c: [+ {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. L! u: R H5 |7 {2 g& o' T2 R. u5 }2 p5 E$ g
l+ a4 o9 V( g0 l; ]9 v' }2 A
|
|