|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / t; J. S8 n- x
- [code]EDMA sample test application
- W1 `: H$ \1 [, Z - /*
* m3 }. c. u h, T6 b - * edma_test.c# c! w; K: Y3 f' b9 u4 S* i9 K" W
- *6 F3 C. Z, f2 K& I/ o" M9 a
- * brief EDMA3 Test Application
& w h) J0 g$ O# y - *
2 ^! G0 @" Z: [+ l! H7 j3 I - * This file contains EDMA3 Test code.1 x" [) W) k+ R
- *
0 H) [- N! o5 A5 U: b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% X+ r6 ]1 k% W" l& d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; p- Q( r' a5 _# D
- * TO CHANGE.
" X o# }$ K( m5 [ - *
/ y" D/ m" x" e: N1 t: V7 [% b3 {" c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// |; p0 y- K& }: q9 c: o ?
- *) A, A1 c J- z
- * This program is free software; you can redistribute it and/or W4 Y9 ~$ h$ ?4 t7 z5 i3 p
- * modify it under the terms of the GNU General Public License as% D+ m- ^! a' f% W# e. ~
- * published by the Free Software Foundation version 2.6 V" Z( i7 `% A, q7 t8 _
- *1 H6 r# B2 _9 D. z9 H9 @2 {* G. V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 g. F) O# S' z" O: {. T8 T+ A" J) b - * kind, whether express or implied; without even the implied warranty
: d+ ]5 o, q% c5 P% M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 w$ ~7 x' Z' | v/ P }3 X
- * GNU General Public License for more details.8 A* q* _) ]$ l/ ^
- */
* b, x. n% c. V( W9 H) W: b3 Y - + V- C4 z* A6 k% j1 @0 u
- #include <linux/module.h>
3 X. U1 z/ O, N" j3 x6 K4 [ - #include <linux/init.h>
. t& U( F k l, Q8 i; a4 o - #include <linux/errno.h>9 E6 i' D3 c: C9 {4 E! d
- #include <linux/types.h>
6 i4 t8 }8 p1 b; h - #include <linux/interrupt.h>
: m! A! ~$ y/ f* q9 s' M8 | - #include <asm/io.h>
6 H+ n) }% k3 a- e8 t - #include <linux/moduleparam.h>* r+ \ `* t$ D& N% d, X; A
- #include <linux/sysctl.h>, T4 [8 X" a4 N' L, {
- #include <linux/mm.h>
; f/ _. q$ P. \/ W1 }3 F - #include <linux/dma-mapping.h>
8 S8 V4 k- G! w. V - & W) E& A ?! K
- #include <mach/memory.h> p1 R" H4 f7 `! K
- #include <mach/hardware.h>
2 ^$ C' l3 u: ? _0 F2 v5 w0 ` - #include <mach/irqs.h>0 O: J# @4 h4 }7 y
- #include <asm/hardware/edma.h>
) k8 t2 q8 b$ E! Y1 {- R! D! K2 T) T
7 |+ M$ h" H3 Y- #undef EDMA3_DEBUG8 ?" m5 P( Q0 p7 N) l% S
- /*#define EDMA3_DEBUG*/
! b. [7 u9 l! |) q; U5 R - F5 u# x- l% K* Q5 d% B
- #ifdef EDMA3_DEBUG% U, } S0 i9 B) V3 o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* k4 l" r" y, n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ ^6 e% S1 Y! V2 \0 A3 G3 q4 U; }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 F4 f4 x) g6 ?5 L- j7 g6 b Z - #else" t5 K6 ]/ q6 ]. o- }: v% S l/ p
- #define DMA_PRINTK( x... )& o0 N4 t5 I* }% |
- #define DMA_FN_IN/ `: Z( y2 S0 |! z, b( p: i& V
- #define DMA_FN_OUT
# F4 Z. V( n* E- W/ J# b - #endif8 p1 n% }; l. F% E3 p4 J1 F/ ]
/ r( n: e7 b! ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 }5 p! ^) ~' h) a" E. ]
- #define STATIC_SHIFT 3# p1 y8 }) v8 b- ]) E8 Q$ r; X3 s
- #define TCINTEN_SHIFT 20: K; g$ A: |) V7 X
- #define ITCINTEN_SHIFT 21
) F9 G0 u2 |0 W: E - #define TCCHEN_SHIFT 223 o! U, ], p& E; z" A# W
- #define ITCCHEN_SHIFT 23& |. I! }/ F8 @+ n
" t; w- J; }" P5 q2 ]$ `$ s5 }- static volatile int irqraised1 = 0;
( K' h: ~2 R7 D/ E& d - static volatile int irqraised2 = 0;% c2 `+ X0 g" m" P, L( P1 I
0 d% ]2 W' n$ b! L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 X! ^( b4 U, [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ e6 E7 \$ M! Y) l4 v! D, a$ g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 P1 m$ A7 ?+ n) J! x# J
- 0 \2 m* B4 Q/ n( I5 ?- Q) c3 l
- dma_addr_t dmaphyssrc1 = 0;5 p$ x: v% u, B2 K, x/ b) G" E
- dma_addr_t dmaphyssrc2 = 0;
$ K4 u! l4 O6 J, f4 T3 K T2 t - dma_addr_t dmaphysdest1 = 0;
) o: [' l* Y) m) u3 G* ?- ?7 k2 j6 D - dma_addr_t dmaphysdest2 = 0;
$ m/ u" M0 n: U - . L5 I2 o& k9 o- B1 |* \
- char *dmabufsrc1 = NULL;
$ N- H8 [: @7 }/ V5 \ {: i - char *dmabufsrc2 = NULL;+ X! D% E: F8 W! B' T
- char *dmabufdest1 = NULL;5 g: |, Y: x/ y/ z) v+ } |
- char *dmabufdest2 = NULL;4 j% N z. ^# Z
- # p. w* ]7 ]$ C/ b) m+ G. U/ t! p" _
- static int acnt = 512;
$ i: c# |# {9 l" c, M4 b+ Y! ^) P - static int bcnt = 8;9 m7 N' w2 Q5 l3 ^4 h, S: L( l8 Q# t
- static int ccnt = 8;5 Z" D! K! d8 C" o1 C" Z, p3 M
- 3 z p. m. ^, t. C5 U4 ?2 K
- module_param(acnt, int, S_IRUGO);: \! H" q: X% r" @' z) X
- module_param(bcnt, int, S_IRUGO); [; X" |8 t- s% n3 K
- module_param(ccnt, int, S_IRUGO);
复制代码
7 ~$ o+ t1 w' p. Z- M
$ q6 a: {: P2 W2 g+ N" T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% S' P; t4 i1 o$ H3 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" P0 d4 o( W% }0 r; j/ j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% D. u) o% R; k) m3 a1 T
2 V! J# i0 b8 f
! j6 n0 |7 s+ M# k7 W2 R5 V |
|