|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* B8 A' v# y/ B$ Y b- [code]EDMA sample test application5 K+ W7 p, n3 U5 `% v1 A0 T0 l
- /*% j3 O! w0 M$ q' k/ @ K$ ?: `
- * edma_test.c6 p# i4 I) K4 R# k
- *0 @( G" g% x6 ~
- * brief EDMA3 Test Application
, H5 E1 B. w+ ^" e& _5 S - *- v3 o" B$ D* R: _# O" N& w& l
- * This file contains EDMA3 Test code.
% F) e# o# V( H4 H h5 u" ? - *" d5 T; m5 {. y6 t5 i0 o7 X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' u+ j* [' ~; I7 M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- d6 m( X2 D* C! _, X - * TO CHANGE.$ C1 _4 q4 C$ F% `
- *. f- A; E7 {: a+ h E H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; q1 B! ^$ m/ J- _
- *
& _, Y( P0 X0 }$ A0 e/ R - * This program is free software; you can redistribute it and/or
1 y- [. }3 ~: m+ p* T - * modify it under the terms of the GNU General Public License as
; y* o9 \- o5 Z3 R) h# H - * published by the Free Software Foundation version 2.
; ?0 H6 t9 B2 O - *
- G0 Y( \' c1 h* v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% Z. x; e, J; E
- * kind, whether express or implied; without even the implied warranty/ Z5 `) @& f. e0 Q5 l" d( b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 `4 z4 T7 u( x8 I- } - * GNU General Public License for more details.
5 p/ t4 x- L- w( B - */
n2 \7 ^/ ]1 p5 t& s- }; M- N$ M - $ e9 x4 c$ V% G { ]
- #include <linux/module.h>) p0 r0 s& a# \/ E( C) a4 S- j2 v
- #include <linux/init.h>
* z; ^, b4 B2 x; H" G8 M$ _& l# z - #include <linux/errno.h>& U2 ^. p1 \/ @- g' _6 L
- #include <linux/types.h>, q5 R/ Z0 n. o# B& _: r$ i
- #include <linux/interrupt.h>8 i z7 W* }3 X+ l- i
- #include <asm/io.h>$ c |6 U3 z% R. N" ?; e2 l9 l
- #include <linux/moduleparam.h>
7 |$ l2 J) H# L4 R. U: H- Y7 i - #include <linux/sysctl.h>
( o- ]# Z" Z9 W" ?4 \2 d& c - #include <linux/mm.h>1 C* Q& ~* F9 r J
- #include <linux/dma-mapping.h>
# |( ?8 x, T @ - 2 B' _" {- D- ]
- #include <mach/memory.h>) n* E1 {4 y z' ?/ k. a) Q7 m
- #include <mach/hardware.h>0 X8 F( H" L# P$ X1 X+ i, o
- #include <mach/irqs.h>2 P! _4 l$ R- `8 u/ g% N# S
- #include <asm/hardware/edma.h>
/ n, \3 C4 b2 L i" O1 e7 I* l! @- R - 9 a( o3 B2 z0 t2 G# w% Y6 z
- #undef EDMA3_DEBUG w5 h5 o, x5 z7 i2 W
- /*#define EDMA3_DEBUG*/
8 ]2 a6 @9 g; ? H; \; N- s3 e& Y
7 u7 j4 F2 W b* i: e$ Y4 R, r- #ifdef EDMA3_DEBUG8 {6 v$ d' f! Z2 Q, N/ m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 c. @+ v [& W6 _: @1 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! c0 h9 e+ Y! ^% s3 J' m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 w: x& P- m5 S3 ?9 E) ]- |
- #else( k( `5 N. Y# O3 L
- #define DMA_PRINTK( x... )
3 \* B F7 c/ D$ O2 f" D - #define DMA_FN_IN
7 t) e6 |0 v$ G& Q - #define DMA_FN_OUT4 `3 |/ { k V4 X$ H5 K) Z
- #endif/ W( t% k* Q* `9 S: {
- 8 L: j+ x8 Z0 e0 ~, {! d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) v0 N. E9 d* m - #define STATIC_SHIFT 3
. m% O2 m N: Z& d" i" @# |8 y - #define TCINTEN_SHIFT 20
; A9 E+ }" m) g+ h5 x$ f - #define ITCINTEN_SHIFT 211 k, O5 W% `; x4 i
- #define TCCHEN_SHIFT 223 O# q f; X. u @
- #define ITCCHEN_SHIFT 237 Q8 m5 i1 J9 G( x3 r
/ l$ `7 U6 T6 Q! b- static volatile int irqraised1 = 0;2 s& L% _. e( H8 a5 U+ s
- static volatile int irqraised2 = 0;' h/ k p; G& T8 `
0 x5 V- ]$ S- U/ |. k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. Y. `, E9 n( `; u# P1 O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); I. E& }7 e7 @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' S3 @* [0 j* V0 h; W1 H! ^8 T+ w
- ! u. T0 r; n p. x" H* v# f
- dma_addr_t dmaphyssrc1 = 0;% L* m6 w9 w: r( W; O
- dma_addr_t dmaphyssrc2 = 0;
# o" ~% Z8 X" W4 Y6 @. Z% d* U - dma_addr_t dmaphysdest1 = 0;( R P, J6 x( w* Q1 r
- dma_addr_t dmaphysdest2 = 0;" O! s" ]# b/ A* M& {2 y
- 0 }: `; O, Z4 t- R$ M* B8 y
- char *dmabufsrc1 = NULL;
5 Y, B4 L: h6 _& v. X9 O6 z- v8 y - char *dmabufsrc2 = NULL;
" j; Y/ E$ ~: e1 ]4 H/ ^, Q - char *dmabufdest1 = NULL;
) `0 R: ^! F; h) g% e0 U! Z - char *dmabufdest2 = NULL;5 d: u. u f6 [: z/ }
- ! q/ V( d* a0 ]- A
- static int acnt = 512;
2 D$ A" R& H: k6 E - static int bcnt = 8;/ h' @# Y9 ~! q& s( @" ]- ~1 U
- static int ccnt = 8;
$ `( j$ v9 K5 g$ o1 Y! |2 r8 ~+ P( x - ; `! S! n& _7 T9 M! }, d. w
- module_param(acnt, int, S_IRUGO);& M& {# ~1 h7 [( a* W: R! Z
- module_param(bcnt, int, S_IRUGO);
" R8 e# g/ k2 r5 Y - module_param(ccnt, int, S_IRUGO);
复制代码
7 f) _8 j$ |, P( @( B" k/ s n' Y) B7 c, S) L5 N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 c' b7 I# j# g- Y. s6 T1 z- U! Z5 [2 C
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 W$ @3 b2 I* x) G' \7 r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& ]- T+ s X: v6 F
4 `# C! f- X) t, V
: @9 f) d, S* A4 B( ?$ h
|
|