|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & M& `8 ^& B: }
- [code]EDMA sample test application9 o4 e3 O9 ^5 t3 b- s2 H9 u3 j
- /*7 C. n# T' }7 e+ L0 T
- * edma_test.c
& Q1 k; n4 ?1 a. _1 X+ k' f - *
3 Y! Q. B! v. R4 X: d* h3 |8 D/ S - * brief EDMA3 Test Application7 K4 U0 j) ]/ ~* |7 v/ E$ H
- *
! l9 X4 V( ^( o8 L9 y) Q- z1 k - * This file contains EDMA3 Test code.2 i! w5 Y! c8 ^! R3 ]
- *7 \4 k8 W0 A0 g% Y6 z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 N. o0 j) g$ x# [# k. O0 ~+ j, a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 U% i6 ^1 A, D5 N - * TO CHANGE.3 m; a7 ]! `: M7 N4 c1 @
- *" a: \- l% R; d4 c% ^" V' i) f9 L# H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// R* t- V# {8 y- M6 K; ~- L( I
- *2 ?& A8 ]. U# o( ~7 ?' s! ^* Y9 v
- * This program is free software; you can redistribute it and/or1 D/ H% s5 x2 h' G5 V& ]/ p. e& n# {/ K
- * modify it under the terms of the GNU General Public License as! N/ g4 K% X3 z0 I1 x: O
- * published by the Free Software Foundation version 2." o# |2 X) P/ F9 T$ z* ^! O3 h
- *+ S6 v, w$ V* D2 S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ [3 p- L. Q3 U# d" q - * kind, whether express or implied; without even the implied warranty
) ^, D: n6 H; k7 T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ Q0 {- ]* V* e' V5 c - * GNU General Public License for more details.
: [1 ^) l* A% S( s: C$ H - */
/ ~5 [/ F( j, p+ p1 f# T - - x" F) [! I8 ~) ]# h# A; O! E
- #include <linux/module.h>5 c3 y9 V% a* y: P/ Q3 T
- #include <linux/init.h>* j+ b5 N: U0 e6 t4 f
- #include <linux/errno.h>
( I9 s6 d5 k2 y1 M' h- q) v+ ?# W' K - #include <linux/types.h>
9 i; G: V( J' x- g" ]) \1 Z - #include <linux/interrupt.h>
. i8 |. W+ U% H$ ?- B1 c - #include <asm/io.h>
2 v2 E/ d% Q& P" J" \ - #include <linux/moduleparam.h># L! T! X- F5 S8 x
- #include <linux/sysctl.h>
2 e( k1 M1 T( B. s - #include <linux/mm.h>
- L, R5 P7 [, [. Q4 l3 n A - #include <linux/dma-mapping.h>
% r3 T8 g8 H- Q5 @3 f) k
9 P8 ^- y3 k7 d0 Y" x- #include <mach/memory.h>; }) Z. f, z, |/ c
- #include <mach/hardware.h>0 L) A/ S# {4 L/ D% E
- #include <mach/irqs.h>
2 r O* @6 ^3 ~6 n: d) C2 V - #include <asm/hardware/edma.h>
% ]% s7 D8 @5 H1 O) @
7 z( M$ b' N2 i- l b- #undef EDMA3_DEBUG( B* n; u d0 u j% p
- /*#define EDMA3_DEBUG*/* u& q8 f0 Z7 R( E: Y- Y) i
- ! y4 H, N6 q* T! z! @% o/ C
- #ifdef EDMA3_DEBUG
$ G6 C5 z( u. Z: q6 w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 @6 n9 `; C# S0 O. W5 a. N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! z8 }2 R, {. P: X R6 ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% K8 {4 H; K, k6 w
- #else) J3 B1 p1 {, M& D* F
- #define DMA_PRINTK( x... )# Z& g& K. }# Z6 W- {: G
- #define DMA_FN_IN/ P& H/ J1 m& ?
- #define DMA_FN_OUT5 K! w; P; S8 h( c& y: S
- #endif
: \1 o6 B2 |8 g - ; [3 _7 }$ }' d3 O$ ~1 j9 F" O+ T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 q$ |4 q6 `! w: u% U8 f
- #define STATIC_SHIFT 3
L! O6 w9 a2 @6 T - #define TCINTEN_SHIFT 202 j4 j$ u1 F# F) H$ v5 l6 j
- #define ITCINTEN_SHIFT 21
! J" G) i$ P/ h, K+ K* f0 W - #define TCCHEN_SHIFT 22
# M, ]' J9 a; z - #define ITCCHEN_SHIFT 232 t8 `+ f- W# _; a/ {: |
) f; c2 `3 J9 K+ F! N- static volatile int irqraised1 = 0;
4 @! c) ~5 u j# A X( R/ n3 { - static volatile int irqraised2 = 0;0 W* _- I0 E2 ?% w9 a, d8 _& W8 w
% J s% L6 B! l9 O2 W5 e, ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& {5 E% e1 \' `, e( D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' o0 X! ]* I; c( X$ V. f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 d; N" a3 I+ ~" D& p) A
, p b+ S5 l) {$ }- dma_addr_t dmaphyssrc1 = 0;3 [0 Z! s& O: M9 L
- dma_addr_t dmaphyssrc2 = 0;. y) m8 I9 w* M+ x
- dma_addr_t dmaphysdest1 = 0;2 |. A& C6 V% G- A) p0 L0 C0 @1 _. f
- dma_addr_t dmaphysdest2 = 0;
2 r6 P. ]2 J. E
0 F+ H2 J X% q: b9 |3 K0 Z- char *dmabufsrc1 = NULL;
4 P5 J7 `) E* Z; L- \: P: G, C% v - char *dmabufsrc2 = NULL;' x1 H3 d1 y/ F1 @8 n$ Q
- char *dmabufdest1 = NULL;3 e2 J( T) i% ]
- char *dmabufdest2 = NULL;
0 O- P. o/ Y; H; Z4 W7 z5 z# p2 Y - , p. R, u3 o) P* c8 ~' M0 C+ ^
- static int acnt = 512;8 f0 Y2 B4 ]" w" B
- static int bcnt = 8;
6 X3 l3 S8 V, V7 {- A - static int ccnt = 8;
( I# |& Y! Z Z* q- O+ K W) m/ a
% r- O: J3 z7 ~1 l/ W- module_param(acnt, int, S_IRUGO);* V" d4 [: {- v8 L# J. z- P+ ?9 c
- module_param(bcnt, int, S_IRUGO);
& m+ S9 R1 V/ e& \# [2 A - module_param(ccnt, int, S_IRUGO);
复制代码 ; \% K2 l& K, q: G0 w( j* c2 l1 t
+ v: P. a( e0 b0 ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ @4 B1 ^" c% [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 q2 h6 }& ]$ q5 r- I* A9 |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, H4 p- d( H8 I# V- f, G
) A8 C* \2 C& r E" D' @7 T( v( H' u; } R
|
|