|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' [+ i* { H* _2 A
- [code]EDMA sample test application
# E8 w) t& @, ?# S; A3 \3 i! I - /*
0 T& O1 H1 A/ V7 u - * edma_test.c
5 k; }- y! A: g p% ^1 h - *% B5 T1 M2 {( h' d7 n
- * brief EDMA3 Test Application
" K5 l3 ?$ c! d7 Z - *: q1 M: f9 ]6 R2 a7 U" a
- * This file contains EDMA3 Test code.+ ^/ g% w3 D1 t8 V
- *
1 F3 M( y' p, w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& P/ ~) I" T# r B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 M& D9 h. g( L% K' l
- * TO CHANGE.: p7 F' z# B* U; [2 ^( p; t' ?8 x2 g* y8 ^0 Z
- *
) K7 f8 D+ p4 o2 S7 N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ e) M, o. E4 g3 t' H
- *
0 D/ i: f+ q# @6 V: U- w. `4 \ - * This program is free software; you can redistribute it and/or" |, k5 [9 Z) z3 A6 F; Z
- * modify it under the terms of the GNU General Public License as
; M8 F" [5 R$ W" O4 a t) l( f4 h. J - * published by the Free Software Foundation version 2.* j3 w; K/ N) I0 ?# v, ]2 B) C
- * w$ o$ z* h, x! m3 w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 F. Q. l* ]( N) i& X8 @
- * kind, whether express or implied; without even the implied warranty
, V: e! m6 K0 D$ r/ t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 s. x) i/ n, r- |: O5 u- U
- * GNU General Public License for more details.- A; Q/ } U$ Q/ D3 H0 U
- */
+ D" m- S! P0 B: q7 k9 V6 f" I/ Q - 3 g( D% r' e- T6 W& d% `
- #include <linux/module.h>6 m! F. I9 D* O9 e' a. Z6 @
- #include <linux/init.h>
3 ?; X3 c x& f9 [0 X$ F+ e9 ^4 R8 l - #include <linux/errno.h>% |& ^8 b8 G2 B8 v
- #include <linux/types.h>$ g" Q, Q J4 z; q9 I
- #include <linux/interrupt.h>( K% ~) d( B9 C" a) p8 e9 \, Y
- #include <asm/io.h>9 S9 H- n% z f/ g% f$ l$ k: D
- #include <linux/moduleparam.h>
5 G$ c2 @! {4 a) M* R( h - #include <linux/sysctl.h>
" I. g4 x4 M- a( v2 \' ` - #include <linux/mm.h>
/ o1 e! h4 x& Y; w. [0 z0 b3 n - #include <linux/dma-mapping.h>1 B! c/ N% D" _
- 1 Z" D& x/ \3 `" K6 B, w
- #include <mach/memory.h>
5 e3 F7 p" I0 B8 p - #include <mach/hardware.h>
' [8 C9 a: p4 W3 } - #include <mach/irqs.h>9 \) A/ M: F; i0 ]9 Z4 c$ t8 |0 O
- #include <asm/hardware/edma.h>& M0 |9 z# k0 D0 `+ W( p: ]
! H! c( _4 I0 W! V8 I( Z* b$ X- #undef EDMA3_DEBUG
$ b* }3 K' e+ Q9 A y - /*#define EDMA3_DEBUG*/
7 ?" k5 k( D- C# x$ {0 @; x5 ]& R - % X; o6 A3 Q3 c" T- A% v/ G
- #ifdef EDMA3_DEBUG/ V- H1 D: W$ s1 ?) B% s( f" E5 j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) k8 m& l) E( A' |/ v) }/ X/ y( R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 X& b$ u9 D$ } @ i3 }0 U. P1 V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ T3 H/ d( | A- O) X8 n0 U - #else
: i/ y& d0 W! Y+ g/ X% ^2 ?/ { - #define DMA_PRINTK( x... )! Z0 \$ N9 L# g' L/ H7 g+ ~
- #define DMA_FN_IN0 o4 h( Z9 p: Y6 h7 n
- #define DMA_FN_OUT
$ A9 |0 ~* X5 u" m% [ - #endif* P% u. O* K0 Z( N( S+ N
5 W1 T- [/ I1 d* ?5 O1 f4 ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ z9 b. c- y( q' D
- #define STATIC_SHIFT 33 _, z) O9 r. x6 T
- #define TCINTEN_SHIFT 20
9 p9 [( {3 F8 w" v. _3 d - #define ITCINTEN_SHIFT 21
2 `: n/ V5 C8 R, N/ f - #define TCCHEN_SHIFT 22, a1 Q$ j; h. h1 `0 W; f
- #define ITCCHEN_SHIFT 23/ I4 O, D \; l+ s$ K* m- i
- f4 d; X( ]# E- }& m5 {
- static volatile int irqraised1 = 0;
1 L& ^8 {" S9 W% P2 J+ b X - static volatile int irqraised2 = 0;
- u9 p6 j9 `" U8 p
4 J7 o' Q+ P/ Y y U' f/ a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); b2 ?0 K8 D" V& x( G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( F3 O% D5 p& G( k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 z3 ~! w v- c* a+ n3 k1 S8 ?
! F8 a! z: X+ d0 `& H- dma_addr_t dmaphyssrc1 = 0;# Z- M9 \; {0 ?+ ]0 S' G$ j
- dma_addr_t dmaphyssrc2 = 0; L( k) @; T* M% g/ A
- dma_addr_t dmaphysdest1 = 0;
! z( I) K: J7 b% p) a% F - dma_addr_t dmaphysdest2 = 0;4 T7 k6 M( u( p$ q( H
( i n3 c4 }, i7 }& v' r3 u: @- char *dmabufsrc1 = NULL;
! I) j; w. L: P! Q2 l0 q# E - char *dmabufsrc2 = NULL;: L7 g; Z1 _7 v& z3 @
- char *dmabufdest1 = NULL;
% T' T8 Y; L! n# l1 j - char *dmabufdest2 = NULL;
; I. I5 p) Q# Z7 P
8 B3 X" J5 q V4 L) D4 L- static int acnt = 512;, T* M' I% v) o& P7 n6 S; T
- static int bcnt = 8;
( n) _+ v k, s- e* O' e! T - static int ccnt = 8;1 N$ Z$ H- [4 O/ z) {7 D
' {1 G0 V, ~: B2 _6 k9 E- module_param(acnt, int, S_IRUGO);
1 G- Q( |; E/ {" \2 } - module_param(bcnt, int, S_IRUGO);
/ I; k% z* B8 H% K1 O9 u& z - module_param(ccnt, int, S_IRUGO);
复制代码
/ }; z6 c# I4 p7 v8 d J! o
. `4 N2 [7 e( C- R1 o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ b" m' ?) h+ r0 ~+ H3 E! N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 Z, S7 Z X5 g, T+ z0 ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, t. s$ W; q& t% v2 Y2 G5 e& E. j7 Z
* h! {; p' y8 `. W
2 k) j7 L9 h1 O# {3 d |
|