|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * \) O! j1 N9 Q' }+ K3 b* i
- [code]EDMA sample test application& ]1 N" e) H7 t( u
- /*
Z9 c! F! j( e( W4 o3 l1 m - * edma_test.c
2 L- F8 ~; i: _ - *
( a% ^* L. O4 `# W - * brief EDMA3 Test Application a' q$ a& K I* a
- *, Q* v/ S( `2 X
- * This file contains EDMA3 Test code.; u& d9 x- `& h
- *9 P# I& j; |$ Q7 d, W. x; M' a$ Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ ^2 W& T8 [1 Q5 S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* l( W/ ^, ` L, l
- * TO CHANGE.
9 B$ y" d& d; S' I - *
9 M p/ x. G5 @) O, C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 m1 c# {) x$ E3 v! i* L
- *
& } Y0 s3 s: j) s' f5 I& [6 k: Q - * This program is free software; you can redistribute it and/or8 N. w* U; y: @! _! [& _, i
- * modify it under the terms of the GNU General Public License as
9 B: ]+ X+ t: a1 f5 Y! W - * published by the Free Software Foundation version 2.9 }, l; x% C$ D& Y2 I
- *
3 k% G8 N/ R2 z) G, W: z5 j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 }7 E0 U% X+ w& u- V - * kind, whether express or implied; without even the implied warranty- u- J/ v+ O3 O4 A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 T/ f {+ l. I8 ]& K( j- V
- * GNU General Public License for more details.
4 o6 J% Y9 Y: o# J" D: S - */5 c$ g, ~( x$ j
- 2 C9 ~( F4 M+ U, m! b; i ^
- #include <linux/module.h>
% g* R* T2 X4 V: @! c - #include <linux/init.h>
, b& T) z4 W: [* ` h- J - #include <linux/errno.h>4 ~' W+ i! }' D$ ~; T8 p
- #include <linux/types.h>5 y. Z* b7 \ J1 y1 J7 M- y
- #include <linux/interrupt.h>$ h `0 s) d5 \1 j
- #include <asm/io.h>+ Q5 l2 A; g" I( R; u
- #include <linux/moduleparam.h>6 W: }2 g+ C+ s6 S! p
- #include <linux/sysctl.h>' N6 @% {5 [- B- b2 x {) d
- #include <linux/mm.h>
+ y4 e0 @0 @7 V Q. c - #include <linux/dma-mapping.h>
8 d6 r6 q: J! m3 d
1 m; W0 S! d( t: ^& `- #include <mach/memory.h>% ~. n: J8 J! {# I+ k8 P8 d0 ~
- #include <mach/hardware.h>
; O5 k/ }7 V: S3 v! C X - #include <mach/irqs.h>
/ P% A# Z8 C* w9 E. P, N. T - #include <asm/hardware/edma.h>1 w+ N6 Z, y: Y( j0 P6 M+ @- c# B
- * ^1 E* ~. F" s; _" ~; u0 I0 \1 z
- #undef EDMA3_DEBUG
! f+ `# n. v( i' t - /*#define EDMA3_DEBUG*/- Y/ ^* N$ K9 P
1 Y/ k" P' o- q/ t- #ifdef EDMA3_DEBUG
! l* f4 u, l; e% e) g4 K! H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), I( Q- ~; f1 C; _! f; m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 w4 L, M! b: s8 q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% K. f0 j7 i; N2 A - #else0 W+ J7 @6 h* ?! _% ]5 Z
- #define DMA_PRINTK( x... )- z# y, \# u6 |
- #define DMA_FN_IN8 r! O& G! X% o Q* x8 [" B
- #define DMA_FN_OUT/ D' C/ k: _' g. |, z0 C1 g( Z# F
- #endif; t& Q% f7 K Z6 G2 N
) a8 C4 x# z& d1 ?/ I9 _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( Y% z, u5 D$ U
- #define STATIC_SHIFT 3
3 K6 X7 C3 q% h* x* c, L0 S - #define TCINTEN_SHIFT 20; [' g1 B1 m: P+ P) C3 }2 q
- #define ITCINTEN_SHIFT 21
$ w4 w0 c6 c- b* f& K& O- c9 t - #define TCCHEN_SHIFT 22
' c, n( n1 C1 e* V - #define ITCCHEN_SHIFT 23
+ `$ c2 j9 r0 p6 z! X/ T+ u
2 r) X8 N1 J5 `" ]- static volatile int irqraised1 = 0;
; U) _( ]- E/ b4 d0 o- ?- t. H( f - static volatile int irqraised2 = 0;$ [& l! v& W( X! ~
* G! {, P$ z5 P" ]$ e/ j$ q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) o/ D3 }$ ?! p' o0 ?: y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ V. U! ~8 K6 h3 X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( A4 a( f" z. t0 s" D& r# h
) q1 Q/ z+ `$ C: f- dma_addr_t dmaphyssrc1 = 0;
+ m& c. [$ D8 ? K- {" b6 c3 B5 j - dma_addr_t dmaphyssrc2 = 0;' v9 v" @* H: M; ]6 i6 H
- dma_addr_t dmaphysdest1 = 0;& h/ b* d, {3 U9 L" j
- dma_addr_t dmaphysdest2 = 0;
+ o4 m& m. ~( O- D$ a1 i* c8 ]* H - 0 W- E2 v& U- J4 k
- char *dmabufsrc1 = NULL;& }3 ]9 F' D) H3 Y) g$ {
- char *dmabufsrc2 = NULL;, I! W b' a7 ?5 D* ^, G/ q: }. v
- char *dmabufdest1 = NULL;
/ O$ n# M" w7 Y' _0 I - char *dmabufdest2 = NULL;4 W" l$ W( `( K4 h. H
5 Z0 a2 m+ s1 d: G, b( b- static int acnt = 512;
1 t5 a7 O0 S; n9 o2 W - static int bcnt = 8;% l4 E) T) N+ f' V7 n) C) T& B( h0 K
- static int ccnt = 8;
7 S! V: ?- |6 e7 z; w6 n- E! Q
: }, O4 y. X8 u+ p+ b' w- module_param(acnt, int, S_IRUGO);! f7 d; [, D& m# X. ~. ^3 v1 b
- module_param(bcnt, int, S_IRUGO);
' L6 M( t* V" H0 e* h* o - module_param(ccnt, int, S_IRUGO);
复制代码
1 A o* a3 D: N5 _! o+ e
# x2 u" D, D) x& } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ ~7 |* W7 i% s0 [
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 c, A; D$ o; b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 Q' n5 W0 {1 I: V; o! l. z2 [
$ `. z3 ]# r( b6 z( F' a
- l E1 z! Q! I5 B3 [& _ |
|