|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 V9 `* K5 I7 c% l& R8 d
- [code]EDMA sample test application: f" |# o8 w; ]0 s; w2 z
- /*3 M g' d7 {# s
- * edma_test.c6 a5 [: P; n- G
- *6 h0 J3 w5 \$ i4 J* B
- * brief EDMA3 Test Application
- c& p C$ A* n) v8 n3 ^4 h0 W - *
8 p o) M3 q: v; ]" w' T9 } - * This file contains EDMA3 Test code.
b4 E/ f1 \9 H. q% q7 x: `) T5 J - *
! @$ X; ]3 K4 s% v0 N3 W1 |7 y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# l4 X$ b# A! @* Q M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 U8 C+ K% O9 _+ ?* Z
- * TO CHANGE.
( s8 X. m V% u1 t Y+ f$ v - *
2 [) X& K& y9 [% Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- \9 E4 X% [9 i! Q% l" T( K: i - *
/ E) P X8 b7 L/ ]$ @+ @& [/ ? - * This program is free software; you can redistribute it and/or2 |* n* [7 E6 `
- * modify it under the terms of the GNU General Public License as( n" f) \5 [: U; h& U( t/ }, _& t
- * published by the Free Software Foundation version 2.
/ J5 B* {5 y- [) o' r# y# W c% k - *9 t n1 J( l9 G: N: Z0 _ D/ d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, ~5 x* D; t# h" K* ?
- * kind, whether express or implied; without even the implied warranty
5 o, B( I% }' Y! W5 B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 f0 Z& F# P6 W( Z& E- i - * GNU General Public License for more details.8 `6 n3 N2 N$ [3 E3 D( k- a- S
- */
5 q8 {. |4 u" {: q7 x6 M! G
7 n( m4 p* a6 b" h5 u# _- #include <linux/module.h>
' e5 e [; G: {$ |8 q! S0 S - #include <linux/init.h>
! T5 z- j8 }: G! t( z7 | - #include <linux/errno.h>+ j. j: s/ I4 N5 W/ e a
- #include <linux/types.h>
& a `: N' l) K" U+ u+ b2 K& k) l - #include <linux/interrupt.h>4 H5 T1 F: T4 T+ d
- #include <asm/io.h>9 a) a: [* L6 \" S
- #include <linux/moduleparam.h>
& K6 E6 g, L S$ P - #include <linux/sysctl.h>6 o2 t# `) a$ B! P, t: g
- #include <linux/mm.h>% d) V1 q$ X* z/ m/ {
- #include <linux/dma-mapping.h>
/ S, d! V/ U, q9 T3 |6 h - 1 t& N# V! \1 W! N* S' |
- #include <mach/memory.h>
) \$ k3 M9 ~: b- Z) A( p - #include <mach/hardware.h>4 V6 A- y0 X$ P! x( x
- #include <mach/irqs.h>" g. Q* r- h" y! N3 m; D
- #include <asm/hardware/edma.h>& D6 k5 B! j! \* m) N9 o; a
3 {" ^( {8 p; T, g/ ?: i6 v- #undef EDMA3_DEBUG
" u, k3 Y4 u- W0 T! i7 }1 s; B( h - /*#define EDMA3_DEBUG*/" q- k) R7 |! O1 n- p
" T' g$ B/ H/ \7 K6 G# y" _4 U- #ifdef EDMA3_DEBUG1 U2 ~ [2 K$ U- @3 b) d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( m8 D* _ T, j$ t( h% J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 u. i$ d4 x( t0 [: y0 ~" N0 Z: ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& w2 o6 O( T. x* T# o
- #else
. ?) H3 W/ h3 v! W - #define DMA_PRINTK( x... )1 J8 [- p! {5 Q2 u- ?, y, H; g
- #define DMA_FN_IN
% _- C/ m8 H( C3 e - #define DMA_FN_OUT |5 \, V2 B* M ~7 `
- #endif+ P3 k1 ~, T' ]( f7 E. x$ n
- , I- z8 Q3 ^9 `. _ n8 G* c- R# ?" t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 m; v% v$ O% h' J1 { V! C
- #define STATIC_SHIFT 3
, L. }% g) s2 E - #define TCINTEN_SHIFT 20
, L/ N: b1 I# s' P0 c& e1 H - #define ITCINTEN_SHIFT 21
8 P# [% Q) @3 W5 i# B - #define TCCHEN_SHIFT 22
) U3 Y$ d4 U! @" P. g - #define ITCCHEN_SHIFT 23- |( m% k4 T, l- l! c4 w
) c8 T0 O1 p# z' E* M- static volatile int irqraised1 = 0;: V- ~9 l1 v. V& c4 B/ v
- static volatile int irqraised2 = 0;
* F" ^5 }6 I6 s* j; Q/ X, H0 T- o
3 r3 U4 _" J( { N; y# o) s! L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 x) W6 M* m( z, x( R* `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 h3 L7 h7 x# y. e: O y, V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& r3 z4 a7 m7 w/ T4 l1 x. Z - $ d+ Z% k' I4 f3 b
- dma_addr_t dmaphyssrc1 = 0;
" p* n/ f: e4 E9 t0 W ^, T - dma_addr_t dmaphyssrc2 = 0;. @$ J) }/ ^1 l2 D
- dma_addr_t dmaphysdest1 = 0;1 ~. z. w8 W3 N+ F! p+ s
- dma_addr_t dmaphysdest2 = 0;8 q1 ?5 a/ A( x9 c( I
- & j: F$ W( n% b* ?0 p
- char *dmabufsrc1 = NULL;
7 g) x2 ?2 U8 { - char *dmabufsrc2 = NULL;6 u. O, M( _) i$ s% c8 y1 P5 ]
- char *dmabufdest1 = NULL; f6 O; Q5 h+ O' ?
- char *dmabufdest2 = NULL;4 E% Z" }6 f4 T. s) `
2 O6 q# `0 I7 B; Q9 ^7 \! V5 z- static int acnt = 512;
: M& H$ n' ?1 c6 u - static int bcnt = 8;1 R- C# c* W5 y6 K
- static int ccnt = 8;3 c# {, M! n. X! Z1 J3 a
- ! m$ i& \. t/ b9 d
- module_param(acnt, int, S_IRUGO);
: I! g! Z8 O' U# \ - module_param(bcnt, int, S_IRUGO);$ B/ A. Q) \$ n/ e
- module_param(ccnt, int, S_IRUGO);
复制代码 0 M% F9 ~7 A O6 R, u# |. d
8 T; N6 D9 O$ k% a4 v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ d$ M3 ~; t& k4 ~6 g* [2 P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 ]! _; b' H( D6 c' k' a9 D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 U1 U* k: Y7 a2 F C& ?2 N
; S- p# S8 _+ m( P. I
7 ^8 h1 I; U. ~! }5 o! D! f8 }; i |
|