|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 X. x, q8 K5 ?8 _- I
- [code]EDMA sample test application
' P' M* E- ?, \' O) y* F. \( x - /*
: ~* [0 \! [! [/ [" I - * edma_test.c5 Z1 j- F0 v4 v; n# S0 X
- *
q# @& [& w3 A/ @ - * brief EDMA3 Test Application
+ ~6 L. U2 r0 L9 c - *
/ v" H* r* n* v. g$ Q S. f2 N2 W - * This file contains EDMA3 Test code.3 T9 D% ?8 @9 J5 b- w; t
- *
' s6 `+ ?7 I4 y x w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- Q3 N- j3 M9 ^) A6 X3 `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 B0 }9 h f+ r g - * TO CHANGE., [9 H1 `* ^5 d4 H; U
- *
3 W) g' V8 T. j9 x+ ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) x1 J0 r! [9 R3 Y% v$ C
- *
% R& H( V/ D8 K0 G - * This program is free software; you can redistribute it and/or
' k5 E+ b+ l8 T% O - * modify it under the terms of the GNU General Public License as
1 D) K* K; y0 s* c) X& S2 I* C - * published by the Free Software Foundation version 2.
9 C" {# E( F; J: r( @2 ? - *, a1 j* e+ K( W [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any |# q0 x* q8 _
- * kind, whether express or implied; without even the implied warranty
/ |3 Y5 t# s/ Q; z' q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 W, t3 m% H& t( h( W0 W/ g2 x - * GNU General Public License for more details.! \$ W4 f0 e6 m; F9 @0 a
- */1 Q0 T2 O0 G" v$ v* G1 P
! q4 S6 k) J( w% R; u4 [- #include <linux/module.h>+ {* l8 P6 N8 A) Y
- #include <linux/init.h>
! t1 u9 D$ O- R; @ - #include <linux/errno.h>
5 `2 h2 J+ }6 T - #include <linux/types.h>+ M; i- t. ~" T! Z
- #include <linux/interrupt.h>1 a; V$ k$ N. \% s7 D
- #include <asm/io.h>
, `/ r7 A0 h. i: ~6 U2 j - #include <linux/moduleparam.h>
9 d' C& i9 G3 ~! q5 n - #include <linux/sysctl.h>
+ [+ Z' j5 G5 t! s6 _/ C: J. Z - #include <linux/mm.h>& u: \9 n, I `9 m3 v1 M
- #include <linux/dma-mapping.h>
7 `- ?3 x8 x" n" y
8 O/ J. f9 {6 g, Y0 }$ H- #include <mach/memory.h>; A0 {$ R' ^* S
- #include <mach/hardware.h>/ C5 ~+ y$ l0 t/ Z7 D+ Y6 u& F
- #include <mach/irqs.h>
! f1 O7 m' ?) F: T& q - #include <asm/hardware/edma.h>6 Z) v4 y8 H) R7 k+ r0 S
- . ?7 I: @- R2 T T6 I5 ]1 E
- #undef EDMA3_DEBUG
% y6 O2 w1 y9 `$ f: }8 w - /*#define EDMA3_DEBUG*/
A3 x. F2 W0 I( Q# e
5 ]% u( V8 j- u. k. s$ y$ Q- #ifdef EDMA3_DEBUG
, N) K3 M4 }3 r/ l% F. I, c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ R7 F2 E1 e& ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; a. Z. Q* K9 I, V% R- s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); B0 u8 |8 Q+ V/ M3 H, z
- #else
: Y# H2 D, m6 Q, Y1 a$ q! B9 g) ^0 z - #define DMA_PRINTK( x... ). y6 |8 E2 i" X( }& \- Q! R
- #define DMA_FN_IN- D' L: c7 t. d3 ` H
- #define DMA_FN_OUT) d3 d2 u) Q( ^, ?& j" W2 {
- #endif
8 b" h4 r( n9 N8 z - m. R6 p7 }( j* r8 F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' G' F, N4 H) M - #define STATIC_SHIFT 3
s' E5 ^4 ~& B. C* } - #define TCINTEN_SHIFT 20+ Y4 n0 }6 G2 y( J+ R
- #define ITCINTEN_SHIFT 21
! m+ h$ \( J# t3 y - #define TCCHEN_SHIFT 224 d) i& d8 z$ ?3 R
- #define ITCCHEN_SHIFT 23
% d6 S* [$ r0 t( V; W$ b% p
% g8 b5 U8 [; h: b- static volatile int irqraised1 = 0;
% o- r: P; X6 N - static volatile int irqraised2 = 0;! t% L; N" _# t ]7 r7 z1 l
- 0 a0 P; z: @- u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 ~8 c3 K3 \! Z$ K4 _6 t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 U) y9 e2 z. c6 Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ I$ _; O5 u& d- r2 x7 d
- 5 O. S9 m) \# _
- dma_addr_t dmaphyssrc1 = 0;7 ^& e; R$ V/ g3 E: |
- dma_addr_t dmaphyssrc2 = 0;
8 r3 F5 Y. |0 f% O! c, Q - dma_addr_t dmaphysdest1 = 0;) u8 {4 \$ g- U- q+ [4 L! v
- dma_addr_t dmaphysdest2 = 0;
* b; z8 _8 n9 i
8 }1 ]! m1 }: u- char *dmabufsrc1 = NULL;! ^% E& [# u* [
- char *dmabufsrc2 = NULL;
, n4 ?# [/ ~* i# ^! r - char *dmabufdest1 = NULL;- j4 I0 d! }0 y4 T1 M
- char *dmabufdest2 = NULL;
2 R0 c* E7 Q( ~; R - ! c1 R2 Y4 D: o' L
- static int acnt = 512;1 |/ F' Y1 j L. w3 f: N& o8 h% v
- static int bcnt = 8;/ v: U& W; S" v
- static int ccnt = 8;2 K" _2 w" C6 R) e) B6 U1 r- @6 i8 {
- * }$ i2 u% K, M+ z4 G
- module_param(acnt, int, S_IRUGO);
; `) h: V. u# b' d - module_param(bcnt, int, S_IRUGO);
# g7 D1 ]( X5 f/ V7 O5 i - module_param(ccnt, int, S_IRUGO);
复制代码 4 n6 N& ]) h# B9 _+ u
# f Y9 v( ^, a+ \0 S' n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. l5 t& O7 x6 z: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! K* s" C% N8 p/ A1 m9 k6 ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 \$ x, L( X1 G# M/ x% [: L" k
/ f6 ^* ~( { K4 p
/ g6 m" c* ^$ `" X5 e1 P! Y |
|