|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 R1 ~1 M5 Y$ R- [code]EDMA sample test application0 z6 i1 B) Q% c; W0 m k% r
- /* W E2 @/ X5 _5 H) i- D) r
- * edma_test.c
4 t1 g: l2 @+ g: V0 h( h9 z - *
3 G* ~9 D. t5 E+ ~+ H- p5 } - * brief EDMA3 Test Application
4 e! r' O) ~! j9 d. r( J - *
3 y" h3 E' b- ], S# s( y* T1 | - * This file contains EDMA3 Test code.
8 z% Y0 p. \2 r - *- C3 ]+ N3 D3 n) @' Z7 q/ g5 R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% B7 y+ h: R& l$ r0 M0 @; Q+ ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 A% d* }8 d' D - * TO CHANGE.
4 i# p. h4 }/ f! f - *2 l# |8 s( {4 U4 s4 ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 N) |) f* {. v - *
% V; T5 L, n0 |! \/ ] - * This program is free software; you can redistribute it and/or: o3 r8 R3 t6 i
- * modify it under the terms of the GNU General Public License as
A( e! b7 X" r! g - * published by the Free Software Foundation version 2.
9 p0 A# {8 F2 Y( p1 J# C - *
% D* j$ a2 V- F% C' V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# i4 l' j4 \- z: \" ` - * kind, whether express or implied; without even the implied warranty
4 c" c* f9 Y6 d2 O6 P% Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ u1 n5 G$ [, T' Q$ T/ |7 T. T+ U - * GNU General Public License for more details./ q+ a- y v2 q# M: i
- */! u B" _ t" g) Z) @
- ! P- y- v+ x" d) U
- #include <linux/module.h>
0 q9 Z; e0 w. g - #include <linux/init.h>
; c; m3 f! M: v- C H! U7 ~7 Z - #include <linux/errno.h>" n$ m4 W; I- ^3 R- G" m: `
- #include <linux/types.h>" s( B. W* u+ g
- #include <linux/interrupt.h>( [0 c& O9 k8 {5 F& u
- #include <asm/io.h>
2 Q5 y1 b0 Q& s& d8 E - #include <linux/moduleparam.h>
, W+ H$ r/ y4 w/ u8 K - #include <linux/sysctl.h>
' ^2 `% h& ~. C X - #include <linux/mm.h>
" c; f) M1 |& b/ O4 g- z - #include <linux/dma-mapping.h>
8 r5 K% ]: J/ P% E9 ]6 m2 k* M - C' ~5 b+ D4 v
- #include <mach/memory.h>
' ?+ E6 y& D. p; c0 x2 Z - #include <mach/hardware.h>* ~& r! t' t+ y" F; D- R H
- #include <mach/irqs.h>/ J+ H: ~! K0 d+ I3 P
- #include <asm/hardware/edma.h>6 j3 J* G2 q# d
. B) N1 s8 ^4 I3 o- #undef EDMA3_DEBUG4 f6 x' ^8 b- T$ z7 j
- /*#define EDMA3_DEBUG*/
7 e& C& q( C! k* o3 W! D
2 l3 h; _5 q6 b/ E, T- #ifdef EDMA3_DEBUG( T+ d1 x* n4 b! @/ Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), X0 X- B7 j9 s+ l7 p" k. o& K: q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' @8 e& J# c' e ]+ H. n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- v! w+ |- _ B3 M9 `, P* H - #else C+ E6 D9 d: y& K
- #define DMA_PRINTK( x... )& H2 Q, q2 l0 ]& I9 q5 d2 d! E
- #define DMA_FN_IN
$ [2 i' ~9 p& b! ^5 [; A, j, ~ - #define DMA_FN_OUT
" j g$ D' P6 p, a, Q6 H# s - #endif. w9 r! Y; P1 s/ @% n
( h" C$ d5 {" i" C. S( O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* P2 y3 J e' `0 y5 `: N) X
- #define STATIC_SHIFT 3
9 f+ I( j5 M _4 R, Z6 ~ - #define TCINTEN_SHIFT 20
* K2 ?# ~" f1 K4 Y) `) G7 Z# w& L - #define ITCINTEN_SHIFT 216 T9 n- n) w" u& e! n4 s
- #define TCCHEN_SHIFT 22
& F m7 X' C6 g3 B1 w& b - #define ITCCHEN_SHIFT 23
- B3 s' }9 s9 E# k* ^: Z& A# u1 J
$ s: v z; n x! |% K# u- static volatile int irqraised1 = 0;1 Y3 K3 L& A* l I
- static volatile int irqraised2 = 0;
3 O- K6 u( R4 u/ F
6 k( l+ G' X! f& c' m3 ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; j8 P8 }' h8 J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
c' k$ I6 z f( ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 _0 x$ @6 g2 f6 E% m$ X
9 c- R: T& t# _5 P- dma_addr_t dmaphyssrc1 = 0;
. j" |) h8 e! m N+ d' @8 A - dma_addr_t dmaphyssrc2 = 0;
% U! z7 O9 c8 W& o( L - dma_addr_t dmaphysdest1 = 0;
/ ]: J9 j; W" e - dma_addr_t dmaphysdest2 = 0;- p+ ^3 z5 F4 P) @0 u
- 5 M( p( M6 n( o& f
- char *dmabufsrc1 = NULL;
5 \: c" s2 D+ z9 }9 m - char *dmabufsrc2 = NULL;/ ] d/ H; l4 _+ ] o
- char *dmabufdest1 = NULL;
) z3 H% e! m7 O* G - char *dmabufdest2 = NULL;: Z+ O1 i# l# \. ^6 g& [6 @+ j% i
) E$ i. o5 U7 f. o; Q6 B- static int acnt = 512;
' z, S7 j* |$ [+ _$ }* L0 p - static int bcnt = 8;. y4 j7 U2 W; n" }; R- e! z
- static int ccnt = 8;
3 W% b$ B; [1 m. G6 `) r - ' Z% y3 N7 z; J. ]6 V0 j. X
- module_param(acnt, int, S_IRUGO);; t. w6 }) {" O
- module_param(bcnt, int, S_IRUGO);: y$ ~$ q$ t8 Q
- module_param(ccnt, int, S_IRUGO);
复制代码 / Y/ L! W' ]# v% A1 U
B) h* W$ r. ?; a/ @) e6 a2 }; H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 m3 |' v6 l0 ]" {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" S! Y. f$ x1 ~. Q; y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ }5 T' W% r$ J- M
/ [# s( F" s8 s0 D9 I6 c9 K) v/ G! f3 z) q; j1 o; L' ?3 Q
|
|