|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) q3 F9 o% [. D/ u
- [code]EDMA sample test application
" C8 c+ [0 v1 D7 O - /*
! l* r) O+ M- y% e# S, Q( Z i8 u( p - * edma_test.c
: E& v3 o$ C. X% O/ c% C% _! i - ** v8 S- F' U+ P# P- @7 y
- * brief EDMA3 Test Application% _2 k( z3 K- J
- *& W5 w* g: Z: X+ l
- * This file contains EDMA3 Test code.$ V6 }7 e: q$ O
- *
& J {0 h9 L+ P - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; Z: l* Q H5 o+ _" v* c( D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( Z; b" W1 ~# z! U7 g: Q) W
- * TO CHANGE. \/ y# b/ G, t7 Y- t x' J( R
- *
2 i" Y9 W2 E6 B. y. B+ Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, J7 |4 ?7 O$ `+ T7 U - *# S; T4 O/ f0 \5 P% u! z
- * This program is free software; you can redistribute it and/or$ v9 k- e2 u' O/ j4 C( i
- * modify it under the terms of the GNU General Public License as- V6 T1 k. X4 q) G p2 b& d7 G% }
- * published by the Free Software Foundation version 2.7 b) i5 ?+ X9 Z0 }
- *
# Y+ z7 O8 k9 j5 o1 [+ d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! V7 S9 Q7 z) h1 z. @* k4 D _ - * kind, whether express or implied; without even the implied warranty
" ~1 U+ F4 q" r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& {! e7 y9 n1 t. U1 L
- * GNU General Public License for more details./ p% C6 @) s9 w- i4 _0 d2 R5 s
- */
( L" H4 q* r$ T! g" A
6 T* L" n( Q4 K. h$ v3 U7 a- #include <linux/module.h>% K7 i% ~3 z Y$ H: E
- #include <linux/init.h>
Z4 r4 ]5 [9 y6 ^' [ - #include <linux/errno.h>
+ s! ?" N. T2 e5 _7 `# j, [ - #include <linux/types.h>
a z$ C: i! p+ f' H - #include <linux/interrupt.h>
% F2 U A4 L* p3 S1 t7 T7 {2 Q - #include <asm/io.h>
+ T% z7 c6 W% b% k3 { - #include <linux/moduleparam.h>9 L. v4 s; Q( o( A3 O/ U
- #include <linux/sysctl.h>/ M! c8 P W7 C' z! Q1 o& N
- #include <linux/mm.h>
$ w3 V$ Z& S( Q- [ - #include <linux/dma-mapping.h>
/ B& }5 P) y) ~) q! M2 G& Y ] - 4 i: K) J: z) y# v9 P; e
- #include <mach/memory.h>$ b/ X4 O0 `- r* F
- #include <mach/hardware.h>- } @/ r3 z! {+ ? B
- #include <mach/irqs.h>; B8 ~7 l& c2 N( u
- #include <asm/hardware/edma.h>) p/ c: |$ x9 C$ G. o; s9 `* b
4 c; S" M. ~: b( M. o6 @- #undef EDMA3_DEBUG
. a9 {8 A& c0 G2 c$ R0 |# g - /*#define EDMA3_DEBUG*/0 _1 D8 v* m4 m3 _. J, Q
- , K, N O+ _* ~6 W/ [6 C
- #ifdef EDMA3_DEBUG4 E6 B% f' v0 J F- a, D6 u! ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! j9 f) p6 s: _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% Y8 `" O% V9 |" _( e( g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 ], W |, w8 f0 Q - #else% | c, |* f+ d7 {9 f
- #define DMA_PRINTK( x... )
" ^- g1 r. n' E1 X - #define DMA_FN_IN
: ~7 s, P/ f% U4 b1 t& G - #define DMA_FN_OUT
* J& N& O. Q, H" B: t8 X - #endif
3 T/ E2 p+ |4 F5 A5 ~& z) @
$ i$ V% C# C* U( W% ?+ ^9 ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 n% D) `+ t' s! Z3 I! x( c - #define STATIC_SHIFT 3
, [; a. I3 j/ v) o - #define TCINTEN_SHIFT 209 x4 m! W( {" O$ N
- #define ITCINTEN_SHIFT 21
9 k9 z7 Q5 y, Z f; p- y6 B - #define TCCHEN_SHIFT 22
4 Y: P- a1 k T8 z - #define ITCCHEN_SHIFT 23" T3 ?# O' _4 K) N |8 F) l
( j. n0 s; f1 {: e3 ]; ~- static volatile int irqraised1 = 0;7 P" x/ v. G( \5 T& l) B4 {& n
- static volatile int irqraised2 = 0;
P& x9 V7 i9 Q8 L - & C; C' i# o1 R& @9 \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 L# ?2 ^5 k( w' }9 L4 w4 I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! C2 Z2 E: h- ~0 A E4 K: B- u
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, s: K: g% b. X7 U- u' w3 t
- 9 `* @- U0 Y) L9 \7 p8 G; s; h: j
- dma_addr_t dmaphyssrc1 = 0;- i6 p3 ~% Z$ T
- dma_addr_t dmaphyssrc2 = 0;
3 t% i9 D- j4 R$ Q/ _ - dma_addr_t dmaphysdest1 = 0;7 D7 z! k8 f# X: K8 ~
- dma_addr_t dmaphysdest2 = 0;
! j) h6 I+ K/ l0 Q
: d: t6 c) r* F- l+ d- char *dmabufsrc1 = NULL;# Q- q" P) I% [/ V4 e/ \3 C
- char *dmabufsrc2 = NULL;
% N& w4 W0 S5 T0 G3 d5 i - char *dmabufdest1 = NULL;# \: `; |( p) u) J" N, B% P
- char *dmabufdest2 = NULL;
, M/ E: r0 K9 q$ W2 Y6 Q - 7 i. Q. r/ w9 X7 T/ t# Z1 g# J# C: Y
- static int acnt = 512;
5 f! [0 w# X: }: c" \8 C- F( b - static int bcnt = 8;* s- I: P- ?- r+ V- O; ^" J
- static int ccnt = 8;
! b: v5 z7 U% [/ z2 d. Q9 Z7 r
` U* p% G; \# C8 H- module_param(acnt, int, S_IRUGO);) x5 ~: U. @( K9 |8 }& A
- module_param(bcnt, int, S_IRUGO);
8 A( O! _* ]6 u5 h) c - module_param(ccnt, int, S_IRUGO);
复制代码 ' t/ w) p% [2 h
; A+ o4 c* k5 O2 ?) N: B, L' P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 K0 h. f: X4 a; z h4 g2 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; o, `- n7 f! {( p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& B2 p- j$ Z- q# b, Z: X1 p1 B$ h9 ~2 D, T/ \1 X( F, n J
$ }5 |) W( o/ E |
|