|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 E0 `, x; d: a0 x6 ~: ?. i
- [code]EDMA sample test application
% r7 d( Z; V$ O) [) @, }. ]2 T0 u/ u - /*
! c6 n$ l# k5 h# K9 m- g - * edma_test.c
* a) f2 @, B( `0 k1 H1 d - *
% z4 Y( f$ B- B, V9 H - * brief EDMA3 Test Application
& a! c# a5 h* B& t. H' _# ?! W3 | - *$ S/ ?0 \5 O1 B C0 j5 c/ G
- * This file contains EDMA3 Test code./ T; k3 e0 ~# g
- *
7 |5 F* y" g+ W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 W# p4 b/ r A. _- D: S6 v) M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 r4 q$ N2 s, B - * TO CHANGE.
% e# ^, X; a: ?2 a( t$ ~" s - *
o" m2 T$ L4 H9 A. l5 |& n7 M - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// M4 K: H5 Y! f# O' f. a
- *
# d- m- T' `9 U7 F8 T; D0 ^& V! i6 } - * This program is free software; you can redistribute it and/or
3 `9 m4 |3 a5 |. g7 K9 \ - * modify it under the terms of the GNU General Public License as q/ R& G% ]$ o
- * published by the Free Software Foundation version 2.% R) C( _9 o* _9 [1 a6 C
- *
" V$ K' x: H6 c D/ c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 `# _; n V1 W) q1 M" }7 z8 T
- * kind, whether express or implied; without even the implied warranty; q- ?1 c3 d- c) y- b, v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% o5 R5 k9 X3 i" }/ b$ Z* i - * GNU General Public License for more details.+ y% v1 E! G6 f- ?1 ^/ x
- */
+ p6 r% ^* I7 x
( X/ Y% ] L) Z- #include <linux/module.h>! N3 e# L" E$ ~# o5 g, O
- #include <linux/init.h>
- U9 x S t- w5 p/ x4 k: ] - #include <linux/errno.h>
& o0 M: s5 C. }# P - #include <linux/types.h>9 ~( `/ P' `) k% l
- #include <linux/interrupt.h>
/ @! h) G) U* }% W - #include <asm/io.h>1 p5 o/ s7 ]( M. \) W6 h6 I
- #include <linux/moduleparam.h>' K$ ?( O8 z4 L. ^5 U4 l
- #include <linux/sysctl.h>0 ~; O8 W& \& B+ t; {) r
- #include <linux/mm.h>/ r4 ~, t& ? c, O7 Q
- #include <linux/dma-mapping.h>
- }- U/ p1 L' G9 O- O) M2 G1 |6 W
3 |& r7 j* b5 `- #include <mach/memory.h>. p. I2 E ~* D: M8 k
- #include <mach/hardware.h>2 c6 i& J1 ~/ S# s7 \
- #include <mach/irqs.h>) }' `5 ?% B$ \$ h& f
- #include <asm/hardware/edma.h>; ]9 q! N# e* s% r, v$ D
* Q/ ?" y- S, N- #undef EDMA3_DEBUG1 r/ g# l0 R- h7 D4 B4 `
- /*#define EDMA3_DEBUG*/
?) V8 E9 ^5 C4 E1 Q2 O - & B# Q& e2 w5 |5 }
- #ifdef EDMA3_DEBUG
O, k% x6 G2 E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 @7 `5 W) c6 a1 L/ o$ R/ Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
t# F6 A5 [% U: u: g- t4 m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% b/ X6 ?! C. Q- o0 a
- #else; N4 ^$ }# \4 z, V2 q
- #define DMA_PRINTK( x... )
! z9 T# E. D- P" ? - #define DMA_FN_IN
/ y% d( g* n4 U) \* [ - #define DMA_FN_OUT
! Z. t/ A* ]2 I0 c a+ j6 J: H3 p - #endif
5 P# h/ C% I( m1 ~: ~$ t
. r$ C7 T f8 N% @7 t- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' j5 P5 w* @; H1 {( L% \0 ` - #define STATIC_SHIFT 3
+ m/ L/ ?% f* @) L! N& _. P - #define TCINTEN_SHIFT 20
: ~% J$ I' m7 R2 }/ t7 o - #define ITCINTEN_SHIFT 21
8 a' T8 w2 ^8 Y* C6 b9 `: f - #define TCCHEN_SHIFT 22# ]4 O3 f& D8 N0 s, ]' w
- #define ITCCHEN_SHIFT 23
! ?9 S' s" b9 p
9 @1 d6 _! Y/ L+ m1 N1 E) p3 P- static volatile int irqraised1 = 0;
& j7 o/ u) t# S5 q( i* T - static volatile int irqraised2 = 0;
# p3 E" A1 q6 E2 [9 m/ w7 R- H
, w6 u% N( z. B' j) ~0 J. n: U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 R* M/ T$ h9 e. [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! @6 v& g( @* L2 }0 f, {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! V: N6 x4 S- E; v) R8 V4 g
- , n& Y9 G4 h& D9 K# r4 x
- dma_addr_t dmaphyssrc1 = 0;8 ]% P" P3 P7 R ?" M% f
- dma_addr_t dmaphyssrc2 = 0;0 Y+ \9 [7 a1 d; D7 D. m0 h: U
- dma_addr_t dmaphysdest1 = 0;
( M( y; y M: z1 b9 J) v - dma_addr_t dmaphysdest2 = 0;1 ?/ |& \1 X# n, K
* `$ Q/ s" V2 ~- char *dmabufsrc1 = NULL;
& B1 G% ^2 k# W5 e2 h - char *dmabufsrc2 = NULL;
* z0 z6 e1 w$ e9 p$ L8 _; B - char *dmabufdest1 = NULL;$ o- U8 R, c6 _4 H( a) a
- char *dmabufdest2 = NULL;
# z- _9 A9 @. @ - 3 W3 C2 u2 f9 `+ b2 ^. y+ o
- static int acnt = 512;" b% G. x5 j( X* L+ B" \! a
- static int bcnt = 8;
3 B q+ p6 T* ?5 i& m/ z+ P - static int ccnt = 8;/ x8 d8 K* U( U/ V' r
- * a, ^1 u u) O M* b% Y/ Q v
- module_param(acnt, int, S_IRUGO);5 Y; {9 F ?. E# f9 U; ~
- module_param(bcnt, int, S_IRUGO);" x' I! B8 A( r4 N+ S$ C
- module_param(ccnt, int, S_IRUGO);
复制代码
! e: n! g: W% o2 D: |8 c# C, T" | w& q' u' g) Q9 p% O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- u- L. x3 y; Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; G8 q d& g6 l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% s" w! Y- U+ n6 W/ {
! E1 c& f8 I6 \8 ]/ S$ K8 B# o# T6 q: @: o
|
|