|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& q; |- n4 l, N" m6 @ s" F/ }. ]4 ~- [code]EDMA sample test application B+ B* q. q7 ~4 a
- /*, L# d# b( x7 o P4 Y! k
- * edma_test.c% I* j6 N8 n o
- *) S$ H/ l8 [+ ]/ S. \0 g$ G( i# h0 w, V
- * brief EDMA3 Test Application6 Y l: s! M1 o1 ]
- *( u+ `! }/ m2 b# m; Y9 E' F7 l6 v
- * This file contains EDMA3 Test code.
1 a' j" ~4 d& Z* o - *
! j0 m. w; ~$ s9 l" ^! Y$ F# Y. k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 `, {7 {+ z" i& a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 i9 w4 u/ q6 F4 o
- * TO CHANGE.
& f9 d) ^4 d* H% h Y+ F* ? - *' Z9 O- w! R4 v: d: z2 \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# z |/ p! ?2 p4 |7 ?" K) ? - *
( ~9 }1 t+ q) [8 e z+ H, Q5 Z - * This program is free software; you can redistribute it and/or3 N, y& N- z# I. A; J! x, U9 d( k# A
- * modify it under the terms of the GNU General Public License as
: D1 A& k* ]! C* d8 i5 A+ y) Z - * published by the Free Software Foundation version 2.9 G: s* i3 d2 t. T
- *
& ~# G9 ]2 G, h A" V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 a( i( h* q1 h- h J& x - * kind, whether express or implied; without even the implied warranty
: z3 ~- P* I( i/ a) V% m- F2 E7 f! f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ z6 F* M2 h1 }* A3 q - * GNU General Public License for more details.2 U9 p* S% u8 ^6 h( }
- */( r; a# ^/ y6 [5 r
" X; B7 a1 A$ F- #include <linux/module.h>+ D5 V* F/ a3 {, q
- #include <linux/init.h>
9 y9 r0 @% R; L' U - #include <linux/errno.h>& U T! A; l0 |$ |; R0 [0 T* ~* D
- #include <linux/types.h>
$ W+ X/ C5 D4 s- k5 f - #include <linux/interrupt.h>
7 |. i# J2 n! W6 O: G - #include <asm/io.h>
5 P# g" U# ^* p: u - #include <linux/moduleparam.h>
5 v8 y# o% n# S5 O( A- T1 T6 }9 J - #include <linux/sysctl.h>
; P. H! H, z4 _! |, [ - #include <linux/mm.h>
& B5 L" F, q: Y0 k+ ?( a - #include <linux/dma-mapping.h>
# p0 k( j1 o1 ~
% s+ |: j5 L/ f$ X& m9 z$ T1 ^/ R- #include <mach/memory.h>; q8 G4 t O* R- Q% @. r1 y
- #include <mach/hardware.h>
3 \: d3 w- t8 K I a. w - #include <mach/irqs.h>4 T6 ~ T$ u9 k. i& O, W! C
- #include <asm/hardware/edma.h>
$ a' F+ p3 }! {5 b; v/ v. P6 B
8 I$ H$ N2 c. l! a1 h! h# n. f- #undef EDMA3_DEBUG, r! E. }+ O/ w5 M$ X# ?
- /*#define EDMA3_DEBUG*/. D# I7 q2 ~2 c5 C* X7 h
. T8 u- p' o; d5 S! ]' ^- #ifdef EDMA3_DEBUG
1 z! M5 k9 h7 u9 t3 D# x( ~9 t% D8 Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( ?. W* ]% G* J& g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: S+ c9 F1 l0 l0 b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 z% j a. ^" j9 D - #else( |# T9 k- y- ~; y; U# N1 }
- #define DMA_PRINTK( x... )/ }1 {* Q' B- S) u' w* E; \. R- c
- #define DMA_FN_IN
) `, z% ]' l9 k% L - #define DMA_FN_OUT, y1 B2 [9 |+ O0 B7 {
- #endif, r8 p6 c- X, q8 D) l7 f
- 0 W& o2 I# L/ o* z0 @: H* @2 L7 F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* w* k1 C% I7 B7 t: c5 U
- #define STATIC_SHIFT 3
: I( I+ s* [( m7 P6 | - #define TCINTEN_SHIFT 20
6 R" ^7 J, [( p; `6 }8 [1 T - #define ITCINTEN_SHIFT 210 [8 N9 M Z1 S9 Y
- #define TCCHEN_SHIFT 22
{* `9 H& B; ]9 q2 {4 O - #define ITCCHEN_SHIFT 23* V+ b: K( H! H; [# @, K
" M, L4 S5 I2 {( n0 @! B% D- static volatile int irqraised1 = 0;
! K+ Y0 v% |; K% r J2 o! I# U. r - static volatile int irqraised2 = 0;
' F- `& Z, w7 {6 e" T6 F! ?
3 x1 ^2 }& F) e) c& j& ?, ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 |( @. [, }; F. x6 |- @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ e: u9 Z( t6 [) Q$ v& ` ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) e9 u# W+ o4 i$ q/ O8 k
Q& ]* p; K0 g/ F( V6 [* r+ K- dma_addr_t dmaphyssrc1 = 0;: w( I W& n% y% u1 w* J0 K
- dma_addr_t dmaphyssrc2 = 0;5 r+ P; k- j p6 w$ b
- dma_addr_t dmaphysdest1 = 0;
3 [, C3 X6 I( e& b' `! g# }0 v) t - dma_addr_t dmaphysdest2 = 0;( v9 V+ K9 Q4 B$ o k
- ]. Z% M* f) _" l9 n( Z- char *dmabufsrc1 = NULL;! G. E8 ~1 }9 S @3 |; D) _
- char *dmabufsrc2 = NULL;
9 H) Y; q, W; T f - char *dmabufdest1 = NULL;
+ n- H! A5 ]) m) Z+ D7 V, ] - char *dmabufdest2 = NULL;7 W% F0 J% ?% A. m. |
- . j# l p) u) p
- static int acnt = 512;
( }$ X& f7 D1 q \) ~ - static int bcnt = 8;9 q& U! \9 Y: q7 O# j! Q; X
- static int ccnt = 8;5 z# t6 _& ^9 s4 M% O9 [. [2 Q! f
$ _3 C+ ?: b) E5 c. Z* f0 c- module_param(acnt, int, S_IRUGO);
. O- G. r: y3 q5 T! v7 Z0 ~ - module_param(bcnt, int, S_IRUGO);; Q6 ~0 s8 n+ N' V% G0 o3 D9 _) { c
- module_param(ccnt, int, S_IRUGO);
复制代码 ; n: I; `1 w, z, [
" p& M9 t" X# i/ X- X& |/ ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 q) r# o% m8 G, _/ Q/ O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ m/ h8 d. L+ r/ r/ F: s2 v c' p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) D8 d0 j/ o& K- |+ w* ]
6 o" \( q+ j3 j) ]* I$ N: }
: n/ M! h6 T7 C ~
|
|