|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. V4 x& i: ]" y: `- [code]EDMA sample test application
9 d5 H w8 Z* c( ^5 ? - /*
/ c7 Y! g- K+ m5 Q( a R4 t2 o9 s - * edma_test.c$ D% r$ J+ E% i# L
- *, A: L, b3 I5 {* k
- * brief EDMA3 Test Application
& {$ k8 M7 Y! u$ d9 ? - *
2 c* V; H" [- j2 U h& u( z - * This file contains EDMA3 Test code.
& T( ?* A3 D) g$ N% F s - *% x) S) _$ @6 |" J% A |8 w* v+ [6 |; E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. o$ R- D j- x$ C5 Y# B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ a# ~4 a. j* }/ b. U2 I" v - * TO CHANGE.- t& i% L( \6 G* f% R! D/ l
- *3 Y2 d9 c7 ^8 k- @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// N8 I, e: L3 E& z4 s& \
- *
; r" v! j5 V. Z/ ^' B! H - * This program is free software; you can redistribute it and/or8 ^- b1 U( c' v$ M
- * modify it under the terms of the GNU General Public License as9 I& Y/ U( G9 G' W5 Z& _4 T
- * published by the Free Software Foundation version 2.
; w; h% z' ^9 _. s! v" K) h - *( n" X8 \5 v4 D/ U1 ?2 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 W8 j! e5 F9 J$ h3 Y
- * kind, whether express or implied; without even the implied warranty; e _( S8 ?6 ^8 y# \
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" s$ c4 r* @; M% r: p+ y" p5 m - * GNU General Public License for more details.
: W! Y% q9 X- z6 {* @ - */
+ K2 A; i# E$ Q7 R" y% _" \# J
9 J, d' r; j8 m5 A5 A. X/ v1 l- #include <linux/module.h>8 ] y1 }& b. U& O) s
- #include <linux/init.h>7 _+ a' [% N3 I- X8 ~* M
- #include <linux/errno.h>, p v! T6 V# _0 y$ L* C
- #include <linux/types.h>
" x2 H# Y! ^0 _* K - #include <linux/interrupt.h>
4 O7 F2 z' R! v$ L6 C: h - #include <asm/io.h>) w# B% G8 b3 c' C; I; Q% i( m
- #include <linux/moduleparam.h>
9 R: ?& i E, m d - #include <linux/sysctl.h>9 e* o Z/ ^6 Y) t' O/ D7 |
- #include <linux/mm.h>
2 b; R4 B) ^$ |" ^ - #include <linux/dma-mapping.h>
7 ?/ ~. T4 U+ p& A1 Z/ S& p& v - & j7 y4 T( m% A+ u+ R
- #include <mach/memory.h>) k, t2 D' U) g* W0 \1 d5 j
- #include <mach/hardware.h>
! |% g! ^+ G/ o/ j" M" }; x - #include <mach/irqs.h>
* O F" U& B/ }" j+ s& i8 |; L. K - #include <asm/hardware/edma.h>6 `8 i; }1 m9 o: {5 Q; C
0 u3 @7 {) a3 T* P6 S7 ?8 ]$ V- #undef EDMA3_DEBUG8 Z2 t3 R$ ? X! I! {, g2 Z" H
- /*#define EDMA3_DEBUG*/" l; _" H: k9 v! V& T1 b6 v! P
- ' F+ G' E# e9 |" |" S
- #ifdef EDMA3_DEBUG" K/ {4 B w ~! S- i4 E$ c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ ]2 M1 ~4 \" c, I3 o; b+ h8 B7 h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& O1 ^5 h! N C9 z: S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 Y9 S& H9 O$ r; a2 ]1 I0 H - #else
0 I5 l- g4 n- |2 e& A5 g - #define DMA_PRINTK( x... )
5 X E; ~9 F6 f& P) D. P - #define DMA_FN_IN
' Q! M6 P. Q' m- x - #define DMA_FN_OUT
& @; ^& I5 L. l7 e, _- a. K3 K - #endif
- x( f5 l( Y N+ u4 U9 z - , t' ^( k0 z' X) B3 J7 p: T" T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 w" R6 ^6 B2 x; H1 a, G2 [4 S
- #define STATIC_SHIFT 3
" N* n' }! P+ j4 X$ o - #define TCINTEN_SHIFT 20
( G- X, V3 p& t/ @0 H2 F( j+ B - #define ITCINTEN_SHIFT 210 w+ b7 I1 L' g d0 f
- #define TCCHEN_SHIFT 22
* x- H* b& X6 Z! D6 _9 P/ N - #define ITCCHEN_SHIFT 230 J( u' G) P& o3 ]
- 6 {6 Y6 Q; l5 d+ H0 k; o6 L8 W
- static volatile int irqraised1 = 0;1 `8 K, @! O6 u( I+ I
- static volatile int irqraised2 = 0;( F# D& |- w* D! z
- 5 D: ?) e$ u1 N& D2 M( q' p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 B2 [7 {; _8 J! D8 V4 |2 W2 F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. B. _7 r4 Y9 T4 Y" Y- y6 E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 u, j% ]( v2 O" ]
- 3 w' E0 T8 t: z& V P) I- Y- |
- dma_addr_t dmaphyssrc1 = 0;
! U: P0 u, r5 A3 N/ ?/ o8 H - dma_addr_t dmaphyssrc2 = 0;% ^. W5 r' w( r# a
- dma_addr_t dmaphysdest1 = 0;7 i, N2 h. O3 i% }! Y& p
- dma_addr_t dmaphysdest2 = 0;
3 R1 K- O# O, s1 R$ U
3 L( T6 D! d+ \* n( w0 T- char *dmabufsrc1 = NULL;5 D4 _: w) P* j$ d; z/ W: T
- char *dmabufsrc2 = NULL;
( |; J2 y) ^) c3 R/ \( k% n+ A - char *dmabufdest1 = NULL;. C& y8 h) |! R& J
- char *dmabufdest2 = NULL;+ O( _! c% B8 J, B+ x
_* Y* x' T: h. a+ k; }" A& Y5 B- static int acnt = 512;
: o& ]( L8 P( U, T: p+ Z - static int bcnt = 8;
; m( z+ P: Z1 Y4 H1 f - static int ccnt = 8;
1 @) Q: N3 ?% g9 Q
. {, v0 K* V: A3 z! a- module_param(acnt, int, S_IRUGO);0 P; E& u) F9 x0 j& v( b
- module_param(bcnt, int, S_IRUGO);
7 f M1 s/ S( _8 F - module_param(ccnt, int, S_IRUGO);
复制代码
3 y3 c3 L* o3 E X9 |; L& R- K' z3 r! t; Q* C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 f3 ?) E0 E& X, A8 O9 Oarm-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% z; f; r; k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) c6 t4 T5 C2 Y7 |# n$ a
5 [1 H& U; Z. y* O
9 V' t0 }6 Z$ ` |
|