|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! l# j8 e V; l+ K2 k S, ]3 z H
- [code]EDMA sample test application* U* n8 z8 m7 e! b- _9 O/ ~, B
- /*5 V% w2 C9 @7 v8 `0 C+ z' G7 P0 i
- * edma_test.c% J7 I& `* c5 I5 v( D- }
- *6 _( L. R) \' `7 q' W4 c
- * brief EDMA3 Test Application
( Y3 A- \' {7 u5 E$ j5 p - *
; ~; a" _5 B/ T: s6 K! y - * This file contains EDMA3 Test code.' B9 o1 A/ f- p: B- C
- *
- A# x; p7 K2 u4 e+ ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! a: X* c* I1 L2 B1 d, K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 c$ E5 t8 G% s6 h! o. g
- * TO CHANGE.
R6 g# O( R/ W - *! a' ^* r* A% H: m' q3 _! l- y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! J$ x( V9 i$ O |, e - *( L0 `/ E# U( e
- * This program is free software; you can redistribute it and/or
8 ^. Q3 Q7 d/ K. ~: n& ?7 n - * modify it under the terms of the GNU General Public License as. v' ~% L8 G# B! t- R0 w; d$ `
- * published by the Free Software Foundation version 2.
$ i; V! z2 e) n& z4 s- J+ ^( | - *
& w; d/ @4 X* a. Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' O: v% x# G8 A8 C) `% C' a - * kind, whether express or implied; without even the implied warranty( ^. c+ r( Q# |2 P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: { u2 }# V: Y% \ - * GNU General Public License for more details., H, {0 D3 C9 Z( b
- */! ?1 G$ C: k& M7 k1 y g' h
- % w" X7 [$ X/ g" ~' o
- #include <linux/module.h>
% [, O* L6 B+ G3 _ c - #include <linux/init.h> I7 P* r5 M- h( P) W P
- #include <linux/errno.h>/ {7 w9 e2 j8 a4 |2 W6 s
- #include <linux/types.h>
- L1 O; H& D) s4 D( ~) Q( l - #include <linux/interrupt.h>" M0 X* Y3 Q% P% x9 d0 m
- #include <asm/io.h>
8 C) L* v% b8 Z. d& D1 j - #include <linux/moduleparam.h>
! [. e% R, f) T% n j" c; t2 C - #include <linux/sysctl.h> Z4 \ s/ A% G T3 k9 u6 b/ }& K
- #include <linux/mm.h>4 Z2 Z& F4 [ j B3 C
- #include <linux/dma-mapping.h>, U- v6 L6 l9 X+ s" [! }
0 y6 ?, y q! W6 g! i( ]) F/ ~7 ]- #include <mach/memory.h>5 N9 }; ]- O' [% k! `& j1 f
- #include <mach/hardware.h>
- _7 B; l& y0 f0 H - #include <mach/irqs.h>8 z4 [4 z9 _; ?6 s3 h8 Y
- #include <asm/hardware/edma.h>
/ W) e9 \3 {% A, `# u: Z
5 {1 e7 U2 t" J @% W+ E' B4 t- #undef EDMA3_DEBUG# Z8 h8 p3 x2 p* J& o
- /*#define EDMA3_DEBUG*/
' Q7 V9 _% q( P3 A" B
1 @2 H* S+ m! f3 ?- #ifdef EDMA3_DEBUG& h% W/ V. S4 U% [0 \$ E# }; K5 E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 T1 S A5 C% K" Z9 V/ Z: r9 ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ p3 I$ t- f( ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ n. ~+ Q4 C, Q! T - #else, g) R0 [1 Y6 d! a
- #define DMA_PRINTK( x... )4 S2 y _) L3 a# q) P
- #define DMA_FN_IN
}6 [; V6 g0 Z0 P s+ s - #define DMA_FN_OUT0 U0 @+ _, [( t, U U8 r
- #endif% z& c8 L1 J0 d5 o: |( r
- : [3 u" m1 {, [+ z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 h0 w2 ^; o) H% q/ E - #define STATIC_SHIFT 3
+ V/ x% T- X4 W/ Z3 Z - #define TCINTEN_SHIFT 203 x3 o& Z/ c; }) P; C% |: V
- #define ITCINTEN_SHIFT 21
# o, F* v& N7 r1 W" y - #define TCCHEN_SHIFT 22% r$ e/ \ O0 G$ c0 M
- #define ITCCHEN_SHIFT 23& O3 C0 L5 H- N+ d
, ~! q8 i2 \+ K: Q- static volatile int irqraised1 = 0;
& G6 I3 p; m; a& M - static volatile int irqraised2 = 0;0 d1 Z) i$ E- y& V
! B4 K6 D. q( n2 p8 @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ b, u7 M3 I3 A0 l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! A& g% T9 v R: H9 O# E* o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* J6 s9 @5 ~( s) J0 t3 { - 4 _9 A' Y2 B# `$ y, j
- dma_addr_t dmaphyssrc1 = 0;2 O: j+ @! d) j' {
- dma_addr_t dmaphyssrc2 = 0;. o1 f% B9 L2 [) M% c* V
- dma_addr_t dmaphysdest1 = 0;
1 C# f8 |& g2 V7 ?8 Q T( L" a - dma_addr_t dmaphysdest2 = 0;
: a; j! S/ Q" R8 S) v, k* F/ w
0 T- V W4 b2 Y6 j6 \* B) H$ T- char *dmabufsrc1 = NULL;" h" c/ P- q5 m
- char *dmabufsrc2 = NULL;
. S; J1 }- Q; N - char *dmabufdest1 = NULL;, @9 W1 S; O) N0 n( t
- char *dmabufdest2 = NULL;, K% b& V' I: M
- / i% w1 \3 R, m$ j8 e- V& |
- static int acnt = 512; L3 ~; k6 n+ c$ |0 @& t3 ?
- static int bcnt = 8;
5 [$ b$ }9 i3 ] - static int ccnt = 8;
( p4 G' q' }; A* T$ z& D, B" |/ E9 K4 h
3 g" t5 D7 r7 t0 I( S+ A- module_param(acnt, int, S_IRUGO);
8 ?7 V& b, g4 p) [6 Y* O8 h9 u+ r - module_param(bcnt, int, S_IRUGO);
! `' d9 u6 q# D1 @2 w - module_param(ccnt, int, S_IRUGO);
复制代码
, m4 D4 p. @: R6 g# k, d$ i) p8 J
. m# \6 x/ p! G9 y4 b N u7 r, V$ H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# ]) Z/ ]9 D) ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. U6 R2 {; ~( R6 a9 F K
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! c' l1 d* C& q c+ \& |; H7 Y
* o0 J5 b) W1 ?" x% F
6 I# H1 B- y7 L' G; W* {9 f |
|