|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 K/ l* p0 q$ y1 U" e- [code]EDMA sample test application
0 ^) e+ W: c. h - /*+ u" B$ Y) w5 s5 ~; t
- * edma_test.c0 \( N5 _# p6 c
- *
$ K& ?( P0 g) H+ g7 q0 ` - * brief EDMA3 Test Application) }* [& d0 Z0 ]: N7 k
- *' l7 U* t/ Q: S; G
- * This file contains EDMA3 Test code.
$ e; W' {# I+ N2 S" Z - *
( `6 n5 k6 q2 F; P - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, w, w1 E) m+ U; e6 H% b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 V/ j; Y: u; ]) [# P - * TO CHANGE.' Z, y g$ z. c3 J/ L0 q- `
- ** d6 h. r9 m1 O3 X+ G- v5 ~9 _ j5 r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// \1 t8 L& v! M" O) O9 A+ Y5 p- h
- *
) b- G+ Y# H( f3 U) W' M4 P - * This program is free software; you can redistribute it and/or
' R$ C8 _, i: \% x. Y5 K/ Z - * modify it under the terms of the GNU General Public License as
9 C7 Y8 C8 g. ^* { - * published by the Free Software Foundation version 2.
. D2 S4 r# {$ f9 @ - *0 m3 S3 I( {: k$ H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ v3 _/ ~6 A I& r2 h. a, n - * kind, whether express or implied; without even the implied warranty
% U7 K. q' e+ ^' J6 i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, e( @( n$ D1 K! [/ l - * GNU General Public License for more details.+ H6 c1 R- D3 n5 D* S( K
- */7 ]3 a1 k2 \! X8 N) O7 Q
( }8 {' f! C8 B2 }; ^- #include <linux/module.h>7 V1 i( o% F( v0 o9 c1 A1 b! S3 D
- #include <linux/init.h>
1 _7 U, g4 `& Q/ M: v4 ~: O - #include <linux/errno.h>
& ~6 I- I( d N( V - #include <linux/types.h>/ ]. I. e/ p: T& }. `' D' O
- #include <linux/interrupt.h>$ E" [6 W7 V5 E. I1 e
- #include <asm/io.h>; r' f0 H2 k& B; b% b' J; t' [1 G
- #include <linux/moduleparam.h>, Q! H& M, V+ k
- #include <linux/sysctl.h>- R/ o# P8 H. w% ?' D! C
- #include <linux/mm.h>
) T1 a ~ R. y* N: C- k S) J - #include <linux/dma-mapping.h>
7 O! x: F1 _! B, S0 ?7 P5 R
" I$ a$ g9 o, h g- #include <mach/memory.h>5 s2 d) d9 ^4 G6 [- A, |+ {+ I
- #include <mach/hardware.h>. K+ [6 q" o8 c0 s6 n
- #include <mach/irqs.h>
# h H6 S3 [5 ~: v - #include <asm/hardware/edma.h>
& U; y. ~+ G* S. U. @2 T( j$ H
& S, Z T! F; l- #undef EDMA3_DEBUG5 n9 S/ a a2 ]* ]# a6 M; u
- /*#define EDMA3_DEBUG*/' f! a' D$ q |8 e- u# j3 @" m' q
( [ _( s G( b( ^/ W+ P# e- #ifdef EDMA3_DEBUG0 [9 \ C; H" q3 L6 s1 P0 E! @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, j: |7 }4 u4 \8 G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 Z* t2 u0 z4 d8 b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, `/ Z3 Z* q4 e - #else
* f% O4 x& n: s0 q/ A7 i2 ] - #define DMA_PRINTK( x... )! ]1 R L. |% k2 [0 V* h6 A
- #define DMA_FN_IN
C9 F; x7 y, M - #define DMA_FN_OUT
( U2 j( f! j, W& B2 V - #endif. z9 r7 U6 l! P7 R1 w' y
$ E( p( i" @. J8 J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! O0 e$ ~4 s% K
- #define STATIC_SHIFT 3. H1 N6 m3 X0 ^ H8 ^* G
- #define TCINTEN_SHIFT 20! ~/ A# K$ ]% F8 j/ X" ]: c. G
- #define ITCINTEN_SHIFT 21
. ~- |5 U/ L1 m- D9 t5 N/ d' ] - #define TCCHEN_SHIFT 22
+ u" R) F t l! p0 D - #define ITCCHEN_SHIFT 23) ~3 \4 ]- s" [
: T ^+ u, [( @( }: R1 O/ `1 |- static volatile int irqraised1 = 0;
_6 p# i4 y9 ~ - static volatile int irqraised2 = 0;1 w1 f! K: K) x, H$ X% B
# i' u% R c' _0 l Y( q9 K8 f Z+ I1 X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 m1 h/ f; o1 Y* A1 X9 ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' A' B5 X. \6 P& Z# N, W* V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 j J" @/ N6 J1 z/ T9 M
- , e% u. S4 ]) Y- ]
- dma_addr_t dmaphyssrc1 = 0;' I: [7 W( u& A+ n4 E: p% B* _
- dma_addr_t dmaphyssrc2 = 0;
$ _# G; P7 n: p8 K a) a: f) a - dma_addr_t dmaphysdest1 = 0;
% \0 j! M {' y) y! G) g( |2 l - dma_addr_t dmaphysdest2 = 0;8 ?2 O/ b6 m3 W8 L' L
) h6 V) T& K4 i: Z# G: ?7 @- char *dmabufsrc1 = NULL;
N" {$ z9 Y0 P; p$ y3 a P; |. y - char *dmabufsrc2 = NULL;
0 ?) A! M+ p8 s% u4 c - char *dmabufdest1 = NULL;
6 I9 s8 [3 ~% b: d0 ] - char *dmabufdest2 = NULL;/ V- r; U. k; i7 h
- 7 V" r6 t8 X: N# c
- static int acnt = 512;% G a9 p9 E2 M
- static int bcnt = 8;# c, q8 ~/ ]' h. @
- static int ccnt = 8;) Q# U7 e" G- H' p) U& N! G# u1 d3 e
- ) w& M: A' ^$ z, z
- module_param(acnt, int, S_IRUGO);
; Z( k& |/ n6 I* d - module_param(bcnt, int, S_IRUGO);
# p4 \8 l; x! k; h+ A# W6 X - module_param(ccnt, int, S_IRUGO);
复制代码
3 Y% k* y9 z' e6 c
c" k* |" c; ]% M7 T( K/ Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. Z* C8 G w& marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( Z: B/ ?1 D0 V. {6 w, X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& o: u Q, a* x f3 W! V) b
/ M% ~7 p+ b7 a H1 d
( {: {, s! p; y0 z$ Z! Y
|
|