|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : P. L7 i5 `& b- G& w
- [code]EDMA sample test application
* [* \+ Y4 q0 ~; i. w% i - /*" v6 n# M$ p8 j, H% H
- * edma_test.c
/ Z N; `1 c: o: h# X3 `5 l. Z - *8 J( Q2 G+ P* ~: S) I& ?
- * brief EDMA3 Test Application: h0 I7 O- \5 c0 n1 I( I- @
- *
0 D: V1 I* i' ]7 Y9 o$ D* w7 ? - * This file contains EDMA3 Test code.
]; f$ R$ z3 t. V$ d$ a% q# T! g - *
3 B* n9 Q& M& H, q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE |8 ]. {1 f) x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& l8 T F9 g3 \0 X5 S$ G* F
- * TO CHANGE.
+ g# \( T& ^' h ~9 v3 {! h - *6 E+ `) K% ~* O! y$ V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; W, s. a1 T. }0 t& ` - *
8 q4 f3 z0 R) q# m: m+ r - * This program is free software; you can redistribute it and/or
+ w0 h# y# ^( R! L, m - * modify it under the terms of the GNU General Public License as7 L9 S. C1 u. l2 C
- * published by the Free Software Foundation version 2.
! q p" i7 t1 P% e! O8 y3 I" O - *
* e1 p& f, s! y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- m- {. g! r! c6 \4 q - * kind, whether express or implied; without even the implied warranty
. l" R- F# V$ h. l1 z- u0 g; y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! t2 z3 H+ l! s. R - * GNU General Public License for more details.
. O9 w" a* \; v - */. C. S4 ~( \, g0 m O7 Q8 `
- 4 K7 Z* |- ]+ s/ m8 ^5 ^2 C: k; R
- #include <linux/module.h>
. ~' m" L# A% t - #include <linux/init.h>' N! u* t' b! G1 P9 S
- #include <linux/errno.h>
[. ^5 L% S ^$ A1 s - #include <linux/types.h>9 _6 j' b0 f' v8 s+ B
- #include <linux/interrupt.h>& |: r0 C* C) u
- #include <asm/io.h>3 G4 W" g: L ]8 R
- #include <linux/moduleparam.h>
( U( R4 P. V% Y2 W - #include <linux/sysctl.h>
1 F9 X/ P3 P. e! N4 H9 u! r - #include <linux/mm.h>
; y/ Y6 ~- v5 R3 Z2 `7 Y8 P - #include <linux/dma-mapping.h>5 F7 I" T: @+ s2 B9 I
, t5 @* e; i4 J0 L) a. s- #include <mach/memory.h>
* b' p8 d; l* C, w! V( Z2 S' c - #include <mach/hardware.h>
) ], n/ j8 a4 V- q5 ?" Q/ W1 e- c - #include <mach/irqs.h>6 i; P3 s Q- s, G. h7 ?
- #include <asm/hardware/edma.h>/ Q6 Q9 e4 G( p! W0 {' l
/ i% X* `6 j, ]% I- #undef EDMA3_DEBUG, I# e+ g7 X V- x9 y( B
- /*#define EDMA3_DEBUG*/' D0 H6 Y' L( H9 `) g G
' U( c4 e' w" Q- #ifdef EDMA3_DEBUG! J7 e" D1 J9 i. H+ Q( B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; F& r# c3 Q7 z+ M. T+ ]; W& M" [( W o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ l, }5 E+ ^* o) p0 W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 A( i. O$ E4 `" M+ _ - #else
. S) m" W+ v5 \3 W - #define DMA_PRINTK( x... )! N/ Z! f6 I0 c/ W) s
- #define DMA_FN_IN) K/ F) W& K" A; d( J
- #define DMA_FN_OUT
5 U' a/ r. w* b2 L5 G3 e - #endif7 Y" |: @$ K' E/ X: d& W
: G/ c3 M0 q9 p, b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( {4 t0 E8 R. ~, D& l- w - #define STATIC_SHIFT 31 @1 Q# {4 ] |8 i/ A; K
- #define TCINTEN_SHIFT 20% X% V/ _ ^, G3 L& o+ I
- #define ITCINTEN_SHIFT 21
J$ m5 u# ^* k8 U& z7 G4 d - #define TCCHEN_SHIFT 22
& C: e4 [5 q( o - #define ITCCHEN_SHIFT 233 |2 K3 J- z% c+ _
* `- s! Y7 y7 R$ j' b- static volatile int irqraised1 = 0;# i1 c. b: P- h/ ^ f
- static volatile int irqraised2 = 0;, j* s( J9 f+ ^( M a& ~& R
4 ~% R7 d& n, g7 L" v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 R: D7 P, ]6 a" r+ r0 B3 C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% S( L" U5 v% ^, e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: A7 o4 d9 Z( e! f1 R4 F' n# y* x
) U) c% P) j' d0 c" @- dma_addr_t dmaphyssrc1 = 0;& F5 d3 S; r# Z+ t
- dma_addr_t dmaphyssrc2 = 0;& }# f% W$ F! K& L0 W1 T# ?( K; P
- dma_addr_t dmaphysdest1 = 0;
! c) X( C# k; s3 {6 ^ - dma_addr_t dmaphysdest2 = 0;9 H1 g$ A' C+ c' G, F
- + Q7 N( |( \6 n# _
- char *dmabufsrc1 = NULL;
& S( f" q' X M& Y; t - char *dmabufsrc2 = NULL;
0 w% D3 \! `4 M2 O6 \% N) r - char *dmabufdest1 = NULL;
/ ]) `; Z. x5 |6 x2 U' K1 l* K1 B - char *dmabufdest2 = NULL;
; u h; E/ k5 V
- v$ W# A! h$ E" H p1 O1 }0 u n- static int acnt = 512;5 F, I3 X5 i: Q0 V8 @% o
- static int bcnt = 8;
5 |5 [2 g9 }6 \0 Y& ^$ T - static int ccnt = 8;
: S6 _0 y5 {, w/ V2 @7 z, \6 v - 4 e3 @! E$ l, B* @2 n
- module_param(acnt, int, S_IRUGO);' s J& K5 N# j/ v+ p' f: a
- module_param(bcnt, int, S_IRUGO);/ I* ~4 t( A# K6 F( n
- module_param(ccnt, int, S_IRUGO);
复制代码
& k3 N0 k0 d* G, R
0 Q3 y% o+ ^% z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ I: `) t" r+ `0 a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 Q T- \# [: B( W3 [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 }; z/ P3 \' z
9 [6 ]4 {4 k' x" _- U- g
$ C: S' Z0 n2 v; Q b' P' o% n |
|