|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 G+ y# j8 @# b3 _. e: q- [code]EDMA sample test application3 T& ~* \6 B. x* g
- /*
' H( C0 o& I" R5 P* | - * edma_test.c" C+ D! z; _4 r. Q; W6 ~
- *
4 o8 c3 q& b9 h! x0 I( J* W( Y0 Z - * brief EDMA3 Test Application
" z9 r: O& R+ H$ { - *1 \2 w$ |+ G3 w: U F6 K8 V
- * This file contains EDMA3 Test code.$ d8 t: e, ]7 k$ F$ C) X T
- *. l: M3 C; b* K. s6 O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, i; x. a& A; v0 O: H6 [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- _, t' z* P+ L+ v5 G2 e P - * TO CHANGE.& r$ ]5 I& c' g; h9 Y3 s% o3 ~
- *( T+ p0 D4 k" ^0 v1 P, v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- E$ a+ L+ I! \6 n( N1 ^( n
- *2 `; H: P1 C) ]9 \
- * This program is free software; you can redistribute it and/or* W2 w) _0 W- D2 o6 b; `
- * modify it under the terms of the GNU General Public License as' T7 P! G- R @1 N9 [- y
- * published by the Free Software Foundation version 2.3 n# \8 t( \ |$ a+ t8 o
- *( F" g. |& p0 t* S$ l& @; E) a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; I& [' \4 |1 Z7 W; i8 ^2 { - * kind, whether express or implied; without even the implied warranty) W6 i3 _3 T/ I) A, u; C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" C/ B X4 ~2 [( v2 ~* }
- * GNU General Public License for more details.
* V6 ?- f0 m w" g$ f - */ U$ Z' B f2 {5 K. D$ K, ?
& I& I- p4 e, V8 h- #include <linux/module.h>
5 K5 T4 g4 H9 S; T; C& | - #include <linux/init.h>
% R( w2 @# V2 C* x+ n# N - #include <linux/errno.h>$ \, u. ]1 T( C* v6 g+ G9 G3 m
- #include <linux/types.h>
3 j* P, x; u, m: z H' X - #include <linux/interrupt.h>! G) @4 F* }. j2 N* P, ~
- #include <asm/io.h>
( ~: C* V+ ~$ A - #include <linux/moduleparam.h>
$ l2 H3 `, W$ x& F( e0 h9 ~ - #include <linux/sysctl.h>
) F% L( G% j* ?+ F2 f; `0 Y - #include <linux/mm.h>
+ d" D) k* h3 F0 T8 G; F; P' d - #include <linux/dma-mapping.h>
4 i4 H. u8 S6 k7 X6 ~
7 Y/ @7 f0 M1 t% T9 F- #include <mach/memory.h>
( k3 L0 C, r# T. C* p- ?1 a - #include <mach/hardware.h>
+ [. F5 s* j. O. ^* l. W) X) v - #include <mach/irqs.h>
7 ^1 M* C9 \7 W! j K - #include <asm/hardware/edma.h>. l0 k2 Z' B; I7 W3 i, Q% ^7 w
! {+ T0 D: }7 D( L$ d- #undef EDMA3_DEBUG& w! n1 o& c3 k X3 c$ X
- /*#define EDMA3_DEBUG*/
# S( x) N m! e& X/ ]# M2 X" b# @
; K: t6 |& d$ p& d* L- #ifdef EDMA3_DEBUG" f7 L; K' K0 f6 `. I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& K& P6 E5 F {/ i) u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- H; }. c- u' E& C. F" v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ?$ E' ? N- C3 H
- #else
" ?& d' I2 N5 C. { - #define DMA_PRINTK( x... )
4 v Y" A" S5 p: N+ X - #define DMA_FN_IN
# C5 L4 B) U4 b& g( E" {- d& j - #define DMA_FN_OUT
, o& G. r( J( [ - #endif
2 D* B3 w) c" M) l, v - * Y ^ l3 F8 U p: m5 y. J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 ]2 H S% {5 \2 b8 \! S
- #define STATIC_SHIFT 3+ X8 K, f1 {* i
- #define TCINTEN_SHIFT 20
6 e% B" ^- e! [8 F" n; g# Q# Z - #define ITCINTEN_SHIFT 21
" |$ q# ]* K2 ~" q9 l- U: W1 p r - #define TCCHEN_SHIFT 225 [$ ?0 G) W, v- m, i2 `" g1 I+ K
- #define ITCCHEN_SHIFT 23
* q9 A* V5 \9 N/ O8 q' T: r
0 w, s L3 |% @% e: ~# v8 e. i' V- static volatile int irqraised1 = 0;
. D9 i6 i0 _- A7 X! p* c9 ^ - static volatile int irqraised2 = 0;
; f9 j$ W4 f9 n. ]6 p2 { - - x, z# i( l# C0 M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 H8 e% X7 Q0 m5 L$ |& i) V8 Z4 V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 t7 V% ?1 N( ~* U* L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 l5 {1 ]6 e) H- }: @+ l2 h& x - 4 J; i: \# G8 N* B8 s
- dma_addr_t dmaphyssrc1 = 0;
; k- `# e; B8 q6 }* |8 a8 e | - dma_addr_t dmaphyssrc2 = 0;6 F/ F" h" i% \
- dma_addr_t dmaphysdest1 = 0;
, J& S; z8 w7 S2 t, U' K5 Y% J - dma_addr_t dmaphysdest2 = 0;/ ~8 w; \5 G c5 I3 O6 R1 r1 f3 K
; g" i" t2 ?& U3 H6 Q3 N+ F- char *dmabufsrc1 = NULL;
: z! q9 R3 U" g' t - char *dmabufsrc2 = NULL;0 ~* N6 X2 \' k2 e7 K* p/ f) R/ @
- char *dmabufdest1 = NULL;
% A( }+ ^( ]4 c6 S) i, H& X - char *dmabufdest2 = NULL;. E" U4 E6 @3 c) ~, F3 ]
- 0 H7 W- O; \- H: Z% p. I
- static int acnt = 512;
) b0 i l% n' _# K. V7 C* O5 z - static int bcnt = 8;
+ O0 h2 x! O1 M5 H1 d" F+ t - static int ccnt = 8;
6 o2 c0 x' D) E6 ^) `5 e8 P - 3 i! o8 W d0 ~" F% k9 _0 O
- module_param(acnt, int, S_IRUGO);
: \' h5 ^1 l) ]; f! g - module_param(bcnt, int, S_IRUGO);0 J8 M9 m# t+ R* N7 ~7 O: M8 q
- module_param(ccnt, int, S_IRUGO);
复制代码
% C9 N; d* I+ Y1 I; ^% H+ Q; [9 ?: y$ F" B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& I: Q) F% k7 m- W! i3 `0 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( m3 \8 e. H p* e" W7 a+ X* }7 d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- f4 W8 j8 b% P' y( ^
! \1 I8 k2 z& [! K7 [0 |1 u' ]8 M x* x" I1 t1 Z; v7 N% |
|
|