|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' _2 C: T& R, k/ P1 |/ }: K# i- [code]EDMA sample test application5 m" _1 H: U8 v5 f! Z
- /*
" O" {' \: w, Q0 U* O' u0 z0 O1 j9 b9 A - * edma_test.c+ l+ I/ `- G5 C) X
- *
' n& m, e9 I t5 ? f8 }% a - * brief EDMA3 Test Application
& T q3 P4 r8 P ?+ G - *
# F% o+ e# R" d; g C - * This file contains EDMA3 Test code.
: X* C: ^9 P4 @9 J% Z% {! k; t - *
3 \! i3 U- F4 Z! _& a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. z- I1 j4 v/ w. \$ }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% D5 e0 `- L8 {( o6 o
- * TO CHANGE.
( g* b( v% Z2 Q0 } - *+ a+ v+ \6 M5 g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. b0 w. m2 M) q" g
- *1 n$ p3 t* Z/ k) d/ T
- * This program is free software; you can redistribute it and/or
& H, {% I. X- d" L3 ~$ G: f- v' y2 C" A3 [ - * modify it under the terms of the GNU General Public License as
/ X5 T/ W' o$ d: G: g - * published by the Free Software Foundation version 2.- \1 c( P7 h$ m# M9 r) ~+ v$ d
- *3 K) S6 K) |- _+ ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, ?) P( [: c) Q$ W/ A - * kind, whether express or implied; without even the implied warranty) u5 T4 M' G, I0 s: v# `" i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ v1 J' |$ E4 i' Y& n
- * GNU General Public License for more details.
' I; {4 G5 n$ {" n - */
$ R9 R q: U# H2 f; H! S
, b$ C* M5 L! l1 R _& `- #include <linux/module.h>
5 {% r" w: a. o* T" D - #include <linux/init.h>5 z) O: u5 L; I
- #include <linux/errno.h>7 Q, r: s& e5 C" U9 |0 t; j
- #include <linux/types.h>
6 m# L P0 X! n6 e, }2 P# w - #include <linux/interrupt.h>
+ [$ ]& n0 ~4 w9 c$ b - #include <asm/io.h>
( a. T4 _) a* J- [" {; [; A. Z9 { - #include <linux/moduleparam.h>3 H% m+ [/ ~' |+ E7 N; z. d
- #include <linux/sysctl.h>
2 w5 I3 D. c% G; K - #include <linux/mm.h>& I9 k0 T) j: D. J% t L a
- #include <linux/dma-mapping.h>' Q2 L6 I! T+ H* j" j q, L: ?* d( u
7 b5 I s/ d9 t5 g- #include <mach/memory.h>
) `8 J' i/ I; F& s' c" F - #include <mach/hardware.h>4 E" D, Y, t$ q5 R, ?5 i. o W* d
- #include <mach/irqs.h>* K- i8 v; a! }
- #include <asm/hardware/edma.h>
% r5 h4 ]5 B+ C$ w% }9 H5 \# h - }' Y3 J5 H7 @6 J: {
- #undef EDMA3_DEBUG3 o) k6 K2 |% e7 u5 d
- /*#define EDMA3_DEBUG*/
) b- p8 r- d, h8 W. r0 w! { M P - : H( ^5 P& D4 J+ y$ F& k2 ~% u
- #ifdef EDMA3_DEBUG
, x1 Z6 l5 B b( \9 b' C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& k( F Q9 B G: B, K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! n' R$ D$ {5 d1 \7 V& C% [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 a8 C( T4 x1 K/ D- O/ b) p* r - #else
" f. s) m) M l: z" f$ M) \9 k3 J. n; k - #define DMA_PRINTK( x... )# g: c1 d; T2 r5 r: y4 T$ L
- #define DMA_FN_IN
! B: d' Z( v; A) P% o - #define DMA_FN_OUT0 p9 `8 S- b& H
- #endif( \6 a$ f2 e2 t$ }
7 c0 f+ h6 h* z" ]" F: g" x- #define MAX_DMA_TRANSFER_IN_BYTES (32768). ~$ ^, A: ^; I- q# C% L5 u2 V! {
- #define STATIC_SHIFT 3
4 K+ i d# m; A: n- v( _" Z& r6 h - #define TCINTEN_SHIFT 200 I) s. m, \* s. S6 j4 h" V& D
- #define ITCINTEN_SHIFT 21+ I% Z! L" h- S- x) i6 g0 }
- #define TCCHEN_SHIFT 22+ {, K1 a: u z9 e) U% D0 l6 r! |
- #define ITCCHEN_SHIFT 23) l9 v" Z* Y. C8 x! S* V/ y) ?
/ |# B. r, e! G2 t- }- static volatile int irqraised1 = 0;
% s& L. X7 [8 p! q - static volatile int irqraised2 = 0; L, c! ]/ m6 ?
- ( O* R% n# L: Z0 Y O% z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* b7 t# S; X2 `" {4 z3 m7 q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 t) P. R3 u0 j9 F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 j+ x- C ]5 l' ^$ J$ S
- % U# a( C4 V5 ~
- dma_addr_t dmaphyssrc1 = 0;: F& t: n2 T. t
- dma_addr_t dmaphyssrc2 = 0;( Q x M! c# h, H7 ^. ]) z
- dma_addr_t dmaphysdest1 = 0;# X' d! |: n, @4 Y5 y/ u
- dma_addr_t dmaphysdest2 = 0;
5 M8 U6 _! B) B4 B2 t2 Y - , n" c. {2 F* Y4 z8 a% ~+ }" [
- char *dmabufsrc1 = NULL;7 p X p! z* }$ Q) X0 l x
- char *dmabufsrc2 = NULL;
2 q1 G( X v c& |" s - char *dmabufdest1 = NULL;
' H$ k6 b2 D }) z# z8 v - char *dmabufdest2 = NULL;
- d% L$ b7 o9 o! y - 4 k) |) s9 G3 J- `( T) s
- static int acnt = 512;
8 e. u2 }# V7 S) H - static int bcnt = 8;
; l, W" g" `6 l& R4 @# B - static int ccnt = 8;
G2 X2 ^8 F$ Q1 I: C - ; M' k. p a* F* c, o u+ r; t
- module_param(acnt, int, S_IRUGO);
3 x: o5 \7 l( ~: }: E - module_param(bcnt, int, S_IRUGO);
i c, ~* m: T0 f1 T - module_param(ccnt, int, S_IRUGO);
复制代码
4 G' L' {, a* i8 G5 {2 t# G7 e
6 f# D4 g0 k5 N, V( s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. O" x" i/ |' x& Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 y$ M1 Z, H: [% s3 i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 K% L6 `. z8 m- K
2 b4 A; w0 |: }9 }
% L5 o8 M) @$ Y# ], Q! M7 w |
|