|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 `* o& N" b& v9 o; e9 ~/ u# C; C- [code]EDMA sample test application
6 E$ \. }! z# U7 a g( ~6 f - /*
1 u4 u0 N* | w' O6 C- H - * edma_test.c# U) {3 k8 u# Y5 n
- *- k5 s8 H2 I' o8 V
- * brief EDMA3 Test Application* ^8 D& ^+ @# v0 f( C
- *4 z l; l1 Q( u
- * This file contains EDMA3 Test code.7 ?+ L9 } S/ K" g1 {" |1 m
- *) g3 x% ~3 }: e4 S4 N% Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; s& j1 Q8 s- J/ ?. H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 A' Y2 G$ ~3 B1 } q1 w1 B
- * TO CHANGE.9 O0 ?7 \4 E' h# a9 ?
- *' I% p5 e9 H$ ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! k( L$ R) u) e, l j* p - *0 N# p7 ]8 _' K9 `9 x
- * This program is free software; you can redistribute it and/or5 [ O, k0 Q' [% p7 U" J9 n1 B( ~
- * modify it under the terms of the GNU General Public License as( V1 |. J- t; u
- * published by the Free Software Foundation version 2.
7 S/ F7 w8 H) Z - *
5 c: U+ z$ H, }5 U+ R0 K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' v1 z P# X/ O; o1 Q0 ~: U" m5 k
- * kind, whether express or implied; without even the implied warranty
2 x( M( \$ B4 D" i9 f. C ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; o6 P5 x- Q% _% m8 L! d - * GNU General Public License for more details.
& D7 [5 h" P- K( \1 ^: m2 h- ]8 k - */
3 h% G- V% T0 I; X0 Y - * W' g: {. o/ [; Y( r8 w
- #include <linux/module.h>, w. U7 z0 N1 m6 Y% u
- #include <linux/init.h>( V+ R* V) g" G0 C" w; \3 |6 t
- #include <linux/errno.h>
1 N8 k7 K: Q! `- v/ \& q) e - #include <linux/types.h>1 d) e+ H' q" |3 I' o8 l" u
- #include <linux/interrupt.h>
. F0 k6 w" t/ Y& P' B - #include <asm/io.h>9 d+ K) t( @3 u/ }
- #include <linux/moduleparam.h># m$ A0 t- d9 l V
- #include <linux/sysctl.h>
2 }' p9 h& Z1 Y' ~* s) c9 U2 l - #include <linux/mm.h>
& o0 Q- ?) m! T: L0 ` - #include <linux/dma-mapping.h>
1 X1 }4 }" |: g" B! L, Z$ _ - 1 s a" e9 m' |& f+ I+ R6 q6 [! Z0 Y
- #include <mach/memory.h>* _# e/ |0 X/ ?: f
- #include <mach/hardware.h># U0 r) J9 | f7 X* W+ M
- #include <mach/irqs.h>
% \7 i3 Y+ y( X8 L M9 W& x - #include <asm/hardware/edma.h># N+ \# g9 m5 N1 ]" h w/ a
7 Y" F8 m& e1 H U- #undef EDMA3_DEBUG
+ K. ^9 o3 A8 T: M7 I - /*#define EDMA3_DEBUG*/
+ K2 g8 X0 i, P2 _- ~ H - " a0 F+ u/ w0 Z6 F2 d4 A
- #ifdef EDMA3_DEBUG
# C2 s) {! M. V& ]8 v2 k. L" _, Y' { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), L+ I; C# A/ \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ x5 B+ U& v }( V+ ^/ m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" O/ ]4 x9 t; j - #else$ Y; z) x4 x1 ~ Q/ @8 B7 t4 H
- #define DMA_PRINTK( x... )
& L( M1 @8 h% ~9 V) K - #define DMA_FN_IN
# t5 ]) E; v: c0 F9 ^9 v( }, ^ - #define DMA_FN_OUT" O x$ L' f* [
- #endif0 x2 {6 P6 e& B
- % ~. t. ]$ |& i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& M6 v; x/ e0 o4 n' H" s8 i - #define STATIC_SHIFT 3
/ S5 }) c2 X$ x* r( g. t - #define TCINTEN_SHIFT 20: x$ @# f. H1 Q+ _& u' o) x7 K/ |
- #define ITCINTEN_SHIFT 21
8 I1 }8 T+ U) u# M. @2 O - #define TCCHEN_SHIFT 22
/ `8 D& Y# s& ~ u - #define ITCCHEN_SHIFT 23. p+ U0 k# w# ~8 u0 D& }* I1 Z
- : p0 T6 n9 Y( A+ M6 Z% M
- static volatile int irqraised1 = 0;
A& t" H6 t& Y/ k! ~$ ^) S/ {7 m, G - static volatile int irqraised2 = 0;
" N: r* r7 v4 w2 H7 Q( z
0 A6 g0 g" a% N% W( R5 W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 b+ f7 f; Z _+ T( |( \ W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" S, U( f# T: T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. k; B r% g7 J9 S8 Y# K @
- ' T2 @! }1 U: Q& d& D
- dma_addr_t dmaphyssrc1 = 0;
8 C+ o+ G5 R% [3 r+ ?2 v: B# { - dma_addr_t dmaphyssrc2 = 0;
; u2 i6 z- w: X: F - dma_addr_t dmaphysdest1 = 0;3 i& W" \# x; d: a$ m
- dma_addr_t dmaphysdest2 = 0;6 E( k' M% N4 E7 I/ H# @: M
- $ [) V( V) j: f6 N3 Y
- char *dmabufsrc1 = NULL;/ m, q; }# F6 I( R, N1 m9 m
- char *dmabufsrc2 = NULL;
5 Z6 p6 E! N y _ t9 f - char *dmabufdest1 = NULL;
1 ~% G1 d& k6 W% V - char *dmabufdest2 = NULL;' R* A0 `# e% M
" ?) V2 i+ W5 [ O+ @- static int acnt = 512;8 Y3 B3 h: e$ s1 V+ c
- static int bcnt = 8; }+ \5 x$ l$ P7 p0 [6 p
- static int ccnt = 8;
# A) U7 s* n% z - ) h4 v5 B7 K/ x7 V/ r
- module_param(acnt, int, S_IRUGO);
. v! H3 b# ^2 i4 A9 J+ a w1 t - module_param(bcnt, int, S_IRUGO);
0 q6 P, Z3 }: Q: A9 x - module_param(ccnt, int, S_IRUGO);
复制代码 2 G! q; Q" h* }/ W
& |- F" S6 x0 x, O- h9 Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 |" D. P, O% {5 earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; a* B. @1 f9 [) E M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% ^2 ^+ \* c+ K& \% {- h2 w. K; i! c
5 n- _8 Z; u: N+ n6 T! R# S
5 S( z3 F' | [8 Q. Y# A/ z
|
|