|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # l+ U7 [$ t( c: B" d7 ?: O. G& \
- [code]EDMA sample test application f: x0 X; H( R! ~* \) D& w" ?
- /*
7 Z& R, n7 l8 h! M5 R0 y6 t4 r, r2 c - * edma_test.c# _$ x; U: R. E P2 |
- *
! H9 e& `; ]2 t - * brief EDMA3 Test Application
4 b n' { I- T( \) T) S# Z - *9 _8 }6 u# u; @; H$ X4 j
- * This file contains EDMA3 Test code.0 I; F$ e8 o( O
- *+ v/ [( \8 ?! b& [6 _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ? i! S! Y5 E( U/ z5 p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 @/ H' Y7 D6 W: i+ Y8 G& T - * TO CHANGE.
* h8 z* j: ]% M7 T3 I, c - *
+ Z1 `: h' D' y7 ` J1 | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 O. O( P9 P% f1 F, x* K - *3 _1 k( u( D7 o
- * This program is free software; you can redistribute it and/or! u/ x& @5 K3 }& O1 j8 B6 s' }
- * modify it under the terms of the GNU General Public License as5 X: s. i" K& Q% K$ j' V
- * published by the Free Software Foundation version 2./ V% S& x1 e8 p+ a
- *
) m& e/ E+ {; m) Z: K% ~$ k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( ~: i4 ^" \6 Q - * kind, whether express or implied; without even the implied warranty' T5 `2 e& E3 m3 i! [( a4 T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" B" _5 ^1 u; [$ c( T - * GNU General Public License for more details.
! D0 n8 R; A# f( N - */ i/ P7 P& y: i: d2 y% {8 {
- , w/ P9 o" }: a
- #include <linux/module.h>
( u3 J X0 u$ N, ~4 G5 ]6 K - #include <linux/init.h>
7 z; u. l# G7 [7 H8 Y - #include <linux/errno.h>
' M9 V- T0 L3 [2 e$ z- A3 I - #include <linux/types.h>8 C" R& m9 S2 [7 ]
- #include <linux/interrupt.h>
8 b' |: g* y) j2 y- v - #include <asm/io.h>
# p7 @# V* c3 }2 {; b1 j$ }" Z - #include <linux/moduleparam.h>( {, N7 P6 i1 g% ?2 `
- #include <linux/sysctl.h>- P* c2 P( c$ G9 k0 b# b- J
- #include <linux/mm.h>
/ d% j% X# {. F% p s6 m - #include <linux/dma-mapping.h>
" ?' |: F# k( I8 E* T - 8 Z# X: d* G1 S0 z; F$ Q
- #include <mach/memory.h>3 {5 B% E- q/ g2 G6 Q; |( n* D
- #include <mach/hardware.h>
* g) s2 t# O t) `+ a% A - #include <mach/irqs.h>% L- c' F) ?- ^, D% D) Y) T: x* i
- #include <asm/hardware/edma.h>
+ V( {0 e! ?$ p5 D7 A
5 G) Z, E3 ~: Z. J2 j/ }9 z- #undef EDMA3_DEBUG# g R! E7 M0 }$ \8 R) k( O
- /*#define EDMA3_DEBUG*/
4 H$ Q6 X5 \ `, h! P6 ]
( Y) q4 h! ^5 C: X1 E1 D5 k- #ifdef EDMA3_DEBUG" F! r. H# U0 \# P( w; k4 O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% `! C5 S( t) {
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 T1 p4 Y6 j3 l1 i$ j* c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 O" A+ x" C0 G1 X1 q; ^: j1 T! h - #else. J8 e+ ^- [* ~; v9 k0 b8 A
- #define DMA_PRINTK( x... )
; E: n8 w: R* {1 }: ^8 h - #define DMA_FN_IN' f* K( t3 O( V, A* Y/ d; L
- #define DMA_FN_OUT# K" Z- l: Z9 [+ M* U
- #endif
S; \ W) T7 N) ^8 b3 Y: Q) [9 X
8 _: L3 E" m; U; }7 S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 W4 N% ^6 |& [: K
- #define STATIC_SHIFT 3: u* C% u3 t7 L' W/ S# q6 v
- #define TCINTEN_SHIFT 20* U4 D" s2 T4 U$ L b5 `
- #define ITCINTEN_SHIFT 213 B. Q8 [/ H, S3 j
- #define TCCHEN_SHIFT 22( ^- k2 O/ d6 E) }6 Z0 z4 v
- #define ITCCHEN_SHIFT 23
$ q8 ^7 y8 D' G) t- u
0 q6 Z5 L0 r) ^5 V8 y- static volatile int irqraised1 = 0;
* x% i9 _% _# M - static volatile int irqraised2 = 0;
. Y, Y' H4 H% w - . o4 U3 B4 W* N6 V* G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 P, O/ _ z$ |& t* Q! ]4 u! ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# L) C! L; k- X( R& D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 e) f" q; {% Z0 U% S( s$ C$ p
- - x$ A9 ]! B! o
- dma_addr_t dmaphyssrc1 = 0;
7 q/ A! s9 \7 r8 u% r - dma_addr_t dmaphyssrc2 = 0;
, n( l/ g1 }% n; Y' ~. T4 N- s - dma_addr_t dmaphysdest1 = 0;
( }& ^! K9 y, i+ q$ U; U: b - dma_addr_t dmaphysdest2 = 0; ]& ]/ g0 l6 A S$ A
7 }( P: `% v9 E7 |( d- char *dmabufsrc1 = NULL;
& ~5 f1 T/ c" ^ - char *dmabufsrc2 = NULL;2 D3 W6 E0 B/ h; d
- char *dmabufdest1 = NULL;
- S4 ~+ a" H: F1 p8 ` - char *dmabufdest2 = NULL;
; e' h1 c6 N* O, M+ p- x* D& P C& n - ) @+ y9 e5 }6 Q! V1 C. b, y! n
- static int acnt = 512;
% b, h) r0 L7 Y+ A5 u2 _ E& H! q - static int bcnt = 8;: A, ~- B' R( [$ g
- static int ccnt = 8;
4 O* b; c$ Y- e
+ ?4 X, ^. S9 _0 C$ d) d- module_param(acnt, int, S_IRUGO);
$ Y- l& o( F0 j% {8 k$ t - module_param(bcnt, int, S_IRUGO);
( v- C" n i* m2 ^3 x/ a7 q6 ~- w" [7 G - module_param(ccnt, int, S_IRUGO);
复制代码
/ H* n/ A. {+ j" m
& m! D: ^6 ^, } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 W% O k# ~2 \- ?( zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; ]% E* l; U" r2 o/ V% @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 U$ L& H5 V2 h+ B6 |0 k% Q2 A
4 d6 C- `) H" c/ l" V8 x: z2 z2 ~) I% i6 k+ Q( U( y) _
|
|