|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " i' X9 n! |; h$ i' c
- [code]EDMA sample test application
" }# l! ^/ A7 C3 \2 q/ N - /*2 C+ u6 V! T, p2 R- q" Z; `- ~" \2 N
- * edma_test.c. L8 Z' q: h( X% D- w, n* s# Z
- *
6 |2 X% h# d1 H f+ E. I5 I - * brief EDMA3 Test Application6 w" T) x* B- f3 X, p" ~
- *8 @* s! d2 ?. ~" \/ _
- * This file contains EDMA3 Test code.
" k; V' s* n0 @ ?4 T# Z1 | - *
; @$ P5 G' w0 F' f% Y1 ?1 X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" x; x0 Q( t: N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 E& l* j \- f" I) X
- * TO CHANGE.2 u0 A$ h9 @; O* ^
- *
- X" ]0 U2 `/ B$ g7 T9 t% i, B8 c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) W: b3 @ m- k s; P4 Z- H - *
) Y( U7 g8 W5 v9 V$ Z& ^" `) C - * This program is free software; you can redistribute it and/or
- E. R9 f/ B8 ? b+ `& Y - * modify it under the terms of the GNU General Public License as% a, R# A! U! N. G* S
- * published by the Free Software Foundation version 2.7 ^' f! ~5 K \( g }" G$ }8 a+ I
- *
# W5 n, e7 F$ k5 q# f8 ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ L I# V: w3 G$ s/ P
- * kind, whether express or implied; without even the implied warranty4 N T4 e! ~- s6 @# L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% ?3 W! M, g8 h) s) o# A) P4 ^9 |0 z
- * GNU General Public License for more details.+ W l$ N) R3 Z8 R
- */
; z% u/ ?& [" F; [6 r1 V5 N4 S6 S - O j# s+ e( f m9 s3 d4 G
- #include <linux/module.h>
' u5 V4 S, G) R1 I - #include <linux/init.h>5 P! ~! G& {) M5 |- K
- #include <linux/errno.h>) p9 t6 }9 u4 D. J
- #include <linux/types.h>
3 Q6 R v5 ^7 ?& ` - #include <linux/interrupt.h>. z* a* n: E( \! C/ X' ?9 y% x/ \
- #include <asm/io.h>
( T1 e; B" L0 C+ Z& }! Z - #include <linux/moduleparam.h>! R1 D0 {. q8 d
- #include <linux/sysctl.h>
0 {. H! r7 `, } - #include <linux/mm.h>; @3 N% F) F3 c5 Y5 l
- #include <linux/dma-mapping.h>& p! L- \ E# ~) T9 O4 p B0 p
7 v- D7 s/ t9 i- #include <mach/memory.h>/ S, J; I2 H7 B2 F& S; P
- #include <mach/hardware.h>1 L9 F1 N; W/ @7 {
- #include <mach/irqs.h>
6 G) `) b2 @3 r8 X0 i' A - #include <asm/hardware/edma.h>2 ^" F# V" u% F4 C0 S8 U1 e+ Q
- $ G) I, i7 A t
- #undef EDMA3_DEBUG
4 d6 O* |! h8 Z( t" c - /*#define EDMA3_DEBUG*/
) @$ U4 e1 {' V* y) Q; L# n
; P4 x" v |& Q7 h+ u0 d- #ifdef EDMA3_DEBUG1 i6 l( m' Q) q0 q2 W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 Q' T7 U# K/ z$ h+ q- u6 e! V+ G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 v* s- O) m7 `2 D2 t* }9 j4 u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- [* [% ?. ?& w- B5 O8 a
- #else) ?5 W6 d1 W# E5 L) e$ K9 }+ t
- #define DMA_PRINTK( x... )
7 ?/ g: Y+ z/ b1 y+ p - #define DMA_FN_IN3 C& d' T. P# e: i9 y, `8 |
- #define DMA_FN_OUT
: c8 D1 N& B1 e; t. F - #endif: q" ]* x- i V# ~3 `7 G& J F
* w% ?! M6 q" x+ X8 c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* f5 `4 R! p4 |: }7 I" _
- #define STATIC_SHIFT 32 @- D) p# j; t* j
- #define TCINTEN_SHIFT 20
2 d: o, |, Q7 } - #define ITCINTEN_SHIFT 21& F; w* K$ \8 ]* V7 c* z c
- #define TCCHEN_SHIFT 22
( M- f: f C# z" p. W4 B - #define ITCCHEN_SHIFT 23. S7 I) q% j5 c
& c7 H# s- j# L4 |% }) R+ g1 K q- static volatile int irqraised1 = 0;
! ~" R+ |3 [5 n3 F( X% V2 |& v - static volatile int irqraised2 = 0;; T! D9 I4 `1 o$ D, c) d( n
, X) P& L) `) t% p; k6 E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& g( l) d p+ f2 E2 H' h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ p1 Y# L! @, V+ H4 ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ E% G8 E7 t) z5 F- ?
4 n( P) r- X2 V3 s4 i" T- dma_addr_t dmaphyssrc1 = 0;$ L2 G: V+ [+ v
- dma_addr_t dmaphyssrc2 = 0;
0 n m T( ]6 R* x - dma_addr_t dmaphysdest1 = 0;% ?6 y. N: S, z0 n% P `
- dma_addr_t dmaphysdest2 = 0;
" A9 y5 z" P9 m$ V' ^- ~
& P0 [( H- j3 \- char *dmabufsrc1 = NULL;# X: H; M" @: T
- char *dmabufsrc2 = NULL;% o }# ^. k7 a* z7 h7 x# X, E
- char *dmabufdest1 = NULL;; n" [4 B* w& F% H
- char *dmabufdest2 = NULL;. v2 R3 I7 i/ c H( k R, p9 x
- & W' R1 B- b; j& t# E" ]; p5 ^* {% x
- static int acnt = 512;
! H5 ^# [- C- A6 A* D* }3 F' u - static int bcnt = 8;
- l' `' F9 A7 o6 \ - static int ccnt = 8;0 M- R5 n' U V. A9 w, H
+ g; o- _9 O+ X; S- module_param(acnt, int, S_IRUGO);
9 f- W1 |5 i, @0 P - module_param(bcnt, int, S_IRUGO);
. E& m/ o! {) C# B9 Y - module_param(ccnt, int, S_IRUGO);
复制代码 # ?& O% l$ U+ m, L) Z" v6 I6 ?# A
. r8 V- `+ L2 u6 B5 T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* v, x6 _6 C: Z4 R( larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 h3 r% p+ i2 ]: R. z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ u) N3 w2 m @" s! T3 s: T0 t$ g r/ [: @$ |
8 ?* v, P2 o: @( n8 K. U6 Y4 m
|
|