|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- g% a. f% R8 V2 ^5 S" w7 c' e- [code]EDMA sample test application
9 A+ p7 n4 t1 ]. ]& e/ V - /*/ H8 [. Y$ Q: [7 I' p& q
- * edma_test.c3 R2 l+ x" q* e( A2 _/ o4 r" Y. @
- *
9 l" q" R. b6 b! ?1 o0 Z - * brief EDMA3 Test Application1 } h3 y( [6 ^( H
- *
8 c; e+ l* r8 P3 J- Y9 b - * This file contains EDMA3 Test code.0 z& R1 K5 d) f) j9 E' S" x
- *4 w2 w+ W! G4 S2 F+ n) L% H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 C9 ^# ]) J' S3 g$ a/ f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- C2 H1 W9 \) I7 h! T - * TO CHANGE.8 {' U( a) o0 G+ u! j
- *
8 u* W" ~ C9 f# y; D. x) x - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 }+ m2 z# v; v6 y t7 G# _$ K - *6 S6 O: x! A! \) u; C1 W `
- * This program is free software; you can redistribute it and/or( H; q2 J: |0 p% c
- * modify it under the terms of the GNU General Public License as
" j' S/ ~1 v" L6 F9 g, a - * published by the Free Software Foundation version 2.3 R1 S6 r3 _2 I* V" o0 M8 x2 n
- * Q D% ~6 N+ ?3 D2 p( g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 K; c6 E- a- u! M! y: y7 C6 z - * kind, whether express or implied; without even the implied warranty7 B; N. h# ?7 i; t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 r) S* O- K+ E' P3 a
- * GNU General Public License for more details." c; [- _& d" }% N0 a8 {$ H. M
- */
6 ^) o% {! o1 T/ D: r" i7 | - . [3 s! }/ [0 x% j& [3 c2 k
- #include <linux/module.h>
8 {" c% [9 z5 { B: K - #include <linux/init.h>+ T" g' d4 s0 X; W' L
- #include <linux/errno.h>! z+ Z! S' ?& L& Y! g
- #include <linux/types.h>$ e4 o/ _" C3 W/ _3 ]$ b
- #include <linux/interrupt.h>2 \# G2 N5 R, |1 C; N, H
- #include <asm/io.h>
! f% r+ @7 ^7 l# ` y( C) Q - #include <linux/moduleparam.h>! ~7 K1 f& Z7 n9 S
- #include <linux/sysctl.h>$ r- t- {4 H) p8 D. `
- #include <linux/mm.h>% o7 i9 ^- f: b- o: [
- #include <linux/dma-mapping.h>
, h6 ^- [. h( c
+ H' o8 r% u: k) C6 B- #include <mach/memory.h>. d8 V. Q n3 @& O
- #include <mach/hardware.h>, v- L7 E% B7 h* m5 i
- #include <mach/irqs.h>0 k2 F; w7 j; A: B$ n+ i' X
- #include <asm/hardware/edma.h>
9 A& q _6 z: B# A1 ^' K
! s7 j) ]7 Q! f3 w- #undef EDMA3_DEBUG' C, Y& K& G* b9 w2 P
- /*#define EDMA3_DEBUG*/
3 B* x9 N7 I: c8 j9 J) n: B/ C* v9 I
: ]4 D- P6 @+ a- r, ?( ?& b4 W- #ifdef EDMA3_DEBUG( C% z5 x3 J z$ U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 f; n ]+ H+ B+ M1 Q5 _) x _& k' P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ l d; P2 a; u0 e, Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) n% A/ D* ~! f3 p) t( ? - #else
) Z C. Z- T _9 r1 D - #define DMA_PRINTK( x... )
i5 }, M8 v3 q - #define DMA_FN_IN
7 I6 W0 F6 u+ N) [5 c8 M. m9 E - #define DMA_FN_OUT: ^& \0 T9 Z) }3 C/ C! ]
- #endif% t2 \9 U3 Z8 Q: s! R2 ~
7 |# ^' @/ y B8 U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' P8 J$ z8 k% ^. {* G b; N - #define STATIC_SHIFT 3( n1 ]* v0 o: J* w9 ^- n
- #define TCINTEN_SHIFT 20/ X; g2 O. r& Y6 e8 h" @" ^: Y
- #define ITCINTEN_SHIFT 21
+ a2 x. a) z6 T8 ]6 N% W - #define TCCHEN_SHIFT 22) o) X" {3 U: k$ f# o& z' X4 G
- #define ITCCHEN_SHIFT 23$ N) h" ^+ ?. Z$ A g
- p# o' ^5 n# _- l1 t% u0 n
- static volatile int irqraised1 = 0;
# M6 U5 w; x9 ^ - static volatile int irqraised2 = 0;
. a7 z% F: y7 ?5 y - & b8 h, I5 U, h) q* H) O/ W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' j, D) r* a9 u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% x6 o4 A. a8 S6 j- \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" x# Y# M$ \' C% E
- ( f! p1 ~- b6 k! |' l7 i: b; Q
- dma_addr_t dmaphyssrc1 = 0;
8 d! h ^) M) K, z' l8 k( `4 t - dma_addr_t dmaphyssrc2 = 0;
9 O& h3 I" [& E* V2 }8 g; ?* b - dma_addr_t dmaphysdest1 = 0;
! H. A/ l5 z: F0 U5 |; n% R" o* ] - dma_addr_t dmaphysdest2 = 0;- e& j2 }# t/ n+ s' t4 p
& Y, m+ d# a$ s) j+ z& A- char *dmabufsrc1 = NULL;: M% Z6 M0 q' k' z7 g1 U+ t; B
- char *dmabufsrc2 = NULL;
7 E0 B/ I8 O( {9 E - char *dmabufdest1 = NULL;: x) A! N4 o. m$ @' u
- char *dmabufdest2 = NULL;' n: }& `1 {4 M, ^- i, G' g
9 A2 u# D- _& G$ T; }9 K( R( f- static int acnt = 512;0 R, Y; [3 O# z4 z; H' `+ m
- static int bcnt = 8;8 l+ ^4 p; C( p) k- P
- static int ccnt = 8;* u% i: }8 {( k; p/ W9 D* h% E4 T$ C! k
Y p8 q! r9 k0 c- module_param(acnt, int, S_IRUGO);
! j; x( Q6 [" G @ - module_param(bcnt, int, S_IRUGO);( z( O( s, e- ~1 L: M( }% Q5 i
- module_param(ccnt, int, S_IRUGO);
复制代码 9 y+ o4 {2 ~7 S! @
! y7 ]% u/ L6 }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& z% ^) d4 A/ J3 `6 }8 w6 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' l, }5 D/ O7 A) {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. B4 D2 Z% M: e4 p5 W/ k: ^
9 _' J S8 _* R2 u$ y: Z7 a' h/ Q
3 D; I3 ?, x) k8 o& v |
|