|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 @7 u+ ?; ]4 e; P; A9 h- [code]EDMA sample test application+ t, F6 C( f1 @" b" @" n- l. P
- /*
3 S1 B- [) U8 W: } - * edma_test.c- G" ~( I) Y% \& U. e5 K
- *
2 ]$ w' T4 r5 T, Y {# G - * brief EDMA3 Test Application+ S5 x$ @6 N$ m1 {% ^ W: n
- *, k ~9 j: m; p2 b& @
- * This file contains EDMA3 Test code.- K' R+ Q4 h+ ], R
- *
% A% U& n X4 J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& k8 R: m9 [( B, z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; q4 N4 ^6 n/ S2 e" R - * TO CHANGE.
( |6 j% W$ |& G: S' c) V9 h - *, Y5 v" c$ h% J# |3 x% y" e
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, f0 J7 g5 E1 Z3 f, N - *5 w" x$ ~6 E* N. b( w- n
- * This program is free software; you can redistribute it and/or
* Q/ R% B! h' N6 k2 p - * modify it under the terms of the GNU General Public License as
! v/ I2 l/ B' x2 {2 c- P/ ^! t; U - * published by the Free Software Foundation version 2.$ h7 C# `7 Z8 S3 Y/ k/ v
- *
# o3 R0 W5 [) Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: q2 K3 Z: X3 K. K, ?, y+ i; ` - * kind, whether express or implied; without even the implied warranty
* F/ v1 N/ o$ r. D6 T; J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; L6 _% H8 q$ b9 R9 o - * GNU General Public License for more details.' \. S& f: m- v" c7 b; Q9 Y
- */2 x0 n: m3 k$ ]$ r7 @; d) n
- # a5 q7 U4 U1 x5 }
- #include <linux/module.h>
5 ]. `/ j4 T2 e* P - #include <linux/init.h>
+ A+ I0 k# Q8 a1 B% s - #include <linux/errno.h>" T, S8 v, l8 z. U2 a
- #include <linux/types.h>
}+ ^9 U9 `- E1 b' ^2 G l - #include <linux/interrupt.h>
' R) k! a9 F& z6 R$ v8 G* z - #include <asm/io.h>
' N4 t& b. v1 X: o$ y* z2 f+ P( W% Z - #include <linux/moduleparam.h>
# T0 X z# ~2 p' S( S5 E! t2 H - #include <linux/sysctl.h> x V: A; |$ R C- C, ~2 {8 y
- #include <linux/mm.h>* \" @9 b+ l, s4 `. ^5 q
- #include <linux/dma-mapping.h>4 _$ r, j! `4 e. i0 s+ g
- + \# v0 i- }; ~- c4 h" k; g
- #include <mach/memory.h>6 I- R5 ?2 G0 C q7 f4 _
- #include <mach/hardware.h>0 {* F1 q8 x' k
- #include <mach/irqs.h>
0 V, T7 p' `% i- L Y - #include <asm/hardware/edma.h>
6 Y& A' Z$ k# X7 p! N* l0 Z
0 K& ^$ E+ v" P* G- #undef EDMA3_DEBUG% j# j6 n; D( d' @
- /*#define EDMA3_DEBUG*/( t. m+ F+ V0 @% s: O2 h, }
- $ \# o% I+ a) d4 C2 W N/ M# s! B2 Y
- #ifdef EDMA3_DEBUG r2 W" P- ?- q e0 c6 U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ E5 f3 f" q0 [2 N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% E) u9 V+ N1 V, }7 o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 l \6 ~8 n4 }: E6 o - #else; r! i$ C' Y3 _8 S5 |
- #define DMA_PRINTK( x... )
' D$ h+ k9 W2 k" X4 B - #define DMA_FN_IN
7 m6 p/ s$ x4 [ - #define DMA_FN_OUT
: H: F" e! k. D* s% Y7 ]/ E - #endif# M, q& W N8 T9 W# G0 R9 `
- ' l2 h+ z! |/ R- e: s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 `% x: i; g3 d, z8 R2 |, J - #define STATIC_SHIFT 34 {" R( Y6 ~) y! \( O8 N
- #define TCINTEN_SHIFT 20
1 n: n6 ~% t0 S, W% Z$ c - #define ITCINTEN_SHIFT 21. w; b, q G( S9 J! L* V
- #define TCCHEN_SHIFT 22: r4 m4 ~( A: Y4 L, j! ]
- #define ITCCHEN_SHIFT 23 S7 J' I' F% Z1 G) n5 w
5 I: @* Z \! q5 e: Z$ i; N$ o/ l- static volatile int irqraised1 = 0;( X9 u9 p6 @6 a2 [- I" j3 f4 p
- static volatile int irqraised2 = 0;
7 R* s- b3 o3 ^! O* p+ Y9 u - + [6 B f1 Q0 E) C5 T% d0 o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; t$ o; \- R) J8 q+ J5 y" u! L- h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" I7 C) w+ x1 Y" k7 c: K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# S9 ^9 S7 j: u4 x1 L
+ @/ C. J0 m: A. c- dma_addr_t dmaphyssrc1 = 0;' b1 S( Y5 k. `8 X
- dma_addr_t dmaphyssrc2 = 0; z# S5 `. h6 e6 i! k2 h4 ]3 Y& d
- dma_addr_t dmaphysdest1 = 0;5 h1 k2 M2 m( E; P" V9 [
- dma_addr_t dmaphysdest2 = 0;
! Y/ g( U% _' ~# u, W" `% }1 i
3 { S1 a; L/ }% A0 s: q- char *dmabufsrc1 = NULL;- e7 Q7 j9 m# m$ |5 l3 Y9 f
- char *dmabufsrc2 = NULL;2 d5 P% H/ o3 O! G B' b! s
- char *dmabufdest1 = NULL;
) j5 H" A8 U6 i* m8 u - char *dmabufdest2 = NULL;- f& B" y C! W7 e5 y0 J( Q
- ( ]2 v) }3 ^; Z* J
- static int acnt = 512;6 y; p- K- d4 U
- static int bcnt = 8;
4 D: N- K& J5 D, |, z# Z" p- z7 a - static int ccnt = 8;
% b% N( r) P4 k9 Q; m - 9 |; P8 A# z F0 _) ?: y
- module_param(acnt, int, S_IRUGO);
+ U: T4 s. ]8 G/ }; Q3 L - module_param(bcnt, int, S_IRUGO);8 ?3 [8 `7 g/ \: R- Y3 W7 v
- module_param(ccnt, int, S_IRUGO);
复制代码 8 l' h# R& i0 a) s" o( l
# ?, `: Y. T5 U5 c, C+ \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 E$ _ Q* d& t( D% Y: Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ m9 ?6 s5 t7 r @& t- ]6 E p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 S$ Z3 M8 `$ Q P
* s, b! ]4 Y) L c" f& N9 O
' u' d2 G4 }! L7 ]7 l |
|