|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ B) @/ M8 I7 B6 e: I/ [* `0 W- [code]EDMA sample test application
- O% ]( b" y0 o- a* _* s2 K; X - /*
! L0 n2 G$ u" V" a" ]% m7 l - * edma_test.c d: Y7 [. ~$ R# D% r
- *
7 y( F# r4 M- P2 n - * brief EDMA3 Test Application9 X7 U- ?5 U/ W, T% B# b
- *. m4 r5 F* y! E) _7 t
- * This file contains EDMA3 Test code.2 I/ e) v B% l; J3 V! l, W
- *. t0 _3 N0 I+ n2 ~. K% X% D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
s0 \+ L! }7 f& I# V3 O' x, ? Y+ @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" S5 w( u+ J2 i$ L - * TO CHANGE.
, _5 t+ {$ K( n) x - *' p; P# D3 `. u* @ f) Y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 B: I+ t7 Z$ i7 i
- *
, m' D8 S/ l! |( S" A4 \ - * This program is free software; you can redistribute it and/or; V2 s/ ]9 S/ P8 ~# X. _5 l& D
- * modify it under the terms of the GNU General Public License as
7 K% i Y& w: }% z - * published by the Free Software Foundation version 2.
$ I- `% T- K+ M0 j/ i! | - *( y& O3 t1 F: s" [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) m# C% |; S. n7 S
- * kind, whether express or implied; without even the implied warranty* ` A& b$ w7 U* |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" n5 i; L) S3 T/ Q
- * GNU General Public License for more details.! ?3 N- R$ }% _
- */+ w& g/ t3 f: }1 z9 r
1 Q. Y) P0 o0 _' P3 G9 w- #include <linux/module.h>
( |& T* P( z& p - #include <linux/init.h>$ O" V; y% D% b1 m T" B2 Q
- #include <linux/errno.h>6 n+ e9 M4 c& R$ \4 K% Y6 k9 o
- #include <linux/types.h>
( D2 I+ u8 G; k8 g. O; u - #include <linux/interrupt.h>
7 t/ J0 l$ B3 g, M5 G - #include <asm/io.h>
' R+ t! E9 M m) N3 h/ @* B - #include <linux/moduleparam.h>
+ j( N1 u+ c# K( \% H: k - #include <linux/sysctl.h>
' E" P0 l- |( G: Z9 C2 l5 V- z - #include <linux/mm.h>
, e4 l" `( b" M! Z) A2 g+ d - #include <linux/dma-mapping.h>, e7 |9 p1 E! z9 [
: A S: H7 {0 n; [ L% N- #include <mach/memory.h>
: ?" I) q/ e1 D9 _' v/ Y - #include <mach/hardware.h>& C/ j7 l" A2 T! Z0 Y
- #include <mach/irqs.h>" |3 ]; v8 I0 i3 j
- #include <asm/hardware/edma.h>1 a0 |( m4 ^ W5 s1 H0 P# A
5 k* o+ o/ l% W- #undef EDMA3_DEBUG
4 X2 L& X- o$ R: {$ X0 D) F - /*#define EDMA3_DEBUG*/
( N+ \% N: u0 W
K$ y# e6 F* A; E6 O0 c: h8 c- #ifdef EDMA3_DEBUG7 l; }2 C4 s% N D5 B' s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 v6 b J; u8 Y; i7 n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 U: U2 x# { t# {: Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 Q9 [5 c9 L7 K
- #else
; T9 p7 Q8 O; I( @3 i/ U& Q% L - #define DMA_PRINTK( x... )
! F# G7 q) |' g( ] - #define DMA_FN_IN
" T! n, m; l- e - #define DMA_FN_OUT
0 f" _% J4 |0 W; c! @# Q7 {3 J - #endif
" q0 q7 b$ G/ b# ~: }7 S: K - 9 U5 K* F1 b, w; n9 e' N6 o5 H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 S) ]; N4 N" r1 W g" x
- #define STATIC_SHIFT 3
" D& C! T$ f! M& W& L6 B* ~ - #define TCINTEN_SHIFT 20
/ c6 [$ K8 U$ T& i O+ `. g - #define ITCINTEN_SHIFT 21' b2 a) h" w( A1 `" r+ N
- #define TCCHEN_SHIFT 22
+ v1 |. Y* P6 m" S - #define ITCCHEN_SHIFT 23
. f' P( d- Y, |$ [1 r - 7 {5 D$ ?; }: [
- static volatile int irqraised1 = 0;
2 a6 y8 r p, d8 w% S! F$ b8 l - static volatile int irqraised2 = 0;% X; v3 U4 X+ k! [- s( {! Q' W0 T
% @+ [: q2 [) c/ B. b2 g( f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ C* X, O$ W; }9 f; M' I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ]2 I3 g/ v5 f! t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, z, G4 M6 V/ `2 X2 {+ {
) m' D, X8 @& L* v; C- dma_addr_t dmaphyssrc1 = 0;
& c1 ^8 C. \8 z/ E n - dma_addr_t dmaphyssrc2 = 0; b. w7 M0 m/ D$ y
- dma_addr_t dmaphysdest1 = 0;
& h4 V) z6 L( S& f7 R7 { - dma_addr_t dmaphysdest2 = 0;
1 d) [5 c$ P3 ?- p7 b - & M5 Q7 T# p3 ?9 K
- char *dmabufsrc1 = NULL;
# ]% s4 o) o6 V- K/ X - char *dmabufsrc2 = NULL;
+ P3 v5 }4 R" A - char *dmabufdest1 = NULL;+ ]' U' f% x3 a% }
- char *dmabufdest2 = NULL;
, o! X( S- q1 F6 F# j3 F: G' a0 k" H9 Q+ B
+ b6 E7 s/ M) @. F Y6 M- static int acnt = 512;/ A( i. x) b2 \1 L! L" ^
- static int bcnt = 8;
) p. t; F5 {: U3 M7 D - static int ccnt = 8;
& d f5 E, d6 k( }
/ ^! ~1 v% k0 M$ S( h% N! d4 O- \- module_param(acnt, int, S_IRUGO);" c' S& g7 P; s5 j2 q* l1 ^& A
- module_param(bcnt, int, S_IRUGO);
& y2 d. U/ Q- _+ j) m# a& d - module_param(ccnt, int, S_IRUGO);
复制代码
4 T6 q& U# X% E4 f. V) k3 X3 y; `7 f( p7 Q9 \4 D+ F3 ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& q$ z. U" J4 r- } k% p2 e* \3 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 p* W) R7 a) e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* [* ~. M8 t9 L0 C3 O& m
, Y4 [7 _' E; |+ x0 H) ? [7 _6 H: a9 x2 G2 `, w- s$ ?) p
|
|