|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ M: H% V" V7 \; p- [code]EDMA sample test application
. v( j6 N; T* T: r$ r& ]: F - /*
3 e( t! E2 Q5 L& M! f# T, O- T - * edma_test.c+ Z8 C$ g1 Q. t; Q; w; Q' f
- *. m! @1 x5 Q* ^/ o, K( ?& `* s
- * brief EDMA3 Test Application8 F. o0 c- \' O/ _3 G
- *
8 R T1 v8 a" u8 ?7 p - * This file contains EDMA3 Test code.
- e: W/ W8 k! X2 W - *. `+ ]8 A, a6 {
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE O; v6 S) c6 g+ @ O3 N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& n- p+ ^. \4 \1 E0 ^& V
- * TO CHANGE.
6 a4 _" k2 i$ | - *
! {) t L- { Z6 P- G6 L1 a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; g2 K( C) F4 ?: g2 n
- *
9 o: p5 C6 R2 h, x: \& n$ @: G - * This program is free software; you can redistribute it and/or
& ?+ i. x9 W" P& R - * modify it under the terms of the GNU General Public License as
+ n- C7 G+ u; d7 V( q1 ] - * published by the Free Software Foundation version 2.4 q4 `7 ^% f% l. w8 J) |
- *5 i# k7 P/ _0 G# W$ a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 m+ a" |# r3 N5 ]; y# [
- * kind, whether express or implied; without even the implied warranty
$ y k. k. F& A- v) f, W0 G5 B& }6 b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 W! p' m" B( ^2 g9 V+ \# p
- * GNU General Public License for more details.; F9 g7 e# W2 n
- */
& Z0 Q) [* K2 u - 7 _* i# a; v( D$ y# F: O
- #include <linux/module.h>9 ~! w8 ~6 z. s6 L
- #include <linux/init.h>
* a/ h) V3 ^! ] - #include <linux/errno.h>
% o& X* c p+ C+ f* E7 a - #include <linux/types.h>
$ [, y) i; D- N$ U% ^3 J" Z - #include <linux/interrupt.h>8 Q. \+ H: l! @" K# r4 u t
- #include <asm/io.h>* n3 Q5 N0 I$ j3 R% l3 }
- #include <linux/moduleparam.h>" f! |+ ~, C/ @; C- I D K! J; e
- #include <linux/sysctl.h>
; Z: c% ^' r' \: s" E: F5 G - #include <linux/mm.h> `& y, V# G8 [' Q2 W
- #include <linux/dma-mapping.h>
6 Q: N5 @! v* R0 K4 O* s. o" n - ) e9 G- }$ g: w, x: p& ^2 k. k
- #include <mach/memory.h>
+ ^; q# S. d% t& a( o ] - #include <mach/hardware.h>8 q7 W- N+ u4 E1 k# Z8 r- ^
- #include <mach/irqs.h># N4 a n: F, M- q$ M. l0 d9 [
- #include <asm/hardware/edma.h>8 a" S6 {8 d7 k. O$ B x
- / b9 {# M$ F( h( `9 K
- #undef EDMA3_DEBUG
2 z/ ?- Z8 f1 A- r( W& k - /*#define EDMA3_DEBUG*/ V$ o( n: z8 q- G. n8 C) W
, g5 }1 O( s, Z3 B: u5 T$ z1 Y- #ifdef EDMA3_DEBUG# ^. x( Q+ o' s2 J; E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) C- I0 H6 m1 h* P2 ^. k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), Q/ g0 X2 X" H" C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 m& X, M8 N5 \9 A - #else
) E# u$ F) L! }& o7 w1 X - #define DMA_PRINTK( x... )
. U8 C) e; _; q) G- u - #define DMA_FN_IN, R0 \5 _: }7 b# B# `7 A
- #define DMA_FN_OUT
8 D, ]5 G) }- O7 |5 t9 o4 V* d - #endif
t- c; I* w8 Y8 M' a - 5 g+ N' B% |( r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' i, |! w0 U6 c% Z+ S y - #define STATIC_SHIFT 32 W/ ^, L3 d$ H( {# s- Z2 c6 L
- #define TCINTEN_SHIFT 20
' L9 c7 i- e3 Z - #define ITCINTEN_SHIFT 21
/ Z/ L+ u' E# n \ - #define TCCHEN_SHIFT 22+ }6 {. ^6 I6 ?) W) Y7 ]% r
- #define ITCCHEN_SHIFT 23
5 {9 v J2 N. T" e! V- G
4 V$ S5 H% y/ N2 ~- static volatile int irqraised1 = 0;
8 N/ u% Q6 R3 D& F+ M X - static volatile int irqraised2 = 0;
1 W, ~7 v3 P6 L% i* l
: l. t' n8 V- a; [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 X6 j9 v6 J7 b. H- @( _- W: x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 W2 J: b* ?8 l# r& G* L$ k2 W7 S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Y. ^) ?; a" x3 O& x
- ) |' L5 G7 N p) T: z2 \1 ^
- dma_addr_t dmaphyssrc1 = 0;& E1 R- r" ]( i1 W: w
- dma_addr_t dmaphyssrc2 = 0;; t. z5 |2 `# q
- dma_addr_t dmaphysdest1 = 0;2 I2 a$ Y9 M& l0 O; q( ?1 ^# C& j
- dma_addr_t dmaphysdest2 = 0;
1 `* \0 k' D: X, R/ P6 k) ]
0 d' |6 Q1 B4 Z0 W) c8 Y- char *dmabufsrc1 = NULL;7 c$ d9 d) l) j1 c2 I# G' _
- char *dmabufsrc2 = NULL;- _$ k8 a# e$ ]; a( Y& W
- char *dmabufdest1 = NULL;" E+ J& ]) J2 g) F* g S
- char *dmabufdest2 = NULL;. w2 a* e( X5 B. d; b
- / B @1 p' U6 {' x: U8 ~
- static int acnt = 512;
9 A5 q4 l* V6 C' y - static int bcnt = 8;
2 |: u0 ?0 B/ p0 U7 U - static int ccnt = 8;
% }6 ^) W1 m8 k I% }( R' ^ - u' F# y, i1 L
- module_param(acnt, int, S_IRUGO);# I* j$ j" r2 a- @
- module_param(bcnt, int, S_IRUGO);
0 J T' e. t1 V/ D7 f3 z9 O - module_param(ccnt, int, S_IRUGO);
复制代码 + a8 `0 C/ r% ]) E
: n( ]2 @& A$ Z; |6 K* U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 l+ D8 q) x% I, e4 l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- i7 P. `( E7 y: I- ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ W/ h" g+ N* R5 J, \3 n8 @, m8 W3 w& R3 Y0 k: P; s' |& k3 t
4 L5 x. [' T3 F [7 x% H- ~
|
|