|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , D3 ]! e4 L& `# B
- [code]EDMA sample test application
! G/ G5 s1 O0 w2 I3 \ - /*; J8 L% U6 D7 G$ }" m
- * edma_test.c3 I' {9 o2 w- h- d2 d2 B, P' R% ^3 o+ ~
- *
. {; P: n: v' [6 W" x! t0 G" E/ K! o - * brief EDMA3 Test Application% L- _8 k9 s4 {3 G7 K
- *
$ z& x: f2 h {/ M& N - * This file contains EDMA3 Test code.
* {" O5 b z+ ]0 n5 U# J - *
; C% W( @2 D5 @, ^+ d! C! { o1 C9 X* i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- L; d# d+ M0 ~* H4 P2 P! c/ e+ q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ y! U5 X: a0 [ [" u8 ~( S - * TO CHANGE.1 _- J/ U9 E% W/ ]
- *
4 h, ~0 i. A R& k' L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& n+ t# E/ \: r, D# l, w9 X+ u - *
3 B3 o. `6 o& ?; S - * This program is free software; you can redistribute it and/or7 `, z j: u3 X8 H1 B0 T9 x
- * modify it under the terms of the GNU General Public License as0 z+ y4 Z6 o8 V; x! S- |* [
- * published by the Free Software Foundation version 2.! |1 {6 Y+ ]' T, ]4 {+ ?
- *
# s/ a$ L. R, D6 C/ I0 d) R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( b7 R* y7 T2 Z' {- F# D9 g) F2 H, N - * kind, whether express or implied; without even the implied warranty
, e8 D+ J% z& p j- g0 V" K: \/ G) z+ L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 q2 l5 J9 Z0 g/ L7 O8 ] - * GNU General Public License for more details.
8 @5 k6 X: r9 f& M) Y- _* e$ J - */
6 h( B7 a2 c& G8 V" `2 s - + D7 e5 x' S1 O# A
- #include <linux/module.h>& d, W& v/ A0 d9 [. P! l4 i) o
- #include <linux/init.h>
. ?' m' y+ c& Q& ]% r6 z; b1 `, e - #include <linux/errno.h>' U$ j3 i% n" c0 @9 K& H/ J
- #include <linux/types.h>
/ h" t6 v7 K& P! N - #include <linux/interrupt.h>, z0 J5 s) G2 k9 E% Y) L
- #include <asm/io.h>" K9 [' _: U* W8 N; i9 m) `
- #include <linux/moduleparam.h>6 j$ Y1 }9 ] q; R2 N
- #include <linux/sysctl.h>& f0 E8 v; H/ o+ L# e3 ~
- #include <linux/mm.h>0 L" L5 a' P1 H. W/ A
- #include <linux/dma-mapping.h>- C3 ~' g3 _% S6 c6 j R8 l* D x
- & g ^( l& B G2 [" s
- #include <mach/memory.h>
0 C& ~0 w0 u7 z6 X$ T - #include <mach/hardware.h>
( P2 n9 Z; O: D* D) A$ ` - #include <mach/irqs.h>" ~/ n' l# i" [- l5 w6 V4 k+ r
- #include <asm/hardware/edma.h>
" C# n( T; }' `4 x1 R
( t Q3 U2 `& ]' r, D2 ^" \- #undef EDMA3_DEBUG
7 o0 B" ]( M( B" ~% f - /*#define EDMA3_DEBUG*/
. ?. L" j @( l4 u7 D - 8 x* `0 m& C$ S& ?8 F- [; e% Y" F
- #ifdef EDMA3_DEBUG5 A6 _* S9 I: J4 C# x. {9 U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% {3 r! {3 T6 s1 A& j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). {, o0 h' a# j4 d: H5 T0 R& I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# g8 w7 P$ u6 q5 m5 r9 k - #else v0 `- O* Q. i9 Q
- #define DMA_PRINTK( x... )) S7 ~* Q9 |$ W) d+ G | A6 m: e' l
- #define DMA_FN_IN n/ ?* r1 U$ w4 ^* ^+ C
- #define DMA_FN_OUT
: s7 q" b2 U5 s) R2 ^ - #endif
( j9 \1 y. V4 v" s0 x: u
( J7 o/ w5 S7 h7 A# P- #define MAX_DMA_TRANSFER_IN_BYTES (32768), k* p! t0 q D. @8 l% l
- #define STATIC_SHIFT 3 ]* F; x) L. S# J$ P2 f! f
- #define TCINTEN_SHIFT 20/ y/ V& }, j1 s g( U
- #define ITCINTEN_SHIFT 21
, O$ L9 t* \) M& E: ?; [: T - #define TCCHEN_SHIFT 22
9 U0 e' L! X4 {, f- ~( l - #define ITCCHEN_SHIFT 232 C, A. I; R: G3 A
" Q* R/ |; ~& s' b3 k5 X; X, M- static volatile int irqraised1 = 0;* ?2 {( Q" ]& t
- static volatile int irqraised2 = 0;
, z. A* ?* _( i* ?& p - & h) O) u( r6 e) u- A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ K& G1 E5 t' V' I: q" q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 B9 l9 M0 T+ @ g4 c' G$ M$ m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, P4 {) m- r4 z& R3 j( m - ( V3 @! P1 R/ e; ?( Q- a, {
- dma_addr_t dmaphyssrc1 = 0;2 A2 T: n& I( {8 N4 [
- dma_addr_t dmaphyssrc2 = 0;! N9 A( g" P4 x# {' Q% D3 H
- dma_addr_t dmaphysdest1 = 0;
( `5 f' u! a0 ~ - dma_addr_t dmaphysdest2 = 0;
* c0 {' m9 R2 k* B2 k7 i- Z7 T - / p! J8 l5 J2 [8 Q7 R9 @' ^
- char *dmabufsrc1 = NULL;
9 E1 w2 {( ?2 n( h" u. _0 @# c9 \) x - char *dmabufsrc2 = NULL;
) C/ x+ _9 }- O3 m% B; B - char *dmabufdest1 = NULL;
# o `3 W: t A& D J# j- I - char *dmabufdest2 = NULL; s" A6 |* z0 i1 z
, S0 j: ^- n4 X6 W8 f3 c- static int acnt = 512;' r o: l, @, S( ^+ C$ F. ?
- static int bcnt = 8;
; y9 E$ H" w( J; B8 n9 Y8 X1 W - static int ccnt = 8;7 n( Q9 i W: H/ s( `7 [
- " w( }, j- Y5 |! Q" L
- module_param(acnt, int, S_IRUGO);6 B1 _1 W% |* T+ m& ]1 m# m1 u
- module_param(bcnt, int, S_IRUGO);
1 A: l1 _0 Z9 S; l# k o& X; g - module_param(ccnt, int, S_IRUGO);
复制代码
" J+ Q- E7 I. p. H' J$ v
7 G- u% p" j. a" V; L* J5 w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! Z+ T4 u8 g( @, h6 v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- V/ w+ f: y; O4 d( b" u3 M9 N* S5 | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 X$ H* s7 A3 h1 b: s; X0 W+ C
2 h- _9 F# P/ p& ?* ?) G# N% S, T0 a' M5 }, i
|
|