|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! Q. N/ ~, T, z+ x- [code]EDMA sample test application- S# C9 I4 d3 z) S
- /*
- C& @* _2 N, N1 b: M - * edma_test.c
' K, a2 ?( V u4 L! J* { - *
' x& Y1 S/ y d% i2 I - * brief EDMA3 Test Application
F1 ^" m+ } @0 _: k j - *, n7 L' N4 k0 _( \( J/ o: l. N6 s7 p
- * This file contains EDMA3 Test code.
% {" r# v0 T! a, u/ K% }6 x - *
1 W7 M* R/ v- e8 l4 F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 g/ p% W* L* i5 E, E4 f% Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ h5 h0 I: V. o& B2 t
- * TO CHANGE. b! x9 H9 k4 P+ h
- *
# x% G' q: f w* y* J' v+ ~ | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! @% w/ [" B2 ~
- *6 O9 G% j7 U: ?" I5 ]
- * This program is free software; you can redistribute it and/or
5 ^1 ^/ ~- f3 x/ I1 R8 P. I) I& p - * modify it under the terms of the GNU General Public License as/ ~" d' l% h' T+ X$ g) {
- * published by the Free Software Foundation version 2.$ O6 Q: U$ X' H/ ^9 U4 A7 X' N
- *% {6 `8 M+ `. B9 |2 {2 [3 u: P1 ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 a/ O7 u# u; [/ e+ p: x
- * kind, whether express or implied; without even the implied warranty( K/ ~- L0 n6 V0 @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 g+ k( A7 t7 e) _/ Y; @ - * GNU General Public License for more details.
' z/ F3 w) S! I$ m4 Y. U2 X - */
% N5 O% ~3 E. G, { - 7 L7 F* R- S# D5 M
- #include <linux/module.h>, @$ h( d8 o2 x5 Q5 e; s
- #include <linux/init.h>- R& b! d! ? y' s
- #include <linux/errno.h>. F I$ T+ v, K1 D$ }
- #include <linux/types.h>
$ p; W8 ?2 o [7 k U/ Q5 _) I - #include <linux/interrupt.h>7 D# I) v. a _ y/ `; f# f" o9 k- |
- #include <asm/io.h>; }0 C1 s. {2 Y( d$ |) q% `
- #include <linux/moduleparam.h>
1 s, U8 v& [! ~3 S6 z5 u - #include <linux/sysctl.h>
% z: n" i; q7 a& ^ - #include <linux/mm.h>
% C# @! w4 f& }# k8 ^) ^1 m - #include <linux/dma-mapping.h>
* j$ V8 l! Q' l" F - 1 Z1 \* Z/ D# y4 O, k
- #include <mach/memory.h>. W$ F! s$ q' s0 U
- #include <mach/hardware.h>+ X2 N: @# _% N, G X
- #include <mach/irqs.h>6 k1 R" p* S) Q! S+ Z* c. e; q
- #include <asm/hardware/edma.h>
2 F. u3 y7 V; _- ^+ ^: b6 I - 6 b% q& o9 Z, M4 n8 K, h w7 d# q
- #undef EDMA3_DEBUG
" k+ @) T" M; w3 a - /*#define EDMA3_DEBUG*/
& J$ `. W7 z5 y ~
& ^6 q9 s6 Y2 Z$ V6 b- S/ L/ ^" S- #ifdef EDMA3_DEBUG# V) a; O3 e: J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 k2 i) u' V5 n) n9 u. ]9 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 B9 B" s3 }( k) G6 J% U* V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) G2 W" c$ c* {, `
- #else1 J( }* ~% X g0 E. I
- #define DMA_PRINTK( x... )
5 ^3 X8 x, B0 L- P& H - #define DMA_FN_IN
8 d6 [8 H5 Z. \7 y# r5 w - #define DMA_FN_OUT
~6 V% F6 r- S$ W/ O( Z4 } - #endif/ e% \' [' {( d8 k
- ' z5 ~6 X4 [9 O% e) C& M6 I+ a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ p6 H0 e, y* O3 L* p! g. g - #define STATIC_SHIFT 3
2 w5 z5 g& N/ z5 k - #define TCINTEN_SHIFT 20# d1 w( y+ a- s) u- \0 @ M
- #define ITCINTEN_SHIFT 21
. v9 S& y" t' W - #define TCCHEN_SHIFT 22
( ~3 y9 }' O+ g. [7 N9 K/ T - #define ITCCHEN_SHIFT 23- T: x& ?( U7 `+ }$ m; h# q4 r5 P
; ]( Y* ]! \3 O6 d& K8 v$ ?- static volatile int irqraised1 = 0;$ E- a) [% e' H( y: y
- static volatile int irqraised2 = 0;* J) o9 \4 R) S" x+ x" [
4 a; s$ I- R4 {4 E. j2 H; |1 p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* w9 u2 ~& S. ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, }# M# L+ q' ]$ a) W; [8 X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ g+ V H/ g# P W" D9 h - 3 r' X0 Y5 \2 ~: |
- dma_addr_t dmaphyssrc1 = 0;$ x) q( _" ]+ o' J# S- w
- dma_addr_t dmaphyssrc2 = 0;& z' m4 X% N6 X2 A7 I
- dma_addr_t dmaphysdest1 = 0;
3 F9 E" x3 [' `/ }& V. q - dma_addr_t dmaphysdest2 = 0;) K+ `* C* T; ~. W# i r2 k3 r( e
- * h4 P4 S$ N8 | J. u
- char *dmabufsrc1 = NULL;
X' q, ~3 R. v; n! r4 C - char *dmabufsrc2 = NULL;# u8 d3 B8 q( W( r' J2 M- a
- char *dmabufdest1 = NULL;: Q1 V+ S: M2 b: k$ t+ E; @ m, ~ l
- char *dmabufdest2 = NULL;3 u6 m% O1 U& q, V
3 u% ^5 K" e: E ~/ E/ ^4 h- static int acnt = 512;; h) w; A2 T! u( A ~
- static int bcnt = 8;
. L/ W* L; W1 l y9 t9 `9 E1 b - static int ccnt = 8;
1 U% n( i0 q0 t* l0 l, a
# l. c2 k+ ^5 }7 A- module_param(acnt, int, S_IRUGO);
# P g8 {/ @# u( p1 N. ]8 W - module_param(bcnt, int, S_IRUGO);4 j9 t' y y6 x' [# j2 r
- module_param(ccnt, int, S_IRUGO);
复制代码
. u, Y: e5 Q( X* J! c+ r* z/ ?+ F
1 s8 i- j" F2 R, X# c5 s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( ~7 _0 L$ ?4 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 C7 N5 V4 Y& z0 o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 @; t5 m0 f& m8 \* Z
, o, o( C; i$ w% n% d4 P0 u9 y! V" M. S9 Z1 \7 x
|
|