|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( L8 z1 I- C7 h6 D6 M- [code]EDMA sample test application( w9 B' b, C q: v6 I
- /*6 f. ?. y1 J( y$ p$ Q. C( R
- * edma_test.c
# I7 H( H e8 U! `6 G" Q - ** g6 i& `! K3 e
- * brief EDMA3 Test Application' z' |; A5 L. n" q2 z+ d! b- R6 M; D
- *) G7 s! B# f% R: a6 A3 T
- * This file contains EDMA3 Test code.* g3 V8 H0 |) c4 v
- *5 s- }: s0 y5 n$ B Y p: f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ Q9 S; n2 R) @3 ^3 {; o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. y2 H6 k% N) P" G2 J7 g# B$ h* b0 d - * TO CHANGE.
8 A# g0 v6 _4 M# g) r - *+ ]5 [4 T9 m6 `* [# m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" a* _) N; T/ x% A. ~ - *
& T w/ s7 c2 L0 S - * This program is free software; you can redistribute it and/or2 O2 |) }: w3 l
- * modify it under the terms of the GNU General Public License as6 W, T0 |& U/ |. ]1 Q Y0 P
- * published by the Free Software Foundation version 2.
" {5 x; I! i" \7 F - *
0 M) F% Y8 w" }; s8 v3 { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; b g, r- l; x: y3 f
- * kind, whether express or implied; without even the implied warranty2 x e# {6 \4 I& \/ c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 H6 J0 k" O3 [, r# c+ P# g
- * GNU General Public License for more details.: ^, p) n; Q+ |; ]! n+ s% f
- */
1 ?2 h! a) ^) C* u7 u% t. [0 z d
1 P+ b* s0 \% g5 A/ _- #include <linux/module.h>
- m4 n b( G% P) j u% Y) d - #include <linux/init.h>
$ e" N) E7 ]% } h) g4 v0 N$ t - #include <linux/errno.h>
+ A7 G/ Y7 R6 y- ?) s6 Z& k# S - #include <linux/types.h>, h# u' U; Z7 P
- #include <linux/interrupt.h>% n5 l% B/ F- }' O& [; R
- #include <asm/io.h>
# y1 x4 \' d4 F- o$ s$ x - #include <linux/moduleparam.h>
+ r9 Z6 I: ?$ P8 A - #include <linux/sysctl.h>
9 g6 C- T" r: I - #include <linux/mm.h>
5 I7 c* \; X( Z - #include <linux/dma-mapping.h>
) |9 b% j; z, M) e7 k - : p/ J/ |9 j& Z, r x" d* K: A
- #include <mach/memory.h>
( F* U! y. U$ h# ~ - #include <mach/hardware.h>5 t9 {5 K8 |, }3 `& r5 E
- #include <mach/irqs.h>
5 C0 h0 _0 ~' p+ |1 J- M( }( i n - #include <asm/hardware/edma.h>& L& ?$ E9 z8 {. m1 j! T
- : t0 U4 b+ F% \* n7 D/ n* [2 M2 [
- #undef EDMA3_DEBUG
: Y5 Z% {' P2 ] - /*#define EDMA3_DEBUG*/8 b% ?, |: T3 B9 `) M" H
- / g! o7 y& }; ~9 ?0 Z' W2 E% f
- #ifdef EDMA3_DEBUG
7 A; Q! p2 `3 ~2 W8 `) @7 j2 E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): U( e. c5 @3 Y- J9 G9 Z2 g" z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), s# ~. p+ R7 X- C8 {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 C8 H9 H0 ~0 a( s - #else
7 ]+ t8 M4 K5 ^1 S0 l& o - #define DMA_PRINTK( x... )/ ]0 t1 }3 L+ [( {6 V1 j
- #define DMA_FN_IN4 _* r$ g q7 w7 ]
- #define DMA_FN_OUT) }4 k/ [* d7 s
- #endif1 k8 B! p7 p& I
- & O u; Z2 A1 Z; s! r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ Y" u: d" I' ]
- #define STATIC_SHIFT 3
- S! ]0 E! v+ v& X - #define TCINTEN_SHIFT 20
6 n8 Y. q4 P% p, k% \, T% J* t - #define ITCINTEN_SHIFT 21( f- d) q4 T1 i" W" m5 N" ?
- #define TCCHEN_SHIFT 226 v5 J% }) Z4 N5 j
- #define ITCCHEN_SHIFT 23$ h# x- R6 W; U# r5 y
% V7 T; a- L$ x7 A! B0 V# Y- static volatile int irqraised1 = 0;
! [7 @, A. Y; Q9 i. B4 t: {; {/ g5 {( k - static volatile int irqraised2 = 0;4 V( r, u1 `) c. u
- / j2 L- M1 G& `2 w5 N$ g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; `; v! w; H" O1 n' s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 f2 x8 m1 @% A5 J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' ]) ~) o, [/ c1 U. |4 S2 x( O" r' b
& p) j( R0 x+ E3 v- dma_addr_t dmaphyssrc1 = 0;
- B9 u( c0 c/ C3 r6 c0 |. b: b- L - dma_addr_t dmaphyssrc2 = 0;2 G& ]7 T: I- ?' X5 Q% t
- dma_addr_t dmaphysdest1 = 0;
$ |' b K' u% m5 f q - dma_addr_t dmaphysdest2 = 0;
: x5 _, Q! Z% m3 H0 D" W+ L
, d4 |( @" [9 p; x8 S8 l9 I- char *dmabufsrc1 = NULL;- O" k- ?) |- H6 M
- char *dmabufsrc2 = NULL;4 P. T3 y0 a3 y9 G$ y, o3 g# z
- char *dmabufdest1 = NULL;# G. w. `" ]. e6 h7 q/ J( H
- char *dmabufdest2 = NULL;& i; J5 c/ e: S3 I3 H
" i) A8 z/ p: a* i& j6 }- static int acnt = 512;
) c4 k2 S# x+ M8 ]+ S5 U - static int bcnt = 8;* J) o8 v/ W( r3 E' K- |1 a
- static int ccnt = 8;
1 u' n# L1 S$ ~* |4 C
1 Z x: b2 Y/ c- module_param(acnt, int, S_IRUGO);
; _2 ^* A4 F8 m4 o) K! v - module_param(bcnt, int, S_IRUGO);1 c1 D+ C: `* R4 T
- module_param(ccnt, int, S_IRUGO);
复制代码 3 P$ k! c+ {1 Z1 U4 m, n; C: A8 t
1 Q* i+ c% l/ s! Z! z# ^( h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" G9 ^: j D, @9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 ~! \* G0 n9 D! r/ `/ g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ b' V+ n7 T ~* f3 w; i
* l) T5 d4 t! H
* e+ S& p8 L( [* m/ }; m& k |
|