|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * K) J6 c5 ?5 |7 A7 j4 r9 R1 f
- [code]EDMA sample test application
8 Q9 G+ Q [0 X4 b - /*
( B/ T# h1 ?% t+ n& z - * edma_test.c
% C5 `2 ]0 W1 E% j5 M% q0 U* W - *; Y* k! x! E/ P$ h: G
- * brief EDMA3 Test Application, d R7 D4 q; X! O9 o i
- *) A9 z; X' L: V
- * This file contains EDMA3 Test code.
& b8 b: T' O$ X% B( u - *
( _) ?, p( ?4 H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. j3 m4 x: c4 M3 z6 U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 ?, t/ g( V1 J
- * TO CHANGE.8 O% H+ X* v) d
- *6 R+ V" R1 v+ n. T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) t( |) X; f/ y# E/ I
- ** Y. {# y" ~0 ]& f6 {' b
- * This program is free software; you can redistribute it and/or+ G; o3 S1 g# {5 V# d N; k
- * modify it under the terms of the GNU General Public License as) O- _% L" o" F P( o: p
- * published by the Free Software Foundation version 2.9 V- o& H- R" k b8 j: [
- *
6 f1 D( y, {) a6 l. b, f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* W, \% H2 n% X4 E$ n5 T6 Q - * kind, whether express or implied; without even the implied warranty
" D* Y0 J* R$ D) V# L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* u' n. S" T3 }3 p" k: _' W - * GNU General Public License for more details.
3 K$ R' B+ j [# K5 E" u: ?4 h - */2 [+ f/ Q- \- h- Q) S) a
$ Z2 {1 Q) X" P9 h- #include <linux/module.h>. p7 Z' u. X# C2 R0 \) T
- #include <linux/init.h>
: _! h$ f" d8 B$ |! A - #include <linux/errno.h>- n( z! T. e4 S8 M- }& Y: w
- #include <linux/types.h>
8 B m& P) f% i) _# G7 @ A( A2 Z0 c - #include <linux/interrupt.h>
# p4 `! d( p" i3 t: C0 p - #include <asm/io.h>
) u% k$ l/ n \; C. g - #include <linux/moduleparam.h>0 G5 b" Q9 e J2 N! k3 g
- #include <linux/sysctl.h>
+ p& ?+ W7 r, x M+ I' ^0 s - #include <linux/mm.h>9 i6 T: Z- J; z) M; R
- #include <linux/dma-mapping.h>+ y& h6 _; u7 X0 Z1 K/ c" F
: _8 W! I2 c8 c9 Y0 p- #include <mach/memory.h>
4 s8 j6 @: ?; o& u w! l7 P - #include <mach/hardware.h>
" {5 `2 W; r0 T7 H) E; N - #include <mach/irqs.h>
: t. E/ a/ ~$ [0 L! Y - #include <asm/hardware/edma.h>
, W8 Y% E9 [( u3 B6 B8 b) {
2 p3 I, Y% [+ ~+ f+ z- y! s2 d( m- #undef EDMA3_DEBUG
' S+ Y9 k! ~, G1 S8 u6 _ - /*#define EDMA3_DEBUG*/
, a2 L: o) d$ h8 T4 S' e( } [
6 M9 ^6 `: Q% i9 @+ a$ }3 t) G. I/ z- #ifdef EDMA3_DEBUG
: X$ Q. y; o. \6 s3 z1 _7 A) E% u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ {; F& S, a) A# f* X$ L' I: s5 c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# d/ a4 I' e `( P2 j- i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& [( o! ^) x4 k; Y
- #else5 U: h( a/ d( {; d& g
- #define DMA_PRINTK( x... ): A6 Q7 h5 q9 m4 Z, a8 R
- #define DMA_FN_IN: N& d* Q( u7 J6 t6 a& ^
- #define DMA_FN_OUT( I8 c# T6 V2 S2 l
- #endif
! R3 c* e2 J: e; w, G& f% K
, B- X! N$ R) O2 {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& l% p+ D# H5 j8 K0 h; b1 f9 z/ ^! _ - #define STATIC_SHIFT 3
/ z @' \; f, [' Q - #define TCINTEN_SHIFT 20: A% V/ R/ D) \
- #define ITCINTEN_SHIFT 21' d: A8 U" K9 H( `* L
- #define TCCHEN_SHIFT 22; W% h3 q @4 K6 t) ?/ j/ b$ v; v
- #define ITCCHEN_SHIFT 23
* ?# y- o; a( i1 t3 x* h - " m0 J' ~3 n" S# f$ F; W% w
- static volatile int irqraised1 = 0;) ~$ \3 W; c+ Y( ]( T% T0 x
- static volatile int irqraised2 = 0;; T. D+ ~% \' K8 p& F
' J- z3 ]5 k1 a# M. V* r X: y$ P. ?5 w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 o' P3 T. e! _ F# _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( p3 h) k! l, C z( F, X) x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 F/ D/ ~9 ~2 p
( P {9 V$ k& Y* \4 D- e6 [; w: D- dma_addr_t dmaphyssrc1 = 0;6 h! f2 e: I2 r
- dma_addr_t dmaphyssrc2 = 0;
5 o5 H0 v3 q# Z4 W* r0 Z7 r5 z - dma_addr_t dmaphysdest1 = 0;
+ i9 S) ~1 f8 ^1 z0 z& ] - dma_addr_t dmaphysdest2 = 0;
1 c8 s# l3 y& P" V5 |( {! g - % Z5 N* ^$ U% R i2 X" ]/ e- e
- char *dmabufsrc1 = NULL;9 `9 S2 T8 H# v: Z$ W, V; F% D9 T
- char *dmabufsrc2 = NULL;
7 r" o# m, Q5 K; n* C2 z - char *dmabufdest1 = NULL;4 g9 L% X7 }) k- ~; y1 ^
- char *dmabufdest2 = NULL;- j% }% G/ Q6 t9 n& `9 Y
- 7 ^7 i, Z1 S3 Q4 E" F0 v t
- static int acnt = 512;
( b* y: }4 _% ^1 d - static int bcnt = 8;" y* }0 a" p( |# Q4 H; O6 F6 Y$ d
- static int ccnt = 8;
h2 f) F) O, T/ q2 E- K4 m( { - 1 j7 S: \5 h" k" x
- module_param(acnt, int, S_IRUGO);# X3 s' H: V* Y4 k* r( u9 N* A+ m
- module_param(bcnt, int, S_IRUGO);
# z) d4 i/ k% I6 _& ` - module_param(ccnt, int, S_IRUGO);
复制代码
5 x. h, k: |4 f& X* Q* [( a. c7 F5 S: I/ U+ f6 p3 b$ g: p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ U3 p- x$ Z4 u% W% W F; u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 l, ~2 M8 e, k' Y. {1 |% N( e+ l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 e4 `! a' ~9 D$ O, j1 b- ^6 J' W# v3 A( i6 Q$ [
) P1 ]5 J e6 W5 l I0 @- M
|
|