|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ m" |% S# w. @- [code]EDMA sample test application7 [/ _. R6 {4 y/ R
- /*% ?) ~2 Q% h/ o- Y
- * edma_test.c
( b5 D+ H1 @/ w! `# m; W - *
5 ]0 _9 |* g" F" o w - * brief EDMA3 Test Application
5 i) I( Y b4 [ - *; R. _9 }6 |- B& I
- * This file contains EDMA3 Test code.
# Q) F, N5 j. l - *4 j1 e# \# Q4 ^; k0 l, M) R/ Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ Q u) E; v2 ~2 {) D# S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 B5 W: e. `: A% T# g; n2 o
- * TO CHANGE.
4 e4 B2 B7 {4 C: D% V5 s - *' [! L4 b3 X: }$ z$ Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 b/ \' T+ F) p( [5 V - *
6 h% f' L. o7 \8 ^; _ A. } - * This program is free software; you can redistribute it and/or
: k- _ k% k4 ] - * modify it under the terms of the GNU General Public License as
* t7 O6 L* }5 c1 b* p6 Z - * published by the Free Software Foundation version 2.
# Z" B& O \! D1 Q; ]# e% `: _ - *
0 R/ }. [% D- f7 m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ g) [& f0 J( }+ S8 N: K5 X0 R9 F/ @
- * kind, whether express or implied; without even the implied warranty
. ^. P$ b8 D u9 i/ p+ d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 ~0 b9 q$ |* G" z' w+ ~" m
- * GNU General Public License for more details.
4 F: n1 h/ a% _7 b - */
- x. n$ d( e* x. l8 v
' g* w, Q( ?8 ]6 Z) k+ _- #include <linux/module.h>
' P- r7 n+ j1 l, k8 ]: z- i. \# f - #include <linux/init.h>
; Y5 m+ @& g. H- Z# k3 {4 H: x - #include <linux/errno.h>
& Q/ T4 q3 t4 i- K2 n - #include <linux/types.h>
, t8 y% K6 c% W9 Q- Y- Q2 p - #include <linux/interrupt.h>$ V) C l8 a& a4 w* G. s3 a
- #include <asm/io.h>/ a3 {9 O* z" t& |- I
- #include <linux/moduleparam.h>
: w- O# \2 M% o - #include <linux/sysctl.h>
; i V1 R* A: ~# W5 k$ f - #include <linux/mm.h>
* _# `2 A+ i) G( J/ o( O - #include <linux/dma-mapping.h>
l0 p' X+ w# |, g; u% [$ m' D - T( S h& r1 ]) x2 \
- #include <mach/memory.h>
: B# J' d8 W1 v* y0 M6 k0 b' z - #include <mach/hardware.h>
! S2 K) z& J5 ? - #include <mach/irqs.h>
! y j; q8 K6 \; p7 ~5 @ - #include <asm/hardware/edma.h>0 t' U7 U& q) o6 A& Z* @ ]
- % D/ }$ z. @0 \/ N( o* \) E/ [
- #undef EDMA3_DEBUG
: C# t$ E4 f' h6 ~7 C1 [ F" @ - /*#define EDMA3_DEBUG*/7 Z$ P, l/ `" \5 Q f9 z4 K; X) L5 r3 @
: h6 ~+ l* y6 U# f8 h, y/ h- #ifdef EDMA3_DEBUG
9 q6 M* x/ e& J, y I5 {: K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( H& l: r% m# ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* J3 V% Z2 ]5 S, s9 y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 N) d: S9 a+ ?/ C4 ?
- #else
5 {6 E. L( Z0 c& j" X - #define DMA_PRINTK( x... )" H4 {8 _' F; t {- e, B
- #define DMA_FN_IN
! f+ p* o4 X8 G1 k6 B, F8 X. b - #define DMA_FN_OUT
* j% l$ X+ F1 Z! X9 m$ d - #endif* N# i9 D) t% m2 ~) E
/ t* Y* e0 T7 _6 y8 n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ z" O1 V/ |( b: I
- #define STATIC_SHIFT 39 X- u$ F: m7 m& @! I1 G
- #define TCINTEN_SHIFT 20
9 T% q: U4 T. n! D+ r$ f2 S - #define ITCINTEN_SHIFT 21
$ |0 y9 [2 m4 e! \ - #define TCCHEN_SHIFT 22
" Y4 J& W# }$ t! M: m! N6 } [ - #define ITCCHEN_SHIFT 23
# }9 F! c; s; O
& V l3 ], r( j1 p- static volatile int irqraised1 = 0;* G5 N- z. F5 n( B
- static volatile int irqraised2 = 0;
* A9 c7 g3 z% G% Y9 c" \ - ( m% a* n% Y5 Y& Z4 ^2 Q, F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, m: Q0 [0 j! k. I* a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 l9 x9 [& q+ ?# K6 X6 G( l2 @ w# y, o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); d, S' T* j# N9 T# x. ^( @
- 8 k$ Q& Z6 g5 J0 `8 W7 q+ J8 ~/ V
- dma_addr_t dmaphyssrc1 = 0;' [7 u! v4 E+ b" y$ N
- dma_addr_t dmaphyssrc2 = 0;
7 P% k- h: N+ `( V5 K - dma_addr_t dmaphysdest1 = 0;$ D: Q+ Y& M! _( c: p" E4 h) \6 e0 Y
- dma_addr_t dmaphysdest2 = 0;" e4 u' O6 d1 p3 d
4 V& V6 s* q7 G5 U- char *dmabufsrc1 = NULL;/ }# q% y+ ?* r3 h; [
- char *dmabufsrc2 = NULL;
' E0 ?$ i5 M& q; m0 i; a - char *dmabufdest1 = NULL;1 \$ m0 j7 ?& m7 D- Z/ Y1 c( x
- char *dmabufdest2 = NULL;
9 {, |% t" a0 {- Q& e0 a
- k/ s7 x/ D% o# g9 F& b2 J- static int acnt = 512;( u5 F/ D5 {7 m3 @& [) b, r
- static int bcnt = 8;
& Q, m$ }9 k3 x V" R, X/ B* u - static int ccnt = 8;' X7 t& l& }; h. M
- d( R3 l! c! i6 Q5 X, e% Z
- module_param(acnt, int, S_IRUGO);
) @8 m+ a! s4 W( ^8 Y# [) w# v" g - module_param(bcnt, int, S_IRUGO);
2 q$ J1 u9 H( z# D, V9 l; K( B - module_param(ccnt, int, S_IRUGO);
复制代码 4 R8 D- A7 j& \( f1 E: V8 C& g
7 Y) e8 E3 O' X4 p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) H! e+ M, L# I6 u9 f6 e" h) r- c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 V% R0 ]& ]7 a) `/ L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 }0 |9 ?7 L7 M. Y- P* d% v' H
" B& M% a0 T, M; B
; q H% g5 T+ p" g0 u+ R
|
|