|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 j; i1 S( ~/ w& r' [* S* N4 Z3 M
- [code]EDMA sample test application% u- m7 i# q R6 }
- /*6 _7 }+ |4 U- o
- * edma_test.c; u3 G& I2 ~" x3 S; j7 i: d
- *
! `5 x% @* A& s6 W - * brief EDMA3 Test Application7 M' }, P% g8 i6 B$ h7 Q) T
- *1 j( p! x* ^5 E w% f. q
- * This file contains EDMA3 Test code.
1 g; K5 C) K+ w/ g9 V' k - *# `* Z" h5 r8 Z I% D' ^3 X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 P2 e( A$ a8 o# ^" ]7 U, u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT U( C7 H: X7 B- m+ r
- * TO CHANGE.$ g, A' ?% k1 J4 |7 \5 z+ @' O
- *! N! u/ J6 s4 D( }2 z4 f: g0 k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) v, K" X$ v/ N( F0 D* I
- *
8 y+ n$ o( Z/ t/ v6 r - * This program is free software; you can redistribute it and/or8 A$ @( ~1 C6 `# F# {& v4 X9 Y$ N6 o
- * modify it under the terms of the GNU General Public License as
" U7 L3 D4 h0 z2 K5 ~, a - * published by the Free Software Foundation version 2.& V. v$ Q3 ~1 k8 r& D
- *( O# M$ V3 j' ~0 R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( B: J) g* p0 u - * kind, whether express or implied; without even the implied warranty
8 X, r+ N2 `0 ]+ [, u/ Y9 D! u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ z3 v1 _; C. E6 A7 ~ I8 E) R
- * GNU General Public License for more details.
; u' ]% K8 c4 m6 d& O - */) M7 o U" f: D$ Y8 N* [1 f8 U
7 I5 i/ r C% g- #include <linux/module.h>
! |- ^! z: z m1 J - #include <linux/init.h>
& |; J4 K- @( Y$ K: ?. s( ? - #include <linux/errno.h>5 y N6 i7 k7 C, X9 Z
- #include <linux/types.h>% A- m+ S) I6 d5 j! N+ _* m
- #include <linux/interrupt.h>
9 W( e( `; W5 n! w) J# b$ v - #include <asm/io.h>4 _* ]% j" m* a6 D
- #include <linux/moduleparam.h># b3 i( a% Y. B L" ^& `, z
- #include <linux/sysctl.h>8 D1 T& H. B& ^# u6 y1 V( Y1 M
- #include <linux/mm.h>3 [0 i0 A/ N* E' E; [+ l- `
- #include <linux/dma-mapping.h>6 e" e/ ]4 U2 \. x3 W
/ i: A9 j7 o$ V2 W1 ?- #include <mach/memory.h>
1 g. ]4 Z7 z3 N6 Y& w, m - #include <mach/hardware.h>
% G5 E) B! N. }3 ? - #include <mach/irqs.h>
/ O6 M7 _9 b. A0 b: C - #include <asm/hardware/edma.h>) C. v; ]- p& P6 W6 A1 R# t* W
- 7 W' `/ F; q; f* j
- #undef EDMA3_DEBUG$ J: d* I* U7 Z+ n; Q! i
- /*#define EDMA3_DEBUG*/
/ t# ^( j) ~( ^9 [3 w' @ - / W! {4 {* l" N( e
- #ifdef EDMA3_DEBUG
I# c, g9 U: D' d" g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 g6 e+ S) k/ @2 g9 D U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; r5 V" y: I& R: K3 n; U0 G* M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); G7 d) J0 y7 |( s
- #else
% Q* O( d# u {) t0 c - #define DMA_PRINTK( x... )% Y- t( J( N, F4 K3 ?
- #define DMA_FN_IN* ^/ B: A% v2 S& x) i6 r/ S
- #define DMA_FN_OUT
0 a0 _" q: S l4 d; ^% b - #endif4 R1 P- a2 B9 q4 z) n& Y. z' L
' j$ B; D$ D9 B; {' n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! U6 F0 s8 [! ]' t: d7 t
- #define STATIC_SHIFT 3. {- z" \; H: o
- #define TCINTEN_SHIFT 20
! t2 v1 }: T, u- P T) J' k1 E: I - #define ITCINTEN_SHIFT 21
. i: b9 W9 o/ \4 _0 }+ } | - #define TCCHEN_SHIFT 22) ?9 E7 Q$ u7 f! f; w
- #define ITCCHEN_SHIFT 23
" O5 i9 m! b+ {7 i+ g- W - $ }& H! e; A0 B3 P6 F
- static volatile int irqraised1 = 0;
7 l# v/ I1 e4 q - static volatile int irqraised2 = 0;
( E, h! q! C! k3 `4 X7 |7 }
# L% j5 Y6 C1 `- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: X' z9 M$ i# ^9 S4 \) e7 [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
m; v4 e! \. J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) @1 R4 ]1 }) r2 D" c6 n
' E2 a; w3 h0 C# a6 X- dma_addr_t dmaphyssrc1 = 0;
( {" r+ U4 G; V0 c - dma_addr_t dmaphyssrc2 = 0;- X+ Q- b& W9 P% ]% ?" \
- dma_addr_t dmaphysdest1 = 0;
: Q# V8 x6 V: c+ E - dma_addr_t dmaphysdest2 = 0;
' _4 B u2 l$ X8 n2 U - ! j4 }( R0 G, C0 W
- char *dmabufsrc1 = NULL;
/ H+ A2 n3 q! H9 {" S K2 c& q - char *dmabufsrc2 = NULL;8 C" G* o/ R ]7 R. L5 e+ E1 V
- char *dmabufdest1 = NULL;4 P( ~* i% {1 Q8 Q9 g# z" K
- char *dmabufdest2 = NULL;
( ]& x; }& H) F
4 S$ `& {8 a4 I& W# d, u" d- static int acnt = 512;: j% \" h' E& Q
- static int bcnt = 8;# E% u: D, N( `7 B0 O
- static int ccnt = 8;
$ c. C( F! J' _1 E \
% x$ W% b6 }$ ` d1 ?- module_param(acnt, int, S_IRUGO);
6 v' V& D! v. z8 q% z" m+ ^ q( s - module_param(bcnt, int, S_IRUGO);
5 r% J, p) ?& E3 \1 @( }: f7 l - module_param(ccnt, int, S_IRUGO);
复制代码 ) ?3 Q% [: u* c7 d$ @
) f7 }' ?# }3 a( ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 [; u' _( g4 ~* J9 Y( J6 g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 t1 o/ j8 h% D. n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% i7 m2 N' Q# k% _
2 v: o: Q5 W" {; W) x' T* X- \; _8 B$ Y8 l9 d v
|
|