|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * J* L8 {3 h. A5 p0 S
- [code]EDMA sample test application7 ?7 a o8 L) V1 n0 s& B
- /*
) j3 {. O; j; z8 R. C4 \" z - * edma_test.c' p8 b; t! `2 u, F( ^& @+ u
- *8 F, K) t& |# I, f- }3 c
- * brief EDMA3 Test Application
. ]$ C0 j: z) K2 Z$ A - *
: a0 q. o' y+ X - * This file contains EDMA3 Test code.
4 `; i/ ]# M% E2 B - *- ^7 K8 Z) e* s# n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ P2 o; q, t3 Q* ]( E8 x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 g. N7 J" k$ r9 E( q, L - * TO CHANGE.: ^0 u& k; r0 K+ D8 B- B! o# n
- *, X' V. e7 c6 v+ D/ h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 v: R. _. e7 k7 ^' N8 o
- *
1 b( ^ j* C. N# f t - * This program is free software; you can redistribute it and/or% Q2 O- r6 x I/ N
- * modify it under the terms of the GNU General Public License as
" ^* ~+ o# L7 x& }; D4 U8 K - * published by the Free Software Foundation version 2.
, M* I% G+ R `" B - *. @2 C% h" \+ h8 M ]2 k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& s2 y1 k: |8 e
- * kind, whether express or implied; without even the implied warranty
0 o* ?6 a7 W$ R" n p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 B% K* f4 {( E* R/ S1 V( X' ] - * GNU General Public License for more details." U0 B% O8 E- i0 W( V
- */; O+ w; S. R( r" M6 _
1 C6 P1 x1 |& {$ g+ G) ^- #include <linux/module.h>/ h0 w, E' Y1 ?# [4 D `( @
- #include <linux/init.h>
( g# W8 K8 u q5 v+ k8 h - #include <linux/errno.h>
6 l5 Y* l+ S q& S4 q. P - #include <linux/types.h>" T" N7 s/ B- x- s2 K& J, Q
- #include <linux/interrupt.h>
5 {. l2 ?/ M4 ^3 u }9 g. [ - #include <asm/io.h>) m1 } I6 a7 u2 t
- #include <linux/moduleparam.h>7 w0 h, v( T( V' X6 a Q
- #include <linux/sysctl.h>
, [4 y' g, e/ w$ R - #include <linux/mm.h>
* @! y! {: _" G9 ?( k* L+ L - #include <linux/dma-mapping.h>
# k' G! O; ~4 G- D3 F' x! d
$ l8 n! n, R' T; v- #include <mach/memory.h>
) h- e7 @( O; o4 s U8 u" L - #include <mach/hardware.h>; W1 A- Z- @8 k+ H! N
- #include <mach/irqs.h>9 |6 D/ B2 n/ Y. I3 E: Y
- #include <asm/hardware/edma.h>- p$ g6 o4 H- e& `% b% F
I! D2 }: C- b; e0 C- #undef EDMA3_DEBUG2 }% G9 N K# I6 @2 R4 ]: f3 J
- /*#define EDMA3_DEBUG*/
7 A3 ^% m+ Z% `3 w& e" }0 ` - ) q# c4 j) A+ T! E% @, T" C
- #ifdef EDMA3_DEBUG k; c5 w; q! Y5 s9 K8 d2 \" `3 ^$ Y0 @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* g& ~ o; E! d; V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 j9 k; ^ B" g0 y" A' }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ s7 S" _* A: V2 y6 u
- #else
" O' h: y; A' ^+ L3 |% Y) b$ u1 a - #define DMA_PRINTK( x... )' C l) F8 Z$ M6 x5 x
- #define DMA_FN_IN
3 ?3 J; s3 M; z6 i; j9 |" I - #define DMA_FN_OUT# w0 b' ^+ b9 o% N
- #endif
/ `: V; e) E( U/ N
( \9 C* X6 b* V+ u: a, U- #define MAX_DMA_TRANSFER_IN_BYTES (32768), @" j+ d, T/ e5 h- r. a# _
- #define STATIC_SHIFT 3& ]3 w& n; J5 d- R
- #define TCINTEN_SHIFT 20
3 X( Y9 d2 K9 b. T8 o - #define ITCINTEN_SHIFT 21* _$ `% R- @* I, s y: B
- #define TCCHEN_SHIFT 225 n9 m* G3 H0 `7 ^1 ?- f$ l- |
- #define ITCCHEN_SHIFT 238 T0 [9 D% T( ~( g/ ]5 P$ a
9 J4 D" o' ^: f: |- static volatile int irqraised1 = 0;8 U/ [2 r; u) A, Y
- static volatile int irqraised2 = 0;' i3 B% ]5 s/ O
- 1 y. b/ j& k7 Q, \ M- r$ n0 U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& l( E: p7 U0 D; E0 {+ T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 J2 i9 _8 E. ?2 h# ]8 R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 v+ i, |& I" N4 I8 o$ O( t3 [ - 3 H# A3 T4 c$ s) ` E% A: v, s
- dma_addr_t dmaphyssrc1 = 0;
* _+ k4 b5 q" H1 _. ~, b - dma_addr_t dmaphyssrc2 = 0;/ a; J# t: d3 ?$ l
- dma_addr_t dmaphysdest1 = 0;+ g" \1 i) m2 E8 }5 U2 Z3 _$ E- x
- dma_addr_t dmaphysdest2 = 0;2 b1 q! _3 m R( p/ l
- " S5 W! Y7 `' H" m4 k/ A( ?& S, `
- char *dmabufsrc1 = NULL;
f2 _" x) D9 ^( O& |9 p - char *dmabufsrc2 = NULL;* T3 g# Z- M9 D" r
- char *dmabufdest1 = NULL;
3 R* d4 }0 M) d9 C - char *dmabufdest2 = NULL;
4 e( |5 Z0 L N, _0 h% ]
" p- W5 Z: N6 b- static int acnt = 512;: O: V( c$ l! d- a2 S$ a8 ^
- static int bcnt = 8;$ J( X. Z2 {/ @/ F2 p# E& r. `5 Y1 ]
- static int ccnt = 8;
; Y7 e. p& o. g* o' X$ x
) l. n* l# @; X* ^& N" Y% ?- module_param(acnt, int, S_IRUGO);- ]0 d: N; s7 O* C: b# v
- module_param(bcnt, int, S_IRUGO);
2 U2 g9 n" V" |$ v% j+ t. h - module_param(ccnt, int, S_IRUGO);
复制代码
8 L9 Z7 ]8 ?8 m9 ?1 h3 r9 |
3 a2 C( ^7 x/ |1 L8 x* C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% j6 m7 B+ E! l# \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 d; ~ _: p3 {2 Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- g. b: n7 u& T
# v4 c' H& @" `) P* Q! I3 o ~6 i3 W2 k
|
|