|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) N7 ?8 n* _0 L. b2 T- [code]EDMA sample test application
8 D& V8 p9 T, r0 T - /*
+ S. V9 L. R, @7 v - * edma_test.c1 r; p- J) `3 `8 `' s9 T
- *' Z6 f8 ^, g5 I$ ?; b/ K( Z3 X I: `
- * brief EDMA3 Test Application
6 ^% D/ ^* A7 O8 n5 } - *5 j/ W7 i4 W6 h& B
- * This file contains EDMA3 Test code./ h" N, b ]3 D. M0 F
- *- }! p, f' N" @9 ]3 w3 w1 h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& I* v; _: |+ w: \ S5 `5 i O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 L& P: W7 { @8 k. Y% M( k
- * TO CHANGE.9 A& u1 {, G# m8 }5 W! l/ z8 _
- *1 }' v3 B8 [ h9 |/ c, u" j$ t- S' i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) ^4 U; ^: e4 E! ~' Z - *& o/ K1 D' C, b3 v' C/ ?
- * This program is free software; you can redistribute it and/or" D* O. c$ j3 U" ~" @- m
- * modify it under the terms of the GNU General Public License as
, J/ K* S4 w) k+ y% J+ C- k+ w, { - * published by the Free Software Foundation version 2.- v" f/ s8 |& g: ]
- *
0 d7 s6 w( @! N- R( i/ z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& p; P" y7 ?/ A: }/ L
- * kind, whether express or implied; without even the implied warranty
# d# d1 J3 S. x* @) B3 g# _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. L3 C( Y0 n$ z( F6 ~
- * GNU General Public License for more details.: B% a2 g$ Z& Q8 T+ Y! @1 O" D. R5 x
- */6 U3 w( _+ @- F2 H6 R
: {$ J# A. e" N- #include <linux/module.h>
+ ^( U& _. q# j, g4 E - #include <linux/init.h>' \, O' G) K7 h) G0 }
- #include <linux/errno.h>( }* w6 g7 B/ l$ u
- #include <linux/types.h>% @0 p, T& o% B6 E6 A
- #include <linux/interrupt.h>
2 @7 O4 x, }# a0 Z; d/ {; a: t - #include <asm/io.h>' P$ B9 N1 q( d Y/ H
- #include <linux/moduleparam.h>8 |% ~8 Q+ u8 T7 a \; b) C( [
- #include <linux/sysctl.h>: u- Z9 m$ Y T4 ^
- #include <linux/mm.h>
$ W' s! u* F- }3 z - #include <linux/dma-mapping.h>5 H$ V: u, R3 [$ L. y5 _; Y6 x! Y
C$ |* e- t' y" d( N2 H- #include <mach/memory.h>
I4 v+ m$ ^' p5 B' X4 ] - #include <mach/hardware.h>
n( W6 v( } p - #include <mach/irqs.h>
% Q9 x4 b; c. j+ k- y7 m - #include <asm/hardware/edma.h>
9 [: d; B8 W+ h% X8 K, V
4 ^# h" U3 u" T2 A0 V4 M+ C4 j- #undef EDMA3_DEBUG
/ O V. H3 J) {8 A& _5 F2 y- ?, H - /*#define EDMA3_DEBUG*/
5 H+ _: f% y$ Q j l- A/ e
+ ^- R: m* R2 l2 K# ~/ M- k& y- #ifdef EDMA3_DEBUG5 w8 N) ]2 e/ A7 i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 w( c' I3 g8 Q' o# c4 E) k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) D2 j; M0 G4 R' Z) X* E3 L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 N0 s/ x+ z! z& V( W
- #else" z' y8 j0 Z1 Q. }
- #define DMA_PRINTK( x... )
, _9 D/ Q$ B( x' y( s1 ]$ H - #define DMA_FN_IN! i! ]4 Q! T: z# e; j0 K
- #define DMA_FN_OUT( P4 n) y! X6 D( S* u! B7 h/ N
- #endif& p3 e2 t9 L0 q4 i2 J% r% P
+ z+ t2 L2 V( E) Y8 H# c# y' p4 j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 Z2 `; ]& c1 C7 T
- #define STATIC_SHIFT 34 j# C" E" G Z# Y4 L
- #define TCINTEN_SHIFT 20
$ ~+ {6 g$ g! r- A; u - #define ITCINTEN_SHIFT 21/ g( o" V0 ^( k. [3 ?6 b
- #define TCCHEN_SHIFT 221 p0 Q5 O% ?" P/ C: h: O. ^
- #define ITCCHEN_SHIFT 23) j) \9 P; Z6 [0 |7 e
- {( @3 {) o0 n' n( z; K- static volatile int irqraised1 = 0;
5 r A( {3 N) D% R% m8 [ - static volatile int irqraised2 = 0;
/ ?" [: b4 ?; k/ `
/ H9 q; e* P, ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( |! J0 |; M3 u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- o: c$ C% n* A* i6 r2 C9 O8 w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) u! t5 ?) t5 M; ?$ x
, r4 O4 L8 J) w- q' E- dma_addr_t dmaphyssrc1 = 0;4 v- o0 n8 y9 E" i
- dma_addr_t dmaphyssrc2 = 0;# m8 ?: }" N! Q5 l- L3 q
- dma_addr_t dmaphysdest1 = 0;
! N4 U( O+ O7 ^& E( }( V2 |2 q - dma_addr_t dmaphysdest2 = 0;
: |9 d4 j6 [/ A" d) C: Q' I* Q
) j, r- \7 }" s$ h. M7 B2 G+ n- char *dmabufsrc1 = NULL;
. _$ k% O$ d: b- ~6 S: k - char *dmabufsrc2 = NULL;
; ^2 \7 F/ G; B: a9 a - char *dmabufdest1 = NULL;
) w" _( `0 h, o x - char *dmabufdest2 = NULL;, c5 ~: C- v5 \# t9 L/ r" V) j" K
! O" q6 U8 F+ }9 D. t' y- static int acnt = 512;7 O/ r2 a3 p9 F1 F! T! z
- static int bcnt = 8;
! B* k5 z" C6 G5 z3 D- N0 ` - static int ccnt = 8;% g. o R# h6 x& E1 Q! q" w
8 P1 S0 W1 c4 T: V' m- module_param(acnt, int, S_IRUGO);1 }+ ~5 }7 T3 x
- module_param(bcnt, int, S_IRUGO);0 S. Z- j) ~8 {/ A+ @
- module_param(ccnt, int, S_IRUGO);
复制代码
4 ^6 u$ {/ L2 J5 A/ h/ D+ k9 `" [5 K+ }% G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& K, f; V/ n1 x5 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& H% a1 ?; |1 x8 m1 O6 \: t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ ~2 n+ L# W( p6 x, n( w
" D! m% Z& c" p) y& v$ J
2 Y, L) {: [- g. r# p0 o |
|