|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# d9 x! S W. i! |- [code]EDMA sample test application) D p. g2 v" j6 M2 {0 m; }# C
- /*2 p6 _: x! ?& J. g: B
- * edma_test.c9 z9 C6 Z$ {8 g- F
- *- T. z2 r" K: I* y7 M' j% L
- * brief EDMA3 Test Application
8 y" r1 h8 e2 `* o! h2 d4 D% } - *
4 I$ |8 V! K- h- K4 m$ _ - * This file contains EDMA3 Test code.
& q Z( i! T6 B i3 L+ _* I - *
( Y* B2 |3 l7 C6 _3 | X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" Z! x7 x( z& R1 Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, x0 J$ O& W5 k0 H
- * TO CHANGE.
$ A7 F8 p8 N4 T, ?, M1 O" U7 O8 N - *
7 P1 {7 d+ S$ `' ~1 h9 G _5 B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# u) a- A( L, y/ M# ` - * E" w$ N! H2 X, V
- * This program is free software; you can redistribute it and/or% B! s0 V; c. m9 Q* i
- * modify it under the terms of the GNU General Public License as2 G5 B+ X3 k- K j0 w5 ?
- * published by the Free Software Foundation version 2.
, Q @7 y5 ~' S7 D4 V" g$ O - *7 N: `# l. D7 m" ^0 a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: E4 x% f( Z9 J @3 z7 I, y/ W - * kind, whether express or implied; without even the implied warranty8 P& e7 g4 |7 [+ F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* y$ d! y7 V! T0 G" r3 V
- * GNU General Public License for more details.
5 S' J( U. [# m& |$ M - */
% E3 K6 k; i" S" o" E$ ^7 h
% b/ x8 x( s$ l3 B' z- #include <linux/module.h>4 g- ?4 C8 r# w
- #include <linux/init.h>
# o' h- h3 C# d. R! j# f+ k: }& A - #include <linux/errno.h>, P1 \4 q$ b& C/ c+ C
- #include <linux/types.h>9 M+ t& V8 d, c2 y- U
- #include <linux/interrupt.h>
$ e" B) S$ J2 z! L, m - #include <asm/io.h>
. P' `& X# H3 D% {2 S! r) E - #include <linux/moduleparam.h>) G/ h: z1 v. |+ \' u& ~
- #include <linux/sysctl.h>( E: V m+ u. `) O. u
- #include <linux/mm.h>
$ V6 e: P0 H6 r$ w* h9 U2 z - #include <linux/dma-mapping.h>6 J& p+ N$ v- F' z9 o2 B
8 J, X k) g9 ]0 M0 Z! M- #include <mach/memory.h>
K: d, B2 L! `! R4 H& ?7 c9 y5 y - #include <mach/hardware.h>
& U2 y5 v* J. e& n# @! J - #include <mach/irqs.h>
8 x4 p9 G( M' a& R$ C - #include <asm/hardware/edma.h>5 @7 j: \. Z2 L9 q6 N
- 8 x# t* P s. n0 ]$ |; P
- #undef EDMA3_DEBUG
3 H( O- X# \+ g7 p: j: w - /*#define EDMA3_DEBUG*// o) I1 F2 z( v
. o2 `, l6 t. k# J* f: D7 Y; j& B7 ?- #ifdef EDMA3_DEBUG5 s* r" o* @: w2 G0 b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ o2 L) o; s0 Q+ T$ O/ ~3 X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) E& h4 Z# e% D- ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 c# G; p/ x. L6 m" C; Z5 b7 A' b( U
- #else: e, Z1 ]& }0 x Q: G
- #define DMA_PRINTK( x... )- h4 L; {& }1 w- l0 ]; n
- #define DMA_FN_IN N5 A! o' `! W+ @
- #define DMA_FN_OUT
" t8 b5 Q+ X3 p1 ~/ k0 s9 s% v - #endif5 x$ B" z7 a" J2 \( K; f
5 i7 F7 A0 a9 W# S3 A; f- #define MAX_DMA_TRANSFER_IN_BYTES (32768). J* P0 I- x, H
- #define STATIC_SHIFT 3
! N+ i9 f' y, V- x4 H9 Z2 B - #define TCINTEN_SHIFT 20- C4 i P' d( c6 X5 Y- ~( {
- #define ITCINTEN_SHIFT 21) E+ u- I( |, e1 g! Z
- #define TCCHEN_SHIFT 22 z- ~ ^7 @3 ?6 V( c+ }. g" k
- #define ITCCHEN_SHIFT 23
* R0 T5 K# R- h$ y
7 g7 j& X' B3 K( ^+ h9 d- static volatile int irqraised1 = 0;
v, B- N4 U" z* q( W, M% G7 T - static volatile int irqraised2 = 0;
4 p2 M8 [1 X& B" J8 E - 4 W1 e$ [5 ]6 o, h8 g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 u$ S( o* t/ x) m8 F6 l. x( d7 ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ b' T' I. S5 n. e; j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 R8 y6 C/ N c# r3 c: ` - & f. m: t* [# z: j. J% r" V
- dma_addr_t dmaphyssrc1 = 0;& G1 P+ I. [; V: n
- dma_addr_t dmaphyssrc2 = 0;0 k9 P. i0 j( ~+ B
- dma_addr_t dmaphysdest1 = 0;
8 V3 c+ r# L6 d. `3 I$ k - dma_addr_t dmaphysdest2 = 0;0 `) c# i6 X8 {7 j: Z& J! e
- 2 d# ?* z7 J3 d3 B, X3 k1 o9 }
- char *dmabufsrc1 = NULL;
2 W7 h2 s) g2 i( b - char *dmabufsrc2 = NULL;
& K' \) t7 i( J" M7 ?1 y% a - char *dmabufdest1 = NULL;
# z8 Y. s( }3 u5 {0 I! Y! T - char *dmabufdest2 = NULL;" I3 P+ x: d6 t$ ]
- ( C' R* g7 K. L a! N% o/ w
- static int acnt = 512;5 Y8 Z4 e1 I$ _/ X
- static int bcnt = 8;4 P5 Z q9 R6 F
- static int ccnt = 8;% z/ P! {- I# ~# V
- `# C# O/ G3 j; G1 ?
- module_param(acnt, int, S_IRUGO);
$ A; ~" R$ d& }3 ?8 g9 |, w9 ^ - module_param(bcnt, int, S_IRUGO); l' u( Y: F: ?5 y- V# ^( E; x$ \
- module_param(ccnt, int, S_IRUGO);
复制代码 & k: z. u8 a' j8 [9 p$ b7 R' J
s; i1 z4 n) j. x6 B2 `! L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' V. V2 G. D) D# | V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 S1 j B% }! _. ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ ]/ E" y9 S' C& p. J
- s1 d4 D! b& B7 U& u$ ~3 J4 P% v4 z+ ~5 g
|
|