|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . q) W$ U9 X# _' U# M
- [code]EDMA sample test application" z, C# u( b, [, R# n
- /*. T2 x/ A+ g* F, g( M0 o$ f
- * edma_test.c6 E2 U) K, `- e0 ]
- *5 I$ E1 j4 D2 t# ]+ Q
- * brief EDMA3 Test Application8 {3 g$ K% c' b
- *
" I3 m0 c$ U) \ v2 @# b: G' f - * This file contains EDMA3 Test code." B: r1 M9 ?7 i7 J
- *3 x5 j$ i: q' ^" [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# R) a4 N" ~, |4 P0 r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& M& s; }9 V' C* o) P! N* r - * TO CHANGE.' x+ d7 a* _/ W) ]. N& \
- *6 ]1 g, E8 H3 d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- s6 m3 Z# k0 R' d5 t
- *% o( O$ K" m4 c* z
- * This program is free software; you can redistribute it and/or
" A, J. | P( S( b' H7 a - * modify it under the terms of the GNU General Public License as9 i1 F4 w3 t- ?+ e
- * published by the Free Software Foundation version 2.
* {, q w5 U, S$ a; J - *
3 C1 m ~5 z, s$ K! N* Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 y5 c* s Z9 h" C4 }
- * kind, whether express or implied; without even the implied warranty5 i. U6 a( Y4 c# E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ _2 H* D0 \8 m( h( q2 M, C3 H
- * GNU General Public License for more details.6 g- c* e' T1 ~2 d i3 f: U
- */
( }7 l8 o; B+ j+ S2 `4 x
. N$ h* ]/ Z" O- #include <linux/module.h>
0 F. W3 K) A9 W5 a; o - #include <linux/init.h>
# E, f5 U1 ]3 R8 Q - #include <linux/errno.h>
% U2 N9 G2 [* C; \7 c3 {. t3 c - #include <linux/types.h># O; a' k3 t4 j3 h/ J
- #include <linux/interrupt.h>* j2 T! K9 l6 N& g' m" l
- #include <asm/io.h>/ P0 e2 u, i. t) m5 O; R
- #include <linux/moduleparam.h>2 ?: b- z9 ?: S7 m3 V: i
- #include <linux/sysctl.h>
6 I8 j4 R9 Y% `" E - #include <linux/mm.h>% I# j+ l0 C; c6 a- x) w! e9 E
- #include <linux/dma-mapping.h>! g$ K$ D; f) J
8 v7 D. |$ J' R+ G7 w% ^0 |- #include <mach/memory.h># y4 d# s( T/ l
- #include <mach/hardware.h>) ~, _+ y S; T% N4 M
- #include <mach/irqs.h>1 t) l5 T! l U
- #include <asm/hardware/edma.h>
! k r! u) `) Z# y3 J# \$ Y) ` - , ?1 t8 I8 X7 y( l5 `7 d8 l( [
- #undef EDMA3_DEBUG& [8 @, j8 B" ]
- /*#define EDMA3_DEBUG*/
0 S0 \$ D$ @' k; N+ T - 0 m0 K8 h7 n4 K
- #ifdef EDMA3_DEBUG/ H9 {+ E1 M7 H2 _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 h' O3 w+ j7 U* h; D) B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& r4 s) @+ l3 W3 [$ T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 x2 Q* U+ X1 d - #else
$ p- c1 J" B( H! z2 J - #define DMA_PRINTK( x... )
/ r9 s! L5 n, A; ~. b# ` - #define DMA_FN_IN
1 g: d$ f* a9 c6 V - #define DMA_FN_OUT
6 N- u/ [- Z. `! U7 ` - #endif
- @; P' n1 \2 Q) @9 Q; d" P - & k1 c+ O Y( G5 K9 c. e; b6 S1 ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ t' M: W$ }) I7 x! C9 f9 f9 F { - #define STATIC_SHIFT 3
2 i1 p# _4 d7 [' N& s& @ - #define TCINTEN_SHIFT 20* ~3 q* j- j$ X+ z8 t8 Q
- #define ITCINTEN_SHIFT 21
0 W* r& R% Q; N8 P9 O& R - #define TCCHEN_SHIFT 22- ]1 O U- h- j
- #define ITCCHEN_SHIFT 23+ z7 w0 P* `: ~1 W# N) d& R0 G+ H9 O
5 x' [8 F- L/ Y, b- static volatile int irqraised1 = 0;2 O. A- F& y9 r' K- j+ F/ a
- static volatile int irqraised2 = 0;
* G3 B8 z/ N+ {3 {: e. y - + S8 u4 t0 i3 y7 U" c$ Q% i; m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 E. n) I: z+ O3 u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, U% |7 K! n1 C4 g% s - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 W* a* M1 q: q$ w: B
- ( f9 H5 D5 |. o- X$ W- v7 b( Q
- dma_addr_t dmaphyssrc1 = 0;
' c" N' D% R& l) G& b5 Y - dma_addr_t dmaphyssrc2 = 0;
: o( R# T; L) Y9 A" ?6 K, G - dma_addr_t dmaphysdest1 = 0;
- X3 }$ \8 }: C+ j - dma_addr_t dmaphysdest2 = 0;/ {5 p1 v) _% Y( ]# j
- r2 p k9 J3 q6 m8 Y4 Z
- char *dmabufsrc1 = NULL;, D0 S# N! `* I4 h* @ `
- char *dmabufsrc2 = NULL;
. G: V1 o8 i: q4 ?3 z - char *dmabufdest1 = NULL;
5 C* k3 D0 `+ s, Y* T$ N1 D - char *dmabufdest2 = NULL;
/ E5 n" t+ h3 @& a, S( }
X5 V1 n# g/ U ` a- [, L; n- static int acnt = 512;" |6 f9 F* A: X( e8 ?, p# Q2 }
- static int bcnt = 8;
( f/ P2 r' `: d( _5 [ - static int ccnt = 8;
7 i, g7 j3 m1 L# |7 ?
1 n7 N" X6 ^+ r2 N: f: w- module_param(acnt, int, S_IRUGO);
# A: B4 b9 g4 X - module_param(bcnt, int, S_IRUGO);' }4 H/ H( A# P$ X, L' o9 C
- module_param(ccnt, int, S_IRUGO);
复制代码
5 L# ]# \( w% ?0 c0 W7 g8 ^6 m
" e9 S9 G, R0 K$ Y' M; J0 [& E! h( t0 T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, N K* V- i/ t; s- H7 }6 ^ ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 X; j/ h: u6 o4 j+ A" ~* x q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 C7 X5 a% {6 ~# W: ^ L8 |9 |1 h7 u) |4 M _$ H
2 o n, \8 E+ `$ W; W |
|