|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - [% X0 A7 x4 O' x m, [
- [code]EDMA sample test application
" G& s/ @1 @6 [5 v H) b - /*& B3 [$ \$ l% n- u) E1 R
- * edma_test.c, M/ _# |% T$ u. s6 c
- *
. S: `2 o. c! h" W6 p& S - * brief EDMA3 Test Application
" ~! {$ A' U- A3 ] L - *$ f2 ~$ J2 Y' P, w4 V$ `1 y, i
- * This file contains EDMA3 Test code.9 O' G- e$ h% o
- *
% h& f. Y/ E( N. r- f7 K$ K# v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! P, H' q6 J) f2 ~- b9 g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 a' p6 N/ w& O! q$ B7 T7 h# S
- * TO CHANGE.' @& E. g2 l g0 G; v% P) f
- *. R1 x. g. O1 x) f5 y% L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 G9 ~8 W- ^) c# z n) f - *
" G; @8 \% ~$ K3 }8 j5 n - * This program is free software; you can redistribute it and/or3 }: u; F+ P5 J8 u. j4 b0 ?
- * modify it under the terms of the GNU General Public License as- o. S& _6 D2 ^7 r' m4 q9 Z
- * published by the Free Software Foundation version 2.
& h" q9 P( p+ M* M - * b8 o$ y8 P4 [9 P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! p) n4 {. ~3 e1 h$ I) j7 G5 K6 [
- * kind, whether express or implied; without even the implied warranty
F% F7 }8 }6 U2 ~& C* j% H/ h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- K) K8 k3 ?* s B1 x7 E
- * GNU General Public License for more details.$ U- N- t* U5 ^; x Z" b
- */! T# }) m Y& j: P! z
@8 p7 _6 Y+ |5 A- #include <linux/module.h>
' `3 ]% u! Z- g) K; o1 l - #include <linux/init.h>% u3 ]% m8 V: S
- #include <linux/errno.h>1 y8 R' c2 c5 }
- #include <linux/types.h>5 a0 n T) X% S/ \
- #include <linux/interrupt.h>. p. u6 a& `, D& F$ j
- #include <asm/io.h>
9 Q8 W" o( I- M - #include <linux/moduleparam.h>
9 G$ G: i! {7 i" ] - #include <linux/sysctl.h>5 i) Z) C: E( a9 [6 X) B) e% h- v
- #include <linux/mm.h>
, }; o+ _" x5 S: d+ i - #include <linux/dma-mapping.h>1 C, m' j( ?0 A9 ^( E
- & O4 B, Y/ a0 }/ X0 N
- #include <mach/memory.h>1 k7 p: P; v8 _- h- q
- #include <mach/hardware.h>
( p* l9 A) [& b - #include <mach/irqs.h>
. k# V8 c$ A7 Q" V" P! j - #include <asm/hardware/edma.h>8 k* Q3 I. l! ^9 N
0 H9 C1 K% K- |( F( E. i- #undef EDMA3_DEBUG3 `: s# Z( u6 `! G
- /*#define EDMA3_DEBUG*/2 C& c1 I. [' X% d
- j- H2 P. F s- M1 {* v8 k- #ifdef EDMA3_DEBUG: Q+ Z) [( {% y8 u2 H: s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ w, v2 N! U+ B/ }4 L3 q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 I% H8 Z2 a5 C) i5 k% [1 K& r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% ~2 u) T3 U% A( F - #else- v% C8 n1 ]" u! g# A
- #define DMA_PRINTK( x... )
& a! N7 k- }. r N; l - #define DMA_FN_IN5 h# h: A: {3 R" s' k! y) a
- #define DMA_FN_OUT* e$ a4 K+ r! [) ^
- #endif
7 C- \9 L" ]! ^* p/ @
2 x7 [2 E: v: p* \- O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( n7 m& ? O$ o7 f% f; C0 E5 ^
- #define STATIC_SHIFT 3
4 S5 Q. h) H" k3 k# J, Z - #define TCINTEN_SHIFT 20
+ k; }& U! z' g" B* c5 R4 A - #define ITCINTEN_SHIFT 213 _) o- n( x1 ?4 Q+ _- p
- #define TCCHEN_SHIFT 22
, B( s9 t3 U1 n+ R B1 ^# ]/ Z* P d4 i; T7 y - #define ITCCHEN_SHIFT 23
# A( L2 v4 n a0 y1 N* Y - % G/ n0 S8 E, q& ]7 g- S) w
- static volatile int irqraised1 = 0;1 j4 I" M/ V; a: S5 Q3 f
- static volatile int irqraised2 = 0;
# E; v1 E! O7 I/ h3 F2 X - 5 q! B: R' \. V/ G8 V) p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' @6 G$ o5 ^4 ?/ O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 p. I' Q1 c8 {; Y- s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* s. A8 y8 {" }9 y2 D1 P
3 c8 h# l9 }; W# {3 p- dma_addr_t dmaphyssrc1 = 0;' V' | W9 ?( {- }5 b
- dma_addr_t dmaphyssrc2 = 0;. z2 t- S) N: y. ~4 V7 [
- dma_addr_t dmaphysdest1 = 0;+ Z, N. \( I$ Y5 c8 @( p
- dma_addr_t dmaphysdest2 = 0;
- H$ V( M! e" s7 k' u - + L# |$ y6 M. g& L! M
- char *dmabufsrc1 = NULL;7 N) ~( V: s, w2 D8 y
- char *dmabufsrc2 = NULL;" R& t" ~! K/ @$ x
- char *dmabufdest1 = NULL;
' G, \- [, P( ~5 H - char *dmabufdest2 = NULL;0 R2 y, }' f+ U) H/ a8 |% h6 ~
- / T* e0 t0 V: @2 U, O; g
- static int acnt = 512;" I+ k( s& h |
- static int bcnt = 8;! v p, g$ ^4 u! n
- static int ccnt = 8;1 A$ z) v5 w& a1 `- x" H" n
& I. H' T/ Z3 [8 f( ~- module_param(acnt, int, S_IRUGO);
- F3 h% a& ^ T3 d - module_param(bcnt, int, S_IRUGO);
# f+ L9 [" L3 l% v; S - module_param(ccnt, int, S_IRUGO);
复制代码 ( d. \0 x [; V" h
4 Q2 K. X: M3 M! t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. Z3 r6 `/ U' x8 Q! t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 l! o4 x3 o' M& Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* P+ c6 T" ?1 g( k3 X2 W H F
0 U: O- R4 c, p: P7 Q% p# R4 W6 t3 h, R' w
|
|