|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: e2 D! ]% c7 F, \4 x9 r. R- [code]EDMA sample test application! y% p1 l0 ]% j3 y% z* }/ P
- /*+ K" V. c& t% }. c6 l# {# e6 G2 i
- * edma_test.c/ g2 r! s2 K z. I3 u
- *
: a- k9 _) t/ o* O, S; a. e1 ` - * brief EDMA3 Test Application
: @7 d3 G7 n2 T8 ~+ a& b - *
/ \: x1 u! j6 C. Z/ R* D' k - * This file contains EDMA3 Test code.
. s/ W6 E* [$ h/ c8 h+ C4 A4 V - *
% x& H: e7 h, } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 D2 j2 r% G/ X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 ^* f. a% \& l* ]; K1 Z$ J - * TO CHANGE.! X2 k9 g' h; |- w* i% q( p
- *; d( i' Y3 [& i! _' W( }+ G8 f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ } B9 J; s" t7 \ - *
2 t% T+ J9 R5 w _# P7 \5 N - * This program is free software; you can redistribute it and/or6 j5 Y9 ^9 a, _* L) ?9 z
- * modify it under the terms of the GNU General Public License as
5 J, r1 u* W1 G u) p& B/ G - * published by the Free Software Foundation version 2.
8 J( y* }# |: ]% C& j- L - *
; M) F. v; [% M; S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' f5 V1 u& a& J. _% x: P
- * kind, whether express or implied; without even the implied warranty
6 ^$ Z8 r/ B7 J7 j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# ~6 |- d9 L. {" Z6 h& V' c - * GNU General Public License for more details.8 F) X) V- S" z; ~: L0 T2 Z: i: U
- */
- [: a2 R$ g' _' D - * I% n* u4 [4 @; r8 ]( f2 d
- #include <linux/module.h>
" }; }" x6 a4 t2 N4 _ - #include <linux/init.h>0 ]/ s; R7 A& r# G8 `. Y2 `: g
- #include <linux/errno.h>+ w3 n0 Y# R% a$ w
- #include <linux/types.h>
) o4 E8 Z' {8 f2 y$ t9 v - #include <linux/interrupt.h>
+ a# I# d0 t2 P2 w* F: a - #include <asm/io.h>
) H- [0 R# z0 p$ z: X' g ? - #include <linux/moduleparam.h>
! x0 x2 `0 [9 J A, D! K( F - #include <linux/sysctl.h>! U: E9 h, A R; v/ k+ m' a
- #include <linux/mm.h>
) D7 G& K1 J! |& L8 J: b C6 ^ - #include <linux/dma-mapping.h>
0 f" y% k( ~) |$ N$ u% b$ B$ a1 Z - ) f6 k n/ \' v& L' K! R6 y: f* X
- #include <mach/memory.h>0 d! y- t4 v' c7 [8 K
- #include <mach/hardware.h>
/ b/ b: L2 t. A4 t. E2 ?& n - #include <mach/irqs.h>
4 ~/ J2 ]( Q# J" Y3 J* n6 s - #include <asm/hardware/edma.h>/ I$ Z* B6 x& U/ ~8 v I
; [( V. N1 j t6 \: \- #undef EDMA3_DEBUG7 ?8 P T1 Y. H. Q& e* [' K
- /*#define EDMA3_DEBUG*/
% ~ I5 w# L7 W& d! E
- y/ C: I+ p, A- k' R; h- #ifdef EDMA3_DEBUG% G; e4 F" g2 i$ v9 D# _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# ]4 S8 U( k; M2 B$ @% }, \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ y9 M+ U$ P: V8 A" v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' L* C, t3 [0 a4 v9 E
- #else7 p! q# w0 y0 c, P/ e0 @8 f
- #define DMA_PRINTK( x... )
; u, Z/ k2 P) x! x4 k - #define DMA_FN_IN% r+ a3 a" H& V. a4 s4 @
- #define DMA_FN_OUT
0 J2 `/ e8 R9 r F; ^% M" c; | - #endif+ W# a1 P6 U& b% i4 Y
- 4 R/ y2 q! `* n* n- a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ J e/ O; s! {6 x4 t2 l" ^1 n
- #define STATIC_SHIFT 3) j9 ]3 o+ ~/ z. X8 _( P
- #define TCINTEN_SHIFT 20- n/ [9 A) f, }* u1 s9 T
- #define ITCINTEN_SHIFT 21: f# V3 ]' D* [ G; q/ ?
- #define TCCHEN_SHIFT 22
4 t/ j) F/ W$ D( P3 g; f0 ]+ a - #define ITCCHEN_SHIFT 23: P Q: L( g5 n7 }8 M* I
- @( N* P% M/ l y4 |% ]
- static volatile int irqraised1 = 0;
6 m' G% J+ A8 h# z - static volatile int irqraised2 = 0;! k* f7 {4 W Y, J8 u1 K
. u e$ d+ }$ t1 D& H8 l* w, d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) d! D) n' ~7 L4 ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& }1 }! [1 R7 ]* g. `4 D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 p7 l2 n% X+ ~ U) g" _8 B# p' m1 `
' s% L( ~9 K J; L# B- dma_addr_t dmaphyssrc1 = 0;0 a: K' R- X+ B: m5 P
- dma_addr_t dmaphyssrc2 = 0;+ @6 s* t9 p8 _+ B- j6 w6 i
- dma_addr_t dmaphysdest1 = 0;7 V& H6 c- l( C; g
- dma_addr_t dmaphysdest2 = 0;- k5 {! O% E7 G. O7 g7 Y7 }1 \
- 3 o8 Z; E. `, @- W0 t
- char *dmabufsrc1 = NULL;. J. v% _3 i. Z1 [
- char *dmabufsrc2 = NULL;5 ^! Y' D' x1 I) Y" c& X+ W7 {
- char *dmabufdest1 = NULL;
) f+ h; t3 Y$ z" Y3 k. B - char *dmabufdest2 = NULL;6 O& P& i- L) P# E# T6 u/ H. h% g
4 `+ l j2 H' E3 _% E- static int acnt = 512;
9 J# U2 `$ H2 K9 H4 x& N. ] - static int bcnt = 8;6 x: y4 D/ K9 i3 u* ?+ G
- static int ccnt = 8;
2 S% | h! v/ Q" X4 e - ' V3 m* p/ B$ a3 [; ?5 h4 e% F% g* q; r
- module_param(acnt, int, S_IRUGO);
! p0 S) C, _5 b) U! h2 d - module_param(bcnt, int, S_IRUGO);( Z& N+ X2 l- R d
- module_param(ccnt, int, S_IRUGO);
复制代码 + i) `% Z( ]6 ~) E' p* t
1 V9 ]: y! x3 u, m5 i% {6 a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. t) Y' S$ c: m# x; Z9 }
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 S% m6 B/ U. a* ?' f8 D6 r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 y* {, {8 i1 _- M& |: h4 O
( e. q1 w# x( z1 Q3 s: M3 o0 S# i2 i0 w* C, I: M: \
|
|