|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' q$ u: y% I% X' ]- d0 e
- [code]EDMA sample test application
" v" g' Z# R$ l, n - /*
, F: p& {7 P: D/ I, H' H - * edma_test.c% ?( ?5 N( z+ J8 I% V
- *
& ]' ]& i0 ?# I- a# M6 L - * brief EDMA3 Test Application, z) G4 ]: l7 R
- *# g# M8 Y* k" P
- * This file contains EDMA3 Test code.
9 F0 N" |' @2 C3 H - *
* P/ D4 `1 ~" L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 m, v6 l+ W& J+ F' H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ `% V' r; d! Q- I
- * TO CHANGE.
, J' B! ~4 I# E/ O. W - *
' Z4 L4 @, V% q/ V! q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ C( N, F+ d# K* O - *
* M: p+ B: J! f2 r7 o - * This program is free software; you can redistribute it and/or' t% y2 u3 x. G& x! I% o+ E
- * modify it under the terms of the GNU General Public License as3 ~6 k0 G; D8 {3 k2 i0 b6 D' @
- * published by the Free Software Foundation version 2.
) j' P; c! m) C8 c- _ - *5 P; o; K7 D; p) e# n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 @% \- `; l! A& e1 l8 X8 J: e - * kind, whether express or implied; without even the implied warranty: @5 y5 y3 N- r0 {" Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' c7 ~8 X* @- d/ E( u
- * GNU General Public License for more details.4 \! k, t' X0 a0 ~
- */- s, H9 C4 ~+ f
# c; r0 ?- O$ j& n% Z/ Z6 A. {4 V- #include <linux/module.h>
2 M7 @& X8 U6 S, Q- s! w6 ^) A0 `& m - #include <linux/init.h>+ z# L0 M5 \6 m r( ]& c M
- #include <linux/errno.h># ^- ]% K; F0 `4 b% h) ?; p' ]5 G" x
- #include <linux/types.h>/ y4 W/ S6 ^: e
- #include <linux/interrupt.h>
G" D Y5 Y9 X2 Y* @+ c" F/ j - #include <asm/io.h>9 G. h3 ?2 A) l, l0 J
- #include <linux/moduleparam.h>
. h( e, \* m8 R4 ~ - #include <linux/sysctl.h>+ Z2 L2 @0 ?! a, l
- #include <linux/mm.h>/ k8 M; I# _( g' g$ c! d, ~
- #include <linux/dma-mapping.h>
/ |0 ]* s) {2 s" R' o2 E( v. l( `; s
3 J7 {1 k* K# ` ]3 _) s- #include <mach/memory.h>
) U% y4 X2 {& v: ?8 P - #include <mach/hardware.h>4 ?% q+ y. S0 c5 `; z6 B5 F$ A9 ?0 p
- #include <mach/irqs.h>4 J k+ G& w# ^/ c$ q# F, R
- #include <asm/hardware/edma.h>/ S% b0 x% z) R' @0 D$ ]; X
- 2 J. t* {1 k; _" J. ~6 Y k
- #undef EDMA3_DEBUG
) `, p# I$ L( Z5 ~9 @2 }2 Z - /*#define EDMA3_DEBUG*/0 A% Z7 E- B! v) s
- 3 y2 ]& U' q% d( y
- #ifdef EDMA3_DEBUG
- v" u. u: N1 N2 D: b; L8 n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). t% ^1 Q+ a* }* }, P; V# k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 w; U5 E& `% u& K# q- F) H% _1 l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; t9 R; a0 `/ U# H( z - #else" k: f K9 f& L
- #define DMA_PRINTK( x... ); h8 j3 q" X- H- e9 A. X
- #define DMA_FN_IN% V9 @& d& | f: I# |6 c7 K
- #define DMA_FN_OUT8 K7 ^! ?& e- T7 k
- #endif
* q1 X4 H& @! }6 Z* {8 e - & i8 V' }! e- |% l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 `$ E; L7 S3 V7 N5 y( m
- #define STATIC_SHIFT 3. H `9 N% E X+ \2 j ~( y2 i
- #define TCINTEN_SHIFT 201 q* Q4 g1 G! u4 e* {
- #define ITCINTEN_SHIFT 21+ `/ j Z* b. c- q* H- \- C
- #define TCCHEN_SHIFT 22
6 C: O1 a+ z7 t# T; [# T' h1 e9 H - #define ITCCHEN_SHIFT 23$ Z9 X1 v. f7 Q: s
- , S6 ]. L L* e7 r
- static volatile int irqraised1 = 0;
# ~4 }4 {- q; z4 q - static volatile int irqraised2 = 0;
/ h$ x0 z# l9 s i( x2 u, T - & Q0 O8 q _1 T0 w# n S8 ]( U5 c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 p. T( G1 R/ U6 o9 i+ h9 D. W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ U" d; @; i9 \5 R3 w, G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. C8 [6 E: L4 X% M3 k4 |. X5 N - ' s# |$ C# d: M$ v' I- g4 {
- dma_addr_t dmaphyssrc1 = 0;# E" [( I! @, N8 A+ S6 D {1 M i
- dma_addr_t dmaphyssrc2 = 0;9 R( w1 Q& F3 I) s. ?
- dma_addr_t dmaphysdest1 = 0;1 |2 T. K3 T8 C. m- c4 l/ @
- dma_addr_t dmaphysdest2 = 0;! S' P2 M8 ~ v1 S% e
0 U+ v' g' r& K( V; \8 m- char *dmabufsrc1 = NULL;$ L5 s9 Q# g+ G" K; `4 Q) O
- char *dmabufsrc2 = NULL;
( R) Y1 \3 {. a+ ] - char *dmabufdest1 = NULL;
2 [3 A: @" g/ z- j" a7 t! I7 ^ - char *dmabufdest2 = NULL;
: f0 D! Y1 u T! Z D2 p: p
# w; P8 m' r7 Y; Q# j+ c1 F- static int acnt = 512;9 |7 _* |$ F2 T9 Z+ z- T
- static int bcnt = 8;
! b1 w n- Y1 j8 B. d+ T0 }5 Z - static int ccnt = 8; M) P( J8 c7 ?2 v% q4 f! A
- 8 o8 L4 s; v4 r$ ~
- module_param(acnt, int, S_IRUGO);
7 P$ g" t. E- d& F+ \0 D& P - module_param(bcnt, int, S_IRUGO);; J5 R: v' L* e0 k d" \, c
- module_param(ccnt, int, S_IRUGO);
复制代码 ; y3 W" C/ P( @# R, b9 K! M3 d; i' y
3 P# e2 n4 T' h) K/ k& g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, ^5 h; k% x, ]( d1 V4 E8 p3 ]# {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& S. @- w% Q/ D5 c5 [0 w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 l8 F1 ?! Z$ t5 Y e
3 ?! [9 P& W9 p% S' s( E/ |- f# q& {7 T: L
|
|