|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. S0 W) u8 u- s% F8 @4 @- C- [code]EDMA sample test application; d, R3 ~: P2 T6 ?& {3 w
- /*; f/ X% o! Z: {- l
- * edma_test.c
# {: o9 y1 K e# p( @ - *8 ~7 u% t" P2 a y+ {
- * brief EDMA3 Test Application
! D% ^1 c' w( ~ n- @: r/ B - *
+ H1 _; Z$ o) U8 }, N5 H& R - * This file contains EDMA3 Test code.
7 m, g- e5 _; h! T7 T0 W: m7 q - *; t3 W. p I z% o2 q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( v/ o4 `6 c: z0 |) N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 A4 H( L; X, a: S3 A; p, ` - * TO CHANGE.
3 l. U, i) e+ \3 G - *2 [+ M7 w* m) ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" |5 C* W* l1 O, Q6 I! l - *3 [5 ^1 h: G2 Y! M! U" s3 h
- * This program is free software; you can redistribute it and/or
0 m& i5 F: H4 b% a5 p& m - * modify it under the terms of the GNU General Public License as
! g# o" J7 o4 q' G - * published by the Free Software Foundation version 2.
& b! U( l2 I) @1 h T - *
8 ]) C# J) N9 Y! [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 `; Z% Q& J6 e" h: L* `6 j - * kind, whether express or implied; without even the implied warranty
, ~ K! \& P- v3 }" Y: B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- \5 G4 e2 T( }5 s
- * GNU General Public License for more details.' H( [) \# I( }$ z
- */" [8 |8 a& C. i v& t
8 p8 J$ t# v( ^: f' ^- #include <linux/module.h>
: h* C3 Y6 t4 K# W ]1 K - #include <linux/init.h>
* r7 f/ x" Y/ Y - #include <linux/errno.h>
, j5 |2 i7 {7 u" r- w6 a {5 A. m - #include <linux/types.h>+ O) I, J6 d5 ?
- #include <linux/interrupt.h>
, B! q8 u0 T* A - #include <asm/io.h>6 c9 I+ ^( f( U% S2 }+ ^
- #include <linux/moduleparam.h>. y! P5 Z9 m. b! Q! I
- #include <linux/sysctl.h>. ]: s! w/ |7 M3 A
- #include <linux/mm.h>
% L, s* S: M' w+ A3 p& L4 D) F; r( e - #include <linux/dma-mapping.h>) y7 l3 K- _) m" g( f6 f3 Z) i
( j2 s2 h& M' p2 u2 O- #include <mach/memory.h>
8 \6 }; X. Z2 Y4 \* T6 S$ Y) u - #include <mach/hardware.h>
" P' g0 P' |$ g; P! T& k - #include <mach/irqs.h>
1 `9 y7 l) C+ ^, c* G# l, k4 [ - #include <asm/hardware/edma.h>0 f+ s3 A& R+ F) b5 ?
7 v3 v0 x9 X. _9 I- #undef EDMA3_DEBUG1 k5 t4 l) F9 _% |4 J/ X: U
- /*#define EDMA3_DEBUG*/
1 N+ j& z' ~: Z - / ~' }0 }6 E! _! ]0 D$ K( O+ L# Y
- #ifdef EDMA3_DEBUG
5 X" ?* T! F4 m8 x- K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! i0 Q4 }& x7 l! Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) E+ S' A4 d( w) B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ k$ n' d# H/ `4 l; d
- #else! p9 L' A" U/ D2 Y
- #define DMA_PRINTK( x... )
2 g% e+ E3 w% x: J, a# W - #define DMA_FN_IN1 X* a& {( e- o
- #define DMA_FN_OUT2 S) r0 ]. M9 F/ o* \
- #endif) A4 r- y; a' a( [6 ?5 n
) r4 _$ p) c2 d i1 L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 N$ u- r5 W- }! D5 O* W
- #define STATIC_SHIFT 3
0 n5 R1 y7 s4 y- g& m - #define TCINTEN_SHIFT 20
. W2 B( ]2 a2 s - #define ITCINTEN_SHIFT 21" i1 e0 ^1 C% o* O' @9 _
- #define TCCHEN_SHIFT 22% q5 ^! E: }4 G
- #define ITCCHEN_SHIFT 23
. u5 ?# [6 s$ l1 e - - B, U0 x. q6 \
- static volatile int irqraised1 = 0;
; v9 c9 X& D" g; I: Z+ Y - static volatile int irqraised2 = 0;4 g& t& r3 b; T
- ) S6 k4 `0 l7 T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. h7 |3 U, _& i( J- a7 {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); q' U6 A* c; M: W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 _2 A3 S, q/ y1 x; ? - . v) j- m' b) `1 ]: `" Z
- dma_addr_t dmaphyssrc1 = 0;# Q+ E) d) Y# a( R5 v0 b9 l
- dma_addr_t dmaphyssrc2 = 0;- I1 _' i5 u; k. a5 |
- dma_addr_t dmaphysdest1 = 0;
" X6 C- D- e7 r2 K# {* P i - dma_addr_t dmaphysdest2 = 0;# ?+ w, S1 q6 n: n( e2 M3 \
- ( W, j4 L- \/ y& l
- char *dmabufsrc1 = NULL;
) h% E$ i3 H" d. N6 m# } - char *dmabufsrc2 = NULL;: V o' D8 B7 y
- char *dmabufdest1 = NULL;
: q) _9 r4 G- I; J, i( _! h - char *dmabufdest2 = NULL;% b/ W% @9 y- p/ x; {! `9 B0 n7 l& g
- 0 o+ }% `: c" {7 o% I/ S9 h
- static int acnt = 512;
2 D! R, h- R. h- `) c: P - static int bcnt = 8;* ~' T9 u; U9 k3 n" e: U
- static int ccnt = 8;, C0 B3 C* B9 A4 W1 i4 x9 u8 W* u
- " i5 c5 G# W- P$ e4 i5 o+ z! F* `
- module_param(acnt, int, S_IRUGO);
; m% {7 F( |2 _ j; D4 R - module_param(bcnt, int, S_IRUGO);
8 b8 [ g6 s+ E+ z - module_param(ccnt, int, S_IRUGO);
复制代码
1 k, \0 f. A( `0 _
4 Z* {! \3 P& `" Y9 i7 s: v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& E. V( h( j! C9 w' U- @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 Q! t# s! N4 T3 j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% t% [- A2 e; x' M0 `$ I8 ^6 @& Y9 ^/ x# ]; f6 o7 ?9 F
$ a- S1 x! A7 r8 W% e) e |
|