|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 m: J5 W" Z7 D5 H
- [code]EDMA sample test application" g8 y9 p0 B* k4 B4 D& t. y
- /*
( C+ y6 O* g; F& k1 q ] - * edma_test.c2 z) V( C& o' h `0 R
- *
) }% y0 R. Y8 o$ ]5 A4 i' e+ F - * brief EDMA3 Test Application+ _8 |/ A; u- {. D+ Z' c4 ?
- *( G& u, U5 j$ o( E1 K. P
- * This file contains EDMA3 Test code.
3 L8 \4 e# q( a: ?2 }, C6 m - *% q6 D* D s3 w' @9 r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 Y- B2 X* w7 }# u! l; T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. \7 g4 ~ _7 Y' x/ V6 t, h - * TO CHANGE.
1 o0 Z8 n% ?# _0 Q4 {2 P8 G* l - *" V5 Q' d; E4 h5 l7 R% { L! N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' F0 A5 ?2 i! ~$ r% w4 {3 P
- *) j. o9 m$ C" M4 r) q
- * This program is free software; you can redistribute it and/or
( E5 E4 i: k3 n0 z. {% K: `$ J- b" N - * modify it under the terms of the GNU General Public License as
1 k* ~- q( V3 I6 `+ L( Z4 J - * published by the Free Software Foundation version 2.
* d# H0 Y8 \! R/ Q2 { - *( X& `4 l" f2 [2 M$ D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 P9 [+ j, q4 k8 p( x1 T - * kind, whether express or implied; without even the implied warranty- s9 X2 e" i2 @. a3 V0 T2 P* v& Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: L h8 ]& c+ f; P- }" z" }# R) O
- * GNU General Public License for more details.
; o9 x/ ?8 H( Y - */
, ?. n$ R5 Z4 I; O3 a- H - ' h* n# o7 E! ~& I1 A$ i
- #include <linux/module.h>% B) |- |1 t0 o
- #include <linux/init.h>0 f, ]! y2 _; e% G2 u$ h
- #include <linux/errno.h>
3 @3 J9 a' y5 h5 Q$ r% o' A/ v - #include <linux/types.h>* S) z) c. v5 e, p6 W; Q2 p
- #include <linux/interrupt.h>- F' v( K! S* G1 {0 ? j
- #include <asm/io.h>. r. F7 [/ {0 g {7 `& K
- #include <linux/moduleparam.h>1 g' U% R! _- B5 e0 A3 I7 _9 M2 i
- #include <linux/sysctl.h>9 N! U. `+ p) ~
- #include <linux/mm.h>
6 A# ?5 _/ h' g% _- M$ Q% { - #include <linux/dma-mapping.h>
. M ~/ U4 w5 @% n - $ _" F/ k0 v+ r7 e4 c
- #include <mach/memory.h>, `; C. H7 ~8 T/ j) W5 |) k
- #include <mach/hardware.h>/ t* y _& c; W% o3 M. t- z, j9 H
- #include <mach/irqs.h>7 n1 n/ k' Y& W& P% ?9 c
- #include <asm/hardware/edma.h>
) }; }- I% e, W4 Q1 w% ] - % v. y- b. W! o) Q/ X
- #undef EDMA3_DEBUG
& Q- o0 v( H8 ? k - /*#define EDMA3_DEBUG*/$ T' E1 s+ O4 I1 z0 E, Q
' `+ M1 y" h& z' ^- #ifdef EDMA3_DEBUG3 C" U+ T( A# X y' s! G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): n3 H2 Y7 B5 z, p: R( n- a& m) n* d$ Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
P! m* Z+ B; d4 T3 j f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* G& K8 x3 Y$ F - #else3 f ]; o2 W3 c) Q
- #define DMA_PRINTK( x... )9 c9 c. @ D h. S1 B8 _/ u
- #define DMA_FN_IN
, w5 @# q* f6 @( m* h* y. w3 {$ ~ - #define DMA_FN_OUT
/ O, e1 }! o7 L3 N# C6 g+ J - #endif
& [, x! q. f; ?6 r7 h, y1 H( ~
2 l7 n' t( \' f/ `: z: i4 e, P' k; G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 r3 b5 ?0 R7 x: h7 Z q* n - #define STATIC_SHIFT 36 O: E4 H6 \2 J9 i" ~* l6 d" W+ k
- #define TCINTEN_SHIFT 20
7 {. |" J' `* r* j - #define ITCINTEN_SHIFT 211 V+ u" w7 G4 @" ]. }1 V- ]
- #define TCCHEN_SHIFT 22
$ w; r N+ S' ^9 @& b/ {9 N - #define ITCCHEN_SHIFT 23
, b, V) l3 [' D& c0 Z( ^
; c M# W9 D4 w8 F& N- static volatile int irqraised1 = 0;
& N" ]" Z5 {4 ] W n( z9 ]6 B - static volatile int irqraised2 = 0;' ^ A' z2 x- [$ Q/ E3 E
- / a4 U) h5 T B& @$ K& ^* W8 z( Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" I( \+ S* G4 X; h) b5 ~# R) s B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; e* b2 |3 p" R# \0 H9 m: @/ {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 n E. t: t/ }
& n+ }! `& \- D9 D* W: Y- dma_addr_t dmaphyssrc1 = 0;- _. y' d% f4 j, F1 S5 }! n% z
- dma_addr_t dmaphyssrc2 = 0;2 n. C0 p/ J# m. D8 H/ V* D3 A
- dma_addr_t dmaphysdest1 = 0;
; F( z' y s4 ?8 Y3 Q" _+ r" S - dma_addr_t dmaphysdest2 = 0;" P! c$ _0 f0 {- P# W: L2 i
- % T* \! Y2 t- k% t( {
- char *dmabufsrc1 = NULL;+ H: W3 [' n( t @! J! A. l( b d
- char *dmabufsrc2 = NULL;& j, o1 e s( a" O8 w+ Z1 \
- char *dmabufdest1 = NULL;
8 w4 ]4 F8 a$ p+ q) m9 l - char *dmabufdest2 = NULL;
# {5 L& f9 ~& w. P2 C O5 w
, }) b$ O' ?& p) D- static int acnt = 512;2 n. @$ F4 e( p3 I( ~
- static int bcnt = 8;, u/ w; j1 H' A0 x. a$ D! l
- static int ccnt = 8;( d( a3 X& n, [5 T
- {# }" I% R, ~- Z2 ?- module_param(acnt, int, S_IRUGO);; C, B$ |- o, [& v$ Q
- module_param(bcnt, int, S_IRUGO);# B; Y/ a3 ^' e' u& Y1 ~/ ~! T
- module_param(ccnt, int, S_IRUGO);
复制代码 8 U `+ y! n& e/ ~( @2 _8 k
2 `. k& y! O L$ Y! m+ Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' _7 ?- y9 r* H5 N+ o& D; ~; z6 F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 S0 @0 E: B. w7 i' |2 j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. s0 a* x, L1 T3 T( W9 t# |: l6 f- S/ _, }5 M! \6 u
* }: \% J% R6 U6 U' N9 ?% C: e+ X
|
|