|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 A: r# s# w& g5 E' P' y
- [code]EDMA sample test application" a* f* `0 A& S9 a
- /*7 j8 c, w! }/ Q. R( S
- * edma_test.c$ S! }6 n7 r, K! ~0 c5 w7 S+ X0 Q
- *
. K, B! x% W( \& l* H0 \- e - * brief EDMA3 Test Application
) z2 `8 J* J# i - *
+ a8 k3 M) {# e; A. }6 Z - * This file contains EDMA3 Test code.
5 p' s8 ]& X$ H0 @9 M( K# T# C - *
/ q/ x3 w4 A P9 I" w8 M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- P: C' R# }- m$ I. Q& `( ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 F8 F& C5 V; h6 J+ N2 y# D - * TO CHANGE.
. O L* ^. ]4 [( ~0 q - *
' u; m; \# g3 }: J7 f" Z5 U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& \% ^+ ?: E/ f2 O# ~$ ]2 L% b - *
( {' @& J1 ?$ V - * This program is free software; you can redistribute it and/or
$ Z0 v" w2 S6 w0 b - * modify it under the terms of the GNU General Public License as7 y L: g- { } x' F
- * published by the Free Software Foundation version 2.) s- x! i: V: `' X; X
- *! F5 K+ a- T5 p# \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ J: c# S/ L. J/ N5 [5 |' L! }% S - * kind, whether express or implied; without even the implied warranty
' I. `/ ?, w) n) W, o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 i6 w @( I: k/ x& D
- * GNU General Public License for more details.
q: o/ b1 M+ r# d7 O; V) z" c - */
* c5 k9 M/ B+ H% n* U - 7 E( Z3 q+ k5 E/ s( \
- #include <linux/module.h>
- R; i& U4 i1 b - #include <linux/init.h>
+ p3 b D8 F. R' a - #include <linux/errno.h>
1 a* {* o5 T2 x - #include <linux/types.h>0 k& |& }$ x% u
- #include <linux/interrupt.h>
1 x6 |3 [' _5 A6 r+ A5 w - #include <asm/io.h>- {; z' f/ D7 e
- #include <linux/moduleparam.h>/ A2 H6 G$ E0 ~" a
- #include <linux/sysctl.h>
7 j7 E5 N+ N; ` - #include <linux/mm.h>$ K0 b* n7 E5 G6 Y' e
- #include <linux/dma-mapping.h>
* G: b: B/ J7 w" ? - 9 w7 q* x! j, ]) c" R
- #include <mach/memory.h>& `# b9 H! [3 q+ ^: W
- #include <mach/hardware.h>( u5 ^' x0 h/ c5 U
- #include <mach/irqs.h>3 O" C! M- V4 M/ M' r
- #include <asm/hardware/edma.h>( n) ~2 x. U0 r. x* a
6 w2 S+ p! f# v* p4 l- #undef EDMA3_DEBUG7 W* A) k4 d7 \0 f
- /*#define EDMA3_DEBUG*/: \$ R9 [# w/ X
- , u- j2 Q; P: Q
- #ifdef EDMA3_DEBUG8 e+ T2 L9 z8 Y3 ]: s, g0 Z& I; v' v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 F& {, n& z9 r" f% s' Z8 a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- ?2 i3 ^& T; x, l" Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* |% [. J7 H' s$ [; m
- #else$ t2 \/ C+ G' o7 G' e3 s; T) V
- #define DMA_PRINTK( x... )
; H' L h! Y1 G0 q3 t+ C8 e - #define DMA_FN_IN
4 j x2 D; J) B% G: u, z - #define DMA_FN_OUT$ R) q- i' \! ^7 Y* f9 _* }! [* a
- #endif
: {$ U% g' i! \# A4 ]/ ]0 B; z: H - , T0 O$ U9 Z, T# Q2 `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 S/ r& V9 n$ e! w- }+ [
- #define STATIC_SHIFT 3# |0 l' |+ A3 t5 N
- #define TCINTEN_SHIFT 20
' {3 n, D: q) z, _! _ - #define ITCINTEN_SHIFT 21
9 y8 r; s9 \+ i ^3 }: N! G2 P - #define TCCHEN_SHIFT 229 y. m: U1 v8 v: [; b; B3 `3 u: c4 |
- #define ITCCHEN_SHIFT 23
: q' q; A4 b6 J4 J" |- U - ) O* J- H% E2 z' N) h; j
- static volatile int irqraised1 = 0;7 G6 W8 [# V' k2 `+ q
- static volatile int irqraised2 = 0;& L; D; Y1 V* d9 J2 k
* `6 D) |. F- m- e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 K* R9 G0 ]* M1 y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# L X3 \( R2 m5 c( w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" V4 q5 b( S V3 N
7 n3 r0 h: a2 _1 v7 m! c- dma_addr_t dmaphyssrc1 = 0;: E6 o) y! M- m" S5 p/ w; s
- dma_addr_t dmaphyssrc2 = 0;4 ?0 w. {5 Q% i" y+ {* S1 X: {# G
- dma_addr_t dmaphysdest1 = 0;/ u2 U$ I( t# d8 B* o
- dma_addr_t dmaphysdest2 = 0;
5 |0 I6 B* l- [( I+ E - 3 F; r' M+ l9 ?- ]0 ?- @
- char *dmabufsrc1 = NULL;8 _2 B5 }% K! R# I
- char *dmabufsrc2 = NULL;
& b0 A& U4 ?* J3 j$ L1 `. A5 _ - char *dmabufdest1 = NULL;
6 _& Y& a; u c - char *dmabufdest2 = NULL;
# J9 A( F' Z6 I. s# g- k) A0 c: d2 x
/ [$ }! W: S) _& t: M- static int acnt = 512;
% _3 {; y5 T% w h) Q - static int bcnt = 8;
) j+ x- v/ a: C& j3 U* [0 `, B9 H5 C - static int ccnt = 8;- b* q. o7 O$ S8 |4 ?- @
6 m5 N& A6 B0 w) p/ I- module_param(acnt, int, S_IRUGO);
( e X* p+ N6 j - module_param(bcnt, int, S_IRUGO);) i3 @8 G1 G9 R/ g3 t
- module_param(ccnt, int, S_IRUGO);
复制代码
9 U9 n5 G# ^/ o% L" }& V: @5 C$ N. B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 M( ^) k" j. @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& \8 y# s1 R. t) D( a8 C) c T3 x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 U; m2 f2 n% l
! N7 t7 k1 d* L/ e$ `/ s: x& @* W" r7 S
|
|