|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. L; @- j6 d- N% Q1 ?' k7 T- [code]EDMA sample test application
4 Q E/ q: ?5 j5 I, Z" ]) K - /*
' c; |) t; l& H( L - * edma_test.c8 v/ s# n- x9 v5 J( R A; @0 c( R
- *6 p" S; w0 }/ \
- * brief EDMA3 Test Application; ~6 O2 m: |. p' u$ a1 _
- *
3 z# h. }1 a( x% t - * This file contains EDMA3 Test code.
" F' c& V* Q3 L0 l, s( j) `( j - *
0 c+ L9 X* G. x& {; h, \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* K% I% {7 z8 t" W i W; F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& ?& [1 B& K6 s+ {9 [ - * TO CHANGE.
" S7 B6 v) K1 m8 v$ _- g8 E7 G - *
: q! z2 l) k) z( ~$ c N4 a% b& k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ U+ w' ]' y9 j) R
- *
Z$ |! L* V1 K! R8 @ - * This program is free software; you can redistribute it and/or1 a8 M0 h( r8 I
- * modify it under the terms of the GNU General Public License as
, A" o' k) x2 ?1 U- @ - * published by the Free Software Foundation version 2.
+ P& c$ {# Y. k: k7 q3 N! I - *
) t8 h! ?- X1 \1 [1 g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 n$ i7 _) \5 D C
- * kind, whether express or implied; without even the implied warranty
% n% [* \! K; b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: ]5 Y3 Y# d. q
- * GNU General Public License for more details.3 x" ?' g2 H. I: }5 x
- */
# t! u. g! O, E4 ^. N
( P! m% W$ e$ B( Q- #include <linux/module.h>
4 |# G. ?% Y# V T/ G L - #include <linux/init.h>
% s3 W: a# A% |( A+ _1 n - #include <linux/errno.h>: n7 F6 J, y$ F. A
- #include <linux/types.h>
4 N; R' r8 b1 R% V% l. J6 q - #include <linux/interrupt.h>5 L! v6 X9 U) H2 @. \( v& m
- #include <asm/io.h>1 d1 G: S$ ?/ S& v! A/ T
- #include <linux/moduleparam.h>: D& D- {0 U! f# L! E9 h' l4 ~, |
- #include <linux/sysctl.h>2 d( v# M/ j3 q5 P- R% p
- #include <linux/mm.h>
4 W3 q- S# t) U. W0 _ - #include <linux/dma-mapping.h>; H1 M* Y& V) f" k# j
) _$ E& ^9 r$ l' @( w# v- #include <mach/memory.h>' p6 h& w' y2 N4 f4 z+ I' Y5 F5 V! _
- #include <mach/hardware.h>
) h! j+ d8 V1 |" w0 G8 ] - #include <mach/irqs.h>
, H0 @* |* w3 W, |* p! l+ m& g+ [ - #include <asm/hardware/edma.h>
- m9 ~7 S" c8 K" [
2 x+ L! r: E; B% i& E0 E1 L1 ]- #undef EDMA3_DEBUG
" L% M1 a y, L, } - /*#define EDMA3_DEBUG*/
% z9 D4 W0 [/ M* |0 T - + J! G2 b3 A0 x; ?: ?5 N- L
- #ifdef EDMA3_DEBUG
! z' ^, W% ^/ q! [" u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! W G4 e* r9 ]6 q$ }. P( l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 Q" Z+ @6 z R4 c6 u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# b0 ~& k( D3 \2 A
- #else3 {3 y9 U( o3 n7 q! r7 r
- #define DMA_PRINTK( x... )! X0 ^) V! ]' R' n1 f) C
- #define DMA_FN_IN3 ]7 j9 v! I) z% Q
- #define DMA_FN_OUT! K" H" x- |: B0 ~/ d* C6 M
- #endif9 n5 H4 k; G5 d0 R9 y
- # l- s( c7 j! o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 m" f8 z3 @. h3 \: y9 a
- #define STATIC_SHIFT 3
- V2 Y) s2 W( Q, @9 \" X - #define TCINTEN_SHIFT 20
% z3 i2 g' j+ i8 T; C; o; J - #define ITCINTEN_SHIFT 21
' c6 S$ w0 x4 Q - #define TCCHEN_SHIFT 22# i3 H1 K! q4 a; ^
- #define ITCCHEN_SHIFT 23
- a' a8 P" [ R b! I* R" q
6 @, O7 {$ M1 M- A- static volatile int irqraised1 = 0;0 N' s5 j" ]2 U
- static volatile int irqraised2 = 0;' @8 b! R& P; C0 Q" g8 O
" q( n0 e- B' T p) L# P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 N1 {' p5 K5 \0 p# O; t2 C6 U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' c. Q8 Z3 v' M! C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: | o; F: x" o6 _/ E6 R4 `9 S
" y% {9 |) M; J4 l/ t# o- n- dma_addr_t dmaphyssrc1 = 0;
) f9 [! `% `( J) r- W7 u) U) c. X - dma_addr_t dmaphyssrc2 = 0;
1 w% z+ ^4 D3 @3 P - dma_addr_t dmaphysdest1 = 0;+ x* I- g3 q: d5 @' X
- dma_addr_t dmaphysdest2 = 0;% o" ~6 q; b$ ?! D
- * M5 r* f2 W/ @9 V6 K$ R+ P
- char *dmabufsrc1 = NULL;& ?- a2 R, Q; j$ t x; C
- char *dmabufsrc2 = NULL;2 l/ O$ j! ^: `: Y
- char *dmabufdest1 = NULL;
Y3 }" M$ _8 P2 R - char *dmabufdest2 = NULL;
+ O: B# {" M( e7 z j; l c
- d, w" C$ g" a6 I! h- static int acnt = 512;6 Y$ a E7 T2 m& l/ a& o" G* y0 a
- static int bcnt = 8;9 }2 R" p3 g- q/ u
- static int ccnt = 8;( _9 E3 a& A2 |
1 Y' {+ i6 A! q; u3 y3 g* C* M. N- module_param(acnt, int, S_IRUGO);
- N. a7 l4 K% u# }" G% x- Y - module_param(bcnt, int, S_IRUGO);
, V4 d6 m3 M. z! }- S% G - module_param(ccnt, int, S_IRUGO);
复制代码
* _7 b% F$ z4 O3 z( Z0 k! I, S
# i( S6 `" ?; j# T0 D# I* I; w- ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' f7 b% ?. M2 g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' ~. i; N$ s4 J X$ x, B4 h5 O, j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" q; @1 N2 e+ L' h/ |7 t, X9 j
) T! B' I* Z7 {/ |3 k) R
: p3 q' L& T) Y/ V6 C, t! W |
|