|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) }4 Z6 n# @1 I- [code]EDMA sample test application
. v- [; z, p5 ]. B) [- v/ A) U& E - /*) @7 Q0 p7 o9 O4 z. c) D
- * edma_test.c
& T6 B/ P: t1 p& s - *" ~5 f& l7 b) ~) e9 G
- * brief EDMA3 Test Application. L. L' X6 m8 a8 G! b1 O
- *
' P! ^: _1 H+ V1 G5 q - * This file contains EDMA3 Test code.
0 u: D; u- ~; }; e h: W3 g - *' k# P% X0 N4 W; B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE w7 d9 e ^- N4 ~) k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: E& J r; @: I$ u* v( H - * TO CHANGE., w( ~% h( {) { r4 V# g
- *
8 H" G( W1 h7 \- @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 Y/ c- O; Y f+ ^ - *8 h3 X& @' {: R, G ]8 n! {; y8 C
- * This program is free software; you can redistribute it and/or
+ I8 [$ a& w/ d5 V3 N - * modify it under the terms of the GNU General Public License as
5 `8 m# T/ C5 H. o$ E: f6 e - * published by the Free Software Foundation version 2.' ? r; _ w# i* d
- *
- ~5 w* w D* Y# C* ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! t8 D9 u/ \) c - * kind, whether express or implied; without even the implied warranty: y: e6 H2 O# R1 ~! f0 A; N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 C E8 p. A/ A3 n( Y! P# f/ @0 ~ - * GNU General Public License for more details.
Y2 _0 N6 `0 u; W5 Z- @" f - */
8 \$ J a8 f9 i G# ~( L
* R4 f H* n, g8 J9 M& w% C- #include <linux/module.h>
+ D+ L3 G; h8 @. Q% ~ - #include <linux/init.h>
& j2 }( Y+ r' U' d' s - #include <linux/errno.h>5 D6 W# |% X7 e* W% R; U2 b1 z1 w5 i
- #include <linux/types.h>
6 ^. ]7 M1 J: O2 F; Q C - #include <linux/interrupt.h>) b( i2 G" Q: Z
- #include <asm/io.h>! _4 x H2 U S2 }/ r
- #include <linux/moduleparam.h>
. V2 [4 [5 k# c8 c. m - #include <linux/sysctl.h>2 w0 ~7 v! Z& Z
- #include <linux/mm.h>
3 M4 D# o; B" P - #include <linux/dma-mapping.h>
" p* V$ a5 n$ [! f( X A
: m; X7 T9 a/ E% e! a- #include <mach/memory.h>/ _: B; d9 ]7 q4 {6 S
- #include <mach/hardware.h>2 O {9 E F. W! Z6 I0 J
- #include <mach/irqs.h>
, x: o1 G) ]7 G# N - #include <asm/hardware/edma.h>
0 y/ v' Q2 i) g- ^0 v7 {8 h& H" \* y4 q
- c m* S2 q! l1 ?- #undef EDMA3_DEBUG5 \" g8 Z$ v9 V
- /*#define EDMA3_DEBUG*/
. }" H; N i* Z" r0 l$ \& M - ( ]9 \8 D; X) x7 ^2 W) e, ^ t
- #ifdef EDMA3_DEBUG9 Q; `$ W0 |: y# A- S N/ I# g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 k+ \& y! e! B. ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 p5 U6 U" Z! v' L$ O+ G! I K# | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) b) E6 j! v9 k# e
- #else: u3 o( i* Y. `5 d; s
- #define DMA_PRINTK( x... )# {$ G s) }' Q5 R
- #define DMA_FN_IN
6 `& a' @# r- m - #define DMA_FN_OUT( v- M/ z% o4 N1 o. U
- #endif
3 E. c, c% K3 Y - 4 E1 U8 }* z0 D% R5 e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ O; @+ z0 r# F* c5 o* n8 G
- #define STATIC_SHIFT 3
5 y! L9 x/ U9 ^2 D - #define TCINTEN_SHIFT 20' i( @1 Z) ?. ^( f
- #define ITCINTEN_SHIFT 21+ t. w C* J! e. F! y, k |
- #define TCCHEN_SHIFT 228 y d4 x) [( q7 Q7 `9 p% A# x
- #define ITCCHEN_SHIFT 23
2 S; b9 X s- `3 K p" ~* p/ N: L
7 [1 O7 r$ ~* d- static volatile int irqraised1 = 0;
+ _) M) {6 Q/ Z& a - static volatile int irqraised2 = 0;
' l8 E1 N0 [( e8 y3 q0 t& B - 4 r9 Q' v/ C2 H0 E6 X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Z. U, T% ?# {8 c7 B8 f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Q8 h) g6 G4 C1 ~/ p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 P; F& y6 d8 N6 E: w$ Z! g
5 g6 M( ?* u) j' O- dma_addr_t dmaphyssrc1 = 0;& E3 ]9 k' X. |3 }$ f
- dma_addr_t dmaphyssrc2 = 0;7 y2 w: _# q5 g' \# [4 ?1 _6 _0 A
- dma_addr_t dmaphysdest1 = 0;
- F8 d: u% C3 V# z# \' R* Z ~ - dma_addr_t dmaphysdest2 = 0;
! {- U0 e- u L1 j8 E' a
# Y% I6 B5 b0 |& ^9 ?3 p% @- char *dmabufsrc1 = NULL;# r3 f7 S( I/ E* h' \
- char *dmabufsrc2 = NULL;
. m( I5 j3 h/ s2 ?: X1 W( G - char *dmabufdest1 = NULL;
5 J" @7 q! g h/ e* o - char *dmabufdest2 = NULL;
- J! w; x! F% s. a - # I. Z" J% m$ y
- static int acnt = 512;
: B( D5 f5 |! C( O$ K- h- ? O2 S - static int bcnt = 8;
( Q2 Y" I1 N8 K9 Z C" g - static int ccnt = 8;
0 n$ Q u+ {9 u4 C - y; ^/ D/ V2 V Y$ U
- module_param(acnt, int, S_IRUGO);
' g1 m I1 R) s$ J* v - module_param(bcnt, int, S_IRUGO);
( I: p- O, x1 W - module_param(ccnt, int, S_IRUGO);
复制代码
W o- w8 D$ |( s
* E2 j6 I, h ]+ L$ o( I @ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ d8 t$ T/ a0 D: |. `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 G2 R4 ?! C9 Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( R; u. \+ ^9 e) K; R: Q7 t! T
C7 I" y& n5 M' ^) A8 r% p7 ?- w1 p% e6 o* E/ \% w( T- c# j0 C
|
|