|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 U9 Y0 @+ O" Z9 e2 t S- [code]EDMA sample test application* J* O) r& o) _0 H; X) b- I6 v( ~& q
- /*% w8 W, N0 `" r! Z; j" A% Z
- * edma_test.c
& ?* g5 T7 f; d: P: B/ R/ E - *
) ?4 k, X! m' e% n8 ]& b - * brief EDMA3 Test Application0 a$ `: S, t, \; L
- *
: R: W1 A) w \7 ^$ m9 I( A$ r - * This file contains EDMA3 Test code.
$ O& i" ^7 E- U - *# k7 E) V5 K, H% L& ]; O, I3 h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( J# O7 [: \: |1 s( R* @7 b' k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% v4 u6 X4 h' B
- * TO CHANGE.
' W8 y- K! u5 e* Y( G - *" ^' ?* c& u) G, r9 Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ s& ]2 O- u! a$ `1 Y( V- W) d7 E& A
- *
2 U" k2 V- s( N+ G; ?4 I+ t - * This program is free software; you can redistribute it and/or% h" D4 v; s: f0 G7 { X
- * modify it under the terms of the GNU General Public License as
$ x: i: Z3 B+ u7 \ - * published by the Free Software Foundation version 2.
+ @/ n, E* Q0 _1 t( h. H! Z+ y( l- L - *
' J$ D0 C) N1 D1 y! v0 p3 F- X* T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# B- ?6 [% l, b, J - * kind, whether express or implied; without even the implied warranty
& O* X4 q, E/ u+ l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* m0 _8 X& j& n* m1 Q+ D! H8 l
- * GNU General Public License for more details.& X3 s* t, z7 |1 d
- */
- }: x7 k) _( F* D. l - 6 s5 o( {" S( U, `* q4 o7 J
- #include <linux/module.h>
/ G; U1 u: V; v' d0 r( F - #include <linux/init.h>2 m0 Y6 \( `5 S& P& H3 d9 A
- #include <linux/errno.h>" \% U# ^! t" t& F
- #include <linux/types.h>8 k+ V! V% M& k$ Y% D
- #include <linux/interrupt.h>6 A) [: F6 J' f. i
- #include <asm/io.h>% v0 ^% i b- B$ O" ^: E
- #include <linux/moduleparam.h>
5 X$ }0 t' ]( M8 H/ f) L4 U - #include <linux/sysctl.h>( q/ l4 X# k, b) U/ `
- #include <linux/mm.h>
& X" }3 M3 @+ {, P& D0 \4 i - #include <linux/dma-mapping.h>1 m( M S3 B! w# _ H3 V0 R/ I
- ( k2 Y3 \. V/ p1 p2 e) ^7 w
- #include <mach/memory.h>4 F# e& E+ Y4 d- }% ]2 n8 K3 o
- #include <mach/hardware.h>
) {$ [) I6 n x, f7 A3 Y' Q - #include <mach/irqs.h>
% `/ R. x- G8 B+ {% Q9 W - #include <asm/hardware/edma.h>0 D1 ?7 @& Q( ?6 L* ]' L
- ; m1 s- Q$ D$ c( \1 S/ M( h
- #undef EDMA3_DEBUG
8 d, ]3 o J! |" k1 u6 X+ z \6 Q9 f - /*#define EDMA3_DEBUG*/& H: u, x4 ?" s1 l& Q4 A
( B4 d6 W w1 m' ~$ T* n! O) ?- #ifdef EDMA3_DEBUG
4 L4 }# W. y9 J0 F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
Y8 i5 d! q$ y) D, B. | - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* R1 r) E, i4 ] i* F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 X4 P5 P- ?4 a, D4 d - #else1 r" R0 a* V; ~& E9 @; E$ }" C
- #define DMA_PRINTK( x... )
6 [4 S1 J9 k% I. c$ g y. ^ - #define DMA_FN_IN
1 ?* z6 g: T0 x) K; X, u- H; V) \ - #define DMA_FN_OUT
7 p* W( q! l1 b% D' m; [ - #endif0 b( ^4 x, v* r" K- D- E) P
- ]" ~; G4 v$ d ]8 n) |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 l: @ J' M9 R( A( w( h - #define STATIC_SHIFT 34 b' ?' P4 y: {1 u. V% x
- #define TCINTEN_SHIFT 20: J- \/ d+ q- ^* R$ W! n* a
- #define ITCINTEN_SHIFT 217 E* o% v/ w6 h$ d7 y1 |1 F
- #define TCCHEN_SHIFT 224 z1 v. f5 a+ b: ^
- #define ITCCHEN_SHIFT 23
, K1 L% Z x$ q( }8 O
* e& l4 ]6 F0 E4 j7 j5 C6 q- static volatile int irqraised1 = 0;' R4 w0 m9 M6 e. j/ S: l
- static volatile int irqraised2 = 0;/ ?1 ], |2 K/ }$ ^! u$ h
" A! s+ \2 K$ o6 x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' z" `3 ?* Y0 d, r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& N+ [) P- B; `: p3 v0 T% g' E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. x p& U, x" ?+ @, r6 e( f) n6 w7 D
- 5 p; i' \& A. F& k5 j7 l6 D
- dma_addr_t dmaphyssrc1 = 0;
7 U) g' ^2 {; E w - dma_addr_t dmaphyssrc2 = 0;3 P5 m' ~3 I9 U) ~8 l9 j
- dma_addr_t dmaphysdest1 = 0;, ?6 |5 h7 x" C& V4 `' Q; L
- dma_addr_t dmaphysdest2 = 0;
3 o' C1 p& @* s0 S; u2 E - + t9 F- z+ O1 X! m, _2 P8 }4 @
- char *dmabufsrc1 = NULL;& F1 ^7 J. d! c7 z1 T) x
- char *dmabufsrc2 = NULL;
, o( }8 s! X4 W; Z: ~4 Q4 z - char *dmabufdest1 = NULL;/ Y( Z) r" W0 j5 M1 m4 I b
- char *dmabufdest2 = NULL;
" o: L6 j9 W& u8 ?% N - % [2 L9 k1 [5 |/ o
- static int acnt = 512;( h/ ^8 ~* E" }6 c, D
- static int bcnt = 8;6 Y. ^' h1 Z& j* g1 ?- {
- static int ccnt = 8;
) E$ Y9 Q- X5 M# d/ l" Z - p* B2 ^" X' C' c% L H
- module_param(acnt, int, S_IRUGO);
6 `0 I: e F) t3 y - module_param(bcnt, int, S_IRUGO);' O5 O+ U/ M) v* a. G! W
- module_param(ccnt, int, S_IRUGO);
复制代码
; N" Y. ^) A/ S" i0 j; E
2 f: b# ^% s& E+ m: b+ e L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 x2 p+ F7 s J! l3 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ ~5 K1 B$ s* g0 }! O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 v U- m1 R, X3 [
) f( `$ G8 [7 o! Z1 ^' O4 j/ M6 a; E$ i, U5 m' U
|
|