|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % ~& P' J* j1 p9 @% V
- [code]EDMA sample test application v, B- q3 F' {( K
- /*- F1 K( c# G% b( d1 I! c
- * edma_test.c8 q4 V7 d; I' A9 n# ~
- *
8 D% o9 D% D5 a2 Q! A% N - * brief EDMA3 Test Application/ e7 G2 M f# E# s, J. N
- *
, `/ p* M8 h" e! x' c. E - * This file contains EDMA3 Test code.- A$ Y# ~) s% w" |6 m' f
- *
9 O' O5 J0 @ K8 D3 i" T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 ~) B6 [9 U9 s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; f; c5 J% u) u1 m5 u - * TO CHANGE.; w7 ^+ m$ M* i& n& r
- *; @/ p/ R3 {# I4 k( O* K2 F9 Z7 z1 j0 o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( V4 i; D( e, q8 G - *
& s* g, h" h2 c. `1 P1 J+ G: i - * This program is free software; you can redistribute it and/or- }4 x( P/ p0 f' ^: X( a5 X' t
- * modify it under the terms of the GNU General Public License as) e0 q. m# ~, g+ B% c+ r7 R5 s
- * published by the Free Software Foundation version 2.4 h5 a: o7 ~# u5 b
- *
8 c3 E6 @# H& X2 f, ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& {+ N! G* i1 g( M
- * kind, whether express or implied; without even the implied warranty
7 O1 }; u: |7 D% q* a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) @8 O9 x+ H5 O8 H8 ^( n9 a3 l9 L
- * GNU General Public License for more details.8 I# ^0 R, B+ K( ~) @6 r
- */, N2 \7 [6 @5 Y3 T2 F6 S, Q3 B
- # B" Y& ?; W8 I4 C! E, \
- #include <linux/module.h>
' f) `' ?" i! L, l# ]: V( Q* N - #include <linux/init.h>; U5 @+ y2 d) ~* ] B8 j
- #include <linux/errno.h>
+ S& U" d `" \' o - #include <linux/types.h>/ a# B/ J5 ~4 ^$ K
- #include <linux/interrupt.h>! z# S/ E3 k5 v# J1 r) W& X
- #include <asm/io.h>' r$ B4 [ `" a8 E( X: S: q; U
- #include <linux/moduleparam.h>% s% q X# C! l- {. z6 m- O
- #include <linux/sysctl.h>
5 a+ `% L( P, c3 X - #include <linux/mm.h>. u' O/ p( `: g6 o/ |; f* o
- #include <linux/dma-mapping.h>! J" H1 G& s1 w0 R3 y9 D
- % b+ A. i0 t5 y! i( a
- #include <mach/memory.h>7 i7 N; P6 d7 V
- #include <mach/hardware.h>' f) e# r0 P- X; \0 l
- #include <mach/irqs.h>
% ^$ {. x5 N$ q9 O# t! z; S/ V - #include <asm/hardware/edma.h>$ X5 Y3 c1 j8 G4 z* Q
- p; i& c1 d6 @- #undef EDMA3_DEBUG/ [& K" x/ \2 |
- /*#define EDMA3_DEBUG*/
& K0 l+ |/ d! V8 D* z# d6 l - + R1 q8 }0 f! F% [# U. i
- #ifdef EDMA3_DEBUG
2 @! V. y' z L; `% r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! b7 Q @. O/ m0 f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); m5 I, @. u% X+ V6 v; a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 v6 g. w" `& c# J3 b
- #else/ I- y) K+ X! c, E, T
- #define DMA_PRINTK( x... )
' ?! F& y, q: _1 P, ^& J9 n4 J' v - #define DMA_FN_IN; G3 e; v) c6 R8 ^2 O$ g1 a- {
- #define DMA_FN_OUT
' k; w4 }6 { N - #endif
8 p7 A' @4 y; i6 V
5 P( d1 b8 U+ q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 x7 ^3 A4 ]- Y8 f9 X
- #define STATIC_SHIFT 3
4 ?( f5 ?* Q0 C% z8 G - #define TCINTEN_SHIFT 20. f8 U0 K! C# V6 H
- #define ITCINTEN_SHIFT 21
* ~: {7 c3 Y0 v2 \+ P- X - #define TCCHEN_SHIFT 22
+ \3 c X* L7 c$ d# _; X - #define ITCCHEN_SHIFT 239 k. |' a! `: d2 j: s2 r& f6 R+ F: K, X
- 2 M& T# L9 S/ h/ q8 j6 O4 g, T/ V
- static volatile int irqraised1 = 0;
' [( e8 v& r! X/ U9 P - static volatile int irqraised2 = 0;
3 Z5 O$ ^2 Y1 G! X2 S
% _0 A# Y1 l" H( z' g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! X/ o5 o! U, ~3 @" \$ Y( u! A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( ~; `: e3 s. l - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' S5 o# f) V8 C D1 ?$ ]- b
. H+ |" ?8 D" j0 K. D$ Q3 e ^1 g2 B& v- dma_addr_t dmaphyssrc1 = 0;
a$ @. }9 m+ F; W4 n) g - dma_addr_t dmaphyssrc2 = 0;
N2 F7 e$ q$ @# d7 ?! u - dma_addr_t dmaphysdest1 = 0;/ s M" R3 v$ R, n
- dma_addr_t dmaphysdest2 = 0;$ m8 W* w% q8 T& R
- 5 L, n9 K. [: ^' g1 E0 C
- char *dmabufsrc1 = NULL;/ G5 j9 R# M) } q" K/ j
- char *dmabufsrc2 = NULL;
! ?( _) W5 }; @4 A) w. M3 q7 g - char *dmabufdest1 = NULL;
, |8 \% f0 k1 j - char *dmabufdest2 = NULL;- h: W. g1 Y, W0 I
4 s% q/ j; X3 \+ R) h Q) C' @- static int acnt = 512;- S$ ~8 Z3 }4 b; Q/ C+ @
- static int bcnt = 8;
x: B: U( j3 p* K# P - static int ccnt = 8;
% u' j; i! j2 `7 P' N
8 W- Q' V9 j/ j, o, V3 L6 J( k! G- module_param(acnt, int, S_IRUGO);8 b4 ?0 E! L" S- T8 d) \+ u
- module_param(bcnt, int, S_IRUGO);4 T5 D% y0 k' o3 M3 w
- module_param(ccnt, int, S_IRUGO);
复制代码 3 j# O( l: V3 ?1 i7 X1 R2 R
! ^) ?: ?: f* z+ n4 P/ M9 g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" f, P9 x8 @6 b, [) farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, f4 s9 N2 q8 a/ m# Y5 N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ S; K+ [; U/ Q) H* `; p
3 O) E4 a9 K$ X8 L% q
' C! Z# \9 m# V8 s% U; t4 K |
|