|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - I0 X' P) L9 {- u" h
- [code]EDMA sample test application1 u# q8 K6 o O- t; B+ T. D
- /*
) H: [4 R( G5 X) u - * edma_test.c# Y, G. x; H, L3 g; m1 C
- *
. J1 }3 |9 ?) P' Q - * brief EDMA3 Test Application2 |3 Q+ N( g( J# U) o# E5 ]
- *
6 t2 n8 |9 U- ^' C+ s; S P - * This file contains EDMA3 Test code.% j$ o6 w/ G4 Z2 H$ _& F
- *
1 {. S; q% B4 h3 _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% E0 s$ l+ e, t2 C/ h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# J2 K0 R7 R1 r7 ] - * TO CHANGE.
& Z. q7 Q+ V# y) M9 j% Z - *
* s& F- c; c4 V8 ]7 ~% W6 d! W, b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 r4 |2 q+ O: w- g+ J
- */ l" I; d7 j8 J. Z, |1 ^
- * This program is free software; you can redistribute it and/or9 V- h9 }1 {! z
- * modify it under the terms of the GNU General Public License as
* A/ q' K5 ` B2 H - * published by the Free Software Foundation version 2.
9 P! j1 i) [8 ?" U1 v - *
8 ]2 d+ Q( Q/ V; ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. { D2 _( } `& a
- * kind, whether express or implied; without even the implied warranty( ?4 J2 k2 G: x( E% h. C4 D1 B7 l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, t& A5 f( v- O T2 n+ M
- * GNU General Public License for more details." Q2 v2 A- J; ]% K
- */, W( A9 }* W. {) D
* o& \; v. A* I' `- #include <linux/module.h>
$ P+ ?& ?9 \+ f - #include <linux/init.h>
9 F. q9 Q( g$ ^4 H# z - #include <linux/errno.h>% A8 w, n' m: i$ K: E0 C6 X4 r: D
- #include <linux/types.h>
# V* s: m3 q0 z3 \ - #include <linux/interrupt.h> f* L9 [6 }4 u1 E1 A* h$ w' o$ E
- #include <asm/io.h>/ {7 p0 f! N) C
- #include <linux/moduleparam.h>( o6 x9 r, L- y) D/ s- _5 J
- #include <linux/sysctl.h>
& q, }5 a% i& W+ J - #include <linux/mm.h>
4 b- r+ q& ?8 s$ i4 w - #include <linux/dma-mapping.h>
# D8 X$ @4 V" d - ; d; o, ^. K) T& r; ?
- #include <mach/memory.h>3 i9 p& K, d4 O: A
- #include <mach/hardware.h>
" ]- f, \- |& Y6 l: Y, q S2 ` - #include <mach/irqs.h> S' X1 Q1 A/ Q4 O A9 w8 c, o2 z6 b( s
- #include <asm/hardware/edma.h>& N& j& i0 _% H
- 9 M" }. V3 v( s% R; h8 a0 u
- #undef EDMA3_DEBUG: C- j* z6 p! g; q8 N
- /*#define EDMA3_DEBUG*/
y. a8 C4 y5 N# V) m( P) R - 8 u" F: u0 ?9 L, R5 T
- #ifdef EDMA3_DEBUG
! |- J' w) h2 ?% @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ W$ K; S8 f! K. Y2 D( s) |6 L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& ~1 B, ^1 `, z2 ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& g* t/ R* ?. g7 `9 R3 ^ - #else
7 W3 b' {" k/ E5 F/ n# s - #define DMA_PRINTK( x... )
. Q& z( b/ h }$ R- G1 k - #define DMA_FN_IN; H& Y8 o) M& Q$ ~
- #define DMA_FN_OUT
+ K" G8 N: O; R8 I+ u3 F1 ? - #endif
* `" J; X1 h+ K( |* j! T
7 _( t: ?: v& ~( ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 E# u* P2 z1 M9 d' O8 [* ?$ H! C
- #define STATIC_SHIFT 3( X( u6 n; N. j( F% B7 d
- #define TCINTEN_SHIFT 20
! l/ V( S# Z5 d# r1 U# ~6 m' p - #define ITCINTEN_SHIFT 21, p C% w) \* O5 t/ B" Q
- #define TCCHEN_SHIFT 224 z. V i# M; N( i3 B% z
- #define ITCCHEN_SHIFT 23
/ }; X1 l4 M8 m3 n- j" e! Y0 h6 b
% I7 z4 q. f( M4 J) V- static volatile int irqraised1 = 0;
( J# B/ V# N" E, F- C& j - static volatile int irqraised2 = 0;2 q; S* `5 C& f# T
- 4 r2 T5 B8 q u0 r5 a: o6 y R+ O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- X8 Q$ }* i3 e' I s5 o K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' d- w% Z# ]/ F6 a* n( t @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 h2 A4 g' J8 f4 o
/ x- h3 K& c8 W. y' X- dma_addr_t dmaphyssrc1 = 0;
M. }& M* @0 \6 j+ i - dma_addr_t dmaphyssrc2 = 0;1 K1 r7 N% X% S" x: g$ I
- dma_addr_t dmaphysdest1 = 0;
$ Z7 ?" K- ^' O1 a% _1 E" t6 [ - dma_addr_t dmaphysdest2 = 0;- ?2 L) g9 w/ T% n7 k+ l' d Y6 R
- p& _) e3 v% p2 v% k# ^( \- char *dmabufsrc1 = NULL;
7 ^" D5 W9 j6 `3 B - char *dmabufsrc2 = NULL;5 }6 J- x W' ?: B! D5 ~
- char *dmabufdest1 = NULL;
0 Z. g p2 Y4 V; K; @5 ?; z - char *dmabufdest2 = NULL;
1 T. p0 w6 v' C; U- K
7 J% ^# \4 h; ?. _: J; {3 H) e4 Y2 f- static int acnt = 512;
3 y) d7 p, \" Z* i1 r+ T - static int bcnt = 8;' D2 T- j m* f- z* G7 Z9 a
- static int ccnt = 8;8 s3 m4 T) d- s' E
! F! k( N; o7 A& C- module_param(acnt, int, S_IRUGO);
& ?2 T; e9 @6 A0 c9 h0 h9 X - module_param(bcnt, int, S_IRUGO);
4 u/ D) Y9 j; t% n: j3 U - module_param(ccnt, int, S_IRUGO);
复制代码 ) U% [' Q' n0 y, y, h- ^2 O4 c' }
& U: a* ]* _. ?2 U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 `! O- q' S0 Y: r. r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, }5 A/ M6 u ~1 d) `# b$ ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& Q: t! X8 ~6 q: c! o1 C/ t
3 D! v- ?- U0 w/ z" e) K5 C3 k* G- H
$ X$ t4 d2 j! R; |" M: c |
|