|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" P* s Q t2 A1 V" U* R: Q- [code]EDMA sample test application4 C3 g2 n0 c2 ?* D$ U3 D# Q3 v
- /*
. g% C+ ~, C4 f* J" q9 i - * edma_test.c
: c- l0 i2 K1 Z- u' d3 e4 p - *
( T' e f! _4 v8 p - * brief EDMA3 Test Application6 ^4 A0 |3 B8 N, ^
- *
2 e7 K% ]% ~' z6 g" } - * This file contains EDMA3 Test code.0 ^ t) C3 ~. x! e( s _
- *
3 `8 N- z Q; L& K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
v3 G+ }! G9 k8 y: U) I1 q& A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& S X$ A5 F- ~' r; Q
- * TO CHANGE.
6 g3 B; W6 E: |3 k( Z% u - *4 d; C! Q! E$ n( O( }, V9 v# u4 q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; m* J0 J. i/ E - *
5 ~! ?6 J. T; n. O - * This program is free software; you can redistribute it and/or4 y" Z) T+ ?) t! W4 r
- * modify it under the terms of the GNU General Public License as
' Q& X, A s) A/ q- g* q1 A6 Q( r$ w - * published by the Free Software Foundation version 2.( _. | H. V2 g$ ]' y( }. W: k h
- *
8 s, R1 c; w3 A/ q) i( a w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ S4 I0 w2 C/ a3 {) Q
- * kind, whether express or implied; without even the implied warranty
! ^1 W7 G2 R# v. }& w! h$ s3 e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- f1 u4 e8 m$ T2 c/ l9 c! ^ - * GNU General Public License for more details.
; B& ]9 H, r" a/ U5 t- Z5 q - */
3 F& F# ] I+ K& B, l. |
. Z1 o* a& M0 L `! j- #include <linux/module.h>+ U) _7 t+ j& C4 K4 Q
- #include <linux/init.h>
" j) X$ \6 N$ `" a0 M# ]% z; Q - #include <linux/errno.h>2 _& v5 B/ B7 n4 \9 `
- #include <linux/types.h>$ A! Z% T+ Q2 k1 I7 N
- #include <linux/interrupt.h>
0 ?/ Z: k& D+ K$ [ - #include <asm/io.h>( @8 W- G/ @ ]
- #include <linux/moduleparam.h>* w: [1 J2 n8 e2 B0 C' t
- #include <linux/sysctl.h>
9 H* k7 E2 T# P! c b8 r& C& U2 p3 G - #include <linux/mm.h>
$ C, s( K9 M* j F( I( } - #include <linux/dma-mapping.h>
. T+ u! g, y2 @, \2 [ - 0 @" Y+ L% X$ `7 B
- #include <mach/memory.h>
# [) ^ U9 R& h8 p5 r - #include <mach/hardware.h>* m2 h5 ]5 s8 i( R) }- x! j' O6 F3 Y
- #include <mach/irqs.h>
, ]3 Z4 N p" x1 \) g, r - #include <asm/hardware/edma.h>" ~2 H0 {- C- m' \0 C; Z
! S h$ _6 Q& j7 Q+ M0 H2 B( B- #undef EDMA3_DEBUG
; i$ \$ {/ c. Z: D7 ^% C- e! e4 F - /*#define EDMA3_DEBUG*/
* i# g( a/ }) I$ ? - 6 H- H) Z a3 S$ k3 k
- #ifdef EDMA3_DEBUG
3 }% R, T, v2 p# _; y; K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# N2 N# H4 i6 D2 Z& c6 ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ m; r# O/ p0 R0 U! S4 D, S1 V! s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ F/ a3 y, q) H4 U; D - #else
8 l4 b: Y. z4 J6 f" _ - #define DMA_PRINTK( x... )9 e6 u0 `1 S4 ?: | o" ^/ F
- #define DMA_FN_IN
; u; G9 \9 C9 a4 l( @ - #define DMA_FN_OUT( e: C% C* n8 W, F1 d. j+ l0 }
- #endif! h" M4 W, Z' ]8 }) D
- ) w& n/ N7 b" \$ @5 @! u! G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 K* t: j. E3 @: w/ h - #define STATIC_SHIFT 34 @- l; L" k& c# k
- #define TCINTEN_SHIFT 20! }" O \# W! w* S
- #define ITCINTEN_SHIFT 212 l6 l; ~0 x/ a4 T
- #define TCCHEN_SHIFT 22
. U* v A: |+ h$ Z* ^" R. j - #define ITCCHEN_SHIFT 234 y+ m9 R4 f1 t$ b
- % k; c; R4 v+ H9 T2 k
- static volatile int irqraised1 = 0;
/ c: i0 Q7 ^: D' X8 Y - static volatile int irqraised2 = 0;
6 b$ g: i7 H' G5 H; \
$ l# ]+ {! \! E$ f+ O9 y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- d* L* P1 X9 L$ f; n( b) p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" W/ A! R& j5 h/ [! O4 V0 ?: }) ?, j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: Y N) f e# P: `. y
5 R9 j6 o* r/ U0 h4 y! p1 U- dma_addr_t dmaphyssrc1 = 0;
$ H/ U+ w0 U2 A - dma_addr_t dmaphyssrc2 = 0;
( J ]& h' [# P - dma_addr_t dmaphysdest1 = 0;. h+ f/ b7 s# n
- dma_addr_t dmaphysdest2 = 0;
8 J0 c7 S/ x+ ~' u
6 k( [- r8 G5 |8 ?, ?- char *dmabufsrc1 = NULL;% G2 k3 I3 o) {. f4 ]& z: r, a; G$ n ~
- char *dmabufsrc2 = NULL;; p" b7 }1 Y0 o8 p5 C3 Z
- char *dmabufdest1 = NULL;
* |; O! B6 z4 B! z& K - char *dmabufdest2 = NULL;
; i. a: l; f5 b5 Z( x
( T# Q. h+ R; k. l2 R5 j9 d8 T9 f- static int acnt = 512;( X0 J6 H: p0 _
- static int bcnt = 8;
. [' T H0 {4 V1 U! N% |4 k8 ] - static int ccnt = 8;
1 X6 t9 D, X" E! q9 ^; j, C4 L - 5 F$ G% I; h) a- j9 |& G. r2 l
- module_param(acnt, int, S_IRUGO);7 w. v& G x8 s$ E% t& T
- module_param(bcnt, int, S_IRUGO);0 H: N. P2 `% B. I0 m/ n( \; b
- module_param(ccnt, int, S_IRUGO);
复制代码
* C+ Y6 z( Z, ^# x
/ C$ J% q$ e- m6 V" ~4 A: O6 N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, r2 g8 [# _+ r; k/ [% i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ u% u; V0 Z- j9 }/ Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 c3 T: U! H- f) r f- T; I' t' H
9 v' f! _8 \/ i! @+ F* Q8 |6 R
' E" e: R+ g7 x' p- u- k1 [ |
|