|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! p0 r5 D T9 Z% X- L( k7 {+ t
- [code]EDMA sample test application
1 \- V3 s' Z0 Y - /*" m/ r: P1 u6 Y0 O* g2 ]2 c c7 u
- * edma_test.c
7 _! a4 V! G3 t - *
6 }! J1 }) J8 x - * brief EDMA3 Test Application
1 x: u6 I8 @, P1 L - *
% g3 X& S3 Q% z0 O - * This file contains EDMA3 Test code.
( h( H7 v! H d$ G: \' j - *
- v$ d1 Q8 f$ v& X( o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- x# |* r `4 s: @: x' T4 H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 F0 G O! D+ H+ h
- * TO CHANGE.3 o0 J( l9 a9 ?% L8 y- Z3 u4 }4 w- `
- *
5 u/ H) s" K" J2 ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 P, C8 T! W% Z3 |0 e, j4 U, I1 ` - *
& e+ d+ z/ Y; G- T8 d, [ - * This program is free software; you can redistribute it and/or% g3 \9 S# x1 P* o; A! w# m
- * modify it under the terms of the GNU General Public License as
9 v% ?, s( t6 h. W - * published by the Free Software Foundation version 2.
7 N) B; Z- k) C& a& A9 O! y& F' Z - ** r7 { o0 p6 }- @# }+ E4 m: }, Q" a) W7 }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& @- c$ q% c6 { T/ p- K# | - * kind, whether express or implied; without even the implied warranty
0 Z& [0 T. i! l; ^5 F8 B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- a- y# n: _, x - * GNU General Public License for more details.
4 c% _6 S4 b8 [8 w - */- b$ r. K( c& M& g
1 b) ?) W( c0 C: [6 P& B6 o' b- #include <linux/module.h>
7 ~: q. I0 a6 A' |3 d9 L) B - #include <linux/init.h>
2 X* T2 d7 v5 w7 @ - #include <linux/errno.h>
4 k2 L! d1 E) ]6 r7 y# H. X - #include <linux/types.h>; \7 ~ D/ Z' @
- #include <linux/interrupt.h>0 X' m* d; i& D2 Q
- #include <asm/io.h>6 q, G2 B0 ^# `: V' J7 _
- #include <linux/moduleparam.h>9 J e9 c5 J) Q3 Z( S$ i: [4 A$ W
- #include <linux/sysctl.h>
8 @4 A6 `7 E$ _4 Y - #include <linux/mm.h>
E, A/ Z4 X; l - #include <linux/dma-mapping.h>
& Y$ d; ]0 P1 p) f: n- Y% E - + Y. M5 _1 \( j M& u
- #include <mach/memory.h>
; D e# A" C% u. h3 g - #include <mach/hardware.h>
* P6 m4 C N$ z+ r# ^* E2 t4 q) d$ w - #include <mach/irqs.h>9 q1 q9 i$ o" i
- #include <asm/hardware/edma.h>. F/ R! _9 S, n" H7 i; M
, D$ |* W, P# c3 [2 D1 W- #undef EDMA3_DEBUG
' [' c* t* O" e# `: p* d. w! n0 Q6 e, c - /*#define EDMA3_DEBUG*/
! d+ a. `! B: ^" t) @: Y0 V2 {
8 t8 O" i h0 T, m3 v- #ifdef EDMA3_DEBUG+ t0 k1 a. p9 g: N, Q0 a) T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" L; z( \- @+ N9 Q! K+ z. Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), x9 B, \" D8 o [, k4 M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) i! o |$ j- R; x4 Y4 W
- #else i3 Y8 l3 E( F; l# o/ \, p0 h
- #define DMA_PRINTK( x... )
2 Q2 P5 |2 `; c2 A7 ? - #define DMA_FN_IN2 C! m* Z3 u' _7 M* p
- #define DMA_FN_OUT
# X" h/ r& ^0 q0 b& p; Y - #endif; E$ c8 w2 x. `3 D% [- d# {. g
" [( L% s) }+ e# r5 R, w( m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) t: O2 ]+ k! Z
- #define STATIC_SHIFT 3
+ j9 Z4 H% A5 ]6 @ - #define TCINTEN_SHIFT 20" p' p' ~1 Z1 n7 R$ U8 t! @
- #define ITCINTEN_SHIFT 21: n+ O# r! K' {4 x
- #define TCCHEN_SHIFT 22
. ?" C9 C0 T- b/ [/ w/ D - #define ITCCHEN_SHIFT 23
; Q! E/ `- l. B' M1 B! W: V - 0 Y0 \9 M% m. Q, a$ g/ k
- static volatile int irqraised1 = 0;! d; I- c3 I7 ?! \5 Z; O
- static volatile int irqraised2 = 0;
0 e# Y f& ^# V$ K - ' H% s" p0 ?+ N# }- H- F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. Z0 @- m( ?$ U6 m6 J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 S: y# T+ B$ X* S% h+ Y) F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ N9 N. M. z- m' f
& `% F1 M$ v/ Q4 w! V1 z& P. \- dma_addr_t dmaphyssrc1 = 0;
* t: P8 D! C9 M; d" `$ J - dma_addr_t dmaphyssrc2 = 0;! O- J! f) s: k9 l) N5 R
- dma_addr_t dmaphysdest1 = 0;. m4 ^# e2 p; `1 r* N
- dma_addr_t dmaphysdest2 = 0; V$ _4 |$ G5 S6 a# j& q8 L9 A4 A
, g' U& }+ C* [& X- char *dmabufsrc1 = NULL;
- R& E+ _ E: q J+ Y - char *dmabufsrc2 = NULL;, P% `0 u8 i) a& p5 B
- char *dmabufdest1 = NULL;* M+ e9 m+ R; n7 A$ @/ ~& D
- char *dmabufdest2 = NULL;
, u) u5 i5 X4 y, K: J, A0 h - - D# p1 u2 M8 K. Z( `4 V
- static int acnt = 512;
{9 x) g% _/ k6 S" M0 T9 t - static int bcnt = 8;* J$ T! ~$ y' y: O2 y# a
- static int ccnt = 8;2 t: d9 {3 U& \* }6 k* N, a3 x
+ N5 _, N* y8 H+ D" O; A- module_param(acnt, int, S_IRUGO);
( ?1 C) V5 h7 l3 g" L - module_param(bcnt, int, S_IRUGO);
4 Y6 t$ n) L, L. i; Q - module_param(ccnt, int, S_IRUGO);
复制代码 ) `& Q5 z+ h. S5 ^) Q8 Z5 D3 q
% E# @; O# k1 } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 b& h' A* s0 `4 w7 A5 u. [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. o ]; Q$ p# u" R( Y S% Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ g& J% `! h% Z# E, G2 y
2 Z& v2 t( B1 [1 J/ D/ u, {
' b L, J$ @! }/ S) t4 B |
|