|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - S8 N5 ~! l0 I) |1 |. H; [3 ^& J
- [code]EDMA sample test application
) t- \0 X- \ Z$ h7 u+ _ S$ _ - /*( y; l, e) J7 A/ l4 c- P, `
- * edma_test.c. b5 m* {: n% \
- *
( D: s4 v- g# d5 x" [; }! x+ U0 x - * brief EDMA3 Test Application
8 F4 @& e( z+ z+ s) T% E/ U" p7 A - *
( v; L1 k9 S" {2 I1 K - * This file contains EDMA3 Test code.; N: B1 t, v) D0 h- z3 D9 O
- *" t, W" o$ P: V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# L% f$ X6 P8 q" H9 ]6 n# y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: Y: s* J' k- p: |, O) n" l3 n0 S4 X/ {
- * TO CHANGE.
' a1 b ^; a- M1 f4 a0 e* |, A - *
8 N$ A( H% Q0 u( P: ?9 Q1 v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ {% D$ Z3 L# i
- ** I# N) a. B% i( b# y( M5 {7 f- h: ]% x
- * This program is free software; you can redistribute it and/or" n. X' P( U/ U: n& D6 \) P
- * modify it under the terms of the GNU General Public License as" f* w7 J" a. d) o* v& g) l0 c
- * published by the Free Software Foundation version 2.
; v0 S3 c9 p0 }8 l - *
' t/ Q: V' ?8 J2 e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# T% {' x: C( a- Z2 \ - * kind, whether express or implied; without even the implied warranty6 s0 x7 o: R- @: c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' M! S; Q: J6 u+ d! R; P) L$ e4 ? - * GNU General Public License for more details.
Q' D/ t, H j' S# k1 I5 X - */
& p0 w! l% W: _! Y. L0 | - 4 M" ~ o$ q5 a3 a: g
- #include <linux/module.h>
% n% n. z% B* _9 P: |7 E# ?7 J - #include <linux/init.h>
* V( r: A3 t3 x4 Z( B - #include <linux/errno.h>
& O* u# M" X% Q3 U! q1 L - #include <linux/types.h>
$ q$ w" ]1 _) E - #include <linux/interrupt.h> [' g9 b% u# x: K% O& g% B
- #include <asm/io.h>4 ~" ^. V$ X+ l6 `7 q
- #include <linux/moduleparam.h>
0 Q1 O/ s+ W$ f6 a# N3 l - #include <linux/sysctl.h>' p, Q. r, N9 t: e4 @( |1 b: a
- #include <linux/mm.h>2 ?! G' c: q* S2 f4 z% A* u5 x
- #include <linux/dma-mapping.h>4 o9 C& W5 |) B) C7 u7 j4 u( l& f
- 6 N' c* A# E$ n# t( T
- #include <mach/memory.h>4 a! u; g7 P% f& p# U
- #include <mach/hardware.h>
* Q- _& E+ A4 t H. D! M) x- a1 H - #include <mach/irqs.h>
# s, } `, u6 y9 S - #include <asm/hardware/edma.h>
/ t/ C& Z6 a b$ p: _7 f
O" S; N+ k0 f6 ^- #undef EDMA3_DEBUG
9 A1 Y7 G. f/ k5 ^/ r - /*#define EDMA3_DEBUG*/
, ]* i3 t- r6 ]! ]6 q) N
2 e2 P( h4 j- @& @% F' Z( b$ Y, V- #ifdef EDMA3_DEBUG
" H9 t6 `, ~- v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- w1 C* x5 q5 A5 }- m2 E9 j) d2 y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ A! @! K' w0 r$ O5 v! X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 W( r! R# U2 f8 E' B
- #else6 z+ \: k9 F9 O- k" p
- #define DMA_PRINTK( x... )
: c0 G. J. l6 M5 q1 x3 Y - #define DMA_FN_IN
1 U H8 x, V/ P7 Z5 ~' [ - #define DMA_FN_OUT
# x5 G: |' f0 R7 p, \ - #endif
& N) f8 C: a: ^; |8 Q6 N - % d' p: N0 I7 h6 d7 Q+ j$ j, t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, i A2 o, k6 v, L, D9 y/ i - #define STATIC_SHIFT 3
: c/ R/ L1 `7 F6 M M) r: L# s - #define TCINTEN_SHIFT 20- ]3 ^1 M. M( A7 x
- #define ITCINTEN_SHIFT 21
! S9 ^6 Q! R4 H, @8 G - #define TCCHEN_SHIFT 22% Q, ^) x; e0 i
- #define ITCCHEN_SHIFT 23/ I5 T0 p) v# w! E, P; u7 }% i
- : ~) q0 m$ ?& _8 P) u
- static volatile int irqraised1 = 0;8 `' H: p& r+ K8 P" g, ~8 G
- static volatile int irqraised2 = 0;
- Z. ^0 N3 C5 u: c6 j - : ]2 k/ R& A3 _& y4 V# k' {: E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. s/ ]: S& n9 z$ [7 C( \. m | b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: n4 f( ?# y8 l; T" X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: C7 D$ W# V( S R3 P" r- U: E
+ |6 H% S0 Q6 _, I+ l- dma_addr_t dmaphyssrc1 = 0;
4 Y. w- L: v. W& B; m; \ V& Q - dma_addr_t dmaphyssrc2 = 0;7 \4 Y& H& X0 U- ~: w
- dma_addr_t dmaphysdest1 = 0;
% ]0 S8 c0 r; r1 E& |. @ - dma_addr_t dmaphysdest2 = 0;3 [. D& i+ ^' }; X4 X
+ D4 l# z) {4 x' a' [- char *dmabufsrc1 = NULL;4 Q4 i: B! l* O0 o, O
- char *dmabufsrc2 = NULL;& L5 Q) B# ?+ M, i! ^
- char *dmabufdest1 = NULL;/ ?6 W9 I7 g" K( U% ^
- char *dmabufdest2 = NULL;
7 a% D K5 r+ G: j - 1 P7 G% C$ k% U2 d/ x" ]- C N
- static int acnt = 512;5 ]# V4 ?( x8 k% s' Z0 B
- static int bcnt = 8;5 m" W0 U4 `: E, |0 v
- static int ccnt = 8;
# g7 v: |+ ~. P: C - / e0 U( ^4 U3 k( R9 `0 ?/ r" t; j
- module_param(acnt, int, S_IRUGO);
8 `4 A8 ^' o$ G% @% K6 s - module_param(bcnt, int, S_IRUGO);
; M5 y& g/ T6 X) ~1 p o; C: u$ p - module_param(ccnt, int, S_IRUGO);
复制代码
) h& i1 b+ l6 v! y4 G7 |& t
- o2 l, u8 u$ d- U: Y# h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ B% T" z% A0 D" w: Darm-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 G* ]/ t+ J/ a3 g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% x* d# [. c( k7 o4 D& |% r) p$ }8 c, D( J
! F: v" s4 I! r/ _* Z" D; F, \( {
|
|