|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; d; D! f+ f' P. B% m6 H/ F: L0 M- [code]EDMA sample test application
8 R0 q" _0 h, J" p( n! e - /*
' O* N- c) ?7 q A, d4 T; A - * edma_test.c0 \7 d0 L# f2 G
- *% R' F* Y3 c( }9 ^# Y. W
- * brief EDMA3 Test Application
& D/ t. {. z. A* Q - *# C; [4 N7 S5 n/ T) a1 u( i8 T
- * This file contains EDMA3 Test code.
C! w+ Y. P, P0 {- c& c& m - *# I! Z1 P' w2 P# u3 a+ _6 J$ X2 m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, v; e! C8 S/ ]# A9 I E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) o2 ~5 P% c( L, w - * TO CHANGE.
3 _8 |1 s6 a: t$ t. d [+ d - *
# L& i% i& f7 W9 a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 e5 u- @3 j+ T6 I - *
$ \) r& ?7 c$ w; c3 q! D+ F - * This program is free software; you can redistribute it and/or
$ Q/ o, n) ~0 s% u9 P: I4 Z# t - * modify it under the terms of the GNU General Public License as
& Z- T3 g6 e+ k+ Y% } - * published by the Free Software Foundation version 2.
# `: `3 Q6 }# |. F+ Y7 t$ ] - *
! F" P* D2 ^+ o6 L5 x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& }6 [3 k3 m& Z: g+ M: d& ? - * kind, whether express or implied; without even the implied warranty+ y) x8 ]! X# Y% K9 x# ]6 P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# n5 l& t7 W2 f' Y ^6 K. g
- * GNU General Public License for more details.
. i4 B9 E/ b! P7 p. T8 b - */. m. F5 O/ Y$ Y' F( I
' X) T6 X5 d5 ~+ X" x" Z/ d: c- W- #include <linux/module.h>" J5 x. i* g. r# v' }7 v% o L m0 g
- #include <linux/init.h>( F) i4 J- a0 C% A! ]4 _
- #include <linux/errno.h>
- N2 J' l6 o; e$ E Q& u - #include <linux/types.h>8 v) d* n! ~7 X' \! |
- #include <linux/interrupt.h>7 F7 o5 y8 l& W& { ^
- #include <asm/io.h>! O9 {* K& S# a K
- #include <linux/moduleparam.h>! u( `, f$ S; s1 B" |& m: z
- #include <linux/sysctl.h>
H& `: Q% L$ v) x q6 j - #include <linux/mm.h>
2 Z; v( O& F2 A: w+ Q* [ - #include <linux/dma-mapping.h>2 G" c, k; L3 C% P. ^
- z" r& G4 f1 Q; e# T0 w5 \# H$ L- #include <mach/memory.h>
- S5 W) J4 t. T) q; ]0 l - #include <mach/hardware.h>
( D& P; L: `; H& R6 m3 i - #include <mach/irqs.h>. m6 k: [: A+ P5 _1 E
- #include <asm/hardware/edma.h>, V: N/ T; X7 R: s2 k
; }* z3 z# X g; o$ w$ W- #undef EDMA3_DEBUG) ^8 _: N$ G; r0 @( I }0 h
- /*#define EDMA3_DEBUG*/
$ f: ^$ b7 S4 i" {
1 q; o2 f+ P' D7 I1 V7 O2 z/ B- #ifdef EDMA3_DEBUG
2 L9 ?' e) v# @+ b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 a4 O! h+ F+ B1 z2 }; m' u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ O8 C$ q: T. K* d# H. J! r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 y, ^2 M0 N+ D# S - #else g" q2 _6 z/ ]( f& r a3 n# {
- #define DMA_PRINTK( x... )
/ k ~9 r, p# M; H - #define DMA_FN_IN" v0 a2 }8 v0 U4 ~
- #define DMA_FN_OUT
( ?8 j, i) M" m+ }# L" s1 I - #endif
( y' E7 `0 h; ?$ @; B' @! i5 Q - $ t1 u; ?% }0 e) ^4 c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( P$ \( K8 r$ }2 A1 h: ]' q
- #define STATIC_SHIFT 3
/ g& F. X- \" W% @3 t - #define TCINTEN_SHIFT 208 f% Y8 J. K& U9 t' D) G
- #define ITCINTEN_SHIFT 21- e4 z& p9 ?+ a; z3 \
- #define TCCHEN_SHIFT 222 g' H! z1 ~# p/ J6 V
- #define ITCCHEN_SHIFT 23# Q$ {& V( x( ?& a+ u
' k+ E' P1 ]+ r( u2 T3 [% T- static volatile int irqraised1 = 0;
$ \2 w, E, |, G - static volatile int irqraised2 = 0;
- d# }- u1 [" ~" i - . t" H3 I+ o# V) r5 Q- @5 v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
E6 `% o/ }) o9 j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) N; }% m* i* V2 }6 L) ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& W5 U5 R& Z w. w- x O$ Q
+ `5 f6 E) e5 L: P0 `- dma_addr_t dmaphyssrc1 = 0;7 A# J1 h1 c, o2 a" `" M+ q, X
- dma_addr_t dmaphyssrc2 = 0;) b. |+ \/ R/ S) p$ D% V# k
- dma_addr_t dmaphysdest1 = 0;
; `4 a( A$ }6 U# G+ e( S1 B - dma_addr_t dmaphysdest2 = 0;
& p- r" {3 i) j; a) P
& v& R$ _1 T5 t( y& Z/ R- char *dmabufsrc1 = NULL;
7 M5 Q( G; F4 Y( d) X - char *dmabufsrc2 = NULL;+ Q( \! o3 ~9 \* D% |
- char *dmabufdest1 = NULL;
. B/ f2 |) X* g' R3 u - char *dmabufdest2 = NULL;
: D1 k$ \9 h2 p# {" j/ H7 L
2 k9 a$ z% F2 i* n# c0 |# z) a- static int acnt = 512;+ o" k1 C0 D" p' C
- static int bcnt = 8;( J2 h( y6 ~/ c- z" C( T3 Y
- static int ccnt = 8;" k! f) H0 ?; H5 {( Y" @( [6 r
# r: }1 P+ ~: \6 r" V2 M/ _- module_param(acnt, int, S_IRUGO);
3 T1 X( F; x) S: L, X - module_param(bcnt, int, S_IRUGO);
+ o q( t- O( q1 Q& d/ Q7 t - module_param(ccnt, int, S_IRUGO);
复制代码 & F7 f& Z1 U+ Z |) W
" k, J3 u0 m9 @. N* ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; ?7 N6 G5 [$ r+ v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* B+ x: D/ a. S/ P4 y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 e$ l7 F7 e$ ^3 [' A6 \
3 I9 d3 r b- d' N' |* i
. \' O, l. w, q7 Z1 G/ s+ z! E' P: J; j |
|