|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( ]6 d7 s. t' K2 k- [code]EDMA sample test application2 V- f' o! f9 _& y9 y
- /*9 p( d7 |" w5 D+ k- O
- * edma_test.c
8 x: N! g/ |1 Q& n8 e& D( s6 \ - *8 W+ j2 E7 A1 b" d
- * brief EDMA3 Test Application9 G" `+ p F. y+ o* F$ S' o- n
- *: Y, k8 B6 L/ A3 ?2 N& C
- * This file contains EDMA3 Test code.
" V1 Q- v1 C3 e) I# Z9 n - *( z& T, f/ U( M" U! p4 p! ~0 i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- r) s, o6 y$ }. q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 }6 j9 g& P/ c0 k& v - * TO CHANGE. X9 c5 n$ f( |$ W- ?# @
- *& R& A- M, u( t) y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 H {$ t5 y4 A% g
- *
1 t5 e* d" a+ n% l - * This program is free software; you can redistribute it and/or) E r' L2 h8 J4 \
- * modify it under the terms of the GNU General Public License as
/ h4 B. J; r7 [% B* V8 _% ^+ q - * published by the Free Software Foundation version 2.
+ r0 a' K1 k8 r3 ? - *
! q" f& v5 O" l6 U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ c9 ? h: Y6 N- C* h; \' Y - * kind, whether express or implied; without even the implied warranty
# V l8 |' H' x+ C& T8 \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# P( E* c+ }9 P3 N& T
- * GNU General Public License for more details.8 v$ \$ A4 Q, E T- d
- */
& @1 q: G3 u a/ o9 k) |2 M - 3 r+ c4 K! r, M( t- b* ^
- #include <linux/module.h>- J/ g8 a% Q- a, h4 j, C$ h; {: c
- #include <linux/init.h>' B/ r$ N. U9 H7 q
- #include <linux/errno.h>& R, [: s$ M5 {, w" i" F# p! I
- #include <linux/types.h>6 s, I( b- H# w5 g" O1 R9 T
- #include <linux/interrupt.h>
, }* }$ _; C; s1 n. d5 f - #include <asm/io.h>
% d @& w- J. u" v - #include <linux/moduleparam.h>
: F( ~6 w5 B+ g; e - #include <linux/sysctl.h>8 B; b! F, o7 n, X
- #include <linux/mm.h>
$ _- K+ s& |2 t' a# F. r5 s - #include <linux/dma-mapping.h>3 l- I0 @6 S" D0 D& `
- 8 L$ v- b' F# Q" Q& ]
- #include <mach/memory.h>
6 V7 W1 J z7 p) s; V: e! T& F0 I - #include <mach/hardware.h>
5 z9 C& W$ p9 D" n- [; L, a - #include <mach/irqs.h>
: r/ H9 a- ?9 I) _" I% z" y - #include <asm/hardware/edma.h>
2 s! t: Z% @8 }( N9 Q
2 ?- i; ^0 o% _0 Y6 R# [/ t- #undef EDMA3_DEBUG* C+ \, Q0 z7 k( r8 Y% R7 C, r
- /*#define EDMA3_DEBUG*/: n3 t0 w( ^. c8 G6 R
/ N1 E' N P5 s6 n! i9 B) E- #ifdef EDMA3_DEBUG* F# d. k. j1 y. |9 H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 P4 D1 [7 e5 \) M% R3 O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 x' z% E W' }, ?0 C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! F! S0 d: f1 ?. E3 S1 K
- #else
9 F$ c& w) t- o) n7 }1 W - #define DMA_PRINTK( x... )6 g# \/ N) P, Y0 t3 h' b, m5 R' x( @
- #define DMA_FN_IN
% j& N4 x! @" u. f5 u- o - #define DMA_FN_OUT
# o0 j ]% e. V1 g - #endif) u3 ^" a6 k+ H) j0 l: G! }
9 t. t, [/ u5 A' H6 @, ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# x1 A8 ?- e0 S$ z l) K
- #define STATIC_SHIFT 3
: T) S$ A7 Z& w* [8 u6 I - #define TCINTEN_SHIFT 20$ X' H3 g( C7 h
- #define ITCINTEN_SHIFT 21
1 x- m& O+ Z) w0 | - #define TCCHEN_SHIFT 22
- d; A$ e8 G" q/ V% I. A$ @ - #define ITCCHEN_SHIFT 234 `5 E. H1 h* ]2 q( n+ d
- " H, z L6 C) i) y4 _
- static volatile int irqraised1 = 0;
- e% Y1 y, ^3 x" }. c - static volatile int irqraised2 = 0;" W" j# ^) k2 d2 i) R% Q6 h) U1 c
! v7 R2 k) ]1 w8 A4 w" B3 u- T: ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 ]; v5 ~ o4 C1 i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
v3 I5 E! v; b% I' S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ e3 T: W/ ~3 A. I6 H8 U4 F
- 1 z7 c( A: C1 ~, {
- dma_addr_t dmaphyssrc1 = 0;
. d7 |2 C! `/ u - dma_addr_t dmaphyssrc2 = 0;
; s" `# ?7 t3 b - dma_addr_t dmaphysdest1 = 0;
. V/ V, |! V$ W+ J* w4 U+ t - dma_addr_t dmaphysdest2 = 0;
! H& v$ H0 {2 R0 a - : Y4 l/ e4 y" Z
- char *dmabufsrc1 = NULL;
( h* J7 n6 T3 E' y0 q( w - char *dmabufsrc2 = NULL;( X+ o9 {! d/ w, G6 t# h1 v
- char *dmabufdest1 = NULL;
2 T2 W. q3 G5 j* V+ e T k - char *dmabufdest2 = NULL;8 _! V$ q! \6 D- | r
- " f0 c% X. P8 I/ q
- static int acnt = 512;
2 I6 ~. x7 Q( E2 \, c1 f. } - static int bcnt = 8;
' |7 I6 r- k' q - static int ccnt = 8;
/ \& R( i8 F3 h1 p3 _( d - - u% a. s3 O& T
- module_param(acnt, int, S_IRUGO);
% }6 |4 l7 ^" C: H1 w) q, {7 c - module_param(bcnt, int, S_IRUGO);3 M* S$ s0 n! e) _. z: R
- module_param(ccnt, int, S_IRUGO);
复制代码
0 w. I! E% |. }) G- V/ X5 |8 r" X: f- \" Q5 O) A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 o9 ]0 r6 W1 p3 {. carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 R9 Q0 [1 G3 X8 ?* q2 H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 K, p( s: Y! f5 O
. T& z9 G8 f% j r! _, t G7 v
# D+ i( u h- C0 }+ ?. w7 `- ` |
|