|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' ~1 w2 G W' Y2 K& A g! Z) O- [code]EDMA sample test application) q9 \) V% C9 p4 J& m$ s6 F! M
- /*
" y+ w5 a+ a* P4 m - * edma_test.c1 k" a# j' ]9 x. ^* {2 [
- *
( t3 P: W1 x- l. P& e - * brief EDMA3 Test Application
6 c v! K! x# L - ** H) E: q# Y( g6 _/ A% w
- * This file contains EDMA3 Test code.. Q& v8 Y6 x8 {# T
- *
/ L3 g0 D. C4 R* p5 s7 E, o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- s7 K3 C6 n: U4 A* Y X, | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% S% z2 N, G1 T0 G0 F - * TO CHANGE.
& C l; q( X! M# s& h' R0 \ - *. s9 ]. {9 G) L: t- {7 F- ^8 Z9 I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 R. |# f* W: B% F& e - *
5 h3 [7 Q- `! J1 n, W - * This program is free software; you can redistribute it and/or
" e& P, h' @" I; I6 [& o - * modify it under the terms of the GNU General Public License as ?9 [1 j: Q4 x" G! R
- * published by the Free Software Foundation version 2.
8 e: o/ U3 V# d - *3 C4 i# \& r3 t8 g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 a8 u9 b& k# ^0 z5 \ - * kind, whether express or implied; without even the implied warranty* F( ~! f( W- S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& t' [9 d( C! P2 W/ T; o, g/ k - * GNU General Public License for more details.9 T5 w9 M- x. j
- */
3 ^- A$ P1 Z, X0 C" c& N - / Q$ @6 B0 c! j$ H: L) h+ ^* w
- #include <linux/module.h>
: x' p5 s" U) E- R p N& ` - #include <linux/init.h>
5 B) a7 i7 v% ~. G3 Q - #include <linux/errno.h>
/ o: D5 c1 ]$ L4 P - #include <linux/types.h>$ \% B6 t2 s; F8 Q. P
- #include <linux/interrupt.h>: o- d% f" d2 M5 ~) O+ i, t/ [8 b
- #include <asm/io.h>0 {7 \0 Y' F0 x( n! ^2 j1 s
- #include <linux/moduleparam.h>
' F5 `6 n0 t$ @6 X - #include <linux/sysctl.h>6 [: b u) W" R( u
- #include <linux/mm.h>, M% C ?: `$ D5 H4 Q8 v- G1 n6 J" F
- #include <linux/dma-mapping.h>
# y) O8 l& b/ {) E1 N( p" _* c
2 `2 ^9 P2 U) W- #include <mach/memory.h>) k* ~7 d7 c% a
- #include <mach/hardware.h>4 c- l: V" a$ d g& h( y* s9 `
- #include <mach/irqs.h>
" k$ q$ h/ z6 v& G: S" j, U* ? - #include <asm/hardware/edma.h>$ o1 F W+ e& K- n! w d5 V
% y# M h6 A* m# ]: G7 [- #undef EDMA3_DEBUG
6 o' \- F! v1 R- C - /*#define EDMA3_DEBUG*/8 m- y- N4 A# f/ m% v+ b
- - B- A/ c4 h+ H
- #ifdef EDMA3_DEBUG
! I' b/ m" k. ~; `/ R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 Z7 U( B" X; o5 w, k1 w' t& _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). R( F# z+ x) S7 T7 p+ @" t8 u5 [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ |% |* E* H4 E7 n J) v; l - #else
0 ~0 h; m% _. f; M! o - #define DMA_PRINTK( x... )) M3 D0 ^! K" N+ c, J8 C$ z
- #define DMA_FN_IN
# D& |* W* M2 N - #define DMA_FN_OUT4 Y, r" H' Q$ m) a0 v4 T
- #endif
4 A9 }/ V) Y8 G# u" `. ~ - 1 q N0 ?" S3 k" D. C) ~ ?* {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) h, e$ V6 u0 W z$ Y& n& S
- #define STATIC_SHIFT 3
4 ^" `% y. i9 t* Y9 e - #define TCINTEN_SHIFT 20! B+ H5 Q0 x/ O& W
- #define ITCINTEN_SHIFT 21
) _. B+ K$ M- k' | - #define TCCHEN_SHIFT 22# j1 ?3 w6 O7 G, m
- #define ITCCHEN_SHIFT 23' M4 d5 F" f/ g2 C* X
3 a- e9 @& k( v! g. ~$ u- static volatile int irqraised1 = 0;
1 O! ]) b! l6 V L2 }, h% a - static volatile int irqraised2 = 0;
* L1 h# w+ V4 l* i - $ h6 F% U9 s3 w D6 f% J0 {7 T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" F8 y: `: I. o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 M5 E+ L& a7 q1 t. ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 T* `) E7 w5 r: t3 p8 r; T - ) r1 i7 Y) W# d d Q% g, u
- dma_addr_t dmaphyssrc1 = 0;
) |; v2 o. [* l* w0 i8 { - dma_addr_t dmaphyssrc2 = 0;+ y; O( t8 k/ C- P2 Y5 e
- dma_addr_t dmaphysdest1 = 0;
* Q9 V& S6 f3 G* c$ ~- A - dma_addr_t dmaphysdest2 = 0;
/ C9 ?' o8 n' c' G. W, O
/ [3 L. `# ]. b) ?2 r- char *dmabufsrc1 = NULL;- P5 R1 c/ S9 O8 q8 i1 P- F
- char *dmabufsrc2 = NULL;
, u" O1 U* {: D - char *dmabufdest1 = NULL;5 ~; s! W( x2 h, m
- char *dmabufdest2 = NULL;
+ A, M/ G H/ E0 x
+ x' Z0 G" j3 O& p! ^7 h% A; M- static int acnt = 512;7 R6 D5 x5 c- W
- static int bcnt = 8;
" P% r0 ^6 \: M9 A% S$ W6 R8 P - static int ccnt = 8;
+ R* R' l) H* S, F4 A5 D
+ m) R* T6 n& D' m# x3 U* e8 a) C- module_param(acnt, int, S_IRUGO);
E$ {3 y1 E: T. [1 f* n - module_param(bcnt, int, S_IRUGO);
# Z: E$ C8 |& L( m$ @ - module_param(ccnt, int, S_IRUGO);
复制代码
. x6 z! k; n5 V
; F: A2 J3 n. j& m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; |( { B1 i. Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" i7 b( T- V! ~" D* o9 h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 s0 k& g- ?2 j, i& y' k7 F" B+ X- Y
1 ~- ^# c7 W! u7 u) }2 P
|
|