|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * |0 |8 R5 b$ l) v) C7 s$ }
- [code]EDMA sample test application0 u& a4 V1 }2 x8 G
- /* }( N2 ~! r- [2 A
- * edma_test.c: X& h% X2 e6 v' d( Y3 u
- *
0 V& V/ `, U) Y/ l) R# f - * brief EDMA3 Test Application
$ ]3 H+ W/ Z7 {; P" Y4 y; | - *+ d. [/ J3 b# [# ]4 _
- * This file contains EDMA3 Test code.5 X$ C+ }* H6 B9 t( ]
- */ p& M5 z3 V6 I: R2 P& [! K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 U" v5 T Y& |! F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 R5 o8 m/ X0 }" \/ R$ H
- * TO CHANGE.
' B% k7 H) V; V2 L9 R - *1 C( k3 D: o$ V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 ]) n7 V9 a4 H
- *
( }' b; V0 q+ r' C# A1 q - * This program is free software; you can redistribute it and/or
2 W, t' I* ^' r2 Y$ A/ z7 Q3 @ - * modify it under the terms of the GNU General Public License as
- N+ t7 j/ O- Y3 h/ S) x - * published by the Free Software Foundation version 2.
9 Z, i m: n; W2 D# p - *6 ^, A0 i8 K& ]8 ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( Y6 x0 ]# ?; N
- * kind, whether express or implied; without even the implied warranty
' a/ I- d G9 H, j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 k; y* L5 l, J* d - * GNU General Public License for more details.# ]7 d0 r: b. e& t, h
- */
n, Q( i5 F; _, W
, S* q5 Z7 w# [% L1 \+ f3 W9 p- #include <linux/module.h>
1 W: D/ B( a* i - #include <linux/init.h>$ \, e B |& c/ K& J
- #include <linux/errno.h>! e t( Z9 N" r+ b2 y7 B. [
- #include <linux/types.h>
) n |) y$ M( J& J - #include <linux/interrupt.h>8 N* B0 Z ~# l
- #include <asm/io.h>5 c$ u/ o3 K$ p% I) Q
- #include <linux/moduleparam.h>
' v! D |: V! _ - #include <linux/sysctl.h># d( i3 y8 F3 f; m; C5 V
- #include <linux/mm.h>
- |. N" c: ~7 y - #include <linux/dma-mapping.h> a' K/ ~ K. \! X% t
8 ?; [1 C$ L# S" _" L- #include <mach/memory.h>
: V2 m1 p, K, e- p- A - #include <mach/hardware.h>
3 X4 n/ g: a5 j+ m i7 W: h - #include <mach/irqs.h>7 i, G+ C Q3 h
- #include <asm/hardware/edma.h> F( Q: Y" P# l8 K0 i- H" @# k
: |' I: R+ G4 ]' y0 R- #undef EDMA3_DEBUG
4 C2 F3 V8 f% r; k - /*#define EDMA3_DEBUG*/
( ~' y0 i6 p; V( J* ~1 T
! y: m3 B# x8 p- #ifdef EDMA3_DEBUG) Z2 X* O! x& r* v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 l/ _0 }, f7 M4 C9 ^1 ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 ^5 f. {. i0 m/ o; u+ O1 A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# C, ~0 V7 t) M) D4 e" v6 Y O
- #else
x9 O- k/ l5 @& z. i - #define DMA_PRINTK( x... )9 \$ E! V" U9 t) N0 a
- #define DMA_FN_IN
- w' t+ Q- M8 r$ b( S - #define DMA_FN_OUT+ D6 v" A1 U7 S9 P% n$ X
- #endif
- Q8 s) H; S9 ]; D - + P+ T* }6 n3 Z+ B9 Y' Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% }6 C' G. k3 ~ - #define STATIC_SHIFT 3
- b. {! {' B/ B1 U - #define TCINTEN_SHIFT 20
. j& h* \7 @. n h# \ - #define ITCINTEN_SHIFT 21
8 F$ H. x( @" \. L - #define TCCHEN_SHIFT 22, J$ ?9 s! z6 c. [/ v/ v
- #define ITCCHEN_SHIFT 23" e3 R5 v/ `7 z( q% L) V$ r
- / |( k, n( T0 Y8 H) b4 r
- static volatile int irqraised1 = 0;
, r- ^( W6 I, K; G - static volatile int irqraised2 = 0;
4 M1 J8 ~- U3 E2 n - 1 M' c; j% C. J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 o$ |. n! ^1 a& F2 @5 Q% g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
h0 U, Y. v+ t5 t9 i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- ~4 T( k7 ^& I3 p$ F
2 \* V" q' t9 h' L$ T- dma_addr_t dmaphyssrc1 = 0;
+ y+ Q3 I4 b3 C9 m: ? - dma_addr_t dmaphyssrc2 = 0;
+ a3 ^" V3 N9 [$ Z8 A& p - dma_addr_t dmaphysdest1 = 0;1 H, p# R; T( q& v K# k
- dma_addr_t dmaphysdest2 = 0;
2 e9 S# h# F& c! G! z8 P - 1 L; Q- Z4 z; \3 A; o5 `% @
- char *dmabufsrc1 = NULL;
* m6 n- {" ]8 q+ W* Y- \ - char *dmabufsrc2 = NULL; F% s) {! q& B% q
- char *dmabufdest1 = NULL;
& t5 t. v$ H! e [ - char *dmabufdest2 = NULL;9 A8 }. {; ~" y" O4 l- {5 y
) I5 ~0 i H/ I: T+ {: y4 \+ a! j- static int acnt = 512;
d# I* ]! @/ x* I - static int bcnt = 8;
|, w. V2 \7 L6 g( l - static int ccnt = 8;* |7 I8 A, ]* ?: w4 q1 V
- % o4 v1 e' v% R s) ~& }. r# G3 X. b
- module_param(acnt, int, S_IRUGO);
5 _4 i& w0 I$ { K% [2 [% ~$ ] - module_param(bcnt, int, S_IRUGO);
% |# K6 P6 g* h q5 g - module_param(ccnt, int, S_IRUGO);
复制代码 # p0 m3 {$ \. d# ]7 D
; G: D" R2 w j! r/ Y) \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( V b( h& f+ T k- y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" R2 U" M, Z9 ]9 O: u; n' r" }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; k0 m3 W% M" A% u! h5 f/ T' E/ I1 C
/ C" ?8 i5 c/ v- G, z
& s; Q# }2 s+ y6 _* r |
|