|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) p# y9 d* ~2 o) ^/ p- [code]EDMA sample test application
) t3 C9 Y0 Z6 \3 B- t - /*5 ?2 A+ c/ T; l2 L4 x
- * edma_test.c
5 w( j/ y) a: q, I1 I0 p - *8 I3 Y( `! z/ y% Z: c: [+ l) I
- * brief EDMA3 Test Application% K5 L {9 U1 l' f7 V/ l7 B8 M
- *% c1 N6 l C$ k/ J5 H9 W
- * This file contains EDMA3 Test code.4 ?" X. Z! @( o, F
- *
+ e+ ^) p2 \$ {% B {9 E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ e3 i" m Q! }: O/ q7 i/ C
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- h0 w2 |: a& [# c3 {0 l: ^
- * TO CHANGE.
& N- a Q, I" i I; }) W8 C* D7 l - *
}6 f4 G8 } g7 o6 ]! x. ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" ]9 z; Y9 Z7 {( W0 w2 @; _# U c - *: P. k5 b' o2 a* Y1 l4 H, S
- * This program is free software; you can redistribute it and/or: A6 c. N$ I/ z( L0 E6 P
- * modify it under the terms of the GNU General Public License as
/ Z- n- {$ q2 R1 H+ ^% `6 d - * published by the Free Software Foundation version 2.
' g7 S5 C. ~ ?+ F3 z' `* k& Z& Q - *$ I C9 t8 T6 x' S# X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- g2 a, O8 `6 C" T8 e1 t - * kind, whether express or implied; without even the implied warranty0 ~: a: L& {) T$ z* } K4 `5 r2 d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: I$ `: I/ r8 U% {- S2 E2 c
- * GNU General Public License for more details./ I4 L) ]" X# ^; e- T7 @
- */+ V$ T' C3 n8 n$ k
8 v0 K9 N3 z8 y3 w$ S- P- #include <linux/module.h>0 j/ c3 ~2 x9 B
- #include <linux/init.h>
1 X; j5 X4 m/ `/ O - #include <linux/errno.h>4 A/ k% E, u. B4 E4 ^
- #include <linux/types.h>2 {" L% k* W8 S/ _$ V9 W. X
- #include <linux/interrupt.h>8 I$ R0 f3 q+ o. J' X7 w
- #include <asm/io.h>
0 U9 q+ v" g: L Z) Y - #include <linux/moduleparam.h>
) L% q* n0 ?7 v+ }$ i2 U4 w - #include <linux/sysctl.h>
$ T _1 M" W% {8 [3 o; X3 c/ y1 k - #include <linux/mm.h>
- R) l. |) i3 c/ Z. P1 q7 c - #include <linux/dma-mapping.h>
T" d& d: J; L d# i1 m7 Q
0 L; \+ ?! D9 T- #include <mach/memory.h>
- s! U$ p$ K$ K0 ?: o - #include <mach/hardware.h>4 S# w" D. ^) [
- #include <mach/irqs.h>/ [6 G7 F" g; I8 r0 d! h
- #include <asm/hardware/edma.h>( c0 a; E4 l; B5 r o$ C# ^8 V
+ I$ p+ x+ k7 ~' l$ v% `' t( F- #undef EDMA3_DEBUG
! _/ k) u5 C4 ?9 W; [4 C$ k4 j - /*#define EDMA3_DEBUG*/
2 [8 K& u& ^) {/ P1 r: p
3 T3 t) ?8 Q$ K: R1 {- #ifdef EDMA3_DEBUG
7 J5 |6 B7 v# R5 L; `6 \0 f% s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- g# B% d$ n4 C, V7 K. f$ g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' Z, \8 n+ a5 ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 x. |7 r% T% |0 X% D0 [- K7 F - #else9 }9 n% N7 h- K" ^
- #define DMA_PRINTK( x... )
/ q/ W% o/ r' P- c' }: I& f - #define DMA_FN_IN
7 R! m% q2 R4 P6 M3 i( v - #define DMA_FN_OUT
) {& b2 r- ^. V5 x8 e9 A! [ - #endif( Y) _6 P' g* z( J+ v3 Q
- " G2 V; I E# ~1 @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 l6 P! j& _/ c0 I4 w - #define STATIC_SHIFT 3: L, x* v9 i( u, r0 j: w" J; f
- #define TCINTEN_SHIFT 20
0 X. |0 j( \ m$ E6 f5 O" k - #define ITCINTEN_SHIFT 21
7 e/ x1 O) X! H6 k - #define TCCHEN_SHIFT 22
( r/ ]' s3 @: d. d - #define ITCCHEN_SHIFT 23" Y$ Q( q9 R8 c" _; o
: X- B7 K [$ O5 n. g- static volatile int irqraised1 = 0;
0 o/ e" }' T' J T' _: o" V, k8 l q: ~ - static volatile int irqraised2 = 0;
( b: J8 Q+ O+ C1 {4 u% P' h
3 z5 a4 G/ G7 \5 W9 T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. `" R: a1 W3 ~+ N+ p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 G8 g! n9 }, N% i# L% w; g U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" d2 N3 n! F5 v% e
- + f# s' [; {+ |! O, G8 ]
- dma_addr_t dmaphyssrc1 = 0;
6 B0 [# T2 r" U - dma_addr_t dmaphyssrc2 = 0;1 \" H" H) _4 u5 e* S: b8 l9 ]
- dma_addr_t dmaphysdest1 = 0;
, x; v* C7 e0 d% U% L* \/ H7 n# d" G - dma_addr_t dmaphysdest2 = 0;! l( T! E! u/ ~5 z9 s
- ; J- G L/ E0 r1 G
- char *dmabufsrc1 = NULL;/ \3 r3 Q9 j: \7 u- K# [/ v7 d
- char *dmabufsrc2 = NULL;8 A& m8 {: n% ]! t9 e
- char *dmabufdest1 = NULL;
4 M3 T% n3 K1 }" e - char *dmabufdest2 = NULL;
. K9 M; j1 N+ l) |9 B- J
* n' J5 I0 Z! w/ \ L- static int acnt = 512;* M+ W& F# P" {7 H" r
- static int bcnt = 8;
) }" }$ Y8 O9 A; i2 x% S - static int ccnt = 8;* H3 s8 B3 u6 I; C
- 3 ~9 N& C9 J) U) b% ^' S# ~' h
- module_param(acnt, int, S_IRUGO);
$ {) P8 |( Y I% z - module_param(bcnt, int, S_IRUGO);
+ R* l9 M2 ^! J. g6 |7 J - module_param(ccnt, int, S_IRUGO);
复制代码
T: f: s8 M5 ?6 Z9 d# O3 s' H* _
7 I! ?( o7 K( W$ f' f8 Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. u: A% ^! L& `. |2 c* M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( i+ J& a# _6 E& n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# U; |- l, Q. u: Y' v9 O
0 a( J; N( D/ j5 D8 O0 E1 ?9 K
" m6 D E6 [5 y5 V& G+ e |
|