|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 x* e$ Z( C; {2 c: [. g# J- [code]EDMA sample test application3 U, J1 g% M/ w
- /*! ]9 d0 M3 D; |9 ~" K
- * edma_test.c
1 y, ?8 T! T+ y& ~6 L0 Y - *9 [' I& r/ Z) r; e
- * brief EDMA3 Test Application* i3 c! U h' y/ t- `8 C- V
- *
3 Y4 [" B3 }7 i. I7 P& L T7 c - * This file contains EDMA3 Test code.
5 t# T2 S# V; P) B. }' Z' m - *
- Q& J M, U8 p/ i+ J5 C0 u% u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 a8 z3 Y" B5 V1 c/ ]! P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# D* u! l" N8 f ^2 S - * TO CHANGE.+ Y4 \& i9 `& u+ M8 B$ f; s6 I! H
- *
0 K* \- c& f9 N' y# ^+ L) ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 z% t) `/ @' h$ X5 F - *$ ]* m" o+ E2 O+ I$ o% k& A- ^" b7 f
- * This program is free software; you can redistribute it and/or
- e: B' N h7 P! b' @7 s - * modify it under the terms of the GNU General Public License as
2 E4 \7 C9 ~, P9 w% }/ l( y; g" C* M - * published by the Free Software Foundation version 2.
% s/ f% ^+ ]& L L6 e8 `$ I, r - *; }+ }2 @2 S( d, R: {4 z: Z3 C6 ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
_7 I& B) G" N - * kind, whether express or implied; without even the implied warranty- r/ E* z- f# P0 u) g' _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 m0 B& f7 e2 N3 C# i: F+ [& y - * GNU General Public License for more details.. ^& y; R# q9 D/ _
- *// j* j8 U( A# e$ ]
6 h8 Q! a# ]% l; ^# Q9 \- #include <linux/module.h>- ]& j: p) u# @+ g) v9 l H
- #include <linux/init.h>
* i- e0 _! r4 M4 l5 ~' c: j1 C6 u - #include <linux/errno.h>
% N. w L) Z, _6 m- J - #include <linux/types.h>
v% D5 j" x3 L U0 l - #include <linux/interrupt.h>
5 A! i' F6 S. l. {1 @8 Y& ~* y - #include <asm/io.h>: \, a; e* j5 N- R! ~2 {# H1 |
- #include <linux/moduleparam.h>& r' J$ z, @4 Z7 _
- #include <linux/sysctl.h>
9 Z7 v5 P/ k3 X; ]! t$ [ - #include <linux/mm.h>- W2 d/ Y% f5 i
- #include <linux/dma-mapping.h>! U3 O, m7 \* j2 C; u
! N" i& g0 l4 x/ Y, r- #include <mach/memory.h>
. @, z' e1 Q& L$ u/ J( c - #include <mach/hardware.h>
5 _* i- f% w6 f0 d7 E - #include <mach/irqs.h>
' B2 i+ g4 T% f3 q! x; d- L - #include <asm/hardware/edma.h>
) d! g; _+ \) G7 M6 a
* P2 n8 n8 T% ^) }. s5 e- #undef EDMA3_DEBUG& x8 ~3 V+ q8 x# D: v
- /*#define EDMA3_DEBUG*/7 [! j% C4 I+ h! F, [7 S2 h
- * ?% w5 u! I% ]; R* j
- #ifdef EDMA3_DEBUG
; M7 y. A% K& Y( m9 B# P8 G7 k# G* l9 w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ j% l% a5 ^$ n: c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 Q, y! H5 h3 r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 {& J5 }0 g* {& n; Z) @ - #else
/ G0 i" E/ K l/ s" o# F! ^ - #define DMA_PRINTK( x... )
. ^3 j2 x0 j) O1 X* P - #define DMA_FN_IN
% w. \1 M! b) v2 |7 [ - #define DMA_FN_OUT0 D) a, Y4 c& @6 ]
- #endif
8 f& Q( K0 O7 Q& x
' f7 g' u$ D6 O/ `0 K0 |; V4 E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: u: a u/ C7 I% F* P - #define STATIC_SHIFT 3. R1 I! o7 l: ]) i5 @$ u4 O
- #define TCINTEN_SHIFT 20
' \+ ]% m. N& P7 b2 ] - #define ITCINTEN_SHIFT 21
2 f' d& r/ O$ E, t0 o! G2 I4 o - #define TCCHEN_SHIFT 22
2 s5 g0 a$ Q, X( W- k1 w0 @ - #define ITCCHEN_SHIFT 23/ J9 F% z, O' _: k" G! r3 k
! s6 J7 C+ K" R- static volatile int irqraised1 = 0;
* f$ e; J* I9 F0 ?7 [. X& t/ g - static volatile int irqraised2 = 0;+ X2 u m Q6 B/ l- u: ^
5 V" q% [& }: V' }5 Q1 p! y6 Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 N* p" N, l [% P3 T" x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& {( C, C" p5 }! @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) R& [8 R) j' r" w3 A& d6 m
) X) I- w! l2 N/ R7 S- dma_addr_t dmaphyssrc1 = 0;
7 {; I8 w+ B, `( t! t1 B - dma_addr_t dmaphyssrc2 = 0;
8 n! a; C v) [2 K - dma_addr_t dmaphysdest1 = 0;" a R7 q! ~) T& A
- dma_addr_t dmaphysdest2 = 0;1 j+ ~$ N: K5 n+ Q
0 ^6 \& X6 b t7 x5 P& u- char *dmabufsrc1 = NULL;: H- m1 n! `2 Y0 U, j
- char *dmabufsrc2 = NULL; @$ U( Q, p) v; P# q/ v
- char *dmabufdest1 = NULL;- H0 I% L. O4 g" x4 v- I" Z
- char *dmabufdest2 = NULL;$ \& o: R* v0 U) i& k. o# i# |
7 X6 {" d. c5 t- }% ?0 C- u. v- static int acnt = 512;
4 z- p. B. ~, b* C( T - static int bcnt = 8;
0 P! r0 p$ l$ D3 U - static int ccnt = 8;$ v. i4 e/ o% K# b3 D) X! ^/ Z
1 T% |: R# }# Z- B- x, b, ]( h- module_param(acnt, int, S_IRUGO);
" V. E. w, m# m+ t+ u7 a: Z - module_param(bcnt, int, S_IRUGO);0 i1 n. X$ H: V6 F3 T5 \8 l6 j
- module_param(ccnt, int, S_IRUGO);
复制代码 $ b. \7 l$ N4 {3 S0 X( H0 U, g1 ]$ x
$ u) Y( {1 ]! M' E) f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' H& j( }) M0 B4 i- p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ F+ C( [- E. y( D! V6 S( h
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* @/ G: ^- H( @+ ?
5 s4 V7 Z( R5 E$ m) m6 E+ G6 d( h$ K5 m" e* u+ |& J
|
|