|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 a1 V. [( b9 e" u; [' `, |7 S- [code]EDMA sample test application3 H4 e K; q# @$ D5 G
- /*
4 P3 ~# P9 m+ _% B% l. h - * edma_test.c
( R9 @/ P, Q8 y0 l4 X - *- ?2 b6 T, `. y$ Q {0 N
- * brief EDMA3 Test Application' }' A2 L3 m1 P
- *
5 j: `) N4 G1 m. g7 `( ^8 } - * This file contains EDMA3 Test code.
+ r0 J# [2 C9 d1 a1 v+ R: ^ - *. }! o3 Y& U# \! p) F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& ^) p# C o; q" B# F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; O8 K8 q( h7 b6 \ - * TO CHANGE.0 ~; x) {& s$ ~7 \
- *7 K1 ?: z% W) D$ z+ ^0 I& r; |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( S* O3 t6 `0 ?6 \! ] - *, e, S+ c' v! |: M5 y
- * This program is free software; you can redistribute it and/or
3 W8 |$ d r9 ] - * modify it under the terms of the GNU General Public License as7 ?: S5 x9 w5 D; F8 x( Z
- * published by the Free Software Foundation version 2., J2 V9 w& |' a* a7 l8 L
- *; H% }1 D0 `6 r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: F( ^2 b7 W: Y) f
- * kind, whether express or implied; without even the implied warranty
0 u1 W8 h4 l, g1 r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ N$ {4 M, \5 A; O- N: v
- * GNU General Public License for more details.
: e7 E( F3 o3 U- d5 @* I - */
a7 X5 u4 H# H+ F3 }
7 o* l: Y4 }8 V+ O- #include <linux/module.h>
, D1 z9 M; P$ O4 k( x0 K1 L - #include <linux/init.h>3 b: a8 U7 _ F! M
- #include <linux/errno.h>! `+ P' q- H0 Z1 S' o0 x6 h" V
- #include <linux/types.h>& B) O6 e) k& M9 o6 R. o
- #include <linux/interrupt.h>
7 C5 j7 i9 J. V8 M! t - #include <asm/io.h>5 G7 V5 B ^9 ?" ~+ |- M
- #include <linux/moduleparam.h>; O) z/ ~& i. j0 f
- #include <linux/sysctl.h>
6 z6 P; T7 J/ [! _' W* z - #include <linux/mm.h>
/ @2 f! M: f/ I0 z1 O/ E - #include <linux/dma-mapping.h>
( q6 U \4 I% d - 3 C( x/ L/ N5 A8 E: e
- #include <mach/memory.h>
8 D" J; z- Y0 o4 |" Y* l - #include <mach/hardware.h>% v/ h: }+ f! Y- o# Q# F
- #include <mach/irqs.h>8 j6 K F9 T$ |7 m2 b+ O) C1 {" c* [
- #include <asm/hardware/edma.h>
% b$ r6 X; w& |- H* |1 ?; u
$ s7 d- z+ Z7 A' m2 D2 ~- #undef EDMA3_DEBUG; F; J8 h7 ]6 d! j, ~+ T/ p
- /*#define EDMA3_DEBUG*/
2 ]' Y J. |+ n! w1 n* P' O9 v5 H6 r - & {7 J$ p4 g( T) J6 P5 I
- #ifdef EDMA3_DEBUG$ b+ S3 m' g5 |( H+ k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 h8 F4 ]" p# W. H6 Q9 Z; P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 r o$ f( W9 k, w' D& n5 x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) J$ m# B/ p: x7 x7 [# t2 C
- #else0 J% T" P' H2 J3 P- g
- #define DMA_PRINTK( x... )
X( G( Q$ z) W; L. s: I% _/ E% y - #define DMA_FN_IN
; _' X: g' p+ _2 T& r1 } - #define DMA_FN_OUT* |2 a, n5 X/ _; ^* ^
- #endif9 ]: [+ x+ W, p! m
/ E# y. O6 v4 `) O& p m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 f( @9 V, N0 B( t8 ~ - #define STATIC_SHIFT 3% s0 {+ u c3 O/ g
- #define TCINTEN_SHIFT 20
! T; J4 {8 ?5 }, r - #define ITCINTEN_SHIFT 21
) B' k- [+ A: d& I" B. ?# B9 { - #define TCCHEN_SHIFT 22
* g: _& W; y* r, r* I$ l' y - #define ITCCHEN_SHIFT 23
3 ^+ p D. F g* H
0 O: R7 y+ [7 \: v$ P, \- static volatile int irqraised1 = 0;5 D8 D- n; @& z: Q" `" G$ R
- static volatile int irqraised2 = 0;
: ^% W$ j0 U0 K4 W( ]; \& J/ E7 \& B
" M& f4 h0 W+ \6 x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 r- O3 E; K8 [! B7 E( C7 u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 }, n. J4 r2 K4 C9 }8 H0 G! }% T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* I8 u% e, _5 g
% ~" h( \0 h* b% G- dma_addr_t dmaphyssrc1 = 0;8 t- {6 P8 K0 w w. m6 _
- dma_addr_t dmaphyssrc2 = 0;
}7 d6 H4 k5 i# i - dma_addr_t dmaphysdest1 = 0;
- s% `3 o" H( e! q$ Q - dma_addr_t dmaphysdest2 = 0;& G) ~6 J/ e3 R( P* V; z" e
- - h" a/ ]% }' X$ a1 r
- char *dmabufsrc1 = NULL;
8 B; t ~/ U# Q4 n" R: } - char *dmabufsrc2 = NULL;0 s& E6 }2 \+ Q% H$ a* K/ n0 V
- char *dmabufdest1 = NULL;
" q. c$ q. ^4 L- C - char *dmabufdest2 = NULL;
/ w8 y! _; h+ ? L
/ t8 g" X/ h# |) _, L, ^: J* o- static int acnt = 512;
$ ^& Q/ R" ?$ Q$ ? - static int bcnt = 8;% V% ]. I% ~. ]
- static int ccnt = 8;
* {& `: Q# Y8 K0 H, ]1 C5 m
, K+ z3 t! r6 |1 V$ F! G! K0 _1 ^- module_param(acnt, int, S_IRUGO);* J6 g8 J- p9 v! g9 X% D# B& M3 D
- module_param(bcnt, int, S_IRUGO);
. Q: u# I2 q- e9 D6 i u - module_param(ccnt, int, S_IRUGO);
复制代码
; P* A" w" x6 W& B$ G2 N* Y0 n6 @0 m3 X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( |- k6 \0 { |- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- k- o; L' N3 J; k8 I+ Y1 g, J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% N$ ?) {" o$ K
: \$ ]4 p8 Q* l s
4 ?7 V; X, a7 S U$ e: d7 X |
|