|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" E) x: @6 p7 ]; n- [code]EDMA sample test application0 e& f6 ?. Z+ ^8 y! m, n5 Z
- /*- m+ K7 H7 @/ F# [* X
- * edma_test.c
, `. Y+ T* }! T: N3 H - *
8 x- n7 F: }, E$ a - * brief EDMA3 Test Application
" ]4 @( J: |2 A/ \# z1 b; b - *) k1 e) ~) H. e
- * This file contains EDMA3 Test code.5 M2 N( _; m4 @
- *0 l; e" \! C- D' O; @. G. T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ Q9 T: A1 T) W: x, K% |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 ]6 Q& v8 K G4 p d5 U - * TO CHANGE.
7 Y8 Y5 O& g5 } A/ A2 f - *2 t: ^* P$ k6 Q, @& [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. j: |4 a* k& }/ V - *
% F' ~# V% M0 m6 Y9 ]' M - * This program is free software; you can redistribute it and/or
0 G( o3 l0 G3 X/ x% u$ W - * modify it under the terms of the GNU General Public License as o& y; ~1 U; ^4 @
- * published by the Free Software Foundation version 2.- ~" r: {! v- b% Z+ u5 j5 L& p5 o
- *
, e' m! \8 Y+ n# h1 y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ w* l' w; g& Q
- * kind, whether express or implied; without even the implied warranty
" ]' z. d/ K& R: V- l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* b, k$ e5 q$ ]' g2 P) r) h - * GNU General Public License for more details.5 I2 N+ s4 Y s8 W4 H7 F0 M; t) K4 [; q
- */2 d$ U6 U4 g8 a- s* ]8 M1 y+ W
- & P' [% |% ?5 K% \, F: L$ |' z3 R
- #include <linux/module.h>" g, n, T* y6 P$ R4 N/ b
- #include <linux/init.h>9 f$ V4 y2 H& M b, O
- #include <linux/errno.h>
/ }3 [! x7 A! W; p; B" ~ - #include <linux/types.h>' L3 O0 C4 f" Z9 K' r
- #include <linux/interrupt.h>
v- R5 d5 s6 P: J5 j0 N: r2 [ - #include <asm/io.h>
+ z! Q. a! L; k" ?0 r; U7 O$ ^7 C/ R - #include <linux/moduleparam.h>
: I; |0 X! K' g - #include <linux/sysctl.h>
. T! A- b( D6 y - #include <linux/mm.h>
5 L" R6 S* e2 j- J% |$ Z: b3 N0 f! @ - #include <linux/dma-mapping.h>% ?0 Y/ _9 d& O% _
- 4 Z4 o4 ^0 N* N
- #include <mach/memory.h>$ w4 ]/ F! |: z5 [; J
- #include <mach/hardware.h>
/ Q7 E/ W8 P6 v0 i - #include <mach/irqs.h>
0 Y: ^+ h% w1 L - #include <asm/hardware/edma.h>, r* F* R# X Y% y) z% U
- " Z7 e8 p6 w# U' O) Q# a1 c6 n
- #undef EDMA3_DEBUG
# X# D" M& p# L/ o9 R- C - /*#define EDMA3_DEBUG*/5 n6 L v* n Z5 T
- 1 ^. }/ l% @+ Z+ R$ g( k
- #ifdef EDMA3_DEBUG( A2 Y7 @3 v% B$ X& y @1 B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 v; Q# r6 k% z2 e5 ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# {% l) i8 T' S* U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
M4 k& J4 b" p' P1 s; B! y3 L - #else
3 n3 S/ N C8 m7 F" d9 u - #define DMA_PRINTK( x... )
6 n/ u2 J% j$ v3 ?! w9 s, }% D* G4 a - #define DMA_FN_IN7 o! D: p' j X5 A2 @
- #define DMA_FN_OUT4 d" S# I' U8 R& ~- n3 h1 L4 ~" G
- #endif* d3 U4 W" L3 ?" ~+ P( |+ A7 n) m
- 5 H' P) ~; C/ j! R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% K% Q* O: d8 ^3 } - #define STATIC_SHIFT 32 l8 p% |3 d( Y; X8 X3 _
- #define TCINTEN_SHIFT 20
( [" O. B% d4 @" h - #define ITCINTEN_SHIFT 21
% X0 j _& o& u5 I& r; c7 q - #define TCCHEN_SHIFT 22
) i+ K: W7 Z; H6 d: d1 z* s! Q9 r - #define ITCCHEN_SHIFT 23
+ h- ~$ Q' P% Y a. n/ p: J/ C
, a, d% S% C( o- static volatile int irqraised1 = 0;" _6 Y9 e: n& _9 z: b# J
- static volatile int irqraised2 = 0;
: \9 {, g- B @& B/ I( {: y - . {" E" q' ~5 c! \. [; R$ ?
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); {! J8 Q8 x" p9 o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' X$ J8 A* m- B9 J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; x& m* ^* ], e7 m
/ N) `% i/ c/ I _- dma_addr_t dmaphyssrc1 = 0;
. D2 x w; p) G# B, q - dma_addr_t dmaphyssrc2 = 0;8 F7 `' a9 P1 G
- dma_addr_t dmaphysdest1 = 0;
( n8 o- i* Q8 j% k - dma_addr_t dmaphysdest2 = 0;
' |9 W. Y! I( N' T; n4 d T ^ - : `& l% H* f+ U
- char *dmabufsrc1 = NULL;0 u$ v1 N5 d* C/ W
- char *dmabufsrc2 = NULL;
' k& v8 G, L8 k! H% M# N1 R; S - char *dmabufdest1 = NULL;! C7 j; Y' G6 T9 |% R' o
- char *dmabufdest2 = NULL;! c+ T2 S% g8 Q5 n/ `! [0 Y) x( k
8 l8 |; e7 Z2 \; v- static int acnt = 512;
% W% _; D8 Y) J* h - static int bcnt = 8;
5 R3 s3 `/ Z* R2 L - static int ccnt = 8;& Q6 ~) a) D {/ S, ] E
) `" w+ D4 j0 c7 W3 m; L0 b- module_param(acnt, int, S_IRUGO);
) g, `) [6 e3 w - module_param(bcnt, int, S_IRUGO);
1 h8 U. h, A. }. o8 Z) \ - module_param(ccnt, int, S_IRUGO);
复制代码 + K: w' r X# [ h1 c
' V* q5 x4 J, f$ F* l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 k+ a2 F4 I3 {% c$ k; [+ ~ T6 s) iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 |, j5 `$ s+ t2 x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ K/ `; b* t! C2 x3 |
6 u j6 a, b. p. O# t7 n8 C: z
$ u; w7 i$ j2 l |
|