|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' _# _% p9 H0 S* Q
- [code]EDMA sample test application
% P [ J5 X, I$ x - /*4 ?. _1 {8 Q0 A( j, ?; ~
- * edma_test.c
# n0 O9 S8 }, W6 W5 M1 D/ X% I - *5 e$ C' ~' h9 p$ W6 G7 v4 w0 }- P
- * brief EDMA3 Test Application0 ^3 v9 f" T6 V( ^# F
- *
% ^6 L! ], v5 {% Y" O! b - * This file contains EDMA3 Test code.8 D1 E7 C: S3 W, ?$ L
- *
! s% a8 a( S$ Y' Z4 }( L+ ]7 }7 { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 Z9 _) C; C+ c4 e7 J( l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- r- O1 d) r* t$ G - * TO CHANGE.
1 J# t6 |! y- Q* \ - *( H4 A7 }% E! @1 ?: v9 z f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 f' y) o7 J0 U3 D3 R - *
4 _8 l1 y* Q/ g* x8 @ - * This program is free software; you can redistribute it and/or/ m: ?1 N0 l, H" G
- * modify it under the terms of the GNU General Public License as
T K! o8 F0 { - * published by the Free Software Foundation version 2.
: B: \. d& A3 ~- f - *
1 q9 _% M+ ]; B$ c: S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* ]1 t& r/ @7 V" l( [; _ - * kind, whether express or implied; without even the implied warranty% e( ~7 M) \% h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 t' f3 r* B+ i d: p4 H8 z! L1 ~
- * GNU General Public License for more details.) d, X7 k4 ~ U
- */. ]/ W! z* v# b- F( G+ W! w
- : n& b8 F8 e* s' S) p1 W( L* O
- #include <linux/module.h>
9 D _7 z1 j) b2 h8 W - #include <linux/init.h>
/ R ?' i2 {5 }! N7 ^5 y& M0 M6 j - #include <linux/errno.h>- P% S! ~5 `8 n3 |2 k& U: E5 e$ q
- #include <linux/types.h>9 N L! t+ e0 C# C, ~9 \% z
- #include <linux/interrupt.h>) n# L( ^) K8 b0 I$ z
- #include <asm/io.h>, ?- `9 Z( W# Q0 n" U. S
- #include <linux/moduleparam.h>
6 o9 ~' h3 w8 |2 q - #include <linux/sysctl.h>0 i5 z6 _% e) D1 K
- #include <linux/mm.h>
# V6 \! b- ^) ?3 ^ - #include <linux/dma-mapping.h># w1 Z4 k) F9 T
3 w) I& H1 C! H# I) u& k- #include <mach/memory.h>. Q7 K6 `" M, M6 Z! p
- #include <mach/hardware.h>
- ]0 X9 r6 Y B# O* O" z8 K# N - #include <mach/irqs.h>
- ?) L% p- W$ R& Y4 K - #include <asm/hardware/edma.h>7 J+ \7 B* l4 S( [
- 1 Y( \9 N* j9 B; u
- #undef EDMA3_DEBUG9 z( {8 P* {$ x4 l; U% e
- /*#define EDMA3_DEBUG*/
5 |* {; F5 T9 u* W, M - 1 @% A* ]) x' V2 f, K; N+ e7 ~
- #ifdef EDMA3_DEBUG
$ o4 n7 p; G6 h7 T9 K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 m$ ~9 W) n# m! Q- ^7 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% o; ^1 ~2 v. Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" W- v9 m; H* x" `& A+ z1 h
- #else
0 D8 w z( N/ p/ V - #define DMA_PRINTK( x... )( M4 @# l: R+ z% t
- #define DMA_FN_IN
- a* P _2 \9 k* s# _ - #define DMA_FN_OUT
) {8 [5 b' R( B3 m8 C - #endif% \5 b3 ~; n9 y. a# `0 ?& U
- 0 Q& a8 E8 T, ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" F0 v4 l& p8 R' H" L5 x2 I8 d - #define STATIC_SHIFT 36 [ l+ u4 a& [5 {: G
- #define TCINTEN_SHIFT 20. L( W/ c" x9 O! `8 h$ W) d
- #define ITCINTEN_SHIFT 21* c" y0 ]* ~* I$ R. W, G* ]
- #define TCCHEN_SHIFT 22
% \. `! u2 V9 P* Z0 z: Z- ^ - #define ITCCHEN_SHIFT 23
* x6 o/ I5 g* |% I - , F+ Y t/ y! _4 ]! v
- static volatile int irqraised1 = 0;
0 h0 P1 t4 H2 X; r) h - static volatile int irqraised2 = 0;
1 O* X3 x* N0 N& {# {( q) P - . p8 n" H/ e' u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. z3 }% y! ?5 y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, H, b0 r/ T; U1 B2 }4 ^% G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( U! p8 X2 m! c: o" q$ c
- ! D( ?( W% n$ t" e/ t5 Y
- dma_addr_t dmaphyssrc1 = 0;% g7 c# C$ g& N, R) I
- dma_addr_t dmaphyssrc2 = 0;+ Y! A. p! @- G
- dma_addr_t dmaphysdest1 = 0;
8 V/ g' C4 n0 S j8 E - dma_addr_t dmaphysdest2 = 0;
. o* r ?. g1 q3 I5 ~& Y - / q( g- G$ M' `# o1 S4 M4 j
- char *dmabufsrc1 = NULL;- G& e9 y c5 U1 c5 S! y8 T
- char *dmabufsrc2 = NULL;: p0 T1 L& ^% G# o) E6 k: x1 F
- char *dmabufdest1 = NULL;
e5 b' Q0 o2 N$ m# q3 O; E - char *dmabufdest2 = NULL;% D# @+ A% l: Q7 R N' I
- $ [3 k) Z6 j/ }+ B @
- static int acnt = 512;
& K% C2 u ~4 G+ w; M - static int bcnt = 8;+ Y5 Q3 u4 ^, p- V% r" ^! a
- static int ccnt = 8;. g) @9 p: [0 f- A
) V/ [/ W, _ S5 I( Y% n- module_param(acnt, int, S_IRUGO);
" D# V' u: r( n: d' u2 O - module_param(bcnt, int, S_IRUGO);3 }( U1 d. G6 c
- module_param(ccnt, int, S_IRUGO);
复制代码
2 O2 A3 T( M; ]3 e5 k
' @1 H2 w5 F% {7 [2 W/ j4 @ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 a2 S. D% U, g+ z1 ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& X$ q% C2 C+ T( c; G4 M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 E; l, x& m$ \ \3 N
& ~% y# a3 w! [5 Y
: i" {& \& ]& R: E) E1 u8 u |
|