|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 n: a* ^& a @5 X- C+ w
- [code]EDMA sample test application
; s5 ~$ q( Q4 Y - /*
- p _0 }, t8 S5 {2 H- N) L; | - * edma_test.c8 p+ G3 }- {4 N
- *- p; M5 d. q0 ?; {" `4 P& P5 z
- * brief EDMA3 Test Application9 L; V3 _' H/ e8 H0 F/ b# t; M Y% y
- *; J/ I$ k6 R4 R7 j
- * This file contains EDMA3 Test code.
0 @4 c+ i! u% M1 P3 ]1 d - *% E' B4 B$ [0 V- T$ I7 q0 A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# x# \: p* c, f% P. p, T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ s1 E, i L P - * TO CHANGE.6 g0 H( |; n I! i8 U
- *
) {1 g, V6 p3 H. N& ` - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 t c$ B0 M( Q& Q" N4 Q% W& Y - *
& B( p+ ?6 h9 N# R% {+ N8 O - * This program is free software; you can redistribute it and/or+ q" h% w/ A" I& ?8 N+ z
- * modify it under the terms of the GNU General Public License as
5 g; u6 p- |3 S - * published by the Free Software Foundation version 2.
# U' y* a: W+ X' I' [4 D - *& O3 z4 i1 F* W e5 _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 N4 J ~2 t% S; q, t - * kind, whether express or implied; without even the implied warranty( d3 U9 _3 g2 L) [) I k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 H4 Z+ t% F6 N4 [+ R* n. g - * GNU General Public License for more details.8 Z# h) e( E1 V B: Y& _7 r
- */
4 t) G* H9 p) e* t, ]& u2 L - ; f3 U* q; M$ A$ ]+ I) r' }
- #include <linux/module.h>8 i) @5 m5 A. N; X& Z
- #include <linux/init.h>
; o4 O. T7 m( I - #include <linux/errno.h>( Z* }- i0 K: {' b
- #include <linux/types.h>4 v/ ~! y$ L; @2 s4 l
- #include <linux/interrupt.h>" t( w0 J1 Q$ T9 R
- #include <asm/io.h> Q( Z4 r6 q- g' I# E4 `
- #include <linux/moduleparam.h>
, K- u" ^9 Z+ U$ a: r& h: W - #include <linux/sysctl.h>2 a( M3 A8 [! M0 q+ ~7 W. j
- #include <linux/mm.h>2 O7 i& E3 Z$ d. A
- #include <linux/dma-mapping.h>
' k3 Q$ E9 ^$ N
! H5 y7 S) K" s8 w# H) ^- #include <mach/memory.h>
" y9 `+ p3 n% F. [8 D - #include <mach/hardware.h>3 h9 @1 d" H5 w ^ s# c! A
- #include <mach/irqs.h>
! H2 A0 J4 l0 V; S - #include <asm/hardware/edma.h>
3 S: Z6 N4 n8 }! y9 m% R
! B& W+ `2 ? b' j- #undef EDMA3_DEBUG
& U }, k7 \0 P) ^: n6 q- v" ` - /*#define EDMA3_DEBUG*/
I% t! f# v- Z+ O9 J; G$ A6 C- x5 c - % Y" b! I8 F5 a
- #ifdef EDMA3_DEBUG, h# f @; _) {1 n% X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! b1 D# M5 }# x4 n4 Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! g1 J! A; `, ]8 O+ M: \% W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 g s A. c1 Z) y% c6 I
- #else
" F. d0 m% q: [4 K8 L; G/ q# d8 d - #define DMA_PRINTK( x... )
! p6 o( M- S4 J - #define DMA_FN_IN) z& u: y, ~# H1 b- {, ?
- #define DMA_FN_OUT$ i/ P& N4 `8 o7 l1 O
- #endif0 s P( J" Q, g
- . t/ P5 O0 p. R9 K; n; c- K; Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 z' o) N6 T6 ~3 X - #define STATIC_SHIFT 35 X2 q2 m6 P' b) g
- #define TCINTEN_SHIFT 20, s5 \' z! v0 T; Q
- #define ITCINTEN_SHIFT 21' H! B, s) I* ~2 V3 f4 {8 M
- #define TCCHEN_SHIFT 223 U* Q* J* k2 c! \& B
- #define ITCCHEN_SHIFT 23
) c% q' [2 D/ K5 q
, e0 j, m* M0 e- static volatile int irqraised1 = 0;. q! X, W/ t S: E" l$ W
- static volatile int irqraised2 = 0;9 x9 |1 u9 G# S* @
8 v1 p' G, B$ [; F% A& e9 d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! H6 c# C: k5 t3 |' Q- F$ S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" H) o) @4 ~( J5 v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Q# D; [7 C& N# f: }) o
3 |% N7 A w& G0 ]- dma_addr_t dmaphyssrc1 = 0;
5 d5 X* W- a4 A3 K" Y - dma_addr_t dmaphyssrc2 = 0;6 d1 J0 u" |0 q% }8 N) l& F
- dma_addr_t dmaphysdest1 = 0; _8 i0 y2 J Z, @- K
- dma_addr_t dmaphysdest2 = 0;
2 L6 \' d2 m2 _ - " S! |5 U8 w! N3 R E; v: v
- char *dmabufsrc1 = NULL;
4 @9 S* }* R6 { - char *dmabufsrc2 = NULL;" A' U. W% Z) q' }) ?- v) i
- char *dmabufdest1 = NULL;0 E% {/ q2 Y7 I0 m T. y+ V
- char *dmabufdest2 = NULL;
. @1 `; w' t$ k+ s
6 p7 H9 f( i& B, G+ o; p T C- static int acnt = 512;5 s) g3 q+ ]/ A; {/ F7 m
- static int bcnt = 8;
. c8 c! @2 X& K8 `; F, X) e - static int ccnt = 8;
4 h8 N8 X* j$ @
" _' r: J4 z( i! p- module_param(acnt, int, S_IRUGO);9 e6 w& Q, T3 `
- module_param(bcnt, int, S_IRUGO);) M9 N+ d4 k1 l7 @5 Q$ B+ A
- module_param(ccnt, int, S_IRUGO);
复制代码
* j& H2 t$ e2 B* Z+ a' o
6 {9 j0 N8 n8 o. s" g, S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; Q8 K6 m" U6 E6 l2 Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 I+ G# m9 _ l* n u( K& ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& R( K' p B5 j0 e2 Z7 N+ _3 q( Q" {/ O
' v! a! Y# m% y3 y* |0 x+ j) N6 M |
|