|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 q- r3 I1 b1 ], t
- [code]EDMA sample test application3 @2 s% M7 \. X
- /*2 u7 J6 w0 O1 F
- * edma_test.c
9 m' @( B( }' E) F8 a - *' L% Y- y7 `7 B. a
- * brief EDMA3 Test Application2 ?1 ~' ]) U6 q/ b1 `. B
- *
1 g6 `- H& g" [9 M3 D - * This file contains EDMA3 Test code.
6 L2 g! G# }2 R; X% d - *
. y- Y4 j/ X1 A1 v% A& u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* I" h( ?% c, l8 e9 N9 [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 k6 i' H$ G( T7 e& A
- * TO CHANGE.
Y. N: \6 X2 }* k c8 d' |( X - *# {# }/ O2 i3 k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 G2 K1 j0 p# ~ `5 o) k( I! p: e - *
+ q, N& K* m! N1 l* W# p8 p - * This program is free software; you can redistribute it and/or; l6 E, t1 k& I9 R
- * modify it under the terms of the GNU General Public License as
( l2 C1 I9 U' x - * published by the Free Software Foundation version 2.
2 f% H2 @* O% { - * t3 B; y0 Q# o( O) d [ z0 r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# r/ E) H% i3 o: i" J$ y+ w - * kind, whether express or implied; without even the implied warranty
( V* K5 Q& i$ s5 k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" G# ^7 n# e; ]: r+ J$ e a
- * GNU General Public License for more details." i7 _& o0 l5 ^2 p* M& W
- */- s. V! s5 ?( t
- $ @, L5 [3 o! v
- #include <linux/module.h>2 d- _ G4 y2 n7 \" ?6 c6 B: P
- #include <linux/init.h>) p# }5 r7 h! v7 Q4 _) Z
- #include <linux/errno.h>
* \+ q5 B2 d8 ]# |* I Z% ?8 l - #include <linux/types.h>( s B/ ], v9 x1 s, ]4 H1 Z
- #include <linux/interrupt.h>
4 z. x b0 U- H - #include <asm/io.h>
( V0 K4 m6 K- c - #include <linux/moduleparam.h>
& c8 c4 B) f2 P/ O" {% N1 { - #include <linux/sysctl.h>9 A- E* E1 j% P" q- l( }
- #include <linux/mm.h>$ l8 F! L6 I) W& S" ]! g& s
- #include <linux/dma-mapping.h>
1 @8 o' P0 o) H$ M2 G! F# r
9 n. g) A( C. ^6 z% a" E- #include <mach/memory.h>
* f% I. X" Z; b& R8 m - #include <mach/hardware.h>- i( R6 N" w, a' U P( G
- #include <mach/irqs.h>1 E+ W' {# v8 E. Z0 Y
- #include <asm/hardware/edma.h>9 L% q( p( M. x
1 ?1 u, k) M& @4 p' ~+ S' @8 T8 {" m- #undef EDMA3_DEBUG, p% Q- k% G" q9 D# R4 |, n
- /*#define EDMA3_DEBUG*/
6 d) ~$ J! L) s) u6 }) \ - 0 @* E/ F$ n2 x; G, d! u
- #ifdef EDMA3_DEBUG q: F e3 F% V7 S R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 N1 a8 v* O1 u7 V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, H3 k3 h) J# s# X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. y7 W' M& e+ m' P) S1 P7 h - #else% p0 [" ^! w" ?- X) K
- #define DMA_PRINTK( x... ). V) L+ b. G( t& U. ?
- #define DMA_FN_IN
1 d8 F$ O( o% G# M6 ^+ q+ N& D - #define DMA_FN_OUT/ I3 L2 {% K- z; E j
- #endif
. @6 `; W' H) T7 }( x# \ - : T7 h' Q* E% p/ F' S( A* F0 @: z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! n# V3 A, [0 U) N5 E - #define STATIC_SHIFT 3
' g& B- I; i5 L% ^4 f/ b8 r - #define TCINTEN_SHIFT 20
0 c ^3 j2 G: b3 K: j+ B - #define ITCINTEN_SHIFT 21
# z% N$ b! H5 F a3 g - #define TCCHEN_SHIFT 22- _) P2 J/ l, i. p5 c4 e( b
- #define ITCCHEN_SHIFT 23
, n8 A) |; e3 {7 Q. i }! s
3 d+ Q! M' K( l7 x7 {! O9 _- static volatile int irqraised1 = 0;1 x3 S, V, e* s3 Z9 s* q: o
- static volatile int irqraised2 = 0;
+ t% X/ F2 Z9 x
, U6 L) ~1 @2 |4 `- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 U+ i+ [6 J* {6 t! k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 b8 W- y# ^5 f; {$ s! ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 B. i S: f% ^+ _7 k - ; U4 N" `) z" N- e( G, z
- dma_addr_t dmaphyssrc1 = 0;' }% H' {. ]. Y, J
- dma_addr_t dmaphyssrc2 = 0;) n+ d# s! \, X3 W% Y: K
- dma_addr_t dmaphysdest1 = 0;
' |1 d" l. k6 C - dma_addr_t dmaphysdest2 = 0;# |& g4 X ^ O6 w8 @3 r3 R2 k3 [9 j4 D7 y
u, q L' N' A. `$ m/ ^5 C- char *dmabufsrc1 = NULL;4 P! R* e3 f$ A' ^
- char *dmabufsrc2 = NULL;2 N+ C! \$ q: H+ X+ f4 i$ p# k
- char *dmabufdest1 = NULL;
5 g# G0 `) z( H/ G+ w1 {$ t7 B* G - char *dmabufdest2 = NULL;
5 {% O5 I% [; `, T2 ]) w1 @3 F - ' F+ ~ N3 T, X
- static int acnt = 512;+ Q4 }3 a5 C* Z# `; L+ Y$ z2 r
- static int bcnt = 8;1 K$ S( T0 f( L# l0 ]
- static int ccnt = 8;, T }2 y, M" @7 V6 Z
- . s0 ]) q; u$ u( r
- module_param(acnt, int, S_IRUGO);
6 V* [ N0 S8 |, H0 F/ X4 i) E* O5 N - module_param(bcnt, int, S_IRUGO);: l: [, Y3 H0 K' R2 V1 Z9 H
- module_param(ccnt, int, S_IRUGO);
复制代码 ( `% g1 f1 G5 i& ?* L* u K
. ^* f' O3 l2 `8 y: E1 B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ e" k* o1 T4 d {8 `* v% u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 q7 F5 B+ D0 Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 {6 F2 X, \, n3 ]
* t l( T2 m9 @$ J! _5 @' P& _7 Q% J
- R& d% D H4 W- V1 o- U% t* _ |
|