|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 |( }1 j. v4 X) G2 R6 Y
- [code]EDMA sample test application6 M1 Y# u: @1 q& B
- /*
9 }* z' ~4 A9 b) P; s5 k - * edma_test.c+ N& X7 L5 p: W* a2 }
- *; s" l& X7 f; s4 }( }) z$ w
- * brief EDMA3 Test Application
, G& Z' i; e6 D n9 \$ w' T9 l - * I7 \3 H0 p" w( G/ k/ T
- * This file contains EDMA3 Test code.2 e; i! B, I! [6 z
- *- g9 z7 m1 W5 l; A' s& v* D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 {! i6 B: F: X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* p) Q. _) ~ J; T; N - * TO CHANGE.
3 Z/ e( k! I5 t+ c3 J4 Q' F - *
! D, c( N$ ~7 u6 T+ R9 \4 H# v; X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 M( W& h( T, a, O - *# k0 Z' b! D8 l. [9 j
- * This program is free software; you can redistribute it and/or" F6 v) `" i# n/ O0 J8 H8 G4 \+ h
- * modify it under the terms of the GNU General Public License as
# D% g4 g: N: x* k - * published by the Free Software Foundation version 2./ E C. x9 ~- f4 k4 c
- *+ f3 }5 f! Q" u5 S) f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 d# u, F! }+ f! x - * kind, whether express or implied; without even the implied warranty
0 F* U/ ]3 N# r1 M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. w. R& g' h6 y - * GNU General Public License for more details.
/ A$ R& c+ b3 t# s0 y - */
0 P- e+ T) F4 m# }; i) [ - 5 }8 ^, ]/ u/ S6 [
- #include <linux/module.h>
! |: M) T& d" @ - #include <linux/init.h>
1 _* D0 D7 V4 R4 W& ?0 s# S Z - #include <linux/errno.h>
! i, u2 C; z6 ?9 v) ~8 m - #include <linux/types.h>
, |) t- Q, V9 |+ B6 H0 M9 w. ~" j - #include <linux/interrupt.h>
: Z7 n, }# ^: b/ Z) G - #include <asm/io.h>3 R" a. V- @3 H% g: c
- #include <linux/moduleparam.h>0 L% e" q, m$ q* _6 S4 ~
- #include <linux/sysctl.h>
+ W. B/ ^; ^* H' H5 S0 I% y2 K - #include <linux/mm.h>; K0 v2 L( m1 k* C7 \4 ^
- #include <linux/dma-mapping.h>
) }% E2 L& N' a; s! j
+ h& P! h5 x. G- #include <mach/memory.h>
+ S/ |$ y. P' D( J6 I2 y - #include <mach/hardware.h>8 Y: D7 J8 u- c% @/ P
- #include <mach/irqs.h>" v/ F) u$ ^8 C& c
- #include <asm/hardware/edma.h>! }7 ]5 x& F, f! x% t
- 0 w/ |7 }' C7 p, l
- #undef EDMA3_DEBUG
7 H% J1 P v1 i' y& U - /*#define EDMA3_DEBUG*/' M9 u r. P+ S' Q* ^
5 m4 Y1 g9 f: a; o( f- #ifdef EDMA3_DEBUG0 I* f) d9 s `, y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) G4 i- A5 a9 i0 d6 Y: V- ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
Y* {, j1 h# }% E9 {. v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ I: H5 N% v( Y6 i
- #else
' {2 M9 ]8 z3 z' p - #define DMA_PRINTK( x... ), f: C, G8 [$ f: p& o$ ~
- #define DMA_FN_IN
6 v( v( w. M5 r P# P, } - #define DMA_FN_OUT* t$ h" W- B4 a* ]( D- _
- #endif
) |* z# q8 ~8 \ } - 7 ?2 k) y- |2 W# g8 B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ o9 i0 D! J8 [7 J: ]
- #define STATIC_SHIFT 3
& o% J& i T. O# x C3 y - #define TCINTEN_SHIFT 201 W& E! z. t9 Y P" y8 S
- #define ITCINTEN_SHIFT 216 G3 p- M2 W! Z2 H q% y
- #define TCCHEN_SHIFT 22
: k6 R& l S7 _6 e* f' ? - #define ITCCHEN_SHIFT 23
0 U7 s2 z& E1 c
* B1 f$ H, J& X$ r8 k7 [- static volatile int irqraised1 = 0;
0 J. Q; B8 L, {3 Z. t1 L - static volatile int irqraised2 = 0;
( L- V' Q* S) |, s* u3 I - ( B8 j2 s1 ~! h" e( b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); i( M; V6 F# t' G7 n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! {; H9 w7 M8 A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ D4 C) g4 \# n5 e1 }& }
( n8 T) X; V" {; d: o- dma_addr_t dmaphyssrc1 = 0;3 T; _" i! t9 c8 |
- dma_addr_t dmaphyssrc2 = 0;# d) l( H% P* a2 a
- dma_addr_t dmaphysdest1 = 0;. B- k& ? |! h3 A) I7 m
- dma_addr_t dmaphysdest2 = 0;7 L7 D) x1 `8 h* d; O0 F4 n
- $ n! z! {0 S& L* E! P+ L
- char *dmabufsrc1 = NULL;
' J/ t8 \4 }0 B& L* X" w5 ]! {1 t - char *dmabufsrc2 = NULL;
* }8 Y9 l3 _+ V - char *dmabufdest1 = NULL;) g: l" [ _4 i, w; I
- char *dmabufdest2 = NULL;+ L8 s- ]0 |2 W7 g% R
4 q. w5 V$ J* ^+ o% x- static int acnt = 512;0 a2 H" p/ O" S6 n- E" B& ^# V7 v
- static int bcnt = 8;
7 d% R8 J; c5 i5 P1 G* B0 a' ~ - static int ccnt = 8;
3 ~+ _ J' Q/ W, I+ @
9 [2 [9 Q! R9 R% D6 G, S- module_param(acnt, int, S_IRUGO);2 x- A+ y2 f$ T5 O5 r/ t
- module_param(bcnt, int, S_IRUGO);
% r# \/ [$ _1 l. I - module_param(ccnt, int, S_IRUGO);
复制代码 * D" [" W }" ~3 x- K1 h* d
% \5 f9 A* Y" Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 m0 z# u6 p9 F' G' a5 \5 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" q( X6 a* M0 }1 r3 M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" P/ j+ t' k2 S# f0 B
! _- @& v7 A& j8 X
6 i' j0 C3 j6 \4 y# t" r |
|