|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 Z) {4 g* k2 }8 F& Z6 l
- [code]EDMA sample test application5 } \* s$ E. [% h
- /*
5 T5 B% [# q" t( I% S5 p" L* }9 \* i - * edma_test.c9 o# ^ c/ F+ s" ~+ |! _
- *- a1 [& ]& i! c, P& o. t+ K- Z
- * brief EDMA3 Test Application( Y8 G' ~8 T1 S% U% m' ?0 [
- *, j ^2 P1 d* J6 S- x% f) L
- * This file contains EDMA3 Test code.
% U5 ^, c' ~; a) ~1 ]/ r - *: I& Z( V+ [: [& g9 H4 |& {5 I2 M2 H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 H% V# _9 {5 T8 l) `3 K) A/ o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" G: t# C6 l) X& `% a8 w; s8 b+ a
- * TO CHANGE.9 t9 r7 @3 _2 ?& J# W
- *
) x+ h0 x' V6 {9 w- h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 K% q5 o7 U" [% j" n& x, }# Y - *
" V* d' }3 c: c2 h - * This program is free software; you can redistribute it and/or2 Z- t" d/ ~+ C2 E
- * modify it under the terms of the GNU General Public License as3 `5 d1 a% @7 z
- * published by the Free Software Foundation version 2.* k/ {) D* [& w$ {
- *' w9 Y7 ^6 [$ B0 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. l1 V! N' t* j4 D: P# B3 L3 T - * kind, whether express or implied; without even the implied warranty9 m# E/ u, g: `# n8 w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# J0 Q/ ^. l/ X* L0 s# | - * GNU General Public License for more details.
7 z! P7 d/ m1 g5 ^ - */
# z! h7 u8 h, L! p) b ]
1 g; L( t; B; c" `2 e- #include <linux/module.h>
! t/ I5 O" b; L, v - #include <linux/init.h>
- D7 P! |2 i$ n( r. F1 ~ - #include <linux/errno.h>
' V7 [' \8 x' X, | - #include <linux/types.h>
! V. B5 _% o# {. V0 g) R4 y. L - #include <linux/interrupt.h># A( ~* f. Y; f# G c2 f& u
- #include <asm/io.h># Y3 h. l; `; E+ [
- #include <linux/moduleparam.h>9 Y* t3 P- t# J( W2 v3 f
- #include <linux/sysctl.h>- x% \" r$ c- z2 L; k
- #include <linux/mm.h>
" C: C7 e* z. d$ Z$ s - #include <linux/dma-mapping.h>4 U; y: m* u* C h( A3 }1 S9 }
- D) p {2 k' a: [3 R+ j4 Q2 c
- #include <mach/memory.h>
4 E9 N% s4 P4 l/ D$ C9 E& d; _ - #include <mach/hardware.h>
2 D" {5 f* _: D2 I! D - #include <mach/irqs.h>; W/ S6 Q8 ], O) \* y4 M" {5 R
- #include <asm/hardware/edma.h>
1 p' F$ i, M' V3 W& J' Q3 g - " | S% s' Z+ ^8 n# t" K8 k( e
- #undef EDMA3_DEBUG
z D8 u" _: Q - /*#define EDMA3_DEBUG*/
9 h) i; P" u0 l ]- C* { - # U' S7 B" [- a) B& O( [4 q( s
- #ifdef EDMA3_DEBUG
, a2 u4 Y8 ]7 {6 P1 N* n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 m' i# Q! q+ b" a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( {$ D& q. @& T) t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" Y) p0 T3 n) p, v$ g4 h - #else( M6 {- o, Y }
- #define DMA_PRINTK( x... )
2 a$ p) h, b9 S* | - #define DMA_FN_IN
" m/ I c4 b6 K' D6 q) h1 X/ O - #define DMA_FN_OUT
# c( s% z1 p# R1 n, C3 C. w3 T - #endif @" K: A3 B9 x: M3 y' f% t
- , {8 o4 `7 _+ U9 } e2 B r( o, v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 f {4 k9 a" k1 B/ X* G' { - #define STATIC_SHIFT 3
% M, c T8 p+ ~* I# M - #define TCINTEN_SHIFT 20# ?9 z% A% V r1 W1 o
- #define ITCINTEN_SHIFT 216 E: r" E3 R+ N x6 C5 _/ E6 k
- #define TCCHEN_SHIFT 226 V6 b0 C4 x6 H$ f! j
- #define ITCCHEN_SHIFT 23
P/ X0 [& O6 `4 h" [* x0 a - 8 a/ x1 F) f+ N/ j
- static volatile int irqraised1 = 0;
- C! l8 L" V$ D8 }% Q5 G# R - static volatile int irqraised2 = 0;
6 }* Q d3 h* I
. P$ V. J' P$ g( D% x8 ~, i4 A1 M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 c# V [1 {9 V+ F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' @1 a c) {9 J/ O- T7 M% h; r$ k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! A# J# W4 M( _/ ~/ n% @7 Y( t" w/ H
- 9 M' ]: w& g2 [1 k- `, Z: S1 s& V
- dma_addr_t dmaphyssrc1 = 0;
+ E3 x' i6 ^3 @) ~& k; V. Z - dma_addr_t dmaphyssrc2 = 0;
) u4 G4 G$ \+ v9 C0 h1 `) p2 z: ^ - dma_addr_t dmaphysdest1 = 0;, A4 H" X( `0 Y
- dma_addr_t dmaphysdest2 = 0;
2 T. [+ N4 y& }/ g) { - : n$ s0 K8 {, E* w
- char *dmabufsrc1 = NULL;
% U! T' F7 ^, j - char *dmabufsrc2 = NULL;* x. W8 _$ @% b2 t3 T2 I1 n
- char *dmabufdest1 = NULL;# z5 D* c1 j: B5 ~
- char *dmabufdest2 = NULL;
5 W4 E4 v3 p1 l; `9 c8 ^( | g# { - ( z: {' F3 x& `" t; N
- static int acnt = 512;, E" c0 W0 |/ m' N; _" C1 }- V, G
- static int bcnt = 8;
?% E) H9 p x - static int ccnt = 8; u' v2 p6 \( I5 {
$ F( ]' g$ V# G- module_param(acnt, int, S_IRUGO);
: x4 ]4 @9 D- X e+ h& |. r- R5 K# P7 z - module_param(bcnt, int, S_IRUGO);7 N* U; ~5 t: R/ \& {9 D8 ]
- module_param(ccnt, int, S_IRUGO);
复制代码
/ d4 V: p+ r2 {6 a7 Q
% G O9 ]. e8 R6 n( A& c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 Y. q2 @9 l; Y* warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 K6 Z1 N8 ~5 L' h5 K& \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ R% A# X% M, b8 _ K7 O4 K% h
( _& {; R, a' C4 {, s
8 z& `) H4 ?" s$ j6 k G |
|