|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; P* W. ?" g* U1 O
- [code]EDMA sample test application! L: o k& D; }, t9 N) K7 ]% ^ ]8 F
- /*4 w7 y/ Q% ]0 X# X& X
- * edma_test.c! ?; ?5 G0 n5 P( g1 h8 a
- *" r x; e- z$ ~
- * brief EDMA3 Test Application
. L, y1 u) X6 [, t( E - *
- H: R$ a' e) Y5 W# W - * This file contains EDMA3 Test code.1 T- u. {" O9 N
- *. d4 N2 R* {8 @# P1 Q% `& u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE g; V2 j9 O, m1 C' A# t, M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. p1 O8 d$ [' j& j8 Z$ p - * TO CHANGE.
# _* {" }( b4 j - *
9 t8 Z( b2 F, y. r& T, H& O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 q; x9 [" M y" u( d - *1 Z: f. e- U! V2 z5 u$ a/ m
- * This program is free software; you can redistribute it and/or& H6 g8 v1 Z: A( B7 F
- * modify it under the terms of the GNU General Public License as( _, y$ z" L: i* V$ k
- * published by the Free Software Foundation version 2.! l, H& K1 Y, B- Q# n
- *
I7 z7 V' x% g" W8 R/ x1 h" n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 u" E, Z6 P; \( \
- * kind, whether express or implied; without even the implied warranty8 ~9 \1 c3 J6 ~' p8 J- O, q6 I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 h; i& a# M& ~& t3 h2 E4 `" d
- * GNU General Public License for more details.
5 v8 q* h* E$ Q3 J! [/ e - */
* y& \7 w# ], H$ |, Q V8 Y
; t6 o1 z) Y) \' I- #include <linux/module.h>
! @& p: k# h0 p6 k0 l - #include <linux/init.h>
" F! H, |) ~, t4 c - #include <linux/errno.h>
! W1 J9 S: A, ~1 K. f0 q( O7 S0 Y& ~ - #include <linux/types.h>
& J6 c% Z0 P2 Y C; v - #include <linux/interrupt.h>- e" D& c6 f7 B8 x; z
- #include <asm/io.h>3 x0 K& V) L9 m: d4 J
- #include <linux/moduleparam.h>
# n, d+ b0 _: F, k! p" H; t - #include <linux/sysctl.h>& v4 {7 B8 n* ]8 Q
- #include <linux/mm.h>3 _1 f/ _3 Q! f" \. P
- #include <linux/dma-mapping.h>
+ P+ y r9 m1 C8 }7 W G$ Z. s - * F5 F# |8 S0 ]0 ?
- #include <mach/memory.h>
. p5 \: h1 G' m2 \/ ?1 @7 @ - #include <mach/hardware.h>* x5 |* l8 M- g3 Q( ]
- #include <mach/irqs.h>
" V% ?0 i T$ d8 p! t - #include <asm/hardware/edma.h>, g, _2 l" o6 J4 c( u
6 H- g3 E* V- `7 r8 X S- #undef EDMA3_DEBUG# ]! _+ |9 `; ]5 e3 i
- /*#define EDMA3_DEBUG*/9 w. {5 |6 F" T
0 m9 O' P( ~1 e5 {' }- #ifdef EDMA3_DEBUG
6 t" k4 x8 w# z% A; Q7 P; } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 E# M* ` E1 C" Q. ^1 F. V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* w/ \# i$ r2 d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 U- y& l- C% `, C* d4 H - #else
' L1 _: l+ o4 b) }* Q" z - #define DMA_PRINTK( x... )
0 q1 h$ c7 t$ q1 i4 d* c, _ - #define DMA_FN_IN
( t, } U H3 y% }/ P - #define DMA_FN_OUT
( i8 @, L6 L; W$ [- n - #endif* o; z% O; A: }2 o3 @5 Z0 w/ C
9 M" B2 N) S8 ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 b# b# n% H! h* \3 N - #define STATIC_SHIFT 3
, W- n: a1 P9 Q/ d5 C) r - #define TCINTEN_SHIFT 209 n7 b2 l+ Z& [1 z) U$ Z
- #define ITCINTEN_SHIFT 21
: U9 C- J3 W8 a( @. ^ - #define TCCHEN_SHIFT 22
+ q# _, c6 [2 r6 b: U4 k - #define ITCCHEN_SHIFT 23
- {9 `7 ]- U/ c% ^2 C4 u" G
3 g. ^! ? t8 N* [- static volatile int irqraised1 = 0;
+ v d2 ?4 \3 @3 k - static volatile int irqraised2 = 0;5 s' E1 Z1 \0 {4 Z. |7 A
A9 }' v0 V- q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 t# P- c7 a5 Q' F T; a% w" D* M+ u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" n3 D/ y% ]' g y( d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& W) a5 d+ t* S# ?+ V& a! W8 z
# @" b9 X7 _: t) _3 c* x! F, |, Q- dma_addr_t dmaphyssrc1 = 0; D+ W- Q( L1 {; y3 w+ p4 K/ ^
- dma_addr_t dmaphyssrc2 = 0;9 D0 ^. M8 \) A+ w3 J6 ^4 g' R2 N
- dma_addr_t dmaphysdest1 = 0;( F3 y( } w# W/ A- \8 @2 o
- dma_addr_t dmaphysdest2 = 0;
# H3 L. a' w7 i# A' O: ?" i
8 U- |5 d) s/ \$ Q* V& [- char *dmabufsrc1 = NULL; j* C/ q0 @' d) V& \6 s' e
- char *dmabufsrc2 = NULL;6 l7 D5 M& ~% r
- char *dmabufdest1 = NULL;( I+ F2 V9 v9 i# n. \3 V
- char *dmabufdest2 = NULL;
! q1 g0 b5 F* U6 R* z - * Y+ g W' E& P* I' \% s
- static int acnt = 512;
& L& ]( J+ b2 r2 j* X% L1 ~ - static int bcnt = 8;
$ g4 M! g6 @7 i0 p - static int ccnt = 8;* p, d# R0 |0 O) H3 b* k
- 3 P, |/ N2 G# L4 m7 z
- module_param(acnt, int, S_IRUGO);
) q- y8 h' u; a9 D. H4 E8 R - module_param(bcnt, int, S_IRUGO);8 o: k" R5 Z: `! A
- module_param(ccnt, int, S_IRUGO);
复制代码 7 r" a% E4 p1 w* G' ?) |7 @0 {
7 O3 X ?& d- T7 X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' h4 w q/ Y0 T. {' l0 j) x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' L$ K2 M5 d: L, Z5 T- |3 h
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 I# ~* s$ Z9 O' g: M! A7 H3 t: |2 Y) ?
) r: N' [+ A( [, i; s) W |
|