|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) Z. t {/ U7 K+ n( E& t8 J' G3 Q- [code]EDMA sample test application: }$ |/ f; a' B+ k
- /** x9 v+ N/ E% e
- * edma_test.c
, |# L( |& Y: \ - *2 [# a- p$ Z5 j
- * brief EDMA3 Test Application
* [8 u7 Q; B# e' l - *6 b$ F# m% Z& g/ h5 a, N2 w9 s" i
- * This file contains EDMA3 Test code.
( N( l; h5 Z6 r5 K, {" T8 o. B& A - *- I5 {. l. z! Y9 k2 e+ D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ f" S6 [# j& i5 V* F- S) ~/ L6 G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ x. z) u) B5 J; O6 V9 _& {$ p+ w
- * TO CHANGE.
( Q5 K% Z- {7 j) z - *
5 B2 ?7 J" ?% a8 y4 g- o8 b" a1 b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) r# U5 k4 K, r* H% L - *! t( s, A# A# O5 i" D: v( P
- * This program is free software; you can redistribute it and/or6 f) r+ Y3 l/ j2 i, I7 g3 h( A# o0 a% I
- * modify it under the terms of the GNU General Public License as! a' L7 v, r" Z
- * published by the Free Software Foundation version 2.0 I9 x/ i. [3 Q/ w! ?1 t
- *0 b" ~9 ]. |6 e9 P0 ^# m1 F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- m! _( Y! ~9 r7 C$ j6 K - * kind, whether express or implied; without even the implied warranty1 T( ]5 M" t) P5 V; z$ q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- @5 a- I \! e" o3 z
- * GNU General Public License for more details.
9 I3 j" j; ~' }! ?$ k' ? - */
/ v) K2 Z/ @; F& L3 l - ' w. p' _6 K0 X, k
- #include <linux/module.h>0 \( D; V4 d' ~ K% _; V
- #include <linux/init.h>4 e2 Z2 _ e3 g
- #include <linux/errno.h>! F2 U4 v) ?" K/ q/ b0 N" C
- #include <linux/types.h>$ I- a1 \1 c. m8 a# S% r! e" C/ _
- #include <linux/interrupt.h>$ N1 W7 V. b' ?3 s" G, \% c
- #include <asm/io.h>
' C5 I* U& Q4 e2 P - #include <linux/moduleparam.h>$ S4 Z, y/ c2 o- j5 |
- #include <linux/sysctl.h>
$ d9 T6 i# S, r$ ~ - #include <linux/mm.h>5 [* X0 q% \, F/ W4 w ~
- #include <linux/dma-mapping.h>& U# y( o5 d- v+ s5 O k
- 9 R* y# `5 U+ d2 U% }
- #include <mach/memory.h>
) M! }0 _! K4 o p' R - #include <mach/hardware.h>
' V3 o( @! C5 T D& \" x0 u+ l - #include <mach/irqs.h>1 ~& O+ D7 D; {$ e2 |
- #include <asm/hardware/edma.h>
9 O* H" k5 N6 ^) b! D7 ^
8 q- F; _; T2 f9 y- #undef EDMA3_DEBUG2 p4 v' h4 U4 `; w
- /*#define EDMA3_DEBUG*/9 w. m; j) U( E1 d: @6 ]( E2 E* Z
8 A& L1 y2 i/ {+ e( x- #ifdef EDMA3_DEBUG0 v0 i5 o; q$ z5 S6 G& M* l- J8 h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, f( b! {4 J' }3 @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 Y2 w6 o" B( V2 f6 {) R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( h/ O4 M# G, C- @& N+ n - #else. X5 P: K2 p3 T" F- b
- #define DMA_PRINTK( x... ): C& Z0 ]4 r: L9 A( u- l! _
- #define DMA_FN_IN
2 N% c7 D4 @3 g& m, x0 z - #define DMA_FN_OUT5 H. b( h1 w6 ~
- #endif1 P: z; U7 |& H
- 2 s O) @. D$ x/ K) F$ [( D$ t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" h5 W5 t/ n6 _0 O" B' o
- #define STATIC_SHIFT 3' N0 L1 w4 u# B1 c/ p. L' a+ o. m7 G5 I
- #define TCINTEN_SHIFT 202 _4 H% D/ d7 m# P9 Q; K
- #define ITCINTEN_SHIFT 21* M* e) t( ]2 R) ]2 ~3 d" n
- #define TCCHEN_SHIFT 22& V A3 p7 U0 _
- #define ITCCHEN_SHIFT 23+ z8 \9 [- o0 e( N
# Q) C6 F4 Z5 I0 @+ ]. J6 n/ w- static volatile int irqraised1 = 0;+ G8 V0 h- k: S! p _% d
- static volatile int irqraised2 = 0;- ?. X7 A; K$ `
, W0 c' B3 M1 H- i% \( S+ q! Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' R: A4 w0 t" p4 @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 o( i! H8 Q) O- s6 e6 h/ _2 R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* \2 o$ f" M: W5 r( e
M9 A% j; j- R- dma_addr_t dmaphyssrc1 = 0;
3 B% G- u$ l, _; D1 I ~ - dma_addr_t dmaphyssrc2 = 0;
4 R* |/ v+ q7 z8 E3 x! Y - dma_addr_t dmaphysdest1 = 0;
& S/ B$ o1 E- [. u5 w4 i2 y# m8 ]* V - dma_addr_t dmaphysdest2 = 0;
1 E- {4 s5 g& ? J - 9 o* c( J/ L3 P+ J, n( q0 b
- char *dmabufsrc1 = NULL;
# m+ E0 l3 `3 `" @' u - char *dmabufsrc2 = NULL;" V% V8 u' i5 s" v4 V
- char *dmabufdest1 = NULL;8 L8 [4 i4 v5 n: W/ T( \4 S: @/ T
- char *dmabufdest2 = NULL;
' u3 u- L' z# U2 j# Y5 _
/ L& B- C& r1 `9 ~- static int acnt = 512;
: o3 B$ V& U& r% |/ R' _/ W - static int bcnt = 8;, l; ?9 H* @& h( s( {
- static int ccnt = 8;
# V) Y4 o$ k7 K* }
) D; S" @2 H( I- module_param(acnt, int, S_IRUGO);
7 c6 k3 G1 L3 B( u - module_param(bcnt, int, S_IRUGO);9 G, o* V+ @5 G9 b- x
- module_param(ccnt, int, S_IRUGO);
复制代码 $ L7 P) \2 i, U; O' s4 P% y! [
0 T+ Y$ X( d n4 O1 C0 g* @2 {6 J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 s& l- h7 h) Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( [. M1 A* z# D; |. ~3 S- ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! V# a4 \9 B" R8 f# B* ]
* s1 y, Z& r, G5 P; O; i$ x4 M) D9 H9 g0 ]. `' O: S
|
|