|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 x# W1 a, r* n) d
- [code]EDMA sample test application
" n0 ^1 S o1 `7 W, ?- U7 s2 s - /*5 |/ R) \; c; R
- * edma_test.c0 `0 L% `' q0 U: L4 g' f3 @9 l/ d
- *
8 L5 Q* f/ c' L% e - * brief EDMA3 Test Application- q. t9 Q( |: q. b) M
- *
7 `' Q; Z) F2 q. R1 [: } - * This file contains EDMA3 Test code.
0 b2 p% o [/ G, _8 ?$ d7 G - *
* s! K- ] @, G \1 @& D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( C' \) d* Y7 u: `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 n' } r7 s' X, |& ?2 ?; ~ - * TO CHANGE.
6 m5 h8 |$ q: L4 }/ | - *9 y: Z/ B3 V$ {3 Z( x" [: c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 @8 [2 }& S5 r - *" d1 T2 a3 Q0 \) }9 p
- * This program is free software; you can redistribute it and/or. C- d: }* p: B7 t
- * modify it under the terms of the GNU General Public License as. L6 p6 U$ K" r l% E7 L
- * published by the Free Software Foundation version 2.4 e4 [# t0 X1 c
- *
& m7 e, B8 ~* _ S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 w) S6 y6 k! q( l8 @ - * kind, whether express or implied; without even the implied warranty
- P3 g: J2 T- {$ D/ P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, s1 N' V/ Y& L- w
- * GNU General Public License for more details.! n4 C# U% T1 \2 d! ~7 i. _7 N8 f: | \
- *// I) t- e1 q" P4 o. N
- - ?# o) O' @. V- U! w" M. X
- #include <linux/module.h>& j4 S' [) N3 H4 ^& L
- #include <linux/init.h>
: X) \! ?3 }8 ]8 v3 v, N# \# c3 G+ V - #include <linux/errno.h>6 H: s2 |8 R; G. Y+ D4 C
- #include <linux/types.h>
5 K# o2 g$ p& W( K1 A( N- |% T% p - #include <linux/interrupt.h>& i' a. O' z2 K; o( Q) }& \
- #include <asm/io.h>
2 G7 C9 k: ]& O: P8 ] - #include <linux/moduleparam.h>
* p- b- X+ O# W0 ^6 z! e - #include <linux/sysctl.h># O" r ^5 W |/ E: H
- #include <linux/mm.h>
6 M3 t, G, N6 k3 {- p# E2 }& E c' G - #include <linux/dma-mapping.h>1 F) t9 t2 n. N# d; k# C1 H3 v2 ^
- + V0 J) s% C) {# M3 ~/ ?9 ?7 q
- #include <mach/memory.h>7 G; s+ |: H7 r6 a$ H3 q
- #include <mach/hardware.h>
3 ?& `& l4 n+ b' U" U - #include <mach/irqs.h># l3 y4 E' B# M* @ Z, i3 b# L
- #include <asm/hardware/edma.h>9 F- E& ]& H8 F& \. W+ l, S- W' Z- T
- 8 d7 x9 U. W* F6 t
- #undef EDMA3_DEBUG0 T8 ?8 }. q; Z5 M% k
- /*#define EDMA3_DEBUG*/
: O6 C) Z0 s: l. D* f# p/ [7 P
/ m; k- D( {- N0 B- #ifdef EDMA3_DEBUG* I: Z6 J$ m/ T( e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 Q. T" C9 y5 n/ x% e4 } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): N" C# |, N; Q: _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' X* O" T# F* ?- v
- #else( H0 q4 O- c, J
- #define DMA_PRINTK( x... )
( t- H+ T# ~$ P6 A - #define DMA_FN_IN
% A; v. p' U' h - #define DMA_FN_OUT5 O; e+ R7 a2 g! C# _
- #endif5 B1 Z2 d7 h" Y h; l% d$ m9 j
, d( ~) x/ l4 W) f1 u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
i$ [2 k, M, n" P6 }+ B - #define STATIC_SHIFT 38 n) P5 _: a- `* m0 M
- #define TCINTEN_SHIFT 20& ~5 J- c5 i7 W7 ?6 P
- #define ITCINTEN_SHIFT 216 S/ i1 q/ C+ r. M7 a7 K
- #define TCCHEN_SHIFT 22+ X4 ?, d, [+ M1 a
- #define ITCCHEN_SHIFT 23 F) e* E! d* v9 _
8 g4 b% ?% |; o$ Q* U- static volatile int irqraised1 = 0;- q& R3 }3 y- q1 ?; s# e, _! T9 K
- static volatile int irqraised2 = 0;
6 U9 n0 [6 S6 _8 ^. O
/ W3 l9 f9 j8 ?! o a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; {7 H5 G, R. e6 v' S4 ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 m5 V- b, k* B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 W- ]9 d- `: E) `8 ~* h- K/ y
1 p) i; I6 {) p R5 R- dma_addr_t dmaphyssrc1 = 0;* n, }; G; a. E- S
- dma_addr_t dmaphyssrc2 = 0;6 n/ s6 S$ ~/ K4 Q
- dma_addr_t dmaphysdest1 = 0;
\, a# F; k3 ]7 u# p- x( l' E - dma_addr_t dmaphysdest2 = 0;& E, w B" R t! b) c
0 a3 h% t: D, N9 a- char *dmabufsrc1 = NULL;/ c: r8 n1 j7 b% J# u
- char *dmabufsrc2 = NULL;
8 a; C5 Z$ }1 Q+ \4 G7 _' K7 t - char *dmabufdest1 = NULL;
' }5 i; G) J1 C1 ]* ^0 J+ f- u - char *dmabufdest2 = NULL;
* n( w2 w4 R2 V$ `
2 F0 b( c1 M$ z) V! @0 O- static int acnt = 512;. a0 J, o @3 F9 D; n7 j
- static int bcnt = 8;- e0 Q; |7 q9 ]2 }
- static int ccnt = 8;) G( t& { d! Z: j+ `& @' q
- . C6 s' _& W, y
- module_param(acnt, int, S_IRUGO);
) O/ H E# i' L! P. h - module_param(bcnt, int, S_IRUGO);
& Q1 E- V# R7 _& ` B2 A3 k - module_param(ccnt, int, S_IRUGO);
复制代码
( }6 s! D* J. I0 U+ G% T7 {# a
8 s6 V8 ^1 o( A. N7 g1 K+ B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* ^4 B: F) ]$ {$ Z% u. Y @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% Q/ ^: Q6 G4 o ?& G6 o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 F: I& `" p9 r
- i% a# q* h3 E# m; t
, q- K7 e, U, T1 h$ Q9 H
|
|