|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% ]8 j& r$ |6 }/ R, P$ R- [code]EDMA sample test application6 o. e* ~' c% `; y/ @/ R
- /*
* n3 ^1 e! T5 x! }% V. x* [ - * edma_test.c* V+ b/ m! W: w
- *4 l8 b( v3 Z6 o$ m5 ^& y& b1 C
- * brief EDMA3 Test Application$ Q- Y4 j2 J7 O8 [% v. r
- *9 O$ u: [" N7 z- `/ I) A
- * This file contains EDMA3 Test code.# k4 {0 p4 d. G3 X5 W& |6 k7 s
- *
+ P. { Z: m. n4 l& n& T! I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, Y$ o! x8 j6 L0 _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& B8 r% z: a% C0 c1 Z. O9 s0 f+ @
- * TO CHANGE.
; Z. S2 V/ V' e. c. ]6 I2 I. d - *6 i+ g4 G8 a$ Y" R* a0 j8 b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: T/ b, S. K) d. K! C. P
- *
2 Z5 x' t1 b. T- f, M) n* \$ H - * This program is free software; you can redistribute it and/or% c( Z/ {3 N/ D& i+ r, }2 K
- * modify it under the terms of the GNU General Public License as
) U- e. O+ K! U - * published by the Free Software Foundation version 2.8 f2 _! v: Z3 ]% b
- *
# X; o$ G$ ^- V; o8 Q4 |4 t+ V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 \ L+ ~! E" v; { O1 m; D
- * kind, whether express or implied; without even the implied warranty+ h) b! V9 b4 ^; t$ T' u
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ A! z' O0 ?5 n' H& Q) f
- * GNU General Public License for more details.2 U, F4 `6 @. u
- */, s3 J. f/ |8 _4 T% P" {+ v
- 3 C- ?1 ~7 _1 s$ \8 A( o
- #include <linux/module.h>
' S8 d) p) k) M$ v8 g/ a3 p - #include <linux/init.h>
3 ~$ M, |/ w4 [/ E - #include <linux/errno.h>
' k" d9 ^% H; `! l3 G( F$ y8 j - #include <linux/types.h>
0 z1 d& W0 l5 \' Z/ c - #include <linux/interrupt.h>
5 U. O$ i/ \& {% B - #include <asm/io.h>
/ y$ O+ ]' f* }* V - #include <linux/moduleparam.h>) j4 \* I N8 e# f1 s$ m/ @
- #include <linux/sysctl.h>9 y9 A5 p4 M+ B- T9 g6 j$ X
- #include <linux/mm.h>
9 M" ^4 d* |, I# X) k' B - #include <linux/dma-mapping.h>
$ X4 Y5 I1 j, r+ e0 |6 _, P) q( K( K - ' z0 _8 Y" p( P3 I% v1 l: ?
- #include <mach/memory.h>
8 F4 j7 l% z; j; U3 F - #include <mach/hardware.h>
* y& _/ V$ V; B1 n! M3 ~, v - #include <mach/irqs.h>2 Z) O: u. C- T4 _5 B
- #include <asm/hardware/edma.h>3 `- X5 a2 ]3 v: U; S+ {
' |4 Q/ ]" i: x9 m+ h- #undef EDMA3_DEBUG# e) F& i3 ?6 |
- /*#define EDMA3_DEBUG*/
& x3 R2 @" V2 ?" T - . _/ T0 M u. G" v6 A
- #ifdef EDMA3_DEBUG
. t8 b# m- _3 a1 p$ W& O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 M/ @( l3 Q" q# B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): A8 x2 d o' C6 q! h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) u' E3 P" Y) D
- #else
- e3 f2 o% b' H$ S - #define DMA_PRINTK( x... ) K% o+ d9 \4 j6 M7 T3 i
- #define DMA_FN_IN$ a3 N* `6 J. X" J. X
- #define DMA_FN_OUT
; S' K7 \4 K" W/ p4 B - #endif3 T# f. F: j, k) p i% f' T
4 l: X# j' U; p; L4 ]7 h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ e) N* s% q2 b: k - #define STATIC_SHIFT 3
% S# e2 @% u! W5 i' R& h9 w - #define TCINTEN_SHIFT 209 w5 X5 o- H, `' Z, C
- #define ITCINTEN_SHIFT 21
& L+ E3 v+ N Z# J0 n3 e. P - #define TCCHEN_SHIFT 22
8 b( o( I$ S) N- r - #define ITCCHEN_SHIFT 23
. P% i0 n7 H$ \3 @6 a1 C( [
( b2 s* I V) g5 L9 p Q3 W; Z- static volatile int irqraised1 = 0;
4 C1 U8 V, A. z: a* V - static volatile int irqraised2 = 0;8 F+ P3 I* `3 L9 L3 z8 ^
- 4 h+ i0 s0 G4 x2 I* v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 M$ k; y" Q4 V5 k! o V) h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( g3 N2 }& i$ h0 T% L. G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ g' q. J& I& k' z5 m0 r; X
- % d3 n$ {$ [* o+ r1 {
- dma_addr_t dmaphyssrc1 = 0;
3 T' c2 N) I7 h; @ - dma_addr_t dmaphyssrc2 = 0;/ [# e) W$ h' z/ t- j4 h
- dma_addr_t dmaphysdest1 = 0;/ l9 N! O6 L$ z: G; P
- dma_addr_t dmaphysdest2 = 0;- X1 Z+ D. w2 o* C! C
- / ~& x- i- c! H' {1 [6 |
- char *dmabufsrc1 = NULL;3 F; K0 ]; D) T' _% p
- char *dmabufsrc2 = NULL;
/ `8 V2 Q+ Y4 G! a8 o - char *dmabufdest1 = NULL;
$ G1 \6 q3 n# U' }# f$ ~& V- ] - char *dmabufdest2 = NULL;
K+ X: g- C! h - * s$ u. n# \1 ~
- static int acnt = 512;3 q9 o: ~$ G7 j: a
- static int bcnt = 8;8 B7 k( E2 P6 {; X% S, s
- static int ccnt = 8;" O( T* ?; J6 c. J. v1 v
+ ~, G2 d/ Z4 ~- module_param(acnt, int, S_IRUGO);
( n: G1 U& U- Z0 W. ^ - module_param(bcnt, int, S_IRUGO);2 A6 |6 L* _0 x( ~* V3 ? c
- module_param(ccnt, int, S_IRUGO);
复制代码
" ?9 w! Z3 @0 q; I1 P; R/ l! L9 \ ?; ]4 p# k9 k! }* H) Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: \, ~6 @, y% \* E o3 B: J" ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# \5 c8 n8 l1 s/ y" B' ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* @# i# T3 A) T5 U- r
& J4 Z% @- Y" z9 d' k" m% M/ K
2 B0 J8 N5 {! l0 k4 j M- b$ a3 f0 t |
|