|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( O: I/ q7 U$ P3 [. b' H$ _1 Q" Q- [code]EDMA sample test application7 r3 ~; V ~8 ]
- /*; h$ D3 @2 x; m; [ Y+ n
- * edma_test.c/ `- I; @1 v V& Q N
- *8 G( {2 x# `! ?: i+ g
- * brief EDMA3 Test Application% s: R) m9 `, L5 c; h9 A8 R2 E
- *' t/ _6 t' p2 S: {4 `
- * This file contains EDMA3 Test code. @# w! Z& J1 P, t% Z7 d: j
- *
( {1 Y. p; w* e. h) t$ @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 F+ E! w% |7 }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) J$ x3 y2 n4 y0 H; [2 N+ l - * TO CHANGE.
0 A, b" s) H: C, a - *
7 D5 Z: ^( O5 ?' H5 b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 v8 F. a" I! a6 N8 Y" [& q" ]
- *
! [& `5 d# C6 Y2 I - * This program is free software; you can redistribute it and/or1 h8 A- a5 I* L% R! ~
- * modify it under the terms of the GNU General Public License as$ t. s, h8 q- U3 N! A3 t" f
- * published by the Free Software Foundation version 2.
* ~$ H/ U/ t* F+ @9 |/ F - *
! p* k; L0 q$ a G" k* B& R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 @0 B. C) M4 \$ H* D5 z9 u, a
- * kind, whether express or implied; without even the implied warranty
3 p6 }% I. f2 N6 L T2 A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 c& v9 K, b _7 W
- * GNU General Public License for more details.: j* O$ o3 m/ _
- */
/ k! R) p6 f: @9 M
! U# G7 d0 B- @: Q8 F, a% I- #include <linux/module.h># \" k- v% u" |" k
- #include <linux/init.h>. n( @, U. o; s; I9 Z3 P
- #include <linux/errno.h>
7 H$ z+ h8 Y5 \6 I - #include <linux/types.h>
# d/ ^" l- y S3 n- Q8 c! @ - #include <linux/interrupt.h>
( ?" u( C$ ~( }: D% H/ o \ - #include <asm/io.h>: S+ C' E# r9 h3 @
- #include <linux/moduleparam.h>; x+ u( m6 u% e, S( \% k
- #include <linux/sysctl.h>
* v; D- |% y3 d0 J2 o4 Q( Z - #include <linux/mm.h>" M7 y" ~$ a- t8 u: o
- #include <linux/dma-mapping.h>5 D; x" K! a3 y
- 5 _: o' a$ x6 M* T) O+ H9 P; W/ C
- #include <mach/memory.h>& v8 _1 H4 ]2 l5 Q) ~4 f
- #include <mach/hardware.h>
2 x6 I: Y* v! Z9 T- ]) [2 J - #include <mach/irqs.h>
' @+ `6 B% q- N0 H - #include <asm/hardware/edma.h>
4 Q2 x+ P1 N+ ~. N7 | - 9 F: t7 Y7 C V) F! X' \
- #undef EDMA3_DEBUG
( c/ F* }7 b% A) u/ C# C - /*#define EDMA3_DEBUG*/
: R4 A& D2 S) x% |/ |3 N) {
T: W' K9 L( g0 o' X) ?- #ifdef EDMA3_DEBUG
0 K ^8 j2 L7 H% x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 F8 ]! X& R, k% y3 f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. M. F" B1 I" p1 {( I5 B6 }2 U - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ X7 J3 K+ \( T+ a - #else, H* C3 Y4 ~3 C T& q1 {
- #define DMA_PRINTK( x... )
8 B0 [, |5 g& w# _2 s. {. S( V - #define DMA_FN_IN6 `# r! e& P3 `. ]
- #define DMA_FN_OUT
0 D# I) ?# @( _% j% a; t - #endif
6 ~5 M/ S6 y, l. h
8 g5 Q0 J5 P r) O( H( z6 i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# W4 v. V& Y( m4 D1 b3 y. m" }& f) Q - #define STATIC_SHIFT 3; c' L4 r; G" o) U1 y
- #define TCINTEN_SHIFT 20
& ^/ z% W# i' u& D/ d6 V - #define ITCINTEN_SHIFT 21- c G) z+ M' c
- #define TCCHEN_SHIFT 22) T7 u" w; u6 \
- #define ITCCHEN_SHIFT 23( M: m5 H- a! C0 }) c: n
- 7 E' d( B" ?/ m8 ^2 g
- static volatile int irqraised1 = 0;- Z b) K1 ~8 z" L/ i
- static volatile int irqraised2 = 0;
$ p8 b+ s* g0 k9 e - " G6 e/ T1 v: e+ e4 Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( j/ T1 k. E- x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' ^9 D3 \2 R$ D0 | J2 L( P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: X* T. g% Y$ U) J
& m( t/ z: s9 R* }3 W" O- dma_addr_t dmaphyssrc1 = 0;5 |( X! I d2 N9 b# M6 m0 s
- dma_addr_t dmaphyssrc2 = 0;& ~* k7 ^) A7 @$ E* x# X
- dma_addr_t dmaphysdest1 = 0;9 k) W; l: v9 D7 H0 @' _5 G1 w' o
- dma_addr_t dmaphysdest2 = 0;
, \+ H4 ~4 m6 }
' w( T3 n2 j+ ]1 {/ O- char *dmabufsrc1 = NULL;' K* g$ B& `# G& q
- char *dmabufsrc2 = NULL;
+ N7 [) J9 l: s7 ?2 j& Q! z- [ - char *dmabufdest1 = NULL;
8 \) _0 Q$ R7 ^ - char *dmabufdest2 = NULL;1 h9 ^5 g0 D) D) }
- , m4 _4 ?3 X9 N5 }# @- x# m& a
- static int acnt = 512;
" l) y' q- C. P* u1 o - static int bcnt = 8;
* W- F/ m* i* Q+ L, _0 S/ F8 i8 @ - static int ccnt = 8;/ [) g U; Z3 W6 v( i: J! u* z
7 r5 w k; m* f1 w- D* K3 O7 q- module_param(acnt, int, S_IRUGO);
/ m& J5 `/ N1 G - module_param(bcnt, int, S_IRUGO);$ H6 m. k$ v% Y W) l0 Y# d
- module_param(ccnt, int, S_IRUGO);
复制代码
* j' k0 G+ ~# E3 ?# }
$ X- g- w3 G. q+ G+ R# q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 o& R: s3 Q' d1 I7 C! Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- N5 R" G9 a$ O* L" O) x3 W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 g1 Z, ~( A! c" D+ m- f4 B7 J
! l1 A1 z( x4 n3 A, [3 [, q
; ^+ O! ^* |7 l1 P |
|