|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ k, T9 T, D- N* X& C) s; M
- [code]EDMA sample test application2 L+ j4 F1 i4 t6 M7 Z O* I
- /*8 C* ]5 }0 C" l; c- S0 s$ r
- * edma_test.c0 ^9 C- v4 X: C+ `/ N$ q0 K: Q
- *; r! l! I1 S) E5 G( |
- * brief EDMA3 Test Application
; P1 h, x1 X: b: V6 ] - *4 a" e3 ^, W5 n$ C/ y
- * This file contains EDMA3 Test code.
4 O: ^4 `/ E$ _/ ]2 y - *, J* S2 b( v, a# V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
v* N4 |' j; {: b' M% h2 Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' n/ T' x1 g; Z. j: ^
- * TO CHANGE.
1 f' ~2 \& U6 D8 i7 T* D - *
- N3 p' a1 i1 F ~$ a$ ? - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, D7 y3 Q( H7 Z. n6 A - *5 h/ A6 c8 ]% ]) M `/ D$ e# F# o8 D/ q
- * This program is free software; you can redistribute it and/or
6 i4 V& G9 G5 w - * modify it under the terms of the GNU General Public License as7 U1 v' [" Z" _+ F P! ~
- * published by the Free Software Foundation version 2.8 D3 ]7 {1 d6 ?0 z
- *
3 E6 y% L/ C* k0 Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; l- Z' L! Q% e$ ?7 q6 d3 D - * kind, whether express or implied; without even the implied warranty l9 e3 l6 x. v$ c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, L' j8 m9 A3 s$ f% {- C - * GNU General Public License for more details.! K3 V5 g* @6 U4 P) @
- */
6 d9 K ^9 I2 J! E
. R/ e" l/ t# V: r- v% Q- #include <linux/module.h>
0 H: H Z3 V9 |# Z! Y - #include <linux/init.h>, C5 T; f0 X3 {/ n. Z9 I" d* Q
- #include <linux/errno.h>9 J: b. I% y2 S" I
- #include <linux/types.h>
9 X1 F- T- b- t; j% G; k' T - #include <linux/interrupt.h>
4 T& y! ^/ p3 K" F Y8 J - #include <asm/io.h>7 u- S, ]3 s- M0 ^$ b9 n3 W0 f4 B
- #include <linux/moduleparam.h>1 N3 v. x) h$ o
- #include <linux/sysctl.h>
( R- R9 k- J5 h8 t2 Y/ h - #include <linux/mm.h>$ r G) L. r7 [6 ?# j% U+ X7 }
- #include <linux/dma-mapping.h>
* t4 Q. i' I1 I3 F+ G" C; i: O - & P5 _: R6 l+ \4 ]: O
- #include <mach/memory.h>
' O# H" D+ _9 h9 ~, L8 s/ { - #include <mach/hardware.h>
$ p, d/ H& G2 n0 v0 S' Z3 H - #include <mach/irqs.h>' I, K2 `8 E7 d/ W6 @+ x
- #include <asm/hardware/edma.h>1 G+ g F I: Y" p" U$ X1 c
- $ l: F5 n, j$ q$ a+ r# ?- a
- #undef EDMA3_DEBUG
0 P4 Q G8 Z$ l( }3 u9 m - /*#define EDMA3_DEBUG*/
% K2 W, L0 I, y+ D! Z' c - 6 s; @9 ]5 b% X$ o
- #ifdef EDMA3_DEBUG
' L: Y; V+ o: P4 ?; a! {5 |! y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 ^9 a* o8 F! r0 }3 r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): q: k: a, ^0 ~7 R. m% Q' K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# g3 l7 p" S4 q3 ^& a2 k - #else
9 J+ S4 Q2 P* l6 ]% C! Q - #define DMA_PRINTK( x... )1 W% s2 R+ l- E8 l
- #define DMA_FN_IN3 ^7 l0 l S, @ W6 U5 M
- #define DMA_FN_OUT
1 f0 `0 Q& G; i! {7 d7 s: a - #endif2 `5 L3 s* \% B2 B' x
- 1 K9 c0 Q% J4 |% F- V! o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- f5 Y' a% j: T1 r0 V3 c0 Z - #define STATIC_SHIFT 3
! H4 `" a( t* _2 [% ` - #define TCINTEN_SHIFT 203 N6 @; F7 k8 T P- E4 [! u( E$ _' v
- #define ITCINTEN_SHIFT 21
! C, _9 v& E$ ]8 v) J5 { - #define TCCHEN_SHIFT 22& n3 O; n# O$ G! w/ i. I5 a
- #define ITCCHEN_SHIFT 231 W- Q/ y2 O0 f$ S4 K3 B, A
- 8 f$ m2 S! g9 k% B
- static volatile int irqraised1 = 0;
1 V9 P3 w M% W2 W( f* d1 F - static volatile int irqraised2 = 0;
; E! Q0 u$ r$ l3 t( A1 O - ! w9 G ] S- b1 `0 Y/ o; q( Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: _! ?% C9 P9 p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 M( \% \9 V. H- w# I( u
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; m l% T2 b c+ _: M1 K! X
- O: Q# H- `! g6 A( Z- dma_addr_t dmaphyssrc1 = 0;
4 |5 n' {) D# Z" ?) P) @( U# i1 { - dma_addr_t dmaphyssrc2 = 0;3 ^4 @; C, e& \& D( n' }1 A: U
- dma_addr_t dmaphysdest1 = 0;
7 N4 H: }: F% G; I2 J! B2 Y - dma_addr_t dmaphysdest2 = 0;/ Z- x& r e0 K! e Z j+ Y3 d( O
x9 x# r5 R9 }/ h5 S- char *dmabufsrc1 = NULL;+ J, d7 a0 {, v+ Z
- char *dmabufsrc2 = NULL;
, _& B! D# X$ c+ U5 G( d9 q - char *dmabufdest1 = NULL;( M: z8 x. `6 O9 D
- char *dmabufdest2 = NULL;. b4 @1 T9 _* J/ g/ t5 B
- 9 W6 B j! A5 r8 O
- static int acnt = 512;
' [8 N+ m( |; A( y% g7 } ^ - static int bcnt = 8;" U0 ]2 @& {- ~: k6 a1 l) Q" T
- static int ccnt = 8;/ r1 J ~0 o4 [
W) k. Z, ?( u- module_param(acnt, int, S_IRUGO);
; I! J1 e$ u( b - module_param(bcnt, int, S_IRUGO);4 T0 j6 G/ `4 I5 w# f2 ?* S; i
- module_param(ccnt, int, S_IRUGO);
复制代码 6 V, D" W$ P. {/ q9 e6 m7 t% w) H) \
8 ?* `: J9 O7 N5 o( Q! U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" z- ]2 Y" Z# o0 x5 i' o4 H7 Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: w- ~. i9 C' b! N7 h h# F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 T5 C8 t+ J) H
, [+ Y4 u. x( e
# G d& C! }- _: z; W
|
|