|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( }/ a7 D% Y7 z
- [code]EDMA sample test application$ M9 y3 c& e2 y- s* P
- /*1 P2 O0 j8 [& Q+ @ x9 I2 `
- * edma_test.c
. J* E5 F+ |% T - *6 j3 {, B, D. R$ t
- * brief EDMA3 Test Application/ D7 Z% n1 R: w7 v$ t) x
- *
' { Z2 m5 t3 y+ s, E - * This file contains EDMA3 Test code.
! r4 N) @; N, t- U - * H7 p, t# C4 x: G& n: q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! G2 \/ i) B; `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! | O7 C0 U8 A* G; A* ~( i
- * TO CHANGE.
5 ], X3 S. h6 e2 p! D - *
, u" q+ }5 S7 f9 v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 g: ~2 s3 Y1 [( O A& e# g
- *8 T7 R/ H& d0 {/ e l$ s+ v
- * This program is free software; you can redistribute it and/or
/ D% k9 [8 M$ |4 U - * modify it under the terms of the GNU General Public License as
1 t' O, A; j& L' ?) f - * published by the Free Software Foundation version 2.2 z+ Q" p8 i: [+ A/ e
- *
5 I9 K( F% O0 W! ]$ D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% S+ S0 X/ U+ M% ?0 |6 B5 U/ d
- * kind, whether express or implied; without even the implied warranty
* B8 ], b# k9 p! t. T0 i( p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& v$ J% _0 |, L7 h8 D
- * GNU General Public License for more details.
+ d: q$ c8 V; f3 n. _2 s - */
0 |4 X2 ~' k! d1 ]6 o1 D" f8 X - 3 Q8 H! u) w8 b. G( }4 J
- #include <linux/module.h>
# y* p1 _" ~/ B/ I( f; I# T) ^ - #include <linux/init.h>
2 |6 j3 x. D; V; Q6 ^* A) [ - #include <linux/errno.h>) `2 W v! D0 O) H) y0 M
- #include <linux/types.h>
( Z* M' H4 m3 C7 d9 n/ D' t - #include <linux/interrupt.h>
1 I9 |5 o& v8 Q4 p! D$ n - #include <asm/io.h>
8 G/ k) N, r5 M: A6 [! H - #include <linux/moduleparam.h>
' R+ B \) ]) c1 D - #include <linux/sysctl.h>
8 R2 q: F5 Z& u6 m* K d - #include <linux/mm.h>+ A' p' {$ X& M6 ?( Z/ G: w
- #include <linux/dma-mapping.h>
3 ~: \0 f9 x4 y& u - 5 |* L( \5 K" h2 k: O
- #include <mach/memory.h>
- g' h/ ~3 X6 F5 l - #include <mach/hardware.h>
Z; t7 O9 [- C; V' @, t. e) p2 T+ H - #include <mach/irqs.h>' _0 k# }- e" R' O2 ^8 l$ e
- #include <asm/hardware/edma.h>0 {) Q/ D& r7 ^# W" w4 @. H$ @
5 e9 _$ ]* [5 D, Q& w6 k' U- #undef EDMA3_DEBUG
. B0 d" | m6 w- f* W - /*#define EDMA3_DEBUG*/6 x) N+ O' T3 s# {* v4 N
- : O/ _7 w) @7 J3 @" S1 o
- #ifdef EDMA3_DEBUG0 {2 Y. R1 C4 s8 U4 v" X: d! ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), f" C, ~5 `- o' o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* [$ U; R F, G- [( j( Y( A) ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 c) C' [8 C5 y- d8 c) \" t - #else( w0 p& H( s5 C" g# h& s
- #define DMA_PRINTK( x... )- V# J8 a0 A8 S* |- v7 v
- #define DMA_FN_IN& y# y6 E% z" l. f
- #define DMA_FN_OUT/ H4 B% v8 T2 _# R" K+ b0 \
- #endif
- M4 \2 Q+ [& `" H" `
4 M" l: o8 Q7 p8 k0 _) `, x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* [: p$ R% ~' f2 \" B - #define STATIC_SHIFT 3
' K! o; T1 `1 X3 Y. m - #define TCINTEN_SHIFT 20) Y9 M- l0 V, w
- #define ITCINTEN_SHIFT 21. Y% ~* T' ?" u9 W) _ }$ c2 v% b
- #define TCCHEN_SHIFT 22! r% w, k" L, X& s
- #define ITCCHEN_SHIFT 237 f+ h3 `% m. t% U+ i1 M) d$ O6 Z
- $ H. f8 ]4 a2 s
- static volatile int irqraised1 = 0;; r1 q/ _7 |9 d1 ^
- static volatile int irqraised2 = 0;6 X- N# {6 _2 b7 l- b* F
- 4 S9 e+ C3 K5 s1 `+ h+ I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% L, W' ]8 k h9 c0 ?! p( ~% r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 W2 ]6 ~4 l. ~* d3 T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) V' D: e; m7 U$ U
4 K& N J% o/ P" z- dma_addr_t dmaphyssrc1 = 0;
! [- O0 u, D. e) \, Y; ~ - dma_addr_t dmaphyssrc2 = 0;0 `* |) L; r$ ?# G4 s
- dma_addr_t dmaphysdest1 = 0;4 @ P, Y" A9 J# O9 M. |0 q* ^! A
- dma_addr_t dmaphysdest2 = 0;$ b' E+ H$ H. h( L
- - |8 t+ R. t$ e3 L; d* q2 @/ U
- char *dmabufsrc1 = NULL;
5 L8 f# y; i5 [. N - char *dmabufsrc2 = NULL;
( F+ m; l* T' l, B; S& ] - char *dmabufdest1 = NULL;
2 ?( w3 |" v7 F: {; G5 y" b - char *dmabufdest2 = NULL;9 `" V: L( h5 a
- 9 y( ?4 B$ F' Z6 f& s* T. Q& L
- static int acnt = 512;% b0 E) A. F K( Z% T Z, u E1 m J
- static int bcnt = 8;
. b2 N4 Z! a( M S$ ? - static int ccnt = 8;; B! T; ]9 _4 R5 A
* h' ^" z7 U, ] N- module_param(acnt, int, S_IRUGO);
6 Y) A8 V" w8 e Z2 O - module_param(bcnt, int, S_IRUGO);
: [8 Q; ?1 @% G* O: ]- ]6 x - module_param(ccnt, int, S_IRUGO);
复制代码 + k" x4 G7 w* L5 U. q
4 t; r: n% M4 @+ e- k( x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 v+ ]( Z& J; x# Q$ `% \/ E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ X! @: g9 ]% J# @* a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 |; q5 [( {: A4 @- y
: L0 O0 r, X9 c; X6 ~
7 z* o% P% v) c8 @. I |
|