|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * y4 P! ~8 o$ f1 m3 T4 `1 O5 H( f
- [code]EDMA sample test application0 l, V5 k7 p3 \1 b6 o1 a
- /*
! X6 C. N3 ^+ V J3 ]5 @ - * edma_test.c9 k' s* L$ n0 h3 h
- *
# c5 V5 m' ~" k3 \% ~2 g7 c - * brief EDMA3 Test Application# D( {8 y- [. m# f) Z6 s# u4 L
- *
) ]$ T" V3 X( q) G# o% H: x% p - * This file contains EDMA3 Test code.
9 }7 E- B/ g. Y, u' D9 [( ^ - *
# n1 Y. w6 s; W; Z2 b0 P - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 Z( c" N; Q1 U; S: U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ r4 b# v6 \! d7 G
- * TO CHANGE.( p9 \- z+ R q7 S- y
- *6 R/ w% I" O$ o" b( w( c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: |% t4 h7 e3 s6 W h
- */ M8 {4 B1 G( @& A: q* P; E
- * This program is free software; you can redistribute it and/or
3 e! `: G% h. f. }# D2 z$ w) X$ _ - * modify it under the terms of the GNU General Public License as
3 f- H0 A' |2 h4 c - * published by the Free Software Foundation version 2.
?) C$ t# t7 O) ~ - *. ~: R. i6 O" h6 U6 Z+ O v' d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; O6 ]- V. A$ s
- * kind, whether express or implied; without even the implied warranty
! K3 [0 a3 a- X ?5 @* y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 }! l2 O$ [$ p- E3 g- S2 G& a - * GNU General Public License for more details.2 j- ]+ T* @3 ?1 \6 t
- */
, S# m! a. G0 }4 B - . g1 A5 u* l/ w1 g, j. o! K1 F
- #include <linux/module.h>
1 j$ N l3 z* |- W4 i5 u2 g3 Y - #include <linux/init.h># c+ o3 B" O% l+ P- C( ~# l0 `. Y
- #include <linux/errno.h>
# o( J( T! \/ ~6 L% x: M# w0 A - #include <linux/types.h>* X! M& u( L$ y1 n# k# k( f
- #include <linux/interrupt.h>
" S6 A7 _" ?) V: n6 _+ l: F - #include <asm/io.h>
3 M8 _- O6 c. E# b - #include <linux/moduleparam.h>* Z; v" ]6 l7 h# T
- #include <linux/sysctl.h>* g, M- F4 _ a$ J: Q: z
- #include <linux/mm.h>, Z) ]* b4 s9 t8 X
- #include <linux/dma-mapping.h># Z1 n/ s+ M1 l- o8 P3 ^$ U
- . K" \0 N! @8 y( B
- #include <mach/memory.h># e# N% C8 y8 B; `' ]
- #include <mach/hardware.h>0 R: I+ {& b2 N4 a8 ?% G) ?
- #include <mach/irqs.h>
. E/ Z+ @; W& f/ Q7 X - #include <asm/hardware/edma.h>
& P7 C0 E% Q$ z/ e
8 M. q$ b, g' S- #undef EDMA3_DEBUG
, j+ e, {' `1 M - /*#define EDMA3_DEBUG*/# b- d9 c5 a# Q+ i6 \% c$ N( I
- Q8 t( ]+ O6 }
- #ifdef EDMA3_DEBUG
8 m5 q. C! E% z3 r2 M8 v- U0 Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% C6 k1 s o0 j2 w: C* r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 H" f$ Q1 N8 b: R6 g8 q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' A! A( |! N" O( T' C* z6 Q
- #else4 q$ P+ }- r1 d/ K' N5 b
- #define DMA_PRINTK( x... ) v- _! [0 `9 F( J5 r8 m" j: k
- #define DMA_FN_IN
3 V# K! Z% U; U) } - #define DMA_FN_OUT& v: Z3 E1 z: S* r. ?
- #endif
( r L4 D4 E7 ~8 H" O - 4 V7 A! M/ x+ R0 L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% l9 D/ T3 s) c0 y - #define STATIC_SHIFT 3
L+ S9 o9 t/ h1 I3 n! G - #define TCINTEN_SHIFT 208 [# P$ i/ x/ p1 Y: p
- #define ITCINTEN_SHIFT 21. D7 \0 R% u5 E$ a- }( Z& @9 J
- #define TCCHEN_SHIFT 22 m; P! r$ s+ X: @1 W7 {% F
- #define ITCCHEN_SHIFT 23
- A/ w7 u9 c) `+ ]) s, d
) R/ j. y3 W% x7 k- static volatile int irqraised1 = 0;
0 Y4 P4 \, E$ D- O' E7 {& c - static volatile int irqraised2 = 0;
( _( Q6 y* c, L0 f) ? s
6 z6 y5 O% k# O1 v" Z4 \) o/ n- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- z9 l# E0 w) T7 O( W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% O8 T8 s4 D* h& ~6 C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 Q, f' C8 s4 G* G
7 ^1 }( E) `+ a+ j8 U- dma_addr_t dmaphyssrc1 = 0;8 D! v% Z( r+ `8 U. Q: {! x2 o7 g
- dma_addr_t dmaphyssrc2 = 0;. L0 y/ T3 i/ E3 B8 @
- dma_addr_t dmaphysdest1 = 0;/ z* Z9 D( r, o+ G) b
- dma_addr_t dmaphysdest2 = 0;0 t1 e: o. p( T, z! M
8 C$ w) u0 d6 U2 ^' {# l# n' d- char *dmabufsrc1 = NULL;# p4 v8 O+ E1 q. J; p
- char *dmabufsrc2 = NULL;
& {: u! `8 L# B% _- `) v - char *dmabufdest1 = NULL;5 j* E7 Q/ O b4 Y
- char *dmabufdest2 = NULL;7 S9 X: U8 \6 F
5 Y1 U, g/ Y9 x4 v3 h3 ], \; T- static int acnt = 512;
) O1 F& b8 d. \4 w+ \$ j3 ^ - static int bcnt = 8;
8 }8 T% o2 v x - static int ccnt = 8;7 D w8 Z( s0 H& \2 j3 B
- 6 o, V0 P, D5 U7 `8 f% ?% U: _* S8 y
- module_param(acnt, int, S_IRUGO);8 A1 k# g* w( X
- module_param(bcnt, int, S_IRUGO);
6 y4 r5 `; j. L9 J5 G0 d - module_param(ccnt, int, S_IRUGO);
复制代码
! ?, L2 m! a- N3 C& D. M ]" ^. ^8 U4 ^* F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( E- O' L6 e0 M- a2 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# O9 a8 Z$ `5 O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 z$ ~% `; d: B) P# g, e% A. `2 B$ }: |' M7 z, d% G/ A
- q0 U/ j/ l' |
|
|