|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / L& E! Q" I7 ?( l
- [code]EDMA sample test application! b9 Z, i% @# _# A0 i
- /*
) K# h0 Z5 K! p( [0 O7 ~ - * edma_test.c
% c- j2 v- ?2 L' t - *
/ S. l$ s8 j: F - * brief EDMA3 Test Application
. ^& E. n: T9 \ - *
% y$ R$ ]/ H$ h) j; ~4 ^ - * This file contains EDMA3 Test code." k b ]& O/ _3 d; N ?- y
- *. O9 _* @; J, m/ K' e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, w$ |6 Y2 n: E9 h9 B: ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 y% P# {5 f& s3 r
- * TO CHANGE.$ y# K9 r1 r1 y8 G: [
- *6 `' H* ?9 s' V* p0 R1 ~ r6 ~' q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( X- `$ _- P7 L( t/ ~% q: q3 ] - *6 U2 q, L3 o0 B; F& e
- * This program is free software; you can redistribute it and/or. {) `$ ]# ]& r, R8 [9 `
- * modify it under the terms of the GNU General Public License as
0 Y% j! z( h, q' Z+ w3 x8 } - * published by the Free Software Foundation version 2.
7 ?& r4 ]5 {% {) F! Y9 ] - *$ u# ]. _0 z1 }0 |6 Q' Y+ L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 f7 {( l% ~' ^, u5 g- a9 X
- * kind, whether express or implied; without even the implied warranty# a- k \8 p- _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" k, I! ]6 q/ @1 r
- * GNU General Public License for more details.
: W9 T' @8 g! i# }2 u) n" h - */% A3 s9 {8 s' q4 a/ \& b
- 2 R: d6 ~+ w9 d" [
- #include <linux/module.h>" C* E3 C& o; ^ G2 G. G7 e
- #include <linux/init.h>' Y5 K; {" ^! z$ N% {1 u
- #include <linux/errno.h>* W0 i u8 V T8 U* _& g
- #include <linux/types.h>6 O3 ^6 U# F! [
- #include <linux/interrupt.h>
: M! L f. P, I G( O4 R# R - #include <asm/io.h>2 |2 T# H( W5 W4 [2 f/ m/ { B0 \
- #include <linux/moduleparam.h>/ l8 T: T8 D) V, a" f
- #include <linux/sysctl.h>
P) D* m; J& W* p5 C8 K* }0 J a - #include <linux/mm.h>
7 }6 W7 y, P+ w* ` - #include <linux/dma-mapping.h>" h6 }. P0 ]0 C2 C) H
- # g; S4 w* M! v3 `
- #include <mach/memory.h>
9 |# [* S0 c) F( U# L$ }$ u - #include <mach/hardware.h>
/ P5 w7 }) O; S, C - #include <mach/irqs.h>5 ^* _7 U0 w' M. Y& ?
- #include <asm/hardware/edma.h>6 y; G3 Q5 z: X6 P& S* Q" o
' E1 L8 N/ G3 D- #undef EDMA3_DEBUG( Q9 A+ ~1 Z: N, \% e$ [
- /*#define EDMA3_DEBUG*/2 u9 `% [. N. z7 k
- 9 S. Y; j" L$ u2 H) F
- #ifdef EDMA3_DEBUG |1 H! T. T: l2 R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 v6 z: x' P; [( z) N1 V6 C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 L M. f; K' D7 _, r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); A& u% e5 T" N9 W% | A
- #else
* A# h8 P o( }) m - #define DMA_PRINTK( x... )
: C, b3 T5 O5 p, E+ m8 _2 ? - #define DMA_FN_IN. ?. _, z+ s6 r$ c" n+ W
- #define DMA_FN_OUT
+ O& h5 ^* c/ F- } - #endif
' y! P0 ]; k3 H+ ?; R- x
2 Q9 P4 w9 d6 f) T5 Q( {5 C4 ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 n1 H" P" j/ _+ C; @
- #define STATIC_SHIFT 3
8 e, y/ k# Y. A* P+ C. F - #define TCINTEN_SHIFT 20& ~* f4 B' g* [( d
- #define ITCINTEN_SHIFT 21
{3 B8 n+ c. _ - #define TCCHEN_SHIFT 22
+ s) j$ Z4 Z0 P8 I' G0 z - #define ITCCHEN_SHIFT 23( u7 Z- c. }) q$ m3 M
5 o# v* L1 Y+ t) q* ?& ^5 y( y- static volatile int irqraised1 = 0;0 E3 i j0 Y0 l% K
- static volatile int irqraised2 = 0;5 E2 T) B, h4 b8 b" Q# m4 Y
: _6 N+ X* `' ?* b8 K- Q+ U: r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# f4 h" L" A. F& t# Y* c" D! R* F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- e+ b5 R+ x1 ?: b9 K. S0 ^- s: N - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Q* T( N' N& s& l, d+ J1 u
- ' [. ?" v7 e6 v; j) f
- dma_addr_t dmaphyssrc1 = 0;
8 t7 ]2 G W2 }9 X8 t, Y8 _ - dma_addr_t dmaphyssrc2 = 0;
& S P$ @& `/ F9 W2 B - dma_addr_t dmaphysdest1 = 0; d. m/ Q' x1 r _ }: M
- dma_addr_t dmaphysdest2 = 0;
7 w2 _- B' X' q8 Q
* x, ?) `2 n' o" Z; n( [ [) v5 f- char *dmabufsrc1 = NULL;
- v5 P( t: U" q9 ~9 t! A7 P- E" c - char *dmabufsrc2 = NULL;
6 C) n1 i8 e% i - char *dmabufdest1 = NULL;
) q* E0 V; ?4 u, ?5 r. _! ?# A, K9 l* C - char *dmabufdest2 = NULL;
& H! w9 d3 |1 W5 P. T* s, E5 g - $ h7 s7 J" z C) o, g7 g
- static int acnt = 512;
& F$ Y C/ S+ b( w% x - static int bcnt = 8;
% i2 d0 C' r S1 M - static int ccnt = 8;& V0 w0 {% E) E/ i7 V
- # ~4 r7 _4 Y6 g+ t! w
- module_param(acnt, int, S_IRUGO);
$ L3 u* E/ ^& i - module_param(bcnt, int, S_IRUGO);5 X8 U0 j$ o j, h8 F$ m n
- module_param(ccnt, int, S_IRUGO);
复制代码 + t# ?/ K& R7 }& v; Y# C
" {. j2 |0 U$ w! P1 I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 \9 g/ W0 c& oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! n$ q+ d' I% n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 f9 i4 K8 p1 ~+ w2 X+ f8 @
+ \1 i' B& _( i/ d
2 r8 }: n/ b3 L9 ?$ ]9 _ |
|