|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % f: {& Z; R* [7 }6 `! E d: H
- [code]EDMA sample test application
" s. H8 L) A; v Y4 y - /*
" ]8 K9 U- T7 {1 f - * edma_test.c
7 k) `# ]+ ?! Y1 N& [2 B - *+ u8 D9 Z. O( N2 l/ n2 K
- * brief EDMA3 Test Application7 s: a P! y3 T3 T
- *4 u U, @& t" C9 R& B! h/ R5 Q8 g$ h
- * This file contains EDMA3 Test code., F; U& W" c2 S& f8 ?& H0 N
- *
! E0 y( ^! `9 Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 b7 j7 o- _$ |" c e% ?$ X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 ]- P U: @/ w7 ]" |
- * TO CHANGE.& j8 \2 H" w$ @; }4 U8 T
- *
5 F1 x* }4 D9 N# S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 X X4 h( t9 D - *7 k& }9 t2 B: {/ g$ r6 F. X6 t
- * This program is free software; you can redistribute it and/or$ T0 E$ v q8 v) ]6 d+ x+ A/ ^1 i
- * modify it under the terms of the GNU General Public License as1 K. G- b2 U- B- d/ S
- * published by the Free Software Foundation version 2.) J+ c, X* Q# u9 E4 q% G
- *% o3 }3 P( F& _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# Y9 |, U1 K7 s0 T Z% P' V - * kind, whether express or implied; without even the implied warranty
/ O: d+ A9 [9 P" Z9 b0 C( Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) U0 C8 U( W2 { g* `# _ - * GNU General Public License for more details.
$ b+ O/ ]2 K5 X8 j# b: y4 U! Y) k - */
\ I! ], ]8 C( v
6 i- ]9 l, x y- K& B- #include <linux/module.h>
+ o7 Y. x) W! W# m" p% k - #include <linux/init.h>' d/ n6 C5 `0 u9 L' {8 ~
- #include <linux/errno.h>1 Y5 M( Z. T4 j2 i& Q
- #include <linux/types.h>4 b4 D( x$ J. Z0 w- S+ Y
- #include <linux/interrupt.h>
1 h) y. U v* `9 B+ C7 {; h - #include <asm/io.h>. u0 |) G7 Z" k
- #include <linux/moduleparam.h>
* u+ x) y" r, ]: q# P - #include <linux/sysctl.h>
. [+ H# ]! E+ `! W - #include <linux/mm.h>
, ^) C: i! u _! X( r9 E - #include <linux/dma-mapping.h>+ M1 l9 D1 X' V2 W* N l7 {% ]
2 _- B* ?1 M) Y, y! {+ B- a; ?2 H- #include <mach/memory.h>( J* t A) n+ f f% f
- #include <mach/hardware.h>
* h4 a( j' b; w: v: Z; p - #include <mach/irqs.h>
5 m& L+ S& K& v: a - #include <asm/hardware/edma.h>
6 A q) ~) v7 F+ F8 l; E# f* } - 5 h7 s9 f b7 D# x' O8 w% W/ g
- #undef EDMA3_DEBUG
+ v! [( h$ `, f+ s1 E - /*#define EDMA3_DEBUG*/0 e, w5 o- S: o9 y+ B+ Q
- : W/ s7 ?' [- u7 z1 c, c9 _
- #ifdef EDMA3_DEBUG4 _2 P' l, `5 u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' c+ B' x8 T6 e9 k1 j0 ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 c" N9 G1 s$ w+ a) W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! S) F; [9 m( B! f, X- x/ |
- #else
, U' }% K& u) f) K - #define DMA_PRINTK( x... )+ e, j3 F8 h: r7 ^
- #define DMA_FN_IN
`, |/ o7 t: t7 d1 P( @" `" l - #define DMA_FN_OUT5 Z: ]% p/ w' ?& h
- #endif
" k, u- L) K! ?
' U2 h4 ], P' L+ i" @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ B) Z1 {+ g& ^# ^6 p# h9 g. Z* I u
- #define STATIC_SHIFT 3$ a' a6 O1 [3 k' b; J; a4 s: \
- #define TCINTEN_SHIFT 20
: Y! e4 l; q4 j8 _* ` - #define ITCINTEN_SHIFT 21
7 j/ K$ Y: u1 R: d& n - #define TCCHEN_SHIFT 22
+ d7 C4 @. E) t/ ~$ L/ k) K - #define ITCCHEN_SHIFT 23
- ^( M7 h; ?" s3 r) l$ m - : m2 V1 |6 w8 B0 k2 T& F5 Y
- static volatile int irqraised1 = 0;: _) C* O8 P9 Z7 L# P: Q
- static volatile int irqraised2 = 0;
1 J" F) r7 X# O* b - p& L1 K; }0 f$ u4 A2 @ ^" G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ L! ~0 C: S2 `3 J" ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( n5 ^7 i' L# j& v. f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 H/ j8 L# k; [0 i+ x4 k8 X3 K; c3 v
- * F0 @1 g- c5 ~' u! Q# F" Q
- dma_addr_t dmaphyssrc1 = 0; i+ ^$ N$ ~8 G( ~
- dma_addr_t dmaphyssrc2 = 0;+ t4 ?: A3 D& c9 h4 c6 s' p" j
- dma_addr_t dmaphysdest1 = 0;
1 Z- q0 i- E5 @6 {/ G2 ?! M/ {* K- o - dma_addr_t dmaphysdest2 = 0;6 r- ^' P: R1 a& O& b' Z) _
# c1 ]1 ?. [2 ]& C) a. p2 V- char *dmabufsrc1 = NULL;3 a8 W6 Z; c$ a" k# [/ J& J8 n$ w
- char *dmabufsrc2 = NULL;
/ `! n9 m3 v& m$ {# H$ G - char *dmabufdest1 = NULL;
. N+ m9 H) B. f+ l - char *dmabufdest2 = NULL;/ f! g, _* c1 g
- % z" W7 {; P3 j& a) q0 K
- static int acnt = 512;
! I& l" f7 a. z" n7 S - static int bcnt = 8;
2 n6 j3 C9 b7 B4 \" | - static int ccnt = 8;) P$ @/ D/ ?' f
. P0 z$ i3 ]6 W* Z+ ]: z+ V- module_param(acnt, int, S_IRUGO);0 L+ S1 V6 _* t5 C7 N% }. U e
- module_param(bcnt, int, S_IRUGO);
9 ~$ L# [2 g8 @5 Z+ Q; Q6 Q/ p - module_param(ccnt, int, S_IRUGO);
复制代码 9 L. J) O* C/ [4 z! ^2 C- P9 W
: j4 I, v; b; j" b: V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: B) ^0 }* j" c. W+ ~" P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; c3 c2 X: V1 v) |! k% E: c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) T$ B! V# ^# b% X) U+ y& P# k( v7 t
$ R/ f6 T3 ~3 m$ I0 W! \- i) i |
|