|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; e- F2 i0 m* }, A" o& ]& x
- [code]EDMA sample test application/ f% ^' Y5 {' E6 [% D
- /*
7 v, E0 ]# r, n$ y" W- R6 | - * edma_test.c
' a) o3 R) |4 @6 Z/ _- y - *
6 i' V6 I( [$ N4 p& @% l - * brief EDMA3 Test Application
/ M% O8 q2 p: B* p! v i - *8 S* c8 @$ K% o5 Q" A* |/ L
- * This file contains EDMA3 Test code.
; ~/ H7 m3 _2 l, n; V) `5 O, K - *
/ }. }+ [5 b! S* w$ v! ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- i/ K2 s2 Y, x- x8 K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ B7 `. a7 {- t$ f3 M
- * TO CHANGE.% H2 y; [; D5 ?$ O6 D' o- I: o
- *! t f1 l* g: F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( p! M- b/ i7 b3 K* m
- *8 S$ f7 ~" v8 C* O, U" `+ v& A
- * This program is free software; you can redistribute it and/or, T0 X) W$ l1 e9 [: e0 E
- * modify it under the terms of the GNU General Public License as0 v$ y0 V& J8 ?" y
- * published by the Free Software Foundation version 2.
) S; m; M) F) h; d7 t# R. U1 J - *
) `' l- C0 V* {5 S' p8 H1 v, ?- ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; Z9 a, s0 L4 x2 `) T
- * kind, whether express or implied; without even the implied warranty
- c$ R$ W) I0 T6 E8 Y" i9 A- D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# {$ A: K1 h; O" X; O" \
- * GNU General Public License for more details.' w, x3 q6 U( V. r* I
- */
9 b7 D+ H! w! B) y6 ?! b
2 |9 ?* ?4 H3 Q- #include <linux/module.h>0 T- L' @; |- Q. A4 Y7 p
- #include <linux/init.h>
5 |) x$ x' l/ g6 I' T* a - #include <linux/errno.h>
( Z. O2 K, G3 ~5 z0 o; \2 ? - #include <linux/types.h>" w- H; ?5 c" }. K& A3 Z
- #include <linux/interrupt.h>4 d7 ^* B/ O4 Z6 g* g7 H# O
- #include <asm/io.h>
5 j6 A, Q: F1 Y. j( m! ~ - #include <linux/moduleparam.h>
M0 A# j% r9 \( d - #include <linux/sysctl.h>
4 L8 T, _6 K; M- M$ V& G - #include <linux/mm.h># z6 m8 N( a8 d* X
- #include <linux/dma-mapping.h>
7 j/ L( V% |9 v0 g - + B+ X! E* N6 L4 M# ^& [
- #include <mach/memory.h>
6 b* h6 J2 N7 q - #include <mach/hardware.h>
$ p o+ V) ?9 @6 U - #include <mach/irqs.h>3 K% p* E U/ ]. X+ ^
- #include <asm/hardware/edma.h>( g w! f2 w6 r0 e
- 0 B3 g; m' ^1 I6 q, G
- #undef EDMA3_DEBUG# \2 R$ v, Q' @( k; ?
- /*#define EDMA3_DEBUG*/6 T( G& d% t* F$ [6 r
- w2 n* g" d, L7 e% q( y
- #ifdef EDMA3_DEBUG# R1 h4 D3 ]0 h. o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& A& I9 V( L4 w1 q4 C7 M2 a# z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 D t+ l, e# [8 y3 l: |: W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. I6 ]. M' N+ P2 C' a' b' E+ Z3 Q - #else
! I, Y- \6 a( C- n - #define DMA_PRINTK( x... ); Z# I% e( x* Z. Z
- #define DMA_FN_IN( G. d; D9 ]4 L
- #define DMA_FN_OUT
5 C' e! b' F3 o& P' |5 \% Q6 M - #endif
. Y. O) V% f: w% S) j - + B- s; I! M9 H6 U. J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- Y8 g$ P6 b* k
- #define STATIC_SHIFT 38 f; \6 C. t$ p7 F f
- #define TCINTEN_SHIFT 20
8 L8 y9 R2 q; f% ?4 g: T0 U* y - #define ITCINTEN_SHIFT 21
: K+ M; T" B( O6 h* L) L3 g - #define TCCHEN_SHIFT 22
0 H3 w4 S$ Y; S - #define ITCCHEN_SHIFT 23% d: x3 t- n; ?% {, o& `; h
% R8 N) |1 F/ d. O0 O7 q- static volatile int irqraised1 = 0;2 T& }" q; d0 l4 J
- static volatile int irqraised2 = 0;
_, s! V" v6 B/ F7 J - $ p4 e7 Z6 P0 q/ j4 c" F) [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' S. w ~! q- o$ O& q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 Y; }2 p8 I1 X3 ]+ O" {: \3 F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- D; h# \" n" m( j( D4 [
) W2 E3 m' q, g! } g3 w$ }2 G" }$ X- dma_addr_t dmaphyssrc1 = 0;! d2 o% e$ {, p. [) ]
- dma_addr_t dmaphyssrc2 = 0;& C, r4 U. m" H
- dma_addr_t dmaphysdest1 = 0;
2 m% {+ p0 @0 @' e4 D9 Y - dma_addr_t dmaphysdest2 = 0;
0 r3 f' w8 y( `2 p
' d8 H& u: c1 n+ R# Y3 S- char *dmabufsrc1 = NULL;
! r" b1 e+ w# z. R$ J8 Y - char *dmabufsrc2 = NULL;3 |, p8 O% n# W. k* N
- char *dmabufdest1 = NULL;
3 z |) D8 c, ?7 y - char *dmabufdest2 = NULL;+ s; W2 w* Y& a0 ~0 x
; K$ i9 _/ c! O6 j0 x$ ?- I- static int acnt = 512;
: l( ~; v, j' ~ - static int bcnt = 8;+ R: w: X, P2 E; R* h% M
- static int ccnt = 8;5 @, Z O& U: A& t- @+ J
6 M4 r. z6 F/ e, \/ }( _- module_param(acnt, int, S_IRUGO);: h, b9 [. Y3 ^# Q& L# w# l
- module_param(bcnt, int, S_IRUGO);5 U) s( t5 Z6 T; C7 D K
- module_param(ccnt, int, S_IRUGO);
复制代码 @3 t- {6 [. z
5 U# C) d- [0 |3 \/ k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ U# K# j$ `" V! P+ D, I/ D. Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, \. f) v7 L: J+ M5 j" ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% S+ h7 N# @% H) p# c- }% s% V Q N) p5 Y/ i) h
/ z% e" _3 W! V$ ^' t
|
|