|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 L2 G$ a7 w- h9 h* ?& I
- [code]EDMA sample test application: i# P" g3 f4 R- ]- m
- /*
' B7 e9 `- l% N N5 E - * edma_test.c- y7 l# e/ X; S" n2 [8 F1 d/ x! V
- *
! C# H s6 ^2 o. A: k - * brief EDMA3 Test Application0 N" N" [! S% D. X# a
- *
/ u0 B) _2 e+ U - * This file contains EDMA3 Test code.+ U! M) ]0 Q: U/ h. O0 ?% A. A
- *
, w4 A$ I E, v' o3 _1 _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 Y2 g% e* n' p5 a5 n1 } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- M' a; K( [2 v
- * TO CHANGE.
3 F5 |2 s0 ~) ^- U# | p8 B - *' {5 F. U2 F! Q3 z& K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 }! l- S2 I, |* o- _" Z5 m: ?1 _
- *! t: R# H7 |: M* @
- * This program is free software; you can redistribute it and/or1 ^& {% m6 _+ J' ?" i1 h% Z
- * modify it under the terms of the GNU General Public License as3 g, V: N* ]5 d: e$ E
- * published by the Free Software Foundation version 2., [0 A* r3 u& p5 n
- *
4 [4 v1 V9 }) C) \( L% c0 w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 i. ~1 I7 P, W, w0 p! x
- * kind, whether express or implied; without even the implied warranty
0 t- A: o4 v* X5 L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% s& w0 N+ d, t/ Y, s2 u- e
- * GNU General Public License for more details.; @7 _+ H e6 u! d l2 ]
- */
' S0 }( Y E {0 u7 H' q, }
! v i; w3 D! q( i. _- #include <linux/module.h>
0 ~- Z6 g; T/ ~4 O! R - #include <linux/init.h>6 i/ s, q) Q& v, i; g6 d( y4 _
- #include <linux/errno.h>
) y* \, h' _9 o0 u# _ - #include <linux/types.h>
+ P2 N, t1 V, X. p( p2 a - #include <linux/interrupt.h>
& Z5 J6 [0 u h0 b! O$ V( A( q' N - #include <asm/io.h>2 [# _( P- h7 w8 J" t
- #include <linux/moduleparam.h>
W7 ^9 w. }9 k S. { - #include <linux/sysctl.h>
' T7 w s. e. I3 d6 M5 H - #include <linux/mm.h>
) x$ m4 y4 a9 c2 G- j - #include <linux/dma-mapping.h>
- v+ T3 i5 F% V0 l! N - 3 K J) G8 q6 R4 `3 w& ?' h
- #include <mach/memory.h>( a$ L" H6 @8 N; g+ \
- #include <mach/hardware.h>2 g/ f' t* t% a
- #include <mach/irqs.h>$ h" x8 H1 B3 B. e
- #include <asm/hardware/edma.h>. H" e/ X' x) o7 z7 v, T$ r, ?
|) W& x: p; Z' q! M" E- #undef EDMA3_DEBUG' e+ ?4 T: L7 c
- /*#define EDMA3_DEBUG*/
7 j& n- f P6 y
* Z) }/ v- I z, @5 @! m+ I7 I( W- #ifdef EDMA3_DEBUG" I/ E: z/ c. ~. } S/ U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): O9 C2 R4 X: B/ N9 {
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 O9 G$ G; f; v7 K4 m2 g6 f4 a. t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* x+ i$ _3 o" q* O, ?
- #else
4 K0 U4 {3 V* J/ d, L6 R - #define DMA_PRINTK( x... )
0 m$ P* \8 Z- V8 B - #define DMA_FN_IN
+ H/ I/ r" i1 }) g" n o' ` - #define DMA_FN_OUT
* |9 R' z6 u6 c - #endif( q1 X: ^. _$ K1 b
& \" P( A: W+ h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, e( n: O7 k6 N1 U% K1 ?5 T - #define STATIC_SHIFT 3
$ D+ B; E, E2 `2 {" w* G - #define TCINTEN_SHIFT 202 z% y& r3 C$ f2 G
- #define ITCINTEN_SHIFT 213 J. Z$ R+ N0 F6 ?
- #define TCCHEN_SHIFT 22! w+ c3 W- N& R" P- [" i
- #define ITCCHEN_SHIFT 23
% B* G1 ]3 {, Q4 P1 V5 s1 T - 3 i& C1 m; P5 L: Z+ y$ ^
- static volatile int irqraised1 = 0;3 R+ ?. R- n/ M
- static volatile int irqraised2 = 0;
/ V" ]1 t1 N9 F
' E$ N# O \+ D/ u1 }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 A4 g, O/ B" M. d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' E. T. H2 c0 V s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, o# j% S' c: l! C/ @. n( c. Q# E
$ ?; d, a" Y# c: t& U. y6 S( O- dma_addr_t dmaphyssrc1 = 0;1 [9 e/ Z. d; O3 x7 X
- dma_addr_t dmaphyssrc2 = 0;+ J7 w0 B# c" a4 m' a# E! _" w
- dma_addr_t dmaphysdest1 = 0;4 z. J1 _: q4 X' r0 L, b7 |- S
- dma_addr_t dmaphysdest2 = 0;
9 _5 v. Z2 T0 s. P8 d* V# V - 7 a: f& `, _! M- t3 N/ h
- char *dmabufsrc1 = NULL;. H: l7 [2 W& U& h+ h& n( e7 b
- char *dmabufsrc2 = NULL;8 w* g7 r7 R6 P2 b2 f) v+ d
- char *dmabufdest1 = NULL;. x. C/ L. E9 v# V
- char *dmabufdest2 = NULL;' t& Y9 H; X8 ]( s. U9 B
+ V0 e: |2 B& o {8 V- static int acnt = 512;
( d# u' s( [8 P1 w; T6 R - static int bcnt = 8;0 ~9 u7 ^# l. w( ]' _. W3 E
- static int ccnt = 8;0 r7 C5 E) h# H# `/ |5 N) C7 `+ m
X& z! s5 ]9 w5 J! R0 y- module_param(acnt, int, S_IRUGO);9 }3 K7 [4 S/ \5 ? C7 |' N& a
- module_param(bcnt, int, S_IRUGO);3 K. }! N6 i6 }" v+ C' \; E
- module_param(ccnt, int, S_IRUGO);
复制代码 ( y Z2 S& U1 S3 Q: y& g
0 m# W5 }% x" u; q/ C0 Q i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* K6 x# m0 p4 s. B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' M0 y8 O3 {4 L& ]/ Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ E. ?( H! _* Y% ~" m$ G5 q
$ `4 k, B9 |6 x3 U' P/ e6 d
' n6 ?5 S3 g0 _6 o2 N/ D9 C
|
|