|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + |9 Q O% A& l; L- T6 f3 Q& n6 N
- [code]EDMA sample test application
1 c/ [' i: R4 ~$ V+ Y) q - /*7 ?4 T. w/ a- O9 f2 X- ^
- * edma_test.c
; s. e% K6 C/ D. | - *
$ s6 P; n% h' t2 R - * brief EDMA3 Test Application# O i k4 O: H* X
- *5 n: }& D- G( s+ O
- * This file contains EDMA3 Test code.: `: c$ F0 U! W8 }
- ** F# q) E7 Y% `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ w u9 N) X# e6 E( Y* |8 t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& E2 D: V, t6 |1 y7 c" N6 j# I - * TO CHANGE.' E0 R ~2 `$ P+ g4 E$ e6 c: j
- *
0 x" F1 y. P2 F% T! A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' l' |7 a2 m( C6 n7 K0 z - *
) Y$ i0 u& ^$ ?* k - * This program is free software; you can redistribute it and/or
5 _5 S" D5 @3 R2 T - * modify it under the terms of the GNU General Public License as
! \) ]5 ~2 K& j4 f1 Z- i - * published by the Free Software Foundation version 2.7 `, y4 L ~' c1 G3 ?# i
- *9 k" ~1 e7 B6 k' j+ ^; y( y! _. G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" _ b* o2 _ N
- * kind, whether express or implied; without even the implied warranty9 Z/ n3 E: c/ M' q, }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 E7 u* \* V8 y7 D6 s+ i2 I: } - * GNU General Public License for more details.
9 w; J7 l0 Z9 @1 a0 s - */
, n1 L3 x# a5 @0 P$ Y3 \5 w, Q0 c8 `4 X - g7 O4 q2 P; ~+ Z( `* V
- #include <linux/module.h>
1 Q! S/ G$ T$ L2 D9 L' t* ^ - #include <linux/init.h>3 g9 |$ k" ?+ n7 F/ l
- #include <linux/errno.h>
; k0 A$ q( Z' h' {9 m3 R8 K8 x - #include <linux/types.h>
3 m0 Y- a+ ?2 j) i - #include <linux/interrupt.h>2 K, i- j# c( Y5 a; C- |: d& {0 u" L: f
- #include <asm/io.h>
- Y2 E4 r+ l x- ]0 M - #include <linux/moduleparam.h>, Q1 d' x0 V! n" z9 ?" C
- #include <linux/sysctl.h>
5 E8 ^1 H8 J0 Q' Y! n! H - #include <linux/mm.h>! u$ J: C- y! V, Y3 T* P
- #include <linux/dma-mapping.h>5 ~' ^( n5 U0 d% o3 L
* r9 A8 g" ]- [( }- #include <mach/memory.h>
$ v5 a6 H( i5 l - #include <mach/hardware.h>" N, `9 q- s* a5 M9 F B- \) |5 I
- #include <mach/irqs.h>
- Y$ ~ u2 k2 F3 `# e3 i0 Q/ y - #include <asm/hardware/edma.h>
# Y1 \. @# g; C& ~$ I3 c9 k - " l. K- z% Y' W# B
- #undef EDMA3_DEBUG
3 {" N5 T4 L4 ~ - /*#define EDMA3_DEBUG*/1 i6 E- `/ Y, g1 f C! W
; f+ D/ q: d; S1 a- #ifdef EDMA3_DEBUG& i( K( [+ F3 E% T6 e! N0 m; t+ T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; X% L" q& h% G, ~ e+ }" S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); m: P: o2 d/ H' u1 G% u8 i7 ~7 Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ {# [. @) v( }2 j4 r1 V( R8 ~4 ` - #else! z$ n( F' I' `* ~9 y) _6 y" c
- #define DMA_PRINTK( x... )
4 _0 J% X" C9 e) e1 f - #define DMA_FN_IN8 N2 f* y4 u; T1 I. @; m# M
- #define DMA_FN_OUT# E( Z1 [ f) J+ J
- #endif! T3 r- }1 B* m u2 d% u1 Q
- : u0 m2 F% U5 Q; l5 R4 {$ Y% T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# k' m) s+ d+ O0 ^/ i4 `' C
- #define STATIC_SHIFT 3
7 P( J! |; p# m( h8 t0 E# n - #define TCINTEN_SHIFT 20
% Y: x+ G* _1 b% @ - #define ITCINTEN_SHIFT 21
: W* p" l* b+ f1 W( F' L - #define TCCHEN_SHIFT 22# ]# Z& W, a) }$ } H6 A* b1 d
- #define ITCCHEN_SHIFT 23
* l7 q m8 R. h1 c+ h
' ]4 k' Z$ E7 L+ `% Y N- static volatile int irqraised1 = 0;
5 K& V% P: w4 V# c! g( i' { - static volatile int irqraised2 = 0;1 E1 p2 `$ r' P" L
% j3 W0 j/ `/ I- t! `7 h3 ~' L0 E4 z2 T- Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( I: Q) S$ e$ G9 E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( D9 G' C. w: y( y: I3 P4 l- w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' t4 }2 p' F0 d' h
- Z5 I: J- _, P* i. I B7 q& ]1 D( v/ w' v- dma_addr_t dmaphyssrc1 = 0;
/ k& ^ ]: ]. M' ^- |) I - dma_addr_t dmaphyssrc2 = 0;3 ?6 |+ U( o9 z3 B3 i
- dma_addr_t dmaphysdest1 = 0;
/ _+ c4 h0 [, {9 y3 _$ q7 e4 b - dma_addr_t dmaphysdest2 = 0;
5 F1 Q4 r1 _0 \) {6 }$ K - ( t$ \8 g0 b. |' `/ u9 Z6 T
- char *dmabufsrc1 = NULL;1 l" k I' I+ k' y \# X& V; p5 h
- char *dmabufsrc2 = NULL;
6 c* n2 {2 t& Y, ^! T; N - char *dmabufdest1 = NULL;
: d+ j, Z- G" o - char *dmabufdest2 = NULL;: A) j1 ]" T+ T- Y
' Z+ i# C1 V9 }' O0 h# [- static int acnt = 512;
, n. C2 x$ u, x# I, P* A - static int bcnt = 8;7 [4 B* ?( S. R
- static int ccnt = 8;
" `( R& P7 T( c% T' ]. v; U* w - : `; J% n2 B+ p# W8 K% r
- module_param(acnt, int, S_IRUGO);0 @$ _+ D9 ^6 Y5 [* P( h
- module_param(bcnt, int, S_IRUGO);! g+ @5 ]' }$ M) q. F
- module_param(ccnt, int, S_IRUGO);
复制代码
# g- }/ T. J$ ^1 p, r& ]
0 L9 J) z$ X0 y7 m( L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 G! V. g! B8 [# G7 P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: B2 ]- p7 z& V/ X& q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 w$ H2 J# n- a
) b- @9 y! w* D; T( b7 P1 d" d x
/ h2 X% R/ V+ Q( [/ J |
|