|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 L6 D: O; o8 G. A" J# g& q+ w. D
- [code]EDMA sample test application
" F" B H# f# j& |. D3 t - /*8 c3 K7 ?# n+ f, r3 Z$ T' d: E! f0 g
- * edma_test.c; \8 H: Y9 U( D. t$ G( V! ]
- *
! s8 ^) d! m [3 a8 T3 h - * brief EDMA3 Test Application3 \& I- m4 @2 ]2 Q) E7 ?
- *) @+ |" v& v# M( q! {
- * This file contains EDMA3 Test code.2 q9 r1 t! t% \( L
- *
% @2 F, B/ h, w% D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE c3 n% b# ~: ^" y+ t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ v! h8 x) J6 v& X3 u8 I+ n
- * TO CHANGE.
+ p% X* K* ?- Y - *
( z+ g4 ? o0 d+ @) \' O3 } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ @- R* R6 T( Y
- *
6 O3 ]8 c3 n$ n" _6 @ - * This program is free software; you can redistribute it and/or
, @ y; u7 X* |$ `( C - * modify it under the terms of the GNU General Public License as
" E$ P, n- n+ n# J) a6 G2 k0 r - * published by the Free Software Foundation version 2.
. ^8 i: h2 w6 s4 d - *
% L" Y9 _" R" [/ d9 ^+ j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. G/ m6 s1 {8 f4 H5 \, L& j
- * kind, whether express or implied; without even the implied warranty
1 Y. ~% ?4 C& F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 q0 S: _& H4 e1 w, R6 c% e" a
- * GNU General Public License for more details.
( X# H+ F" Q7 t3 { - */2 Y, ?0 W! U/ e0 U
- ; ?9 q: `9 ^' j/ N' s
- #include <linux/module.h>
5 x8 g) e9 r \. R - #include <linux/init.h>* a W4 F+ ~' r6 T4 \
- #include <linux/errno.h>
; _$ Q5 D/ B$ c# l O+ w - #include <linux/types.h>
% b/ N2 n6 s+ [3 y/ V. N2 ] - #include <linux/interrupt.h>) W4 t k) v" _1 w# c
- #include <asm/io.h>( g4 B0 O' i$ k, [' _8 d) F2 J
- #include <linux/moduleparam.h>9 h2 M& {' C, P& z0 G' x, g" |- Z
- #include <linux/sysctl.h>* m: R3 k: b1 ]( X; u2 K; k
- #include <linux/mm.h>
% O+ }' G$ x9 s3 a6 T- I0 _( `+ } - #include <linux/dma-mapping.h>
6 ]. }3 {5 v$ j
" b/ X4 Y J9 J/ j4 K- #include <mach/memory.h>1 C. W+ v+ A0 t$ Y$ d7 O5 F5 n' K
- #include <mach/hardware.h>+ S7 T* d" I) [" N7 j8 b. e. U. `
- #include <mach/irqs.h>3 ]. }* g0 p: V2 J) ~$ g
- #include <asm/hardware/edma.h>. N; N8 R6 P$ T Y7 o: d2 P$ T
# n- h2 D0 G6 P" u' K0 [% D i* N- #undef EDMA3_DEBUG
$ `; h% Y/ M# Q4 _& ~( {0 e3 w - /*#define EDMA3_DEBUG*/
# \" R5 h; O/ B7 Z
+ C0 I* c) u0 ?" e- #ifdef EDMA3_DEBUG
$ k" d, l8 p! m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 L9 X8 ^ r, p3 L4 e: `) V9 w8 o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ B6 g1 x0 N2 c9 `; c# l0 y. o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ l, _9 V- g% A8 I7 D% Y
- #else8 e' ?2 v" x$ ^* a3 M8 e
- #define DMA_PRINTK( x... )
% J: J# ]1 {+ Q% ? - #define DMA_FN_IN6 d. j1 g ~& ]5 m
- #define DMA_FN_OUT& B9 _" V6 X# m
- #endif6 C& Y* q& K8 o# j' r5 }
' Y4 n4 ]' _1 w+ f4 f/ Y7 ]3 w7 U$ g, z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: Y; Z/ S7 }- U) s* }# G. P, [ - #define STATIC_SHIFT 3
) g) l6 B8 K" [$ R) b9 I9 ] - #define TCINTEN_SHIFT 20: c) y$ s% c2 I H
- #define ITCINTEN_SHIFT 21- J9 L/ v' ?6 M1 A' w) i
- #define TCCHEN_SHIFT 22
6 y6 s, T: q+ C - #define ITCCHEN_SHIFT 23# H/ O4 n% C- u9 B
- T5 Y6 _6 Q) r' ^, O
- static volatile int irqraised1 = 0;
% E( a; Q1 @/ x* [ - static volatile int irqraised2 = 0;3 J( _5 b7 K6 l l2 m, _1 {3 E: P
1 f$ e9 R& {4 ]! t+ G% c$ ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" O& ~0 N6 Z+ E l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; _4 U" ^% h; `8 H" E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( P; Y4 i4 x- E; n$ ?% c* O. c; c
t* I* p0 T" C0 O: z( ^2 N- dma_addr_t dmaphyssrc1 = 0;
2 h$ ^- Y1 T7 h8 ~, |2 ? - dma_addr_t dmaphyssrc2 = 0;( a( Z' E4 o+ |6 U: b9 b& V1 I
- dma_addr_t dmaphysdest1 = 0;
! \" A: y* Q- x$ l( S! `( I - dma_addr_t dmaphysdest2 = 0;6 L# Q* D, I, F6 Q
. l) m& A' [* R: R x) _1 x7 F% q- char *dmabufsrc1 = NULL;3 }2 p- d% \# U. Z' I
- char *dmabufsrc2 = NULL;. F) s4 S. T Y! J( p$ y
- char *dmabufdest1 = NULL;. r/ B0 \- ^/ |: v
- char *dmabufdest2 = NULL;
- e1 U6 ?# G/ [1 A4 N - : M; F3 l0 ~5 G' Z( s1 U# M& a
- static int acnt = 512;6 G( u: P5 i$ @5 G4 ?0 d8 D, M' s
- static int bcnt = 8;2 }0 i6 J. K& G2 ?% w
- static int ccnt = 8;( t/ r) x/ U$ L" I9 f
- 4 ?( y6 V: w& l' a# o
- module_param(acnt, int, S_IRUGO);
6 q+ k/ k) b0 {( |; `0 s. X- K - module_param(bcnt, int, S_IRUGO);
) u0 _1 z* e D2 Q/ ~) j/ q) x - module_param(ccnt, int, S_IRUGO);
复制代码 / F4 V& z- }5 O$ b6 g* J
% r* S+ P6 _# W X/ Z* [+ \9 p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ K; n' e5 }7 D. c' X6 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 \/ @: Z7 ]* [9 g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' V1 y5 T U: Z) @
. s& ^+ {' ]" y9 u% {7 P7 M7 b+ @) P" {
|
|