|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 _7 |4 ~: @& W3 T( \, {- [code]EDMA sample test application1 ]1 K$ c+ {. x
- /*
- Q, d/ U* j) b1 {; N9 \& J Q - * edma_test.c% R8 A" e8 r5 ?5 F5 D- b+ L+ E+ E
- *& O0 g4 |& V/ U7 W8 j) l. i/ s0 [; e
- * brief EDMA3 Test Application
9 m* S$ ?; c: R; {% ^7 E - *
- v U8 |: p9 L; d2 ~ - * This file contains EDMA3 Test code.
& C. i; ^9 s9 d! M9 E6 S- F* l - *$ S& Z( P$ C: e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. I3 x7 ]+ y/ j; | h8 G! u0 b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& L$ l( N3 e. N& J% X# j1 d
- * TO CHANGE.* y, F& k6 p W) ]
- *" z3 h- v4 Z, s* e, O" r. p# W% [ N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 v) ^: A3 }9 N" z0 ?" C, C. D - *: U! G) |6 W4 r: V' _7 B
- * This program is free software; you can redistribute it and/or
; z5 W: O% J2 L U) z - * modify it under the terms of the GNU General Public License as" F0 u0 ~6 D" i1 t1 {& B
- * published by the Free Software Foundation version 2.( v3 }0 ~1 x( b, l
- *
/ @9 c" r" ^& W* n6 H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 P" L* C! g4 v1 h* P3 o |
- * kind, whether express or implied; without even the implied warranty
' ]. u0 l1 [7 L* b% ^2 { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# A2 d6 d. ~9 I* c! \
- * GNU General Public License for more details./ n0 Y+ K7 |+ O) m' J) z) u' o5 E- F
- */
! o; U$ a+ N7 z9 R
2 k: W2 W( @* X6 U" g4 t1 v/ X- #include <linux/module.h>
( _" F' i; R9 O: c9 E% o. F9 V - #include <linux/init.h>
& u- q4 y1 P3 k; e) s+ x. `. K. b - #include <linux/errno.h>9 O1 t7 j: r: T' F
- #include <linux/types.h>
$ X1 r1 h# {; D' i* T: B7 _0 u9 p - #include <linux/interrupt.h>' g! m% L: {+ K: |" l0 v
- #include <asm/io.h>
$ h0 v$ ^" f6 t* s+ B/ J& c - #include <linux/moduleparam.h>
! k' B. _; w/ c9 @. i - #include <linux/sysctl.h>
* k1 V8 Z/ {. y* g7 \3 r - #include <linux/mm.h>' g: J3 {% j# g0 u1 K+ b$ H
- #include <linux/dma-mapping.h>
@7 A1 q- j9 n% r G0 t' o6 E2 h - ' S# t/ K8 t5 N/ p; Q
- #include <mach/memory.h>6 z& M) O" B& @- x
- #include <mach/hardware.h>
3 W; A1 z1 \3 a2 j; |' X - #include <mach/irqs.h>
+ Q8 |( @) i0 t ~9 i - #include <asm/hardware/edma.h>3 z; m8 a3 Q ?0 D+ b" o
# H: n" s7 N8 n- #undef EDMA3_DEBUG( _' _1 C$ D8 x4 D
- /*#define EDMA3_DEBUG*/: S' n3 n1 r @: d
+ s; D+ j3 ~1 L- e a5 b- #ifdef EDMA3_DEBUG
4 w- R3 n/ L* k# \1 n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: f4 x2 `4 Q3 e" f5 y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* [- _2 A/ E. B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! o: S+ B |% i# c- |0 n* }- e; Z6 B
- #else& X2 ~/ U9 q: g( H$ {
- #define DMA_PRINTK( x... )
5 ?1 P0 {/ ]" b* I - #define DMA_FN_IN
8 ^3 ^2 K, y* t2 ]" w& b6 E - #define DMA_FN_OUT* x$ J" w4 {# x$ w+ [0 a. U
- #endif
( J) Y3 g4 P) a' B/ p# G) P: H0 \ - ; ^" B1 w: H/ s; [ t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 M+ k5 V; z3 H% G. F - #define STATIC_SHIFT 32 z8 m& F# _7 L5 }% I
- #define TCINTEN_SHIFT 20
5 i. w2 ] m9 F; D* U - #define ITCINTEN_SHIFT 211 H9 E# s# w$ r/ k4 m
- #define TCCHEN_SHIFT 221 K' B7 E2 g |; q6 ?
- #define ITCCHEN_SHIFT 23' W# H2 g+ a9 q0 P p
" y/ X) o! t/ l# i6 A: [- static volatile int irqraised1 = 0;, Y* O4 M& a# L0 L. X9 Q2 Z# k
- static volatile int irqraised2 = 0;
$ c: p' O: j5 r) s# j8 B - 7 M z8 M/ K8 G) e+ i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, `4 L. X7 \8 k/ J. W1 J* L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# b2 @; p3 j) o9 @+ J& z1 O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( G0 V/ M9 v: _3 C
- & {, s, g0 e, `0 K6 y* F3 E
- dma_addr_t dmaphyssrc1 = 0;3 ]1 P/ p3 `$ s
- dma_addr_t dmaphyssrc2 = 0;/ v' V- P; J% p
- dma_addr_t dmaphysdest1 = 0;% |9 X _; ]8 d% [1 Q i
- dma_addr_t dmaphysdest2 = 0;
! ?, j& ^' u& E' G9 l
( c" ~/ r' w' I2 j, U2 L- char *dmabufsrc1 = NULL;% z, `* u5 k, O1 x5 p
- char *dmabufsrc2 = NULL;* E7 U9 l$ m0 {
- char *dmabufdest1 = NULL;
, A1 W/ ]* ~" L; _ - char *dmabufdest2 = NULL;/ G% \4 M( }9 x1 c# A3 o- o
- % I6 D7 F3 }; v9 Z- ?2 {
- static int acnt = 512;5 G# O: l7 ^ X& \
- static int bcnt = 8; Z* k9 L) D Z; W% p
- static int ccnt = 8;
$ L+ _( t, o: z) z2 a- I - " K' n' `& c" `- k. s
- module_param(acnt, int, S_IRUGO);. Z, _) Y1 k; [/ t0 R
- module_param(bcnt, int, S_IRUGO);+ |2 j9 u/ J0 `. ~) ?- ~# E
- module_param(ccnt, int, S_IRUGO);
复制代码 6 H& \2 I& G" N9 s* l
. i4 ]( a3 r- S7 X% e4 f8 j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ F, o5 h, J1 Q3 v* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ |% i/ \1 l% B* o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% E0 q; N6 }! J9 I3 ]
: h# o4 m4 @6 b% e6 s
7 v! H8 i3 }" `9 t0 s d |
|