|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 z* x$ D5 X* b
- [code]EDMA sample test application
3 C' m" n( u/ p3 O4 M - /*
4 d* `+ @9 W3 @0 V* N! j+ k# k - * edma_test.c
2 F }3 g3 d# O3 C- ]2 t - *
. l5 [. P) V+ l7 ? - * brief EDMA3 Test Application
5 x9 g* O# W: b P - *
: V1 o* p9 w3 V$ ^8 f" {* S+ ]0 Q - * This file contains EDMA3 Test code.
( X( C6 P5 C0 ]3 O2 R# R - *- _+ w/ x! B1 e) u. |7 ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% g/ g" q. Z Z5 m5 u. x; I8 w: U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
}+ ~1 ?/ [* f' O+ t c- Q3 ~ - * TO CHANGE.7 m, U. J! E0 P% c0 m E6 w
- *" u: h3 u% x9 Z; R3 a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: L+ w$ s' M4 c1 w# H* a% D0 O# {1 s
- *
b0 W2 x8 x/ J% y' | - * This program is free software; you can redistribute it and/or
Q1 K# h' H2 X7 @3 z - * modify it under the terms of the GNU General Public License as9 Y) j2 s: E2 c% \
- * published by the Free Software Foundation version 2.
' L" u( f7 Z# t& ^2 Y - *
: \/ N# L- R% ]6 } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. B" w6 e$ P3 T* L2 y0 }$ y - * kind, whether express or implied; without even the implied warranty
$ o* o3 ^; c. v2 E* W) L0 V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 H7 T7 I8 B7 @9 h- U0 g
- * GNU General Public License for more details.
z/ w& H$ x3 Z4 \# H - */% X$ x5 U9 s/ @- G ]$ V. O# I
- ( ^, q8 ]; S Q' [7 O2 L! j1 i
- #include <linux/module.h>" h6 ?4 d" u. T: a* {1 g' P8 [
- #include <linux/init.h>% z4 o8 {$ L* j& I
- #include <linux/errno.h>
1 P7 G& X4 z& k3 T7 G% S9 d - #include <linux/types.h>
: w; S2 Z# h. p& [/ o - #include <linux/interrupt.h>
! \- ^5 l# S7 B$ ^1 T0 }+ ^3 J$ ~ - #include <asm/io.h>
! j& t }5 r. E7 U& }# i - #include <linux/moduleparam.h>
3 e. Q; K8 {& ?+ i: N& |* b - #include <linux/sysctl.h>
9 h+ f$ Y* Y) X7 u. X - #include <linux/mm.h>' A+ H& ?# G# l, v& ^# p4 o
- #include <linux/dma-mapping.h>0 P1 X; l$ y$ y/ k& }! D3 @
- 2 G$ X$ }, M- ~' y S
- #include <mach/memory.h>
" f* S$ S% |; R' Q0 J - #include <mach/hardware.h>
# G: l- U; W: I6 c' \& A - #include <mach/irqs.h>0 K. e; O- V) N, Q; S% a2 [
- #include <asm/hardware/edma.h>6 V R: n, [* l* C" ^7 _
* \0 z! j6 ]1 l y- #undef EDMA3_DEBUG5 P4 c; y( O; j0 v, n; {
- /*#define EDMA3_DEBUG*/: ]9 m/ d7 Q; ^$ Q, c2 W
- " q1 | {* B! ^
- #ifdef EDMA3_DEBUG
2 G3 T6 M' F4 a; O' z; L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 {7 f# L6 W" ~1 y% @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ A4 u/ \" R2 s, N! x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 Z& E% ^5 t3 I w( T
- #else# n. t0 E. v* U; P/ |; E: P" v
- #define DMA_PRINTK( x... )
/ c: W7 m( t: C - #define DMA_FN_IN
; j8 o; r1 d- {. K8 n& h2 h - #define DMA_FN_OUT
1 A, T0 s* l) q. P - #endif1 ^/ m3 r; l+ T: t( ?& o
- B' Q+ R! I6 [3 I5 n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- S/ u( r1 p1 F9 [# @3 S0 k - #define STATIC_SHIFT 3
5 I4 k3 P0 ^+ u - #define TCINTEN_SHIFT 20
) A7 O! B7 d8 m" i0 g8 A+ k - #define ITCINTEN_SHIFT 21. y) `' s! r8 }; {5 f4 o) G# Z
- #define TCCHEN_SHIFT 228 I, d1 ~3 G- [& b) u
- #define ITCCHEN_SHIFT 23
' T( r0 D% G$ Y# X* [ - ' X; T6 h8 \7 V) l5 `1 r) ?
- static volatile int irqraised1 = 0;! u" a+ i$ U) G0 B K) _6 I6 e6 w
- static volatile int irqraised2 = 0;4 h* D% I: ?# j2 c
- 3 }4 a0 l( h# E& q9 U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 K L: r# D9 g$ o8 f+ q- U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 `: j: \3 A1 L% ]4 u- T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 A3 z9 G9 e2 r3 x+ z) p& { - 5 x( W" O7 j8 i' F! L
- dma_addr_t dmaphyssrc1 = 0;% Z2 N5 Z7 ?3 G1 B2 b2 q' ?
- dma_addr_t dmaphyssrc2 = 0;, U+ z$ y, N) \, p! |- e# v
- dma_addr_t dmaphysdest1 = 0;: [3 w( E8 f" { Q( g* t
- dma_addr_t dmaphysdest2 = 0;
3 r# i% y6 j: ?" q' D2 y9 D. p
$ v- q8 k3 K; p6 L- char *dmabufsrc1 = NULL;7 g* d, h2 j" n' ?! W' T' J9 Y
- char *dmabufsrc2 = NULL;
`6 ?: e1 B N/ o1 O - char *dmabufdest1 = NULL;
! W6 Q; ^5 b: C6 S8 B$ e8 c' n! z3 M, j - char *dmabufdest2 = NULL; K- L& A: L: b8 @' x4 T: I( g! K
% P0 |3 @5 t2 j2 t( d- static int acnt = 512;& x: k4 V7 n5 E1 u. P& w, G( U
- static int bcnt = 8;4 s1 d9 u( _4 L9 @" g8 _
- static int ccnt = 8;
6 M! |0 Q9 s; B/ V: W
6 l# Y4 R4 g' X! r+ G- module_param(acnt, int, S_IRUGO);
q" E- }: r( {; i - module_param(bcnt, int, S_IRUGO);
2 G2 z1 A9 ?7 x! `+ z - module_param(ccnt, int, S_IRUGO);
复制代码 ! W3 E! A& W* ]( {3 A; s8 c
, c9 v% q5 U& F" h; ]7 A5 { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 Y1 Q8 {4 S9 ]- O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 J8 p. Q0 C1 J- e: _; \1 A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 a' E6 t, b* y1 s6 z- P, U( E' w/ \8 Z1 V* S- w
2 r8 V; E6 Z: Z. z$ Y |
|