|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - x0 @( n0 g0 j! `/ C$ o
- [code]EDMA sample test application* z/ `* x1 X* }. x* T
- /*9 P s1 {% f" w( F( J
- * edma_test.c4 P `8 g. ~3 K+ m
- *4 [" `" ~8 l" v% m& p2 |$ l8 j
- * brief EDMA3 Test Application' z# K O2 o& V- B! V5 U9 L7 C8 O
- *) ^( A( b: [/ N
- * This file contains EDMA3 Test code.' N2 F+ M. v' ]& O2 z
- *! _( v3 \9 e2 Q4 s: k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* {+ u% r$ `2 L: @) u4 p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 c0 i! k1 c; u$ M - * TO CHANGE.
; h$ S, [: @* F ?5 G - *, K ~8 z* X0 G- K5 P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. Z" `, R F, }$ t2 z8 c$ g
- *. i( S! f3 G7 C
- * This program is free software; you can redistribute it and/or
0 f3 Q- ~# L) z; U3 p9 F; y- L - * modify it under the terms of the GNU General Public License as
$ L0 K7 T R l Y5 f& R# G - * published by the Free Software Foundation version 2.
! Y* y( S# z5 P2 W/ j - *' t% f, [4 @% j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( ], p) j* e0 u, m; t' N! o! v
- * kind, whether express or implied; without even the implied warranty1 V2 x0 U' P1 Y! M& n6 K7 M; [9 a6 i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 v3 j* P8 Y8 o: ~ ?4 L* i
- * GNU General Public License for more details.0 l+ R: Q, N' g" i8 ?# C. J$ w3 H: s
- */
; g$ a+ K6 b" i5 a9 f, J
' ?# F$ l# k* y# x' `* a8 ~7 q- E- #include <linux/module.h>
. ~2 z& x0 |$ R - #include <linux/init.h>
" `' C( j3 }: d! r - #include <linux/errno.h>) i9 O( |; r3 p0 @' K
- #include <linux/types.h>
' O6 e+ J6 ^' K+ I5 n - #include <linux/interrupt.h>( t( R F) x/ Y# s( h: z/ |
- #include <asm/io.h>: D4 E4 X F0 q9 U: t" B. x! t
- #include <linux/moduleparam.h>, j4 m2 f: L: I w- m
- #include <linux/sysctl.h>8 V& ^6 y; f! F6 @+ q
- #include <linux/mm.h>. ]1 J0 j) S7 i* B( c6 Q- A4 I
- #include <linux/dma-mapping.h>' h6 \7 b; t+ e1 j' o4 @7 i; W: N
- , h7 _3 n+ E4 H, t W- F) I
- #include <mach/memory.h> C- u5 n3 _2 O' C, T
- #include <mach/hardware.h>
* C$ e& q& ?* v: R2 }5 u$ | - #include <mach/irqs.h>
8 n/ m- R% M- ?# A - #include <asm/hardware/edma.h>
& X; k7 \/ g9 |
* E& b! D" r& C2 F4 z- #undef EDMA3_DEBUG- j/ {. a3 o l; }1 m9 z" F
- /*#define EDMA3_DEBUG*/
$ j, H4 n5 Z" E: R( L" [ v% y - $ p9 n# S. c5 ~ R! H. N8 @
- #ifdef EDMA3_DEBUG5 o6 r# M n' Z. `7 X$ k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 W: X) z9 Q: h* J& V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! P" w5 l/ U( L% ^1 T7 _& V; y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% |* B# _8 g F* S4 n0 W0 i
- #else
' P5 |8 ~$ l, S- F" [& r - #define DMA_PRINTK( x... )
9 h% i0 u7 h' O - #define DMA_FN_IN
+ L6 |. e, r% Z - #define DMA_FN_OUT+ C4 ~2 J- i1 L h
- #endif! Z. `! ]2 j. Q, v
9 k& S; a9 [7 Q. j. W' ?& e. ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' d3 d R$ g/ l: u, n
- #define STATIC_SHIFT 3
d, x( `2 b# i& R; {$ Y+ a: m/ O - #define TCINTEN_SHIFT 20
. y" Y9 ^' H" ?8 ~. K" X, F - #define ITCINTEN_SHIFT 21# i9 j7 A: `/ \; L+ G* q/ Z
- #define TCCHEN_SHIFT 22
c* {( i% G$ z" [ - #define ITCCHEN_SHIFT 234 u, H# E0 c9 E Q v0 O
' p2 d5 y, M M; {$ l: h- static volatile int irqraised1 = 0;' A' w& g* x1 S6 O
- static volatile int irqraised2 = 0;* o' G! D2 f! f# J' Y- b
0 _- W5 ]+ n% T1 Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 z1 X6 U- n5 I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ]! f2 r G. e% [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: F7 l& c: I: ?3 g) |( [
- % ~: K1 ~1 G3 p8 Q
- dma_addr_t dmaphyssrc1 = 0;: C$ W+ ?1 @% ]1 T9 v8 B
- dma_addr_t dmaphyssrc2 = 0;1 }; H2 V: ?0 g5 L" z( F
- dma_addr_t dmaphysdest1 = 0;2 R& Z% N; p# y- S
- dma_addr_t dmaphysdest2 = 0;! p6 u i# l$ y! j, |( ?
- 4 [+ ^* R: i$ q' M
- char *dmabufsrc1 = NULL;
/ ~/ N6 f* F! f - char *dmabufsrc2 = NULL;
5 c* N; W" q% F# k7 B - char *dmabufdest1 = NULL;
- N+ n2 e1 x& `5 v( w9 N i, O - char *dmabufdest2 = NULL;' Q$ j ~7 z' t- x. `0 n
- 2 B1 J, l3 O- g- g
- static int acnt = 512;. s+ ^5 R3 {6 a
- static int bcnt = 8;
G( y8 h) v* F. Z - static int ccnt = 8;
0 x9 V. i$ E7 V$ A9 u: _
& z+ O% D! Q; {3 m' S- module_param(acnt, int, S_IRUGO);
: }' m# P e0 H, L) u% D( L& M! X - module_param(bcnt, int, S_IRUGO);/ J& z7 t `1 f' m; d3 k& w
- module_param(ccnt, int, S_IRUGO);
复制代码
& y2 ~/ l# O, [9 ^* u% e1 O; a- X
! j6 E |5 Q! z! M) i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) ?5 R7 C4 [. M* W. ]. i% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ p* h; E) |5 `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
N4 Y! Q* Z4 {( s$ _
4 j# N3 J5 r" ~# V! \ ^# c" p7 V$ s4 j( Q
|
|