|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& M9 N$ f+ n4 i* j9 y6 l- [code]EDMA sample test application' u. `# H2 O1 v3 G& m) S/ u+ m$ ~( W
- /*
5 a" K6 h8 U+ t( y - * edma_test.c
" {+ c- _1 |: [9 F - *
5 J, g, F3 U. q, n0 t9 u6 D - * brief EDMA3 Test Application! J9 ^7 V, g3 y0 j* ?
- *" W4 F* X8 c$ ]8 w% c, [6 h
- * This file contains EDMA3 Test code.
, j \7 _4 w( L - *% f' d3 E) M4 C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
G' U( Y7 T9 h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 |3 M" S! Z+ e+ \ `* d
- * TO CHANGE.
2 [7 Y2 G5 A- O - *% A! m7 |' L2 m5 t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ d+ v+ O# F1 R; n l" k
- *
6 C3 t+ p9 {* X8 s$ }# B - * This program is free software; you can redistribute it and/or
. {* H5 f4 \/ C% G3 W - * modify it under the terms of the GNU General Public License as
+ E4 S |0 r, j - * published by the Free Software Foundation version 2.9 k+ q' I! c9 x
- *
0 ^: y; y) u% R) K. n1 U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 p! C) ]( O# n6 H/ R0 B* q
- * kind, whether express or implied; without even the implied warranty
+ p/ s; v7 r$ q6 k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" u# o- F" e/ T& {& c - * GNU General Public License for more details.* J* L3 k6 D7 S% |
- */
/ F! U, L) q( R$ Y" K1 O9 p
# T1 s5 M' y. O* f* q, J" H' C- #include <linux/module.h>6 Y0 n9 C0 C$ @! a; [4 H
- #include <linux/init.h>
8 n) l/ K5 M+ c% D - #include <linux/errno.h>
& i; I5 n; Q8 Y - #include <linux/types.h>
8 F7 [) F6 r9 ` - #include <linux/interrupt.h> q, W( E$ o: _7 R. _
- #include <asm/io.h>, @: k' ]4 \5 ]. b# R7 f. J) X
- #include <linux/moduleparam.h>9 H( a0 h. i; |! a
- #include <linux/sysctl.h>7 x4 s8 c" M! x( ]$ @! {9 S
- #include <linux/mm.h>
7 E6 v$ C. W/ ], U# p, n: K! z, | - #include <linux/dma-mapping.h>& Y( X5 R/ Z8 u- N0 ]
- ! ^* A O% Y. F4 ?! @# w- w
- #include <mach/memory.h>, x! v& w0 q3 s8 G
- #include <mach/hardware.h>
( C$ M5 B% I8 k+ o: N - #include <mach/irqs.h>
4 n8 E. X9 C( r - #include <asm/hardware/edma.h>
8 V" I" S+ ?4 y9 B9 N, t/ M1 m V - $ E: Q, ^2 w( Q2 Q3 }3 X3 C
- #undef EDMA3_DEBUG* ]5 A; x2 e/ v' P: B
- /*#define EDMA3_DEBUG*/
" q2 N7 m0 L8 t5 ~& k7 Z4 C - ' s S' V% p' s0 @1 k
- #ifdef EDMA3_DEBUG
: h% W2 r" b; Z T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" j% ~( x' [( r, J" S: f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" ^2 w/ t. D% z" f9 S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 k( y% p" G& `0 N9 `" f4 G
- #else
! V1 \' X$ y, F0 \$ z5 y+ l - #define DMA_PRINTK( x... )
* N: H+ w, r* P - #define DMA_FN_IN
& }9 O, n1 W, p7 b! v - #define DMA_FN_OUT
) U, [/ f! E5 C+ x - #endif2 n$ U3 l4 ?# F
- . I7 Y- d! W! U1 Q0 p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 S2 q: B) O) E7 `; A - #define STATIC_SHIFT 34 ?+ T4 w5 w! w
- #define TCINTEN_SHIFT 20
$ D& h+ T0 r: n" M2 U2 G: c2 r/ O) X - #define ITCINTEN_SHIFT 21
8 C2 i$ r: l: i# N" E* z - #define TCCHEN_SHIFT 22
4 C$ ]. _3 f" j k6 L! o - #define ITCCHEN_SHIFT 230 i# b' S* L& d* h' a9 R
) \% T! K0 \& z# ]2 O- ^- static volatile int irqraised1 = 0;, s4 U+ Z8 D1 [. ~/ d
- static volatile int irqraised2 = 0;, F' Q7 Z! o6 Z6 K7 {
, R, [; n; E% ^* {: T: H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Q1 ?5 Z2 [( ]& t8 B6 [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; A, E, E d) }" y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& g% n+ t$ e8 `: L) E) ?
- 1 Y" _7 z Q5 N, ]) [& g
- dma_addr_t dmaphyssrc1 = 0;
- f' ]; W5 s+ R5 k; E: L( e - dma_addr_t dmaphyssrc2 = 0;( O# o k* |: i4 I
- dma_addr_t dmaphysdest1 = 0;) n" N; D2 m. @4 E- Z
- dma_addr_t dmaphysdest2 = 0;
) B( p. F8 D7 G3 W
) u1 Y2 ^1 h) F+ X- char *dmabufsrc1 = NULL;
( U1 _& w2 i' e8 ^7 L# k0 f: p5 u - char *dmabufsrc2 = NULL;
: N2 Q4 Q8 f1 `; W9 p; `" h - char *dmabufdest1 = NULL;
7 V1 j; P3 B- N7 `( Y+ R/ r( X& i - char *dmabufdest2 = NULL;1 n; {) x2 P4 u B- O3 l
- 7 t; y+ \9 V4 Y! X+ m
- static int acnt = 512;
, g$ b7 M3 O" X5 n, R2 l F& W - static int bcnt = 8;
. a- D' N5 w$ E2 A0 ]7 _ - static int ccnt = 8;
/ Q! X; t0 [0 |" G) r# B4 U
4 Q0 _7 B7 f0 N" K1 D$ q- module_param(acnt, int, S_IRUGO);
: S4 E- D% @( N7 A; L3 F9 U, z2 R - module_param(bcnt, int, S_IRUGO);
6 ~! b, X9 s7 F3 F8 v) j - module_param(ccnt, int, S_IRUGO);
复制代码 1 A$ ?" Y$ P$ X. Q& u- K
# f& O9 @; N9 ]/ r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; o. t; J7 p% m( xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 W* H6 C; |7 S& T% q0 \& B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( y1 H5 r" N: [* M8 X) ]1 ~6 s1 ?, E
, w2 a) [* v4 g$ [4 R: k8 E4 i
|
|