|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 V9 I3 a$ e1 w$ {8 I) O3 ~; j
- [code]EDMA sample test application
' r% A# m& I7 N" v - /*
/ D w& Z3 N( [2 j - * edma_test.c
2 W& C" m# w1 ^ a - *$ A9 f" A L, V( S7 [' D5 f
- * brief EDMA3 Test Application' ^/ }9 A0 z! \* o! W
- *
( s' ]0 y i8 W. E5 r, h - * This file contains EDMA3 Test code.! u: `5 Z8 w$ M2 ~( P
- *
0 _5 q5 l: B$ v, _5 | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 U1 ~! h' z" ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" N+ H* ^" ~& @# v - * TO CHANGE.
+ _& C' z3 y/ u1 r- o - *
! l7 G5 T& O- e* z1 w; W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 V d- a# V- ~
- *6 E. f5 u6 P) P4 V% l# z- ]. o% X' B S
- * This program is free software; you can redistribute it and/or. F; P/ W6 @0 M
- * modify it under the terms of the GNU General Public License as
& T1 B: `7 r6 G$ k - * published by the Free Software Foundation version 2.
/ Y+ M9 A N, Q% M6 b4 I# ` - *
$ R% n) \2 g; U9 s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ M9 i! O; u% r2 g& g* f - * kind, whether express or implied; without even the implied warranty- V% {. \! q# c3 X* m* E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" k& s5 X2 J8 c1 U$ E
- * GNU General Public License for more details.
. R; B% K8 e7 e1 `( C+ U - */
3 X& V& V! }7 F: U# p - ' H* w( C$ }" {0 `2 s/ U
- #include <linux/module.h>3 t: r2 Z7 T8 D$ I; s0 C0 J
- #include <linux/init.h>. S. p, s# T( x
- #include <linux/errno.h>* z, V2 C9 e( l( @+ D n
- #include <linux/types.h>
8 C. S: G: g5 D5 _5 B8 }6 u* M - #include <linux/interrupt.h>! K" a2 X. W0 n7 M+ q8 I# o0 J/ j
- #include <asm/io.h>1 s( j. n- g$ b `& D: l& g) Z
- #include <linux/moduleparam.h>- @ a. J+ @! V* ^$ C2 U
- #include <linux/sysctl.h>$ O" c/ q: V/ L2 j2 I) r
- #include <linux/mm.h>& u; y1 @# A2 e; t% N& I
- #include <linux/dma-mapping.h>) U# `, Y3 j" x
- 4 M5 X1 V5 X6 F& G8 f+ }
- #include <mach/memory.h>
) b A& Z3 F; o6 @ W - #include <mach/hardware.h>
. {' a) J0 h) ]1 a6 j7 P! L - #include <mach/irqs.h>
5 Z& C2 Y7 c& x# R9 p - #include <asm/hardware/edma.h>
0 h- {; M' G+ w1 c9 [
# D2 N5 c6 K+ j. x- #undef EDMA3_DEBUG- E$ X* F) |# x2 B: S# S
- /*#define EDMA3_DEBUG*/
9 L0 M+ y# ~& o. g! t0 |
6 O. W8 O9 y* P: q- #ifdef EDMA3_DEBUG6 r/ {4 A- e. l3 ^. z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 }8 w4 ~% F. P$ U2 S5 G0 A4 F8 T" _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( `+ u' M8 r' F6 E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' D% y: p- u. g s7 ^ - #else
: S; K( P$ p. O$ l9 O1 z8 o D, S - #define DMA_PRINTK( x... ); t% a! I2 i L5 G; N g' V& {6 T
- #define DMA_FN_IN
+ [: v. q% ~" ^* Y/ S5 _# s - #define DMA_FN_OUT
# \/ x5 z# @: i - #endif
7 O8 d# A0 M& p/ V- {, O
- W$ k( O: U* z$ `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 d$ y2 A4 t2 P* ?8 Q8 x - #define STATIC_SHIFT 3% T( g5 i% w$ E+ b. y% c% o
- #define TCINTEN_SHIFT 20; y$ ?/ W$ R' x* ]6 F
- #define ITCINTEN_SHIFT 21
; m) L& a' D5 b2 \( O, p. N - #define TCCHEN_SHIFT 22- D. f9 f. B6 Z, v. C9 Q( I
- #define ITCCHEN_SHIFT 23
7 ], O8 l2 J7 K% C" M- g ^8 y4 u
" Z) ^, a( [* I3 S1 Y- static volatile int irqraised1 = 0;
( q+ L) e, f& o/ l - static volatile int irqraised2 = 0;3 s+ i! E! M' A
- 0 v% Z0 j4 C( L/ Q% a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# R' k- N9 p7 K8 f" }5 W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ w$ F* `2 n- [3 b# J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 N7 i9 d; \/ @6 B4 Q - / g- Z; [( I3 C/ a9 `! C8 R
- dma_addr_t dmaphyssrc1 = 0;
# O6 E. U% i2 c: e& ~ - dma_addr_t dmaphyssrc2 = 0;% B" m; d c( J) n6 \
- dma_addr_t dmaphysdest1 = 0;! s( r0 m+ l, h8 ?
- dma_addr_t dmaphysdest2 = 0;8 g/ Z+ M6 A2 F- z
: A/ b n& N) S! ^- char *dmabufsrc1 = NULL;
$ y5 |1 Q0 O# ~* h - char *dmabufsrc2 = NULL;, V) [6 Y+ t& `' d5 j6 P. f8 [
- char *dmabufdest1 = NULL;
2 D1 s9 u" j0 S) Z8 w - char *dmabufdest2 = NULL;
% `: N* |; n: u% l
! b, h! u$ U& P2 c, X$ G- t( A* s- static int acnt = 512;+ H2 g. R, P! \/ H! o
- static int bcnt = 8;
" y! y1 u8 r( }# B. N - static int ccnt = 8;+ L7 s# X0 B: Q0 f
- 0 u6 ~+ j: ^% a/ h
- module_param(acnt, int, S_IRUGO);+ Q. t0 D0 l( S0 E
- module_param(bcnt, int, S_IRUGO);
; J( ?9 Z" \- j/ a V& C! Z* A - module_param(ccnt, int, S_IRUGO);
复制代码
, E9 t6 V# a$ I$ V
& O2 j$ Y$ X) v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% q- Y" _1 K6 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 t* M' G' B* f! I/ r; B2 A% Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. l. l9 H' }" }3 U* y
/ a2 u2 o! W3 c! o( L. n L {: \; ^- j9 O, d$ M9 x" ^
|
|