|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & V. }5 L2 b( {+ g0 r+ H
- [code]EDMA sample test application/ c' h" n( t1 \ z+ O
- /*( w- G3 }/ `% \
- * edma_test.c
6 h" a* l7 z8 \ - *% C2 [- q/ k3 T5 @, c" c
- * brief EDMA3 Test Application. r- i: m1 h* s: e
- *
& I* X! M" n0 a1 G: P( T - * This file contains EDMA3 Test code.
( q/ X* f8 K, L2 R- y C4 d) t - *6 g2 J+ O# u. m) Z: l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- k' ~4 r$ H; j8 N6 v, X1 N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. g9 z" Y1 b' c$ s2 m" N$ | - * TO CHANGE.
2 o: s, d, O! m - *
2 w/ M# L R+ m n; E, I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 U, [& u& l* N9 d - *
+ s3 k) i% P( g) n - * This program is free software; you can redistribute it and/or9 B' F0 P* t) E# x5 _ z
- * modify it under the terms of the GNU General Public License as
* e4 ?. x; j9 ^1 X" z1 e - * published by the Free Software Foundation version 2.0 m G |/ A# R. D; b# @/ n
- *
$ _$ P$ L3 T3 ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* s* L$ ~7 W' I# i A6 S9 S" K
- * kind, whether express or implied; without even the implied warranty
# e* I- s n4 r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% [/ s, t, _' w' _1 P) |& ]
- * GNU General Public License for more details.( i1 E4 C/ ?; j# X1 B
- */
+ ^4 b7 V$ q5 I* q& x
/ M4 [: g+ n3 o; \- #include <linux/module.h> a; x4 X1 g3 V6 p! ^& w; E' V. e6 o1 L
- #include <linux/init.h>
4 D; ^6 `3 `" O/ n" F: o5 B' w - #include <linux/errno.h>2 g* A7 Q$ O8 g4 y# S5 b
- #include <linux/types.h>! C6 Z/ _8 h( u8 m _4 G4 W/ T
- #include <linux/interrupt.h>" K; u: q1 G! Y8 e9 d
- #include <asm/io.h>
7 L9 N9 k1 g9 \7 A V; V9 E; J3 H - #include <linux/moduleparam.h>7 E( T' _2 W% r4 S2 D
- #include <linux/sysctl.h>
% C2 H# g1 R$ ~, E. g) ~ - #include <linux/mm.h>
3 w5 R( d: s6 l g" Y, n* ^4 p - #include <linux/dma-mapping.h>5 T3 y9 [/ f+ t
- - B2 g1 \- j9 L I
- #include <mach/memory.h>- V+ Z; u9 w" { A6 z7 x5 d
- #include <mach/hardware.h>
# r$ t& T1 M$ k2 s: z5 J) g - #include <mach/irqs.h>3 {8 \5 w: a9 C4 v
- #include <asm/hardware/edma.h>
# F L1 P, M* d+ Y9 k - + _' W/ R: F* B' x8 d0 g' ]
- #undef EDMA3_DEBUG1 |7 P' K/ a+ p
- /*#define EDMA3_DEBUG*/$ S0 v1 t& m- k8 t
$ f4 j$ D9 v/ `- L5 @+ y- #ifdef EDMA3_DEBUG
; S, {$ Z( g4 {8 Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 @* E( v( v" @0 K! y/ R - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# A/ C: q& t" Q, o* q0 [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 z- B9 |7 S% c5 h& k) e2 [
- #else
0 M1 P X8 n, |4 Y. j* `2 E - #define DMA_PRINTK( x... )5 |+ o1 k+ f2 G5 F. h2 u
- #define DMA_FN_IN
0 R q5 a9 o j' Q& j, l4 z: ` - #define DMA_FN_OUT
* b7 ]+ T- Z# v' k( @ - #endif. g% u; V4 D; s l1 V8 N8 T5 p
0 E" M5 S) ]7 ]& q+ N- #define MAX_DMA_TRANSFER_IN_BYTES (32768), L$ n4 n' H3 k0 J
- #define STATIC_SHIFT 31 _) q2 M W5 a3 h! {
- #define TCINTEN_SHIFT 207 d5 O- y5 x* K0 p
- #define ITCINTEN_SHIFT 21% {2 K5 h8 O, ~0 ~: i
- #define TCCHEN_SHIFT 220 d4 K! B, m" Z. I2 U; K
- #define ITCCHEN_SHIFT 23
7 h$ E6 k9 v/ t" M! o& \ - 2 m, G- |* X+ ]
- static volatile int irqraised1 = 0;0 z5 g1 N* @! Q) t ?( |
- static volatile int irqraised2 = 0;
3 E' [: t# n, x; H3 r( o) j% Y
) ~/ I. D5 t/ ^( F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 K% _ m' h2 o; n% p/ ]. i3 G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' g/ F1 g7 i( n7 o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Y. F& d; a* V
w8 y5 p, \. N- dma_addr_t dmaphyssrc1 = 0;3 X! J# ?3 F4 W O. @& P+ o
- dma_addr_t dmaphyssrc2 = 0;; |8 x& D! Q6 [1 }: v8 G+ D) ~9 F
- dma_addr_t dmaphysdest1 = 0;1 ^/ Q$ x( H9 W$ F
- dma_addr_t dmaphysdest2 = 0;
3 V- c; q: \1 y4 w/ C4 U1 a - % `" X) M, S( A; Z0 q8 C4 S
- char *dmabufsrc1 = NULL;
' O2 T' r) t- M2 p' _ - char *dmabufsrc2 = NULL;) i6 x7 ~. B6 i! P. m
- char *dmabufdest1 = NULL;
+ J% d$ F6 I+ a: M: I: E, o0 ]4 u: R - char *dmabufdest2 = NULL;
9 @/ ^& \0 W% o% B/ w4 C! I; k - * G" S) k3 ?4 |
- static int acnt = 512;* s2 o; x: j% v: Y* Q3 e
- static int bcnt = 8;
0 g& H; N9 R, L' s G) T& ` - static int ccnt = 8;: P) b: R) K6 ?8 D2 Z o3 _
& e5 w7 ^0 D" a( T- module_param(acnt, int, S_IRUGO);" a; y0 D& Z) P$ v3 ^; o" h1 k
- module_param(bcnt, int, S_IRUGO);
( Q' @7 s$ o D/ r* R( C - module_param(ccnt, int, S_IRUGO);
复制代码 7 |8 B! t* L2 j1 F6 E+ l
4 D* o' x8 q8 n' q9 {8 K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' {% h: j3 h' ^$ F) ?! |0 ?3 n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 i8 E1 C# N, e( ^) h9 _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 L8 I0 A' e3 E
1 ], ]+ r" L! c/ U' F3 ^
$ ?" {3 b8 S# n( x |
|