|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & I- O% \5 T$ r- J; k' y
- [code]EDMA sample test application
5 u% `; }7 [' b - /** }/ M, J/ x8 m0 [0 I+ Q( p s# Q
- * edma_test.c, Y9 E8 g! _4 P! [* [8 `
- *
}9 ^- s5 t/ ` - * brief EDMA3 Test Application
$ z, M+ W& G6 Z& C3 S - *+ J( Z; O; j4 L5 Q- c3 A
- * This file contains EDMA3 Test code.! j: J4 ?0 v4 I6 b8 _
- *( z* w# a# e- C: ]% N; Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" D @1 ^1 b% T! x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, n/ s; Q1 f$ x
- * TO CHANGE.
% c0 b" }: J ~! ?+ u$ ^# j+ Z! _. e - *
$ u' X z9 S p6 r0 N- [# B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 B+ f7 |- g. B4 \6 D
- *
3 a9 I. U# J- t% Q1 k - * This program is free software; you can redistribute it and/or. ?9 i# z& z" X; s* o; [9 I
- * modify it under the terms of the GNU General Public License as$ H: E; x( c* g- f
- * published by the Free Software Foundation version 2.! ^4 @" x- }* U/ V' } c0 Z6 L
- *
6 j! T1 E# Z" A: @8 a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# D% O; w( V" b
- * kind, whether express or implied; without even the implied warranty) D1 _0 s9 I/ i# ~2 N- t3 @/ H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 ]4 Y- X; Y, i( z& b2 a1 s! a - * GNU General Public License for more details.
7 j$ _+ ~; w! [7 i - */
/ B6 Z1 m5 H6 E, ]4 J - 3 H, Y3 B. T$ F/ h; m
- #include <linux/module.h>
. t6 C' W, v1 G( R) B7 v - #include <linux/init.h>
( C2 B7 H9 i! }' ^ - #include <linux/errno.h> P! h- I, r; v" X7 q1 P
- #include <linux/types.h>* l. d! D F/ @# x2 o; [
- #include <linux/interrupt.h>
& ^. {0 V8 `4 F. `0 G1 ` - #include <asm/io.h>, e- {! q" h; M9 Z( o" V
- #include <linux/moduleparam.h>9 x4 K3 ?9 T9 J
- #include <linux/sysctl.h>
% U" R" B5 k2 Q+ {- s - #include <linux/mm.h>% k2 x7 s$ l2 ]' F
- #include <linux/dma-mapping.h>7 ]- h/ }9 P5 S
( m9 b9 b$ h9 O. @- #include <mach/memory.h>$ }& W- @9 u& Z3 G n/ R- V
- #include <mach/hardware.h>
6 P4 T4 f& c% E! \5 f& o - #include <mach/irqs.h>
1 y( ^7 W3 |2 s/ ? - #include <asm/hardware/edma.h>; ?+ }7 S; M; J( B+ {' g6 Y) Q) x
- G0 u4 h: A$ h0 V9 E$ u, t
- #undef EDMA3_DEBUG
y c6 @6 j$ f- A( o - /*#define EDMA3_DEBUG*/9 c9 x0 u7 O9 _1 u$ \
9 d: M! }8 t }7 f- #ifdef EDMA3_DEBUG
, m5 ^. M7 e$ P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 `2 b4 k" S2 L$ G$ d0 v' Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 o y2 m# j& U: V+ K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ b4 P% n+ I. q0 O6 P6 S0 S - #else
$ o* Y" Y3 u+ u/ i5 x, V - #define DMA_PRINTK( x... )/ x3 t1 E+ `' W# V) f) y8 `$ z) `6 r
- #define DMA_FN_IN8 U1 f) j" U- l1 ?
- #define DMA_FN_OUT/ C: B$ s) a, W' M* f
- #endif
) |4 J5 d8 ^6 b) P, Z - : Q/ ^ W* C/ Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 K! _7 A7 x1 N8 h
- #define STATIC_SHIFT 3# D2 h r: Q' j# t3 a$ q
- #define TCINTEN_SHIFT 20
' ~$ S5 W5 y4 c1 F2 ^6 ~. d% } - #define ITCINTEN_SHIFT 21
9 W C! M* L0 f7 z5 Z - #define TCCHEN_SHIFT 22
+ I: m, [$ c( r' D - #define ITCCHEN_SHIFT 23( Y5 k0 e3 M1 M% x2 V
- ( v b$ z2 ] |, j8 B0 _
- static volatile int irqraised1 = 0;6 e, z5 V: d. V$ X, |. L5 k
- static volatile int irqraised2 = 0;! j: s% X$ T- D. {: c: c8 Y
o" c2 k: j0 R9 g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: X4 k2 k3 _5 y4 C: y# O3 K: \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; {9 P* W% |6 O9 _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 l6 F9 ]! p& \% i7 E! K) @ - , I/ B" C( ]( s6 G% U
- dma_addr_t dmaphyssrc1 = 0;
6 W5 u7 e+ a, Y; v o! ] - dma_addr_t dmaphyssrc2 = 0;
3 j7 g4 P q8 w+ L6 l4 N4 {" [ - dma_addr_t dmaphysdest1 = 0;/ K( U+ W8 k6 F$ X5 H6 c
- dma_addr_t dmaphysdest2 = 0;$ O; v4 c; r1 z' p1 J
5 ~% k2 Z. ~% j5 y: M- char *dmabufsrc1 = NULL;
4 c/ @! K2 v# v- I, u9 r* j - char *dmabufsrc2 = NULL;: a; a* k- A' A; m; O+ P, J4 c
- char *dmabufdest1 = NULL;
9 [5 u+ X1 D! k' T& X7 n" I' w - char *dmabufdest2 = NULL;
+ Z5 U( e3 B$ F# L0 S7 `3 t - 9 T! F) Z$ K, c) ^8 b# O
- static int acnt = 512;
! O; N# f( r! j1 a - static int bcnt = 8;: _) d, n1 Z0 G( s3 S! ]
- static int ccnt = 8;3 g' o. E) x: O0 v) N6 w
. w) w! q8 y0 [0 ?5 U. V- |- module_param(acnt, int, S_IRUGO);
7 F3 F3 ~/ k5 p9 B" l3 {1 S _& R - module_param(bcnt, int, S_IRUGO);
3 ]4 V7 j) T- x5 \7 u - module_param(ccnt, int, S_IRUGO);
复制代码 9 Y9 w3 g, H6 X" x4 ]+ A4 u8 T
" ^$ `9 \* J& V; v' ~4 o/ X9 x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 w% a" G4 N# o# U! f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' ^, e+ }3 J3 P6 r. w- z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ K. Y* D. G6 y8 |
3 @" V% x j7 N6 j. [/ V F3 v+ G3 M7 F& M4 [2 D8 d7 j6 t
|
|