|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % E/ P( j' b6 M6 u7 `8 w
- [code]EDMA sample test application. s* p; a3 Q1 \- P( p' o! B' I
- /*0 z3 L1 a. d( ~% ^+ X
- * edma_test.c
$ a. q6 `4 R& R+ L0 f - *' a( n6 A2 Y4 u9 ^. e9 O2 ~& ^- H* W
- * brief EDMA3 Test Application2 q8 C |% Z9 V6 `1 j+ ^5 u
- *
; C+ }7 D. m2 a7 b% W! \5 E - * This file contains EDMA3 Test code. T1 h1 `$ h2 ]! _: p7 _7 g
- *
( K4 {0 Z% Z. i( r+ K- j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
x' I, v# i$ T/ K* ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 i' T! E# G* K
- * TO CHANGE.1 E! f' d* \7 T4 c- O
- *
, l! h) F6 o0 q& [: j7 B2 B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 F5 a4 b; X3 f) t& b6 [ - *
- b. M a# R/ q( R - * This program is free software; you can redistribute it and/or
* n, R: | }; {$ t8 q4 _ - * modify it under the terms of the GNU General Public License as
/ h- ^. s( k% J: a$ X1 I( L - * published by the Free Software Foundation version 2.
: a7 \8 h- x8 p' G - *
' H( q, k+ @7 s! F* G7 X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 O/ B/ I2 Y/ _ S) f - * kind, whether express or implied; without even the implied warranty
1 z7 D {4 F) `6 J$ o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* a2 B5 n5 r2 h& @8 y$ K2 {2 W - * GNU General Public License for more details.2 k/ S4 [0 H9 k. ~! m: `4 X# j u* ?
- */. T7 d, L& z0 M% l7 f1 J0 `0 \& A
- C! {/ g1 a$ Y0 U
- #include <linux/module.h>
* V3 I; u, u3 _( P5 P+ N% N( C - #include <linux/init.h>" O6 Y( |3 t: G9 |2 t' M
- #include <linux/errno.h>
, j2 X- O. u( u2 I- r) e - #include <linux/types.h>
5 @- b" u6 h& i% Z* m/ ^2 x - #include <linux/interrupt.h>
6 |; ?+ m3 W- M* M% O$ D - #include <asm/io.h>
7 [) U- \4 x. r+ W& l" ~) ?& ^ - #include <linux/moduleparam.h>
/ y' S4 a# g6 O0 z5 j! h; V3 [6 l, ? - #include <linux/sysctl.h>. {3 W6 W; j+ S! D
- #include <linux/mm.h>
: b4 h) ?" D7 G. P - #include <linux/dma-mapping.h>4 ]$ ?3 j0 m2 Z1 `7 m, \
- . p8 W* W0 T# F! p9 M5 U: B) J
- #include <mach/memory.h>
* A) t4 }! f+ c$ |; H" A - #include <mach/hardware.h>
|5 u- ^9 b2 N+ x) [ - #include <mach/irqs.h>
& p7 S$ A. F3 p" c1 ~ S1 ^" ?- ~ - #include <asm/hardware/edma.h>2 n. ?( q5 a: A( O! X9 B
- & F) }4 h. J, G c& s
- #undef EDMA3_DEBUG; }. n2 Q" ^9 U0 D( F9 t4 ^
- /*#define EDMA3_DEBUG*/
1 A, O; S" _$ u4 g' q - $ s" Y* T7 m3 A
- #ifdef EDMA3_DEBUG
) r5 F. u. @' ~1 @& L* W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- z2 q# w9 V4 F: ^" } o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 Z7 u9 C' y9 ~7 U - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- Z9 f( s- e+ o5 J8 n1 T$ O - #else3 Q* _1 N7 `$ F+ p5 W1 b7 @
- #define DMA_PRINTK( x... )
/ v( ^3 \2 g& e - #define DMA_FN_IN) z1 W/ n# A( c; D) N/ E
- #define DMA_FN_OUT
( ?) K' x9 @# ` - #endif2 x. z. l0 J9 W5 C2 ?1 r2 E( K
- ; _: s2 ]3 t% c. j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 d" G" c& O% E# M9 |; W* m
- #define STATIC_SHIFT 3$ V) C% j3 b* J" q3 p* w) m
- #define TCINTEN_SHIFT 204 g/ d) U3 J. @4 Z* T/ t1 H% x
- #define ITCINTEN_SHIFT 216 o3 ?, V% n' h" s( _9 v! X
- #define TCCHEN_SHIFT 22 J0 ?- j& Y# m5 B# b
- #define ITCCHEN_SHIFT 23
+ E7 `" E3 n0 A, T7 z
2 Q3 D$ S) F, l6 x! D6 t$ m4 H: ?- static volatile int irqraised1 = 0;. W1 N$ d1 ?7 P: X! F3 F6 [
- static volatile int irqraised2 = 0;
+ b. O% y4 e# K! u7 S8 e. u
9 H2 a% k7 ?) c N/ {6 j( C1 K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; W- [+ @) I4 ^, N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% G; i: S# _' m1 u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: ?1 m6 p- W& G- S& W - ! e+ c) O7 f2 a* L
- dma_addr_t dmaphyssrc1 = 0;# k5 W2 o: v( f
- dma_addr_t dmaphyssrc2 = 0;
" R# B( j7 b9 A* s- A - dma_addr_t dmaphysdest1 = 0;9 a/ D' c& T* ]
- dma_addr_t dmaphysdest2 = 0;1 l/ ~6 }( B" z' `6 n
% [6 J% J5 ?# s, l/ a5 P- char *dmabufsrc1 = NULL;3 c3 X9 g/ y6 ]% r/ B
- char *dmabufsrc2 = NULL;
& B' X2 d" R; a8 B+ H, _ - char *dmabufdest1 = NULL;0 I4 }% q- `6 I
- char *dmabufdest2 = NULL;$ A4 v) e8 R; a, g4 j
2 W5 K4 Z" w- O: f, U- I/ N. f- static int acnt = 512;$ g* g3 v# e4 T
- static int bcnt = 8; b# B; `' {* V3 X5 u* y
- static int ccnt = 8;
, n5 @1 _0 g( N0 F2 r: ? - + F2 \% U" n4 N6 U
- module_param(acnt, int, S_IRUGO);
% C. d$ F# [" T9 c! j - module_param(bcnt, int, S_IRUGO);. c8 k y# R2 b$ E- [. C, }; w
- module_param(ccnt, int, S_IRUGO);
复制代码 ' M9 j7 y. {9 H' |6 K# ^) o( |: e
7 e; O2 r" J9 [) d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 u! V9 u5 l W2 h& e/ @- I4 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 J/ p+ t" L6 [. q9 Q0 R. Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& E, q4 ]$ g2 {& \5 K- W
& v& h1 o5 [* X% ` ~, ?
/ Y) D" ]1 A( X
|
|