|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- U) b: d$ h+ @5 H- }" _) J- j! R- [code]EDMA sample test application
2 I2 n# }. B8 V& d+ m! B/ S0 O - /*
! |& j; ^% x7 Y$ d - * edma_test.c* w" z8 ]+ e8 Z: J2 H: T) O
- *9 e, ^% w- t4 M
- * brief EDMA3 Test Application
1 M6 ?7 U+ Q' U7 f - *: ~( g1 R; p' l' ~4 P
- * This file contains EDMA3 Test code.& _' a5 H6 \" A) c6 \ k
- *! t, Z z9 Y* T9 G6 e' y9 Y0 F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ B" z) k5 o8 ^7 a! Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' Y n( e7 p7 W7 ^
- * TO CHANGE.& a- V6 @# i7 U
- *
p5 o u1 r! D9 @$ G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 V, v( o7 ~, P6 V! b, Z, G
- *3 |4 a8 o6 @3 I! V; X7 b
- * This program is free software; you can redistribute it and/or# h: Z0 P% j7 H
- * modify it under the terms of the GNU General Public License as
- z+ B5 S7 O! T# T' u4 T - * published by the Free Software Foundation version 2.
6 M6 D$ J! g0 P) J# i0 ?% ` - *1 Z! h8 c4 Z4 y8 @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ ~$ ?( `# P+ E( P) Z, d - * kind, whether express or implied; without even the implied warranty. K1 ^' I$ o& Q3 o! W+ _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% s4 V* \- F% _7 u% x
- * GNU General Public License for more details. `& r* | y8 g% u
- */
" V/ Q9 K+ u4 h1 E; s
/ d& ~+ ?6 d' Z# v- #include <linux/module.h>( @4 R$ K8 M* y- I: {
- #include <linux/init.h>) v: y. z! x& L7 I Y# S0 X& m( V
- #include <linux/errno.h>, [; a4 ^0 |* O
- #include <linux/types.h>5 M; R/ v0 P0 q7 E
- #include <linux/interrupt.h>
- M& e! S! c' M3 f" E: o5 P6 I - #include <asm/io.h>
! b; z4 z2 T5 G H" E - #include <linux/moduleparam.h>
7 x2 Y0 Z( w& ?. Z3 | - #include <linux/sysctl.h>9 {: C/ ]8 T. w* J
- #include <linux/mm.h>0 s" n% u x8 R: S, Z
- #include <linux/dma-mapping.h>' ?3 J/ F; B. x7 x- T& i0 u
- & R, T: P/ c/ a/ {. y, H
- #include <mach/memory.h>$ h; W& O: _* I# D+ r3 G
- #include <mach/hardware.h>
: C* y/ B0 J( a" U( f - #include <mach/irqs.h>
( h* X; f' l& }1 a/ m - #include <asm/hardware/edma.h>
3 q6 V8 |% \- \) G - & p/ z( B9 @) A6 V
- #undef EDMA3_DEBUG
8 E6 a( W% E/ n6 \ - /*#define EDMA3_DEBUG*/
% n4 `/ i. }2 ^7 i$ f - * @ y$ _+ ?3 q, r
- #ifdef EDMA3_DEBUG
1 C4 T2 f: b- k3 Q$ [; d( f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# e" G2 g' q6 V- t8 x& @0 f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 J- d9 s6 [! b- I/ J% S6 q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 s7 U' q \: l9 f1 ?3 Q
- #else- c/ }: Y/ X! B5 I# @! B' X
- #define DMA_PRINTK( x... )1 ]9 D! K- M+ Y# C, u8 I
- #define DMA_FN_IN
6 ~# o/ h) [& W4 X$ c: h% D& w+ ^ - #define DMA_FN_OUT
% ~% u& r0 }- G) B. d - #endif5 B6 @# F, ]( M; J+ ~
. y" J8 L+ e3 Z0 m$ A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 T. u ^8 x( d& V4 w0 B
- #define STATIC_SHIFT 3
X6 S8 G* O* C1 N8 R - #define TCINTEN_SHIFT 208 F0 D5 q6 O: {3 c. q
- #define ITCINTEN_SHIFT 21
: j/ _* |* K* G. q7 n - #define TCCHEN_SHIFT 22. K" Q1 I" f/ x; R2 q
- #define ITCCHEN_SHIFT 23) i4 O0 @6 k( W7 J1 \; m" e
- & v8 w+ N; I; m7 D
- static volatile int irqraised1 = 0;0 K8 ?7 F9 _/ {
- static volatile int irqraised2 = 0;
! g# v- @, d" O3 H - * S$ Z' B) z1 K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 j1 f5 ^- ~- l! [% A% k' J" @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 }7 l2 o7 O+ _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ^6 K) d1 [1 Z. X$ }
- 8 g% L) q( \4 F5 g) W; ]
- dma_addr_t dmaphyssrc1 = 0; ^1 u3 _7 E# B. Z
- dma_addr_t dmaphyssrc2 = 0;
; @. r& r. h( [ p0 u, K - dma_addr_t dmaphysdest1 = 0;
/ M+ N- d- W' O3 V& B( c; j - dma_addr_t dmaphysdest2 = 0;- G$ O" \) `( q L
- * ~" p1 o& A! s
- char *dmabufsrc1 = NULL;- v6 p4 r- k; W8 D b! e
- char *dmabufsrc2 = NULL;
, T/ J# P; M3 J" u1 L) _7 ?# ]! ^3 A4 C - char *dmabufdest1 = NULL;/ `1 p. \8 ^( K2 u: P+ a9 b5 S7 b
- char *dmabufdest2 = NULL;% q! G7 V( `! Q# D3 `0 U9 E9 p
- 4 v' t) }( X0 M1 K! U
- static int acnt = 512;# \1 K6 W" m9 Y! a- n8 [. P. w
- static int bcnt = 8; p4 p- @9 @0 x; _8 v: y7 o
- static int ccnt = 8;
- ?1 U- R9 P; }! v1 c7 j* I
# W! U2 d# V5 Q9 a/ \ `5 ~6 l- module_param(acnt, int, S_IRUGO);7 t1 o; K/ Z& d7 O1 j! z
- module_param(bcnt, int, S_IRUGO);' |0 z, Q% P* O. h. a+ K8 n4 Y8 T
- module_param(ccnt, int, S_IRUGO);
复制代码 5 s7 P+ N. V' G% I, P
$ K. j4 B3 Z5 k7 m4 b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ ~6 D# k3 ?* J& Y. E0 g8 v garm-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 E0 D, J: S1 y( Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 @3 ?& D( f, S* }- O5 A& y
) w- P% T$ e( b4 e \5 v+ H7 }5 e @" M1 t
|
|