|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! ~$ D4 E: i# E
- [code]EDMA sample test application
+ n. Z7 D, t) c - /*
* V D2 {2 s) U. \ z - * edma_test.c
3 R1 T! u2 D2 `* V7 j; Z - *
. F/ _7 b! a" S* p! O; s2 n& m/ ]6 ~: [ - * brief EDMA3 Test Application: j6 ^7 k$ J7 x
- *
/ v. X b \4 P; ` - * This file contains EDMA3 Test code.% Q7 f/ W5 V! ^: U' B
- *
8 W# u2 j; ]+ M& s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 Y3 X: U0 n! ?1 l' X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% y/ A% _2 I* c: V+ E: a' c8 {' W - * TO CHANGE.8 l% P3 G1 r4 I0 C
- *0 M# L. b0 O7 k4 u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 G- }* c) J) _# r* F* @1 I
- *
& u% P* v+ p7 l% [) k - * This program is free software; you can redistribute it and/or
& j: p% q6 e& l) e - * modify it under the terms of the GNU General Public License as) s1 |- U3 N1 {2 v0 c
- * published by the Free Software Foundation version 2.
3 {. i6 b- u: L" y8 \: A - *% \' h; s& Z7 n {2 ]; X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 Q% d& B7 \6 p" f
- * kind, whether express or implied; without even the implied warranty0 E8 \. ~ Q( C- c* w! A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) a( q* {- E0 d& c2 `
- * GNU General Public License for more details., \( {! I2 l) v2 x7 q
- */
6 k, ?" R: V% a2 N5 |
# E4 F' Z, W- }: U5 }% r) f- #include <linux/module.h>
, U+ M4 e; ?, ~ - #include <linux/init.h>0 @$ C' `! Z/ c& n. _6 Q
- #include <linux/errno.h>3 u6 s4 @: d5 z
- #include <linux/types.h>
$ z: A: p) a. k1 _: M/ c% I5 r - #include <linux/interrupt.h>
0 J1 u1 Z! z/ Z5 c1 o - #include <asm/io.h>; k) L" [. d7 m
- #include <linux/moduleparam.h>5 }9 X) ~% a2 A; {; {- z5 R
- #include <linux/sysctl.h>
5 T5 }+ D' e* u8 C - #include <linux/mm.h>4 |5 |( Z! Q( ]; I9 l
- #include <linux/dma-mapping.h> O6 i% i- n' C/ r+ X
9 N$ L Y2 |6 M9 Y! j* @- z- #include <mach/memory.h>/ m. T/ }( a" g; z# W3 X" Q# W" [8 c
- #include <mach/hardware.h>; s9 |( J$ a. |/ n( t0 I
- #include <mach/irqs.h>! D% d: Z1 T+ y0 c+ R+ X/ Z5 S8 L
- #include <asm/hardware/edma.h>% u" T- e e; p( a
- - t( f: o: y) B% f) j8 j2 s1 l
- #undef EDMA3_DEBUG( s1 M8 ?5 X8 F. }% u5 f
- /*#define EDMA3_DEBUG*/) e g2 P7 B. Z" c9 S6 I$ C
; D0 t2 J$ \5 x- #ifdef EDMA3_DEBUG8 l! e1 s/ p H- _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). r0 _* y: P$ ~. ]0 P! u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, a( [$ I4 [# W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# c5 {6 c; P$ N2 Z5 t - #else4 j9 g" }& n3 o
- #define DMA_PRINTK( x... ): B) u( n! |* I. J( u
- #define DMA_FN_IN1 H- l2 C3 B; v8 n* p- F
- #define DMA_FN_OUT1 f' U9 [0 c. p+ I9 k* [3 m* ]
- #endif- h- L( S2 w* ]
- , ^9 P* |/ W% r! Q9 A# e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* G M: L3 d' m# O2 E- B1 P; t - #define STATIC_SHIFT 3" {1 `1 k- x* `# S. E7 _
- #define TCINTEN_SHIFT 20 {" a* I. D! ~) e7 O% i7 h0 A
- #define ITCINTEN_SHIFT 219 J2 x- U+ A: V6 E3 v; G% N: ^1 ]# G
- #define TCCHEN_SHIFT 22
. }8 f6 }0 u$ V% C9 t# Q - #define ITCCHEN_SHIFT 23( B* j+ {- F( Q. X
- 1 [' r7 O& {/ `& c$ a0 _) a; z7 n
- static volatile int irqraised1 = 0;8 A! _% ]# c7 g
- static volatile int irqraised2 = 0;5 [! n2 a; X4 R0 e
5 N& B. R. e6 s/ m- X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; o$ u; {1 w8 B0 K; q) o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* D( T5 B3 O2 G% `8 v: ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ k5 B9 Q* Y- R% Q L
3 I$ k& ~ p% F- dma_addr_t dmaphyssrc1 = 0;6 ~" j) @; x) a0 e# l8 d
- dma_addr_t dmaphyssrc2 = 0;
: Q; i% S: w4 i$ D( H5 m - dma_addr_t dmaphysdest1 = 0;6 Q( h* | |. ^
- dma_addr_t dmaphysdest2 = 0;
3 |* r8 D0 N! |" u - 5 N. s5 M0 {% {* {% k% E. X
- char *dmabufsrc1 = NULL;, X" x5 z8 B7 i0 w& V( v# ?: f
- char *dmabufsrc2 = NULL;+ c3 R! a/ I4 I1 U& h
- char *dmabufdest1 = NULL;2 o2 w+ @8 }+ M- A
- char *dmabufdest2 = NULL;
- \' ]6 K" W1 t
1 P4 @' G! M* ~0 O2 w- static int acnt = 512;
9 H0 N: }- @9 G - static int bcnt = 8;
) g2 ~- s8 K$ l8 E$ U - static int ccnt = 8;
! ~, [& g/ |* p; |5 b
. X% ^8 ?+ u) Q# w$ a! t- module_param(acnt, int, S_IRUGO);& {* u. p/ r' K( B4 d
- module_param(bcnt, int, S_IRUGO);
5 O( ?5 i9 o- K - module_param(ccnt, int, S_IRUGO);
复制代码
, \$ @2 Z) q2 w
$ o, f$ u5 R0 M( {$ m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 |. y6 T8 w. D6 P, Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 F9 z* u+ Y) X' W0 i# `: N% V( x4 }# f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- R$ S1 F9 A M2 Z q3 `, \/ {, U
5 k4 `* ?% v8 I
|
|