|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, x& s W8 H3 g- [code]EDMA sample test application$ P3 h) h& E3 H$ o0 d& R) d
- /*
6 V) i. I$ L, k2 n/ Z - * edma_test.c6 i, W- @( b' H1 q- U# N# C0 q+ M# ]
- *
- k: l0 M/ V6 k2 o, ?0 D - * brief EDMA3 Test Application
/ {' C* r; A8 Y8 A$ s9 x8 e - *
! T# M, }/ G7 K# O4 f9 _ - * This file contains EDMA3 Test code.* p* d6 T( K/ G3 I$ V, C
- *
! F6 n- k( K, u& B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( B1 P& f" j, V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. d( k1 I+ T+ ?% o2 Z% v- L
- * TO CHANGE.5 p) s% Y+ D/ N9 r+ N
- *
( t0 B8 |" a5 m4 ` - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 L4 R. \: \( d! w M( f7 K; O/ h* j
- *
}% h1 T6 [; z - * This program is free software; you can redistribute it and/or
8 Y" f# T/ ~- V. a1 d - * modify it under the terms of the GNU General Public License as
! e7 a' n; h8 a$ O) s9 i( T. i+ u - * published by the Free Software Foundation version 2.0 G+ W7 o, |. {( h1 o
- *
0 ~: c) H9 r& Q4 u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) a5 [( F& _: z - * kind, whether express or implied; without even the implied warranty
2 W* p5 E0 i$ m2 t/ r) D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 p7 @/ v1 u) o. n0 ~& {3 A: F# l
- * GNU General Public License for more details.
1 h/ K' @: k% t/ B# w( I! X - */3 T+ {+ ^/ a3 N+ u/ A
- 4 n" y- ^/ g5 e( C2 Q1 ]
- #include <linux/module.h>4 W, m4 R ^+ g3 h* m2 H" P* c) C
- #include <linux/init.h>$ V3 i' C, Q: J7 H
- #include <linux/errno.h>1 Z2 v1 u$ J: U9 {: J2 d
- #include <linux/types.h>+ L/ j/ w$ @8 k
- #include <linux/interrupt.h>* L/ c% V H$ _7 h
- #include <asm/io.h>
- a3 j9 e4 ?0 E. f - #include <linux/moduleparam.h>
( O7 t9 W6 w* {9 H* [6 G - #include <linux/sysctl.h>+ {) H* M% r# M7 ]
- #include <linux/mm.h>& R0 S6 Y3 |. g( }$ m
- #include <linux/dma-mapping.h>
1 X: L8 D3 C6 O0 H: b8 a6 f& L - ! D* B+ y" v: m& N( n
- #include <mach/memory.h># a# z5 _' B$ X& a- t
- #include <mach/hardware.h>! t8 ~7 z3 w. P7 P3 S% i& a5 A( K
- #include <mach/irqs.h>
( E1 w) o- I' X1 U# E$ B - #include <asm/hardware/edma.h>) m2 Z0 {; L$ M! ?+ R
- / P1 h% }; ^" |* I% J: L6 {+ C
- #undef EDMA3_DEBUG
6 W& V+ s0 r# p; ^3 A1 R1 {9 F) k - /*#define EDMA3_DEBUG*/: m6 D) @% n% v, ?1 n/ |
7 @4 ]. v0 J4 F0 O3 H! Q- #ifdef EDMA3_DEBUG
( o. z) l( j( M3 a1 G4 c! B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- J2 g2 S) @. D) J& o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 r4 U- ~* c+ o: o; t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 ]0 ]4 ^# Z- N/ s Y* }( H& N - #else) M N/ i5 ]/ Y& P# j0 z4 R3 e6 n0 I
- #define DMA_PRINTK( x... )
8 Y% i0 T% i) F" x! H# L- ? - #define DMA_FN_IN' q0 s8 o- l, ?0 Y
- #define DMA_FN_OUT8 c! N q% D9 k! y% |# A
- #endif
+ Y7 w1 ^. F j3 L5 N) Q! r
; ?2 l, w" Y c) p- #define MAX_DMA_TRANSFER_IN_BYTES (32768). i( `, u# V9 X9 F$ T
- #define STATIC_SHIFT 3. ?3 n( ]8 s; W3 p9 a
- #define TCINTEN_SHIFT 20 X1 r) \# _% r6 _+ k9 H( d
- #define ITCINTEN_SHIFT 21
, R4 c; E7 V9 k, y& U - #define TCCHEN_SHIFT 22- W) ?" [& G( `7 c* B; @' v3 }
- #define ITCCHEN_SHIFT 23% r; g: F: [. {; b7 c8 k
- + S ]3 R: l; P
- static volatile int irqraised1 = 0;
; y l: A: I, h) I7 t - static volatile int irqraised2 = 0;+ p; }3 ]" W4 \
- 4 s- _2 `, m" \% z, S; r" N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ H! Z1 e& d% n% X1 { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 I2 X2 E' D' M6 v2 `4 [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Q+ Z8 V4 n3 a7 ]& f4 i
- & ~2 z- f( O) \$ O" @: ^
- dma_addr_t dmaphyssrc1 = 0;4 X# U: [" [7 ?7 t* L
- dma_addr_t dmaphyssrc2 = 0;
6 Q: b0 a6 U* ~+ I - dma_addr_t dmaphysdest1 = 0;
; ~( @9 R7 H0 y7 x' D% V - dma_addr_t dmaphysdest2 = 0; V7 b" z* @; n4 Q j
% t! _0 d T' a% C; p, o7 t- char *dmabufsrc1 = NULL;
2 V* h: j" r$ q% ]9 ~ - char *dmabufsrc2 = NULL;
0 f* t5 H% `8 j( i1 |; {$ _. `4 s6 b! u - char *dmabufdest1 = NULL;9 P/ l& T9 B, }: L) X! o
- char *dmabufdest2 = NULL;
+ C7 n/ v9 Y! M) ^
: J) B* s# I; e& A3 h3 ]; z- static int acnt = 512;
/ s! n8 K! r/ a# V2 A* l* s5 N - static int bcnt = 8;5 `* K3 c7 {% b4 r
- static int ccnt = 8;
2 B7 T; ]5 f3 D1 ?+ n - 3 F# E% N+ {5 }& B9 K( _7 U
- module_param(acnt, int, S_IRUGO);" n1 u0 |$ x, M. L- {+ T' L+ D
- module_param(bcnt, int, S_IRUGO);( P5 }7 d) |9 a% X: C0 v! O
- module_param(ccnt, int, S_IRUGO);
复制代码 ! k/ D2 P4 Z, d# g# e/ k$ k: y
7 Q0 w0 F# Q" t" H; @5 B0 O9 u& e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; v+ o M3 V5 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 M4 D1 W! `2 G* u& a9 V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 v( t2 ~/ n. S. M, A, i: {
$ s9 P {7 G* i. h$ ?! x8 k7 L+ }- O3 ]+ M i6 w' S# W
|
|