|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 K3 r7 \, ^1 B3 c6 P6 l
- [code]EDMA sample test application% J9 s1 O5 q1 _4 O
- /*
6 h% y* ?9 M; N) Q. E - * edma_test.c
5 X* w' z6 }$ a1 x- |$ P- U - *
. L& p* ?( K" V6 }4 y: [# Q - * brief EDMA3 Test Application* T8 f' a3 y4 V8 @
- *; L! @; M0 p; g" j! a/ G5 X2 b
- * This file contains EDMA3 Test code.1 o8 K4 n" Q: S/ u, ^, i& b# g l
- *
, z9 `% V- X( F4 ^) O! ?/ M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ v O- R" B1 p0 r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ j. Y" ?7 t0 J0 r" N7 \ - * TO CHANGE.3 Q0 g2 o/ I* @$ o
- *8 k* N2 n. @7 c2 w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" K9 J2 x. }( ]3 \. W) Z
- *! a+ `1 X# _3 m
- * This program is free software; you can redistribute it and/or+ g" ]1 a$ n) ]+ d( b& _
- * modify it under the terms of the GNU General Public License as
( e% _$ p& |- |6 Y1 Q. d$ h - * published by the Free Software Foundation version 2.2 P3 L- ^5 c& W( W0 s0 ~2 }
- *
) c3 n* V' U5 ]- Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 L# n# c6 o% v
- * kind, whether express or implied; without even the implied warranty9 T2 P1 T3 a: S2 C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 [( V0 S# }. ] - * GNU General Public License for more details. s. o! K& M- d; C: k4 ~5 T5 l# M
- */ a9 t& ]5 A8 R, v8 A* d
0 v" G6 A! Z" e: P- #include <linux/module.h>
" z4 e" [* M8 s: H' g2 }1 |; a - #include <linux/init.h>0 J' a0 S! z3 [% K; ~2 T
- #include <linux/errno.h>$ j$ n) k! u) O1 K7 T4 z4 P) n+ A
- #include <linux/types.h>
1 [7 ]* T0 N+ G `$ f9 b. Q - #include <linux/interrupt.h>
. Y6 B8 H M* _ - #include <asm/io.h>- L; U7 V ~* M3 ^" b, o. K
- #include <linux/moduleparam.h>
% Q- ?9 ?( z0 }3 G3 e s5 G D, d; R - #include <linux/sysctl.h>
" g" F8 v4 n5 o y: w ^ - #include <linux/mm.h>' V$ q; Y7 T/ B6 j( D6 D
- #include <linux/dma-mapping.h>
% O+ {2 x8 y) F8 [
# W; x% j* D4 E3 n& ]- #include <mach/memory.h>
5 [/ j- H, K: \2 _- P, h% c - #include <mach/hardware.h>/ V" K) ~$ Y- g, R) a& B) [6 q) F$ ?
- #include <mach/irqs.h>
+ j/ [6 Y* W6 l( B7 | - #include <asm/hardware/edma.h>
$ Q4 `/ W5 N, s" H" Q - . j6 g5 s& \+ ~" j" z6 b/ X
- #undef EDMA3_DEBUG$ M1 |5 _ b% Q
- /*#define EDMA3_DEBUG*/# \ j6 N' U$ Y1 h- r0 Z
& G5 u1 y8 D7 j, W& Z- #ifdef EDMA3_DEBUG
. O: T2 Z* N: m& a8 k3 y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 o/ {4 S+ }0 y0 @( i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 G8 g4 L; e6 b4 t! u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& a5 h2 D5 a3 D2 V1 P; ?- R - #else9 n& M# j4 U" i+ H4 U. U0 j
- #define DMA_PRINTK( x... )
i3 ^; z6 C0 x" L$ S - #define DMA_FN_IN: D# k4 S- s2 T0 I) Z/ B# J+ }
- #define DMA_FN_OUT; H' ~+ e. ^# k
- #endif
1 c4 k* c* b* l/ l
% w" }' `- z# }' M8 x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# q5 k) u+ k/ s, a* [ - #define STATIC_SHIFT 3
; s; R, E* G# p" a - #define TCINTEN_SHIFT 202 J7 q5 O' m( Y9 M; T' ~
- #define ITCINTEN_SHIFT 21$ R5 K2 r* o. v. J& @: L
- #define TCCHEN_SHIFT 22
2 G) i. m, b$ R7 h - #define ITCCHEN_SHIFT 23
! a6 c; I. h' ^ D$ h" d; I1 O - ) M/ g$ a8 a, u+ }* @ q
- static volatile int irqraised1 = 0;: D. t- n7 |% y; W- ]5 p
- static volatile int irqraised2 = 0;8 P' _: X6 B' y& N) `* A
- " }0 s! r8 T% B7 i' w* r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 }: q* y2 s8 M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 R' L$ g2 o! E, }1 |& c# _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
[" \# O/ N, ^ - % k( k3 |, G: c9 c
- dma_addr_t dmaphyssrc1 = 0;1 _ x5 \1 [! j6 p' H
- dma_addr_t dmaphyssrc2 = 0;7 V; s. a. a, y
- dma_addr_t dmaphysdest1 = 0;) a V- e% J. @) A2 F
- dma_addr_t dmaphysdest2 = 0;8 U$ o* m7 n9 I6 a7 }* z
- / _/ [" W; W+ Z
- char *dmabufsrc1 = NULL;; _3 u8 ]" H! Q9 r: n$ j7 |3 D! J
- char *dmabufsrc2 = NULL;6 w% F$ b; _2 Y+ r0 a, w$ P; j, I
- char *dmabufdest1 = NULL;
* k0 {8 I8 `6 p8 K; d4 @7 X - char *dmabufdest2 = NULL;2 Q! `0 Z# V" V8 m$ J
7 K" Y8 R9 C- Y, Q- static int acnt = 512;: h5 j- ~7 T B
- static int bcnt = 8;) c* ^2 v" M) o O; M- S
- static int ccnt = 8; w4 X. | _( Q) Z! M9 @
- ) _7 Q5 e3 p" B2 R4 W3 E" m
- module_param(acnt, int, S_IRUGO);
! H/ V) G+ C9 e: j! r - module_param(bcnt, int, S_IRUGO);
7 Y- G" a. D# L% a' i - module_param(ccnt, int, S_IRUGO);
复制代码 8 V: W! y4 L0 ]. H3 V+ N$ n# Y/ y' ]
4 Y: n. b9 U, g7 l, Y8 `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; R h$ Y, Y+ N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ U- {3 [- l ~5 s" B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' y. o2 ? b; \: D
& J4 H( p! ?$ T$ I
% C0 O( X2 \# x) s |
|