|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ e7 c: F3 X p5 s0 B& y- [code]EDMA sample test application/ Z, E! \* I& v4 S
- /*+ H2 `/ H' Z& N3 A) ^
- * edma_test.c% c# \* p% `! T! o) a& R& |
- *; R- _0 x& a* m) H' C
- * brief EDMA3 Test Application4 o8 O" _3 i! @3 T
- *! A7 g1 z" ^ L4 J
- * This file contains EDMA3 Test code.8 G+ }1 e! _: H0 X7 {
- *
% `4 ]2 i$ v+ O. U* Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* Q& D W1 |" U- S( B j/ I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- i6 `1 d% e4 r& u; y - * TO CHANGE.
% J+ U4 _2 |9 u6 [/ B - *) M6 E4 x2 _5 Z; \3 P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 |& z& S& R( m% F- q - *0 m* F4 [9 _5 R) i5 P5 T: P
- * This program is free software; you can redistribute it and/or* |8 o L, S) p' @* _$ {
- * modify it under the terms of the GNU General Public License as
: _; L; b2 J# ^8 o" a* h - * published by the Free Software Foundation version 2.
, s2 a/ P4 f) A: }, r& [ - *
7 Z6 u4 N6 @ ?1 i$ y: U( C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; s2 Y& o+ J" ?3 T# ]4 U
- * kind, whether express or implied; without even the implied warranty6 [& ?' d* p% p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 s# y+ U( ^8 v
- * GNU General Public License for more details.
3 U, ?! p& X0 `5 t. f+ q! ~ - */
& i- z/ ^0 f3 `* p t# R
* y+ G7 D1 x) m m8 } a% r- #include <linux/module.h>' ~3 ~" E; [' {% j. e8 |% c
- #include <linux/init.h>: ]2 t" H5 |: e) F
- #include <linux/errno.h>+ K; _" @+ P& G( s
- #include <linux/types.h>
: u: H7 k) V% t* j - #include <linux/interrupt.h>
/ ~3 T" |6 P+ k; } - #include <asm/io.h>
$ D. p0 f( ]2 x) X7 y2 ~, T3 B- o - #include <linux/moduleparam.h>: _0 ]& u$ N; c0 C
- #include <linux/sysctl.h>2 W7 u6 H" n, \
- #include <linux/mm.h>
" B8 B4 P3 W ~" c - #include <linux/dma-mapping.h>
4 A7 \- o0 _5 a7 s; s
% g8 ^7 g5 k+ g$ c6 G0 d- #include <mach/memory.h>5 n! z/ a. U# e3 B2 F! C6 d
- #include <mach/hardware.h>
" M- d" u G1 M) m& E, W - #include <mach/irqs.h>
# ]" ]& {9 a+ _- X* u% M) D8 } - #include <asm/hardware/edma.h>$ t% L! p9 r2 ^2 J4 f
3 j. d% o/ J8 `5 V+ Y3 _- #undef EDMA3_DEBUG
) p$ P8 }; E# |, Z$ }* A - /*#define EDMA3_DEBUG*/: \' ]& A `" g# d
2 `7 ~6 I3 B& D& ~" h, E j1 o- #ifdef EDMA3_DEBUG4 m' R2 `( }# y2 s1 M, R9 J- s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 c. x: S; g% ]9 k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! a: X& ^/ n# V& g3 _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ D- s, r. _( S - #else
0 `5 C9 m0 O. c/ N, |& U - #define DMA_PRINTK( x... )' E7 j2 m2 B5 S& m
- #define DMA_FN_IN. K# `6 j$ z# h1 b
- #define DMA_FN_OUT& c) W) ~: ^9 n2 P7 |
- #endif* x3 N: ]% Z( [/ I5 z
- 6 t- C8 S3 x7 a# N, V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
{4 P( Q/ g, C) U2 @ - #define STATIC_SHIFT 30 t9 f% f5 O4 T# [
- #define TCINTEN_SHIFT 20
' ~ F, A! k- k: ?0 \6 L - #define ITCINTEN_SHIFT 21
1 a9 C# ]0 r5 R, U" Q# ~; s - #define TCCHEN_SHIFT 22
$ o: e" `) _0 m/ x - #define ITCCHEN_SHIFT 23; A S3 @, o; Z
- 0 p8 a. t; d c! {- K
- static volatile int irqraised1 = 0;: t0 h/ ^. X. t0 D/ K z
- static volatile int irqraised2 = 0;1 b! L) ?: L) ~1 d( D
3 v9 o0 f% k: B& b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 d! @; m% {/ V8 O* U f- u& o* A0 q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! d; A6 E" r! ~; j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 n5 I7 X3 H2 Q- b; Q! R
- * n3 W z6 ?( G d2 N7 Q) F A
- dma_addr_t dmaphyssrc1 = 0;
X( J$ D; u% i+ T1 ^ o$ [ - dma_addr_t dmaphyssrc2 = 0;* M8 Y& I% J% A- n
- dma_addr_t dmaphysdest1 = 0;
6 A4 n$ d1 L/ u1 W3 E - dma_addr_t dmaphysdest2 = 0;
5 k0 B1 w' `9 k% N7 B9 N
2 [& [! p$ z# n8 O# R- char *dmabufsrc1 = NULL;* |* F' a- e" t' {& A7 A
- char *dmabufsrc2 = NULL;. j! c- a) W" g
- char *dmabufdest1 = NULL;* }9 u/ y% D) L( G; y; b& N
- char *dmabufdest2 = NULL;
; t2 F6 n( S1 l! y2 u% R - 9 z1 N" Q- V2 B2 c* x9 n
- static int acnt = 512;
, P8 S0 O8 }; p" z - static int bcnt = 8;* C- b8 p k, z/ z1 a1 o
- static int ccnt = 8;
1 ]. y; S* `6 L8 b: | - ; t) g4 [, x7 U" ]6 O
- module_param(acnt, int, S_IRUGO);
6 T+ P; R+ I4 b0 J; V - module_param(bcnt, int, S_IRUGO);0 H- o. m; x/ f t
- module_param(ccnt, int, S_IRUGO);
复制代码
. T. I: M" y% t( s6 s4 f+ v! L5 w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 x1 b4 ^8 d+ f# A Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" y, b _9 r* s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 p: g. c7 r7 i" v
~2 |+ s$ M+ M: c# R. L; J% T
+ W( T% M: j0 X8 n, y6 T r |
|