|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , X9 p; E9 D: E- s7 G, O
- [code]EDMA sample test application1 t. W) i! t9 O4 I3 p: ]! X
- /*
a+ ^! ^( q& O' W9 [8 h4 N8 I5 Q: ^ - * edma_test.c
% T0 b* A% @0 j - *
+ y9 Z9 N9 t( R8 S: o8 F. t( H# | - * brief EDMA3 Test Application1 v6 K, X8 x. l* w
- *
, P' O# s% X6 _; ] - * This file contains EDMA3 Test code.
. N+ h1 n) |0 ] - *
% t& D+ y5 d1 J. u K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; I4 x7 x6 k: h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ |, q1 e w' m7 B: W' | - * TO CHANGE.
) [5 l; W: c; K3 ?# B - *
# D. S: f$ X( @+ U7 Y' M, W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 o2 A$ q# b/ i
- *) D5 F, }3 e7 \7 j+ g/ Y0 C l) ~
- * This program is free software; you can redistribute it and/or) B5 }# M8 ]+ O
- * modify it under the terms of the GNU General Public License as
! A! D7 D" Z( D. k/ W9 c' E - * published by the Free Software Foundation version 2.
4 q4 P( s0 a# f! h9 z, K - *# `9 p+ { C0 L9 A6 P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 O& z2 W2 N6 B2 m0 w5 {+ S - * kind, whether express or implied; without even the implied warranty$ v7 K3 A" @5 R$ Z: a9 ]" P" v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! ]" o& M2 e) K7 y7 f
- * GNU General Public License for more details.
/ Z$ \( q- e8 y - */) E! A) X% T" | r1 P- w
- : `; F1 ]) ~6 ]! [( Y
- #include <linux/module.h>
" Q o7 {/ i1 P o+ G j - #include <linux/init.h> P$ M8 q* J% k+ H" U
- #include <linux/errno.h>1 ]3 e' y2 e# O5 M" ?- i$ N
- #include <linux/types.h>
2 k) V: q2 O7 e+ r - #include <linux/interrupt.h>7 Y- \" N! [4 [! V q
- #include <asm/io.h>
Y( L1 X1 Y* ?' B0 q - #include <linux/moduleparam.h>! I1 J' O. r: s: a( W
- #include <linux/sysctl.h>' B2 G# s" W9 S- ]
- #include <linux/mm.h>
% z. z8 \, H! g2 M" z: ^ - #include <linux/dma-mapping.h># _0 [0 o+ e5 X9 [, G( Z
- R8 V5 a3 j0 P1 b' K' A0 r3 i$ n& m
- #include <mach/memory.h>% N, U2 N3 C& I& G. S, m* v: F& F. ~
- #include <mach/hardware.h>
5 O% b' `: Q8 p* o, |6 j+ M$ `- W - #include <mach/irqs.h>
0 U# j+ r w& P. h5 q% A) e - #include <asm/hardware/edma.h>% f6 E( o0 Z/ ], }2 p* j
: O. d9 {3 i( G4 f( R# g/ B$ k- #undef EDMA3_DEBUG" N( _; a" a- C0 Z: S$ |4 f
- /*#define EDMA3_DEBUG*/: z0 X* e; o9 ^5 P1 ]
- % R6 ?4 m3 L6 F* ~
- #ifdef EDMA3_DEBUG
& p. \0 e4 c' @( ] - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% @. A8 s6 V k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ L( }1 t, L0 E3 c5 J. g, X/ K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! X* \. K/ v$ A# ]2 K3 f6 R0 Y
- #else
7 q' Q4 |/ ^7 V$ ^* W U& j: a - #define DMA_PRINTK( x... )
" q5 L8 ]6 I8 b4 L1 s - #define DMA_FN_IN2 E- i* Q3 k. Z/ }5 x, d' a
- #define DMA_FN_OUT7 d6 A1 l6 Q9 N) Y7 \
- #endif
x0 G1 Y/ X8 G+ F$ ~ A2 l - * `: l0 H' H. M8 B, V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), E/ v4 F8 d) }8 D+ k6 ?, Y" u
- #define STATIC_SHIFT 3
/ s! M/ p' o- I0 O! y/ R( n; } - #define TCINTEN_SHIFT 20
. w) k# m7 X" y7 k" U8 b1 `7 { - #define ITCINTEN_SHIFT 21
/ ]- P* B) {6 T$ X8 y4 p; E - #define TCCHEN_SHIFT 22( l7 g& o Q( |) j6 E
- #define ITCCHEN_SHIFT 23* P2 L2 r. W* ?: L$ q9 l' R3 [
& V, d8 \$ M' p, h- static volatile int irqraised1 = 0;4 W1 T8 Y! t7 W" ^2 H" H% k% c& Q' m
- static volatile int irqraised2 = 0;
& T# s7 B# c( ]" _6 u - 4 x) b# x# H* e6 E+ I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) t4 q( I I9 y; s# a' T5 [8 u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 f8 I6 x" F, l6 N' E4 n9 i5 C8 O/ m [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! S$ H& N) o/ G# H - ! L; E# j" x Q7 t
- dma_addr_t dmaphyssrc1 = 0;9 O! \1 [- w5 ] r
- dma_addr_t dmaphyssrc2 = 0;# `9 U9 ]$ }& A+ U+ K* b$ j
- dma_addr_t dmaphysdest1 = 0;
" K% m8 ~& l+ O1 ]8 C2 R - dma_addr_t dmaphysdest2 = 0;: X N3 \$ x4 |+ } X" G
0 N# e: ]. _, }) s8 R- char *dmabufsrc1 = NULL;
% I/ G$ X7 \! m8 s6 W2 ~" y- | - char *dmabufsrc2 = NULL;
4 j: H D- o" E* a/ d% d6 z - char *dmabufdest1 = NULL;- R" f. F: \" {2 B
- char *dmabufdest2 = NULL;' `' c5 d1 t$ w" W( C# E% q2 M
- 4 e9 o& ?* P% X. \ c/ {
- static int acnt = 512;4 R" I0 @, E w0 S: Q# @4 R/ R
- static int bcnt = 8;
: X& t3 ]3 `4 C" m2 l& P - static int ccnt = 8;
% Y/ |$ s& N$ U
4 X1 M1 @% d7 I6 A: I; k- module_param(acnt, int, S_IRUGO);8 {2 X5 g+ s0 K6 ~7 ]/ D( w
- module_param(bcnt, int, S_IRUGO);
9 r/ E, b4 [( U; i% y: P" l - module_param(ccnt, int, S_IRUGO);
复制代码 1 H7 B: G6 N4 Q# H
3 y4 V: Y M" R2 E$ q3 X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! \! B2 m( k$ E) |) A3 s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! q: {! o; ]( O9 Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& p+ l6 s2 F1 K6 Y$ t2 e6 g+ ^
( x0 M/ k' e3 \1 S9 H6 ^3 u) n1 I* H9 W* @
|
|