|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( e* |' V* t& y m" a
- [code]EDMA sample test application& N" @; e! F5 T$ t) G5 K; R8 Y+ _! f
- /*
u% b5 G1 ^" t3 M( _ - * edma_test.c1 W4 C- d$ C! L; q6 o4 M7 I
- *$ b" k/ Y K" O* @' _ p6 T
- * brief EDMA3 Test Application" i9 ?5 ^1 r4 ?+ d# g
- *
+ _' [" c8 G' a) u - * This file contains EDMA3 Test code.+ @0 N' ~! U* i) Q% {. Q+ t
- *; b! L! f, q) o8 l/ U2 J" C7 } u1 r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 u" J# N* X: ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! B6 F4 L7 Y: g7 P. T( _ n' p
- * TO CHANGE.
- o) P1 d2 W0 {3 n" `3 w3 \; Y& U7 { - *5 \( g( \* n) G$ v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: a8 W$ c+ @8 N% a# i' Z7 n - * t! t- R- S! B$ I9 ?7 \
- * This program is free software; you can redistribute it and/or9 ~. F+ |' B2 d' f( T
- * modify it under the terms of the GNU General Public License as7 i3 m+ F* C8 a* H9 X2 P, t
- * published by the Free Software Foundation version 2.
9 }8 O$ }5 p% m I [3 p. _: m" } - *# v3 ?# B6 @% n$ y/ q r! A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; i7 D+ m0 j( m. ?) C" y' k8 z
- * kind, whether express or implied; without even the implied warranty+ v* f# o) n6 G$ p7 D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ ]! b& b5 i8 j+ Y [6 o$ Z - * GNU General Public License for more details.
) f0 R& n- X) s& U2 k L; g6 q& W - */
. a% Y) V0 ~% }/ [* e1 l# u - ) t/ s5 N& S/ c% E
- #include <linux/module.h>
W! y e3 V' u r3 N - #include <linux/init.h>
9 x. T( b) v, c( f0 @9 w/ t' m - #include <linux/errno.h>0 d! t- K! g# I8 H
- #include <linux/types.h>& {3 n/ g# K5 x; v9 a9 }0 g
- #include <linux/interrupt.h>0 Y# q! C* A5 e" ^
- #include <asm/io.h>! j; `: I' a! j5 E$ S0 p# i8 e
- #include <linux/moduleparam.h>6 _6 A* c% H, A1 Q4 e# W% p2 a
- #include <linux/sysctl.h>! e9 j1 I9 e) Q8 E/ `
- #include <linux/mm.h>* q: m+ ^; ?& A8 a8 x7 j9 b
- #include <linux/dma-mapping.h>- r5 ^% V0 y% T, L% m5 E! q* B
1 f7 u( |0 D% s& m1 ]2 e- #include <mach/memory.h>9 I; h$ z7 y' j+ ^
- #include <mach/hardware.h> s& K3 `) ~) K. l8 |
- #include <mach/irqs.h>
% h3 b+ b+ {" V. x( R2 @ - #include <asm/hardware/edma.h>! u& I& b- L- ]2 T7 |0 I
/ p, y+ k) m9 V4 G, J& e- #undef EDMA3_DEBUG2 w' w, \7 k' d) ~
- /*#define EDMA3_DEBUG*/! p3 ?9 H4 {6 U! a
- / Z# z, p) I1 z9 n" b7 A5 q! f) Y
- #ifdef EDMA3_DEBUG
6 b( g- h( ?# d: |5 C) B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; t2 C# n5 S6 g& G% R - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: W) t( n# r6 B9 m/ o: R r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" g4 Z( p: W8 X
- #else0 y' R- b4 D+ p' {1 Z
- #define DMA_PRINTK( x... ); P3 S- Y H4 f$ w; s
- #define DMA_FN_IN
. `! k$ \6 Y# y3 L% w - #define DMA_FN_OUT
* A! n! m% O/ C. f ^- A7 L8 h9 y - #endif7 R S3 u+ ]; l0 d3 L) K6 R7 ?
@) l) p& F6 Z5 a# `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; M5 R( X! J; W& b - #define STATIC_SHIFT 30 v" R- s9 H$ Z' ] M9 y/ _
- #define TCINTEN_SHIFT 20
3 Y' m# Z& C5 s - #define ITCINTEN_SHIFT 21
$ Q4 o0 S( i* ]( U - #define TCCHEN_SHIFT 22* D5 k5 m+ U; V4 f* V% h! |7 x
- #define ITCCHEN_SHIFT 23
# x3 {' g8 W& {- f5 ]; T/ l- K o( L - 8 g+ C$ A2 U) ^! U# Z
- static volatile int irqraised1 = 0;; Z+ T1 U& O( y9 ~! c$ |% _' _
- static volatile int irqraised2 = 0;
+ q- t5 z- U7 O3 z' f/ B - & ?& p& R. f' A$ _' {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 q) V7 l8 T. G& S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: q" U! w/ {( T9 }0 m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 J, G& K! k! K7 I2 ?
- F" f. J' |% w [' [- dma_addr_t dmaphyssrc1 = 0;/ E1 f5 p) E# B B# \6 J
- dma_addr_t dmaphyssrc2 = 0;2 o* N4 p/ {; Y6 z3 b/ G
- dma_addr_t dmaphysdest1 = 0;7 S# I& }( Y0 D, S( d/ v; M
- dma_addr_t dmaphysdest2 = 0;
- m( W: e& z% ]; R% D/ M- [ - 1 P) U! J. I; y: A
- char *dmabufsrc1 = NULL;2 s' [& s+ \: h* ^2 P% ?! w0 w, M
- char *dmabufsrc2 = NULL;# K9 }0 V8 J- N+ F* ^" P
- char *dmabufdest1 = NULL;
! D- \7 K4 _/ t: g* _' w7 e - char *dmabufdest2 = NULL;
( o6 q z8 g& s& Z7 X* g5 h
T( e. p$ {! g4 t- static int acnt = 512;
9 M" I/ |2 ^9 h' d - static int bcnt = 8;* x' X x% n3 l0 X g
- static int ccnt = 8;- U# \# U7 R" l5 v
) x' _" r* \* B- module_param(acnt, int, S_IRUGO);
. R) s: ^5 T9 c9 {) y - module_param(bcnt, int, S_IRUGO);7 O9 M: a* D! O! v8 [' E" q4 o% I. j
- module_param(ccnt, int, S_IRUGO);
复制代码
* K8 s1 R* U) J3 K' x
) G+ B7 o( k2 j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- r# u+ j9 _; R T% n# n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) x: }6 L& Q4 p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- H( e$ @' B+ A$ z* W/ O: `1 \ e. n& X |$ C
: ?' \4 G; u# F+ g% l: u
|
|