|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 y" p0 u" A$ C5 }& X+ J
- [code]EDMA sample test application+ [* j+ U1 S) U. j' K9 i
- /*
- w0 L* C C. X; ?! D" N- l - * edma_test.c2 `" U- u- b# R5 R- S' d3 t
- *7 ~, r: B& y+ u) x( O! d' n
- * brief EDMA3 Test Application: d( C+ q. G* K F
- *1 V- ]* t+ S8 M6 c3 ], X8 P8 U. G
- * This file contains EDMA3 Test code.' s5 j) k9 p' l1 Q
- ** n% |) P/ h3 \% b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- p# J% ]& Y9 B- U6 x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. G# x4 ~. }; |' \/ u2 q$ Y# p& o K
- * TO CHANGE.
9 g9 N* |, U. _+ X/ x- x - *! W9 @- R; I7 V% m+ t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 T! `; K% o! q" ^" r* d
- *
e. v, O/ B) Y7 O+ \ - * This program is free software; you can redistribute it and/or
: s- o6 z; u" n5 X - * modify it under the terms of the GNU General Public License as3 k3 m3 x' _8 \0 {! H# @) h
- * published by the Free Software Foundation version 2.
* W& n7 H# _3 g! b/ u - ** Y& h& v& W5 P; @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 x# ?) u9 k- ~7 t - * kind, whether express or implied; without even the implied warranty; n4 H% H- I9 b/ L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, [* Q5 M4 Q/ G% Q2 b
- * GNU General Public License for more details. H* {+ ?9 @5 l
- */
5 M, k4 ~2 p. R' B - ) T" y% c2 T. s1 L
- #include <linux/module.h>
. p/ `% O2 ]! G' f1 Z - #include <linux/init.h>: z! Q( C6 c0 D- H! a" t
- #include <linux/errno.h>
; h9 Z% V+ L; t# z' [ - #include <linux/types.h>4 d( \0 o9 R! o8 J2 P6 L* ~
- #include <linux/interrupt.h>
e# z# C5 p6 G, t# c5 U - #include <asm/io.h>9 \ @7 F9 ]: @5 q
- #include <linux/moduleparam.h>- {8 w* G. J% O3 p: t* j$ ?
- #include <linux/sysctl.h>
$ N3 @* \- S a( B3 q% m - #include <linux/mm.h>% y; X; c6 e) G
- #include <linux/dma-mapping.h>' w5 {6 @7 Y+ ` o' q1 O
- , G4 P1 T- M0 M% }* D
- #include <mach/memory.h> F) }4 G$ N+ O& X& @5 Q- r4 o% o
- #include <mach/hardware.h>
( s6 M) B! \6 P( u' z& D F - #include <mach/irqs.h>
* y3 C0 @- @/ o - #include <asm/hardware/edma.h>
$ G- U4 A8 T6 M - 6 M1 O4 w: s6 b
- #undef EDMA3_DEBUG
# U& R. ?5 Y0 ^2 V; @ - /*#define EDMA3_DEBUG*/3 M' |' p" E8 t) w- M
- % ~0 C% y) x4 c$ n$ E
- #ifdef EDMA3_DEBUG
' W) A# |1 L0 F/ g3 b. \, K+ E, V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" V0 N6 J( [+ `- E2 o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% k8 l$ X! l ?, Z' b7 y1 e& T: v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' y- i; e A& ?
- #else
1 G7 s0 F) L& s {$ E7 Q - #define DMA_PRINTK( x... )
4 V7 d* T \' e# F - #define DMA_FN_IN# P; w0 L q5 c# f
- #define DMA_FN_OUT1 d/ G0 v% R$ @" D4 A. \* Y
- #endif
6 B! p( Q& C7 Y
) A- ^! p; U0 Z. ?* n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, e$ H9 z5 R% G - #define STATIC_SHIFT 3
7 u! z3 C, H, i4 q5 E% R - #define TCINTEN_SHIFT 20
2 [, y1 X9 A% \% { H4 [9 y6 m( c. D - #define ITCINTEN_SHIFT 21
- ^4 L& [6 s6 N' M& w8 j& ` - #define TCCHEN_SHIFT 226 ?. D8 B. v- B
- #define ITCCHEN_SHIFT 23
6 i; Q+ l1 N. f - % K5 h1 E/ s Y! Z
- static volatile int irqraised1 = 0;) Y: G5 o" ]( b/ I2 S
- static volatile int irqraised2 = 0;
* h6 ]1 x' b6 Q0 R6 X - 2 N& U" r w8 L8 N' T, W5 i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, @) z3 r B: `: W/ ^7 t" U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. @8 } n( L* R6 e( h0 \4 | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Y4 Q- o, }4 x, A$ T
$ @5 T" i: i. A; L0 X- dma_addr_t dmaphyssrc1 = 0;6 l& F/ s9 z/ W
- dma_addr_t dmaphyssrc2 = 0;
7 a, c& G, @1 E7 o9 O - dma_addr_t dmaphysdest1 = 0;
9 @: ~1 B, F @; h4 G: [* d - dma_addr_t dmaphysdest2 = 0;
9 J! x8 K+ j0 L1 B% t' d3 k - + {7 U" I- L$ S. D) [8 f
- char *dmabufsrc1 = NULL;' |6 z! v/ h5 Y* j
- char *dmabufsrc2 = NULL;" t" p# a P$ `$ m- p, [' E
- char *dmabufdest1 = NULL;
: h: I9 _" {1 L& c d# d9 t - char *dmabufdest2 = NULL;
. W9 ~ u) Q/ T) e( y7 ~7 k) u! H; b - 9 z6 f1 |& a# R! g2 ~
- static int acnt = 512;
3 U) [( h" T) e" x% g: R - static int bcnt = 8;0 `4 }% _( e( k7 }, @$ b4 z' h
- static int ccnt = 8;
9 r6 M8 _" n( u/ g9 n8 p - ' a" b% E5 P* @' B' Z. p' i
- module_param(acnt, int, S_IRUGO);
' u. o3 H# @2 S! k - module_param(bcnt, int, S_IRUGO);; v7 d9 j+ b7 ~5 y$ B/ x1 [+ O
- module_param(ccnt, int, S_IRUGO);
复制代码
3 [) E X4 ?* \7 _4 d& \9 D
& i1 L$ e& F0 U5 a; w! q; ~+ t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 ]6 {+ e5 j9 q9 s% w$ r( B/ V. I s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' X$ `+ U }$ `- O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' z, a$ f& `- p' R( p5 I. I
9 }. r7 k7 G' t) F/ b: `4 a$ ]5 X; p: `5 N
|
|