|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& J: O3 T0 n" M4 w2 p- [code]EDMA sample test application- j7 w( f4 N4 |2 g& p
- /*3 N9 H8 Q1 I$ L4 k: r S
- * edma_test.c, F* N. M0 V& {/ W/ V% k9 \
- *6 o5 i c* E ~+ M8 S
- * brief EDMA3 Test Application
5 `; h% _- K- `; D - *
' e2 p; B W- B' X G* k: z) w/ I - * This file contains EDMA3 Test code.7 R6 j; h: X2 ?) a
- *- \+ ] N$ I& E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ b8 l; W$ r) @8 i+ `* |* Z& v0 q- ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* A; L% H- Z4 Z3 n% ~- }% [ H
- * TO CHANGE.
# j' w+ s8 {" W. e - *
* U5 W6 h2 o) c6 e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: K' `% H* L! }3 Y. ^
- *
7 U8 a: e" N: Q - * This program is free software; you can redistribute it and/or
" y* P9 O% ^6 D# e& T" X - * modify it under the terms of the GNU General Public License as: \- n' Y2 Q% M: U. z5 `9 i
- * published by the Free Software Foundation version 2.
, v, \5 c" J/ z( A - *! {$ i9 A/ |4 R" l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 e! V9 ~. {( J f; ?
- * kind, whether express or implied; without even the implied warranty
4 O7 F) f! F/ d# r B8 Y& h$ ]! _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 s: S$ }$ n3 A8 g - * GNU General Public License for more details.6 C! m* K# \. E [; {/ z. t
- */
- {, o3 `( x$ a9 h; F) C
0 n9 g @, O2 M% J! P3 M- #include <linux/module.h>+ e# p. Q; t. I* t5 l$ s1 B' Q+ F
- #include <linux/init.h>) {) W& h! x8 J) K
- #include <linux/errno.h>$ v1 Q% G0 r7 m; j0 W1 x" M6 T
- #include <linux/types.h> G b$ C. P4 Y' G" w5 ?
- #include <linux/interrupt.h>
- z; R7 m& s7 O& t) I$ Q( [5 e - #include <asm/io.h>' v( S, x- ~. T1 E: x
- #include <linux/moduleparam.h>: u# \( j( K- j. Q8 E: t9 J
- #include <linux/sysctl.h>$ U. J b" Y+ c# R0 W" d: e) E9 `
- #include <linux/mm.h>
, _3 |# l" _0 J) M - #include <linux/dma-mapping.h>- B) `% t5 ~1 h3 Y8 E9 r* c6 k
! z( Y- ?- n ]$ ]# e$ D' y- #include <mach/memory.h>6 |' n$ s4 J l& y
- #include <mach/hardware.h>
( j2 ^/ A3 g% P0 l" o - #include <mach/irqs.h>" k2 L* F. P( h' I x
- #include <asm/hardware/edma.h>: c" t( C" C3 E4 ~1 i- C
- * _6 h( R1 y3 Y: a
- #undef EDMA3_DEBUG
& V+ R+ L. x5 C6 P - /*#define EDMA3_DEBUG*/& A* |4 ?; g2 E# n5 K; K5 q; S
- o, x! \% u* Z6 s' }! T8 y- #ifdef EDMA3_DEBUG7 h2 x$ F+ S, W3 C, k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 d- x c l+ }1 E
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- T2 q# ^; @% B0 d$ F8 M6 {. V - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ H4 p- G* t3 q% W
- #else1 T3 F% D9 F. ?
- #define DMA_PRINTK( x... )# z9 F, H, i6 c. V# h
- #define DMA_FN_IN
3 G; V i. q2 o0 _ - #define DMA_FN_OUT
& e; E' ^) }# | E$ L/ q - #endif- V& j1 h: p0 q+ f7 f5 o& D& E$ q% m
& [" p: k& a4 u J4 p p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- o: F8 h# M) x. Y9 I( G - #define STATIC_SHIFT 3: N, ?* `3 b% q1 l1 E
- #define TCINTEN_SHIFT 201 W4 m ^* ?( t7 T+ O# o! n
- #define ITCINTEN_SHIFT 21
K$ j" @% f! p3 v - #define TCCHEN_SHIFT 22$ j& _" L" S& L' a- ^
- #define ITCCHEN_SHIFT 23
: l1 [+ p- @( S# J. j - $ J/ l. R4 I: l5 i7 m+ X
- static volatile int irqraised1 = 0;5 C; ], n& r8 ^7 o- K/ x% N( y
- static volatile int irqraised2 = 0;7 ^5 x8 p5 @% |6 _- L
8 H- W* h4 |( e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 J! \( e; ^8 G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) N: _4 R" |: H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ {1 v5 q% y4 T9 C3 _) G; _
: k) y; g5 i' o( `7 O! J8 r- dma_addr_t dmaphyssrc1 = 0;
- a) j3 L7 O8 q# i - dma_addr_t dmaphyssrc2 = 0;% q. w0 u) y" ~3 J* R. X) N
- dma_addr_t dmaphysdest1 = 0;$ ^+ y+ c! l5 ]! p' l7 |0 c
- dma_addr_t dmaphysdest2 = 0;7 W9 e! w% r, z$ }! J4 L9 ?3 D
- 1 K+ C9 Q9 D. D" d; \- y1 q1 C
- char *dmabufsrc1 = NULL;% b+ O' a/ z r1 g: f$ f4 j: l8 g
- char *dmabufsrc2 = NULL;6 t! t( N+ Z* |& r
- char *dmabufdest1 = NULL; X3 ]- Y z$ A+ b1 w5 {1 U/ l
- char *dmabufdest2 = NULL;' e& u. j3 `; L5 h, `/ l7 o- I
- : e% U+ @0 _6 z' ~0 c" [
- static int acnt = 512;
3 C* ~7 h; I/ G6 s - static int bcnt = 8;4 C J4 z5 j$ R+ T ~0 o- A1 X4 [
- static int ccnt = 8;
2 C7 ^; d+ W0 V/ w+ q1 f8 U
$ A6 {; D1 l! D* S4 i- module_param(acnt, int, S_IRUGO);
: F: C g8 }! C. O) ]. \$ f6 t - module_param(bcnt, int, S_IRUGO);3 c) i$ a" U& r
- module_param(ccnt, int, S_IRUGO);
复制代码
) }) {9 ~4 Y; J+ H
7 X9 e. E5 d$ \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- t) O. p2 T! J+ V5 [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
V0 p( _- O p9 ^) a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 G6 P' }2 {0 j: Z( p9 ?% s! B$ c, c! g# ~
/ {1 h$ C/ [1 F; D$ ?
|
|