|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' R! W4 |. \ z+ H
- [code]EDMA sample test application8 M) N, T1 M: E+ k1 J8 j! Y- }0 M, Y+ |
- /*
$ j7 @' U. E) v - * edma_test.c: g" R$ }5 `3 e u+ W! w
- *
! D! G3 \7 N/ r - * brief EDMA3 Test Application6 ? w3 I. x3 Q. r ]: {: Z6 l
- */ r: e" ^& p8 H E8 ~- j$ Y5 V
- * This file contains EDMA3 Test code. t4 r" g+ ?! l Y3 h" E0 n0 M
- *
( Z- Y1 M. @+ l s e1 E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. |+ e0 \" ` U& Q3 |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" m, Y( d- Q7 |. P, v9 |# b; z0 k* M2 d
- * TO CHANGE.
$ F, k5 N5 p0 a W: V! { - *
5 Y$ c* A% h3 A% Z& h% p9 x - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 b- @# e+ E$ X/ Z+ d0 a - *" u9 s% N. t( g! {& u
- * This program is free software; you can redistribute it and/or
4 p' p' K+ i, ~6 S) o) i) t - * modify it under the terms of the GNU General Public License as
. _, V7 l- i$ m8 J4 w; S4 i1 _: o - * published by the Free Software Foundation version 2.
6 [2 i" c) b) {- R& E% a - *
4 Q4 B$ M, c1 J' R3 y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 n1 G' u$ Y! m, s5 ~
- * kind, whether express or implied; without even the implied warranty) R, O; D/ M0 ?5 A: F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( M% Z' s) A; q* V0 C% ]0 M/ d; I% m - * GNU General Public License for more details.
2 @4 S) @& I0 t6 ^5 I r K" i - */- X" F0 \% x2 B& I; C
8 ?: n3 ~9 V+ n- #include <linux/module.h>
+ {& Y0 o7 {: K0 A8 `& Y7 c4 j - #include <linux/init.h>
& b6 D/ s* H+ J2 z+ a4 W; q - #include <linux/errno.h>
' q7 j5 s3 A- U4 l - #include <linux/types.h>
7 O @+ K: q& O3 N( f - #include <linux/interrupt.h>; ] F0 g- Y6 G" Z& P
- #include <asm/io.h>
; m2 \2 ]* G5 ^0 j' L - #include <linux/moduleparam.h>; a. i' b6 L5 H6 C( L
- #include <linux/sysctl.h>. o+ w4 |, e% q! c3 [' M B2 x& ~
- #include <linux/mm.h>5 R1 `. c, l& w5 J/ K& I# [
- #include <linux/dma-mapping.h>
$ `8 n& G$ e* v C. R - 7 N' j4 }) V9 Q! B
- #include <mach/memory.h>
# K ?/ ^& A9 ` T: L - #include <mach/hardware.h>
$ p% t' l3 H( l( T; v5 H - #include <mach/irqs.h>
8 ^7 w. D3 `. _. {6 D8 s0 P) P - #include <asm/hardware/edma.h>& W, M7 |2 |* N3 H1 J( Z3 r; o
- ( @4 n8 c0 j. S% N+ Z2 f, B
- #undef EDMA3_DEBUG2 F0 F8 w2 D/ h# [/ `/ M% z, C# Z, a4 _
- /*#define EDMA3_DEBUG*/ @/ L4 F7 P3 r3 J* {- K1 O: L
/ V9 j% _3 i" ]8 ]; }. W/ o* q- #ifdef EDMA3_DEBUG
8 Q/ u1 S" N5 n H" H. V; M; i4 W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 \/ E8 d: T- `* {9 O6 K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- x0 E1 O& V* x8 i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, F/ k8 X/ B0 U3 X0 Y' x - #else
2 ?9 B! }. l6 _ d$ A - #define DMA_PRINTK( x... )
/ f, p! v( ], ^! a" Q - #define DMA_FN_IN4 a: j- ?0 B# Y) ?* C# q0 z/ n$ B5 p
- #define DMA_FN_OUT2 B3 g( v1 T3 [8 h# N
- #endif8 W- m- b. ]/ T% k' Y
- . p! V) _6 n; O- a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& O8 W9 o8 A% _; l
- #define STATIC_SHIFT 3' c$ e/ {; S6 V( X" D0 ]% H
- #define TCINTEN_SHIFT 203 b& @1 y/ V. t
- #define ITCINTEN_SHIFT 214 g9 L% g6 [, [
- #define TCCHEN_SHIFT 22
; F7 _! w& z( ^- l8 j" E+ E O$ z% N - #define ITCCHEN_SHIFT 23/ I0 X3 _6 G& o) Q3 r
8 N8 t( T* o* I$ |) |' `- static volatile int irqraised1 = 0;0 a, @0 M" c3 m
- static volatile int irqraised2 = 0;4 r2 S( m& g9 V. y* ^$ `, b
1 P& ]; m, X9 _- b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" C1 g) J" U6 [" w4 v& P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ V* n w1 {; F6 a! A2 Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, f% v y5 E( Y y; A. ^: J, C
- % A7 s7 H6 q" F) U9 q3 T7 O7 H
- dma_addr_t dmaphyssrc1 = 0;1 ~ t0 l- E" [& X8 [$ P
- dma_addr_t dmaphyssrc2 = 0;
* V* R, N, a5 A( A$ c - dma_addr_t dmaphysdest1 = 0;
8 O3 L& I% |! u+ ^ - dma_addr_t dmaphysdest2 = 0;
2 V. `2 o k: u- j g) J - 1 o8 U; Q- ~% C) M' a
- char *dmabufsrc1 = NULL;
4 r5 ]1 f6 ^' h3 n4 o: o( m - char *dmabufsrc2 = NULL;0 g$ T+ p2 k+ E( h7 |) ^ Z
- char *dmabufdest1 = NULL;
5 E9 A8 h0 h9 o) G8 r Z( m - char *dmabufdest2 = NULL;
5 E- _4 x4 Y! M. N" z8 _ - $ D9 w0 E( X4 [5 |9 b* i
- static int acnt = 512;
- \6 G: A; o+ v3 x" Y7 w- Q - static int bcnt = 8;
! n7 ?6 a! {" e9 F* n - static int ccnt = 8;: W3 P/ y7 N) w1 V2 N6 x
- # b( f0 I i% h1 ~& |( J( {
- module_param(acnt, int, S_IRUGO);& N4 N* ]0 f' T, |
- module_param(bcnt, int, S_IRUGO);
& f8 z" [5 _6 V$ O' l - module_param(ccnt, int, S_IRUGO);
复制代码
2 t( o: n- L4 S+ H; c4 l& f' }( I4 k0 }% o3 O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ A! C& k# c1 d! @$ t- Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( Q0 I. J4 t( I9 b( M. U2 i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ h* `2 i9 }! w: ^ f+ R
8 j$ T3 v5 w0 M* _' }# c, ^5 x$ F: H
1 O; D; W" ~4 f% G8 \$ M9 H& D |
|