|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 T0 ~8 q4 \( b9 A; g9 n4 n
- [code]EDMA sample test application
; {# F; s9 v7 B6 t1 { - /*
, W& ~5 e& P; C: y - * edma_test.c% V* f8 D. J# {" a* z
- *
! d0 a+ @$ ^ g& s6 Q' N - * brief EDMA3 Test Application+ F2 }* C( M, M
- *
8 W$ d9 F. v6 W, g; D1 y; U) H: o - * This file contains EDMA3 Test code.
+ }( w" h$ Z0 H. U - *9 T1 O& b5 T' Q# o1 N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( ~3 f- U' w) j: ^8 W6 r% m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ {: I$ U, X/ [" F9 V( V3 I/ C
- * TO CHANGE.1 `9 R% b d9 o% I3 b* w( ~% i
- *
5 G# B; k2 Y; T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* s6 V8 e0 R" Y/ l# T6 f
- *
" b9 R3 a5 r; D. Z# n7 o4 Z - * This program is free software; you can redistribute it and/or
& ~5 w) i# D5 J0 b* |0 F6 m6 D c - * modify it under the terms of the GNU General Public License as
) z- G9 y% J! A/ S - * published by the Free Software Foundation version 2.
" G. d) S7 y4 M2 J" @ - *$ o8 }5 }/ A; o! Q" F' x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, y) i" X7 E9 v4 K9 l4 y6 P
- * kind, whether express or implied; without even the implied warranty% Z H/ H+ l* b+ S2 n9 C0 m, r" G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* K D2 p W: J8 a) Y
- * GNU General Public License for more details.6 M2 Z+ n/ S6 w
- */. ]; S6 z. R# i: g5 K% t4 l
% _ d/ T: F+ R: m4 Z- #include <linux/module.h>
8 J3 n, L0 `( B9 _9 } - #include <linux/init.h>
- W$ ]. n1 k/ g) h* H7 @ - #include <linux/errno.h>
+ S7 }* P! Z& R5 J! ^( v5 @ - #include <linux/types.h>' w1 W6 V6 u0 f) Z, i
- #include <linux/interrupt.h>
' o$ i/ r: J% B - #include <asm/io.h>6 I8 S0 U+ a4 T" `: e0 N3 Q
- #include <linux/moduleparam.h>0 x, l$ b6 [4 W# h
- #include <linux/sysctl.h>' e% A+ s# P( G& K& O! W* S. T
- #include <linux/mm.h>
* Q7 k( y% r' Z1 o - #include <linux/dma-mapping.h>. ~; O" o6 Z3 R- I, _
9 E1 ^( H: b R: ]* e- #include <mach/memory.h>
! G% d J& {1 z$ k - #include <mach/hardware.h>" ?$ {+ J# S5 E" A q- ?
- #include <mach/irqs.h>
- x3 W$ N2 F# `- o - #include <asm/hardware/edma.h>
2 e2 ^" i8 n4 l& @
9 m7 R- D6 A) W: l! ?- #undef EDMA3_DEBUG
( T6 M, i; Z/ ~1 i - /*#define EDMA3_DEBUG*/
0 p" ]7 e3 e. O. S! F
& q5 b& U H: A8 p, X- #ifdef EDMA3_DEBUG+ @4 s5 V6 i( z+ K" B# K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 _% Z) x# J: C) E( j. R9 U% u4 c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# T4 p+ H4 p- Q- C% b# K, [, U# H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! o8 z' b% h" G. D: l) I - #else, ?5 _8 U) O: S* W
- #define DMA_PRINTK( x... )! C2 F: Z& s: T1 _( p1 Y. _# h6 U
- #define DMA_FN_IN
0 d. ]: R( i! A8 a% ~ - #define DMA_FN_OUT' {' V/ i0 B" h2 ?. F
- #endif% s, f" O) W5 i+ ~
- 6 E T8 T8 [9 V7 u4 I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: e- x; J: t' n& H. i% {' ?& R - #define STATIC_SHIFT 32 Z6 C; |+ f# J4 i. a; R
- #define TCINTEN_SHIFT 20
: G8 P: t7 N- Z$ {6 V: F* t - #define ITCINTEN_SHIFT 213 x' R$ ~) M! W2 Z% {. v8 T4 f
- #define TCCHEN_SHIFT 220 T/ \0 b6 x! ~( O) @9 b
- #define ITCCHEN_SHIFT 23
- _% \- n% L( {* n2 q1 P5 \
" O y) W+ U N" J `# h- Q( l- static volatile int irqraised1 = 0;7 O' W. P& E4 r3 c5 c" B
- static volatile int irqraised2 = 0;- D/ ?$ h0 J, h
- . O o2 f. v# p9 R% f6 b) R+ D% W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 l( }) t; H- g P* C1 X5 N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
w& h: k" I, F8 u- d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# i9 n6 ^- j* H/ U& Q+ h# K
8 _2 Z' p% M3 a- dma_addr_t dmaphyssrc1 = 0;
# _! |* x: C6 D) Y- |0 |; T. ` - dma_addr_t dmaphyssrc2 = 0;
% [2 T8 I, V/ A. F) U) B9 J - dma_addr_t dmaphysdest1 = 0;9 p* ]; f1 g. l/ F4 c/ Y
- dma_addr_t dmaphysdest2 = 0;' E; A! P, ]2 k9 L* r
! [8 P* U4 q8 ?* A9 @! h- char *dmabufsrc1 = NULL;
2 ^% x1 J+ T, V8 b' A( M8 D5 { - char *dmabufsrc2 = NULL;
$ I( o# B2 v! E7 H1 B* f+ H - char *dmabufdest1 = NULL;
; ?: A) _' ~6 m! B' j! U4 F - char *dmabufdest2 = NULL;9 ]" ~) P6 _* U( X, @, Y
; S# ?6 s: X ~5 H3 C8 p* t- static int acnt = 512;
5 l, B) a" g, K& A5 B5 V- @ - static int bcnt = 8;! ]+ I j2 t7 _6 D) B5 l x
- static int ccnt = 8;9 o/ W# H% y3 ? Y; ~- L# i) K
4 T* M1 u/ k- x- module_param(acnt, int, S_IRUGO);( C& Z, |. U) O4 u) T7 L
- module_param(bcnt, int, S_IRUGO);1 ]) }3 J) U; C8 u; }$ e
- module_param(ccnt, int, S_IRUGO);
复制代码
l8 w2 J, k' H
, u" Z% p# h! p7 L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 ^" m0 s' b2 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
\) ?: b* r4 F) C4 u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 c* ]3 w: l, C2 ?/ M& l: f, Y. B" D! k, x! q/ L, |
2 S6 w5 U, t: `3 r) | |
|