|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ C* e, \ t8 o7 s; K8 b- [code]EDMA sample test application
7 S$ w# F0 V2 d' _3 g7 a! } - /*
' q% j8 H/ c5 Z4 U8 ]0 f - * edma_test.c6 r% ]" E0 u: t" |+ v7 \! h+ @
- *
$ T1 H- Z4 _; W' | - * brief EDMA3 Test Application
0 T0 C& e( G( R& d - *, w2 k; f8 q& B/ L( F$ v" }9 o
- * This file contains EDMA3 Test code.
2 J6 w/ q5 L. W6 S- I - *
& ]! h. M* U+ H: A3 i9 B8 S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: O8 { \0 l& |/ V: v: l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% A. ^, }0 Z: |. C
- * TO CHANGE.
5 h; h+ d% d7 V - *7 l( ^! m6 f+ i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 B5 u$ Y# U9 H2 A# o) M/ _$ e
- *
7 `; m1 B6 ^6 _- n6 T - * This program is free software; you can redistribute it and/or
: O: i& b- Z7 g: W - * modify it under the terms of the GNU General Public License as* R/ }3 l6 a$ v+ U8 z" G& c2 ?
- * published by the Free Software Foundation version 2.
0 @0 f& T8 ]; o# m9 y$ y - *- E* t% z5 A" D( y2 t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" M: }; {" U3 }, |: Z( a x: D" ?1 q
- * kind, whether express or implied; without even the implied warranty
5 H* k1 P# o! x7 n& {& K( Q9 p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ s. W$ m8 z+ u- A8 p3 @" K. w
- * GNU General Public License for more details.
( {6 ?, K5 V* p3 b* x- c& G - */
* R. i* i+ w( ]( n) \ - , Z/ u: F b+ S+ Z7 o5 m6 a
- #include <linux/module.h>9 E3 M' l) l1 v% g0 r
- #include <linux/init.h>
1 X1 j# ] y+ [' \ - #include <linux/errno.h>1 F: L- M! j0 a: v4 Y; E4 F9 P
- #include <linux/types.h>
. q; Y; C, C+ x5 T2 E - #include <linux/interrupt.h>' ~4 k7 \3 J: `) s4 L
- #include <asm/io.h>
# r( `4 ]% x0 s7 a - #include <linux/moduleparam.h>! B% K( ?. m$ b3 D6 M- F4 T
- #include <linux/sysctl.h>" |0 Y" I' S: Y: ]. f( d; ^
- #include <linux/mm.h>8 H! c1 O" c! W
- #include <linux/dma-mapping.h>
/ U3 M4 V& i1 C C B1 M - 5 e. V8 D7 ~$ Y6 k& V
- #include <mach/memory.h>
# I2 n0 H- {4 m# s1 o: V7 c: K& [) ~ - #include <mach/hardware.h>
Q8 q3 w3 q# i3 A/ w" U7 _ - #include <mach/irqs.h>
# } o/ _& H( z5 e" ]( T2 A - #include <asm/hardware/edma.h>
" v/ t0 G4 [+ T8 u) y2 g2 A! \ - / C; E) g# p' d! f
- #undef EDMA3_DEBUG
$ M7 S$ Y/ ]- ^ - /*#define EDMA3_DEBUG*/# z& \3 W9 S5 P* Q' |, U' C
- 1 ~3 I0 j1 ] M' D0 x
- #ifdef EDMA3_DEBUG9 R. K4 E2 R$ U. f& d( X, u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% t/ B. u6 S% w6 \7 c7 i! s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' H$ F# |4 Z9 ^ X3 _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 G$ A( a$ H; o3 O
- #else
: K7 D2 }* ?$ A- i0 h$ r - #define DMA_PRINTK( x... )$ G" o4 n6 f+ O6 `) S2 ]+ P( u$ y0 e
- #define DMA_FN_IN
1 L4 |" _7 m% }6 N$ J1 @8 r - #define DMA_FN_OUT
9 [, W4 Y; \9 }+ c9 s% V - #endif
, a/ W- ^9 U* ~0 \ R - # `+ l+ v5 A, M' `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# Z% q/ E2 I! s2 d! ~
- #define STATIC_SHIFT 38 a$ |" P9 J7 e' V6 n
- #define TCINTEN_SHIFT 20
4 k( @- m2 y2 z) g2 i5 a! q9 I% o - #define ITCINTEN_SHIFT 21, s$ L; a1 |" ?' J8 Y- P3 @: w
- #define TCCHEN_SHIFT 223 l3 `0 O% i! T' v
- #define ITCCHEN_SHIFT 23
9 c% K, V F+ f1 `* u; ^
' `& d' Y% [3 A8 P9 c: J9 z# O- static volatile int irqraised1 = 0;& V3 _7 |# I' l! ~. c) V* u
- static volatile int irqraised2 = 0;- R% Y+ X0 S3 G3 q1 i
- $ H8 r! S, X, t {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, M+ O; I6 B0 t% ]& _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, X8 q' w. J$ O/ U K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ~: ]* l' _/ I8 ?6 j
1 R2 l- v4 D; v3 V. @7 g |2 L- dma_addr_t dmaphyssrc1 = 0;) Y$ f, X7 T- q- r4 V2 v
- dma_addr_t dmaphyssrc2 = 0;6 }& `# h: H1 n: U, n; n
- dma_addr_t dmaphysdest1 = 0;) z7 o- D+ x' v9 ?+ _3 v D
- dma_addr_t dmaphysdest2 = 0; D# D( O& C0 i8 A
: E& n7 f | R3 x- char *dmabufsrc1 = NULL;4 e6 {" R' F" d4 D/ y
- char *dmabufsrc2 = NULL;( u" J) q3 ^/ p2 y6 l: n4 ]
- char *dmabufdest1 = NULL;" j0 t9 C$ f$ l% V6 V
- char *dmabufdest2 = NULL;: ~7 y I6 |6 z1 Q+ T6 ^6 M
- : x$ u- ]7 O$ x h3 @1 _3 v
- static int acnt = 512;
1 T2 l$ Q7 W6 |) _* z8 ?/ `; P, b - static int bcnt = 8;; P% M4 f& y) m9 x7 L
- static int ccnt = 8;
" O% h# z0 F) T/ J* h0 S) e
: [: b4 W8 G- ^8 k- |& E- module_param(acnt, int, S_IRUGO);7 Z+ S, D9 H: H: S) \" w
- module_param(bcnt, int, S_IRUGO);
. Z6 A9 S8 D$ S/ |( l# p - module_param(ccnt, int, S_IRUGO);
复制代码 " G1 l* o( z# t* ]
8 K) t+ J7 \, P" z- q: H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 Q- W$ |! M6 J7 a0 T6 S/ w$ w1 tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, |& t! \) a3 w$ K$ V% z4 A% v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ j0 p8 b* ?1 q, N* L$ M W, x: P4 \
5 _/ n$ Z! {4 n7 v$ W/ H! ]6 @
, ^! @- o6 N" u. @/ B# n v; @# o |
|