|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 J9 S6 A- b0 W1 N! Y% h! N- [code]EDMA sample test application# a* Y+ \+ k' v! |
- /*
" |9 K; R1 v1 Q' \ - * edma_test.c: B/ |% J2 I* N9 M6 D, R' G
- *; |' ^1 H H+ o ^6 {/ p. C/ p
- * brief EDMA3 Test Application
" y* H1 S6 p3 v$ ^ - *
- M( {8 E3 |: P - * This file contains EDMA3 Test code.* o8 d, I+ \8 y
- *
1 K; F/ ~$ e" ] c' v9 i7 S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ S! x3 M9 Y. s# e9 M! j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ Y1 @ \" g* U6 h; F. P. R
- * TO CHANGE.
! r$ X; v0 \: x% r, d4 D) v+ \ - *3 `1 s# {! |0 t* I' `4 o* Z' v8 q( s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! W% E& T: q; ^9 O
- *& f2 f, ~; q7 {* I' N
- * This program is free software; you can redistribute it and/or- W) `0 X4 e) |7 o# F8 f% F
- * modify it under the terms of the GNU General Public License as9 j5 d, z6 w3 i6 F0 a
- * published by the Free Software Foundation version 2.* R; o6 p, _( Q1 A; J) x
- *- ~' P7 P/ Z% N9 U# W: a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& ?. R- h* v; L- G' `7 r8 ` - * kind, whether express or implied; without even the implied warranty; G8 p1 O- o+ {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- L( \" U ?6 H0 {+ a - * GNU General Public License for more details.
, H5 {" {. ~& x' M, x - */* G" K* }/ K# L5 p# `( {1 r
- 9 [' u3 M4 p; P# Z
- #include <linux/module.h>
* v; m6 ]* K; d2 W - #include <linux/init.h>" I; e# A: {7 |) y# Y, z
- #include <linux/errno.h>
+ `- w7 \4 s9 M8 J# J5 e; M - #include <linux/types.h>
# D" ]' _6 ~; A+ W1 R" N0 E; N - #include <linux/interrupt.h>
: D: Z* n- D( `; {& U - #include <asm/io.h>
' E) n+ O3 ]( @- @! B# {- _ - #include <linux/moduleparam.h>
, _, @% J* [, l' r* { - #include <linux/sysctl.h>5 r( Z5 C T' m* l
- #include <linux/mm.h>' V ?) M8 d: `6 E6 k3 {* T2 y
- #include <linux/dma-mapping.h>
6 k' S( q) [' V
9 d1 C$ l3 z6 d) c% E& \' K- #include <mach/memory.h>* R f0 i+ d( w: ^- _, J/ N+ Q% Y
- #include <mach/hardware.h>9 ~) o" [7 T5 z: i5 r4 X
- #include <mach/irqs.h>* q# @) w( Y' e
- #include <asm/hardware/edma.h>
6 z1 X; t& u; a: j5 z
$ U3 E8 U4 i1 f- #undef EDMA3_DEBUG& G4 H) \: m8 W( {. ^. Z
- /*#define EDMA3_DEBUG*/) ~' v4 f; U# e- d+ \0 Z- T: U; x% o
- 2 L3 y9 Q; m. Q' c2 o
- #ifdef EDMA3_DEBUG
# k; w" ]# q6 c. B$ I( w1 A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- }5 d3 n- N& l7 X; S g: p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, z: E2 I# ^) C' O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 m0 r& E$ e* N# ]& K' x - #else
! U* [& l Z2 M( S6 s+ j, M - #define DMA_PRINTK( x... )7 v6 K8 C- M+ W+ Y& I3 p
- #define DMA_FN_IN
+ l+ v( V# Y' a/ `( C I8 i8 e - #define DMA_FN_OUT
3 x* @& H6 [/ \0 Y - #endif. L* c) M0 N" s
$ A3 R s4 w a* s B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& B: @4 l8 I# U( s8 c8 M% B7 B
- #define STATIC_SHIFT 37 X6 r" E' u7 l, F
- #define TCINTEN_SHIFT 20% L: x, O+ L5 G0 X
- #define ITCINTEN_SHIFT 21
& s% ?; W7 H) q/ L. k6 o6 ?$ s - #define TCCHEN_SHIFT 22
8 y5 ~! B3 c5 G6 N" [ - #define ITCCHEN_SHIFT 23* z$ U8 l5 n# G+ Z c
- # \& f9 v; C" V5 D' A' V3 ~
- static volatile int irqraised1 = 0;
% _/ E' u6 ^$ v O7 v: C1 `- i$ r - static volatile int irqraised2 = 0;
9 \! U+ c) `/ u
. d* i1 K }& J" v9 |7 i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; a5 W& N; J8 J" X$ T5 C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 k, c; U7 m" L; V J8 |/ _4 p5 A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 [# b3 a& D/ s$ k9 b% H - # b* \" l/ F6 _- t/ n% N
- dma_addr_t dmaphyssrc1 = 0;) F$ Z" D1 b0 f$ ] g
- dma_addr_t dmaphyssrc2 = 0;
. t+ m4 V% x# {0 }+ J/ X - dma_addr_t dmaphysdest1 = 0;- [1 R# ?0 Y: A J
- dma_addr_t dmaphysdest2 = 0;
! \- o6 j7 ]7 w, K0 V - 2 W+ w; v# G' ^( F
- char *dmabufsrc1 = NULL;
5 w8 G- a9 t# |2 ^& t' V9 b - char *dmabufsrc2 = NULL;3 ]" |* ^) A! Z, N0 }6 M P
- char *dmabufdest1 = NULL;
2 H9 h( M/ Q& d- D- e8 l - char *dmabufdest2 = NULL;) V* c T" I+ [. o( B! ]3 }
' [3 d7 J; p% c* \) V. ~* `- static int acnt = 512;
# r1 q8 k( l- \8 P9 ~' R - static int bcnt = 8;$ o% C. P1 k' _# e& x; g
- static int ccnt = 8;
# F9 G& B9 I5 w" ^& p9 s; U
+ c) ]4 }6 j3 S4 [" `* F. f* w- module_param(acnt, int, S_IRUGO);
1 k \9 f( K- r8 K - module_param(bcnt, int, S_IRUGO);
+ A8 C ~# c0 D" W& M - module_param(ccnt, int, S_IRUGO);
复制代码
+ ]+ p* d: g) {0 _# |7 c! t' ?* |4 T6 E5 w" F2 B9 G& r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" p! k. t+ E' p, W# s5 H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 u* H& l! X& r5 l; P7 ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 m! G8 g: x2 m* y* x! z6 {3 x4 E
# a% l/ s. @2 r# M: v8 K- j! {( v
i, T' a" h) Y/ N0 T$ z |
|