|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( m. b* f. K- |: x1 _- q- [code]EDMA sample test application
# d/ q |5 s! T8 ~2 F& F( }7 V1 q - /*
# p( C! [* c/ L0 K( j2 _ - * edma_test.c
1 I2 A* h4 f u - *
+ j- \& D3 h, v3 v* c5 E' o* I, b - * brief EDMA3 Test Application! d2 {, b, P" U4 Q! T2 h
- *
9 o5 x! g5 _8 x8 T# L - * This file contains EDMA3 Test code.+ N% }" m) f* x! E/ B4 c7 m. [
- *, J* l7 v3 G a& b6 y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 m/ X3 i/ ]! s1 c0 ^7 Q% ^' m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- G4 _9 G- c# q' U- R# W
- * TO CHANGE.1 t, `5 H$ f) S- r% C" B, N1 X
- *
& \* C+ f7 O! }3 D4 o3 ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 x: R8 u: Y6 G/ O* e! _
- *( E# \6 R4 |0 P ]1 Q
- * This program is free software; you can redistribute it and/or% G w: e# \5 F9 Y
- * modify it under the terms of the GNU General Public License as
9 `3 L8 u( O3 V. t' Y5 s( h/ l4 x - * published by the Free Software Foundation version 2.
& N) p" _( d0 A& V1 @/ Y; R - *
( _2 b9 d4 S: j1 \. V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 ~ ~! [6 y- m3 M
- * kind, whether express or implied; without even the implied warranty, }4 U4 N% u8 n+ h. @# x D$ {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) V2 Y5 G5 n& k7 h - * GNU General Public License for more details.
9 K0 s( a9 J0 x2 m - */
, U5 }; e% i( A' h) f$ s - 7 D- G$ c! \' x+ b) ]8 P& y- ? ?8 {
- #include <linux/module.h>, B& C4 k: _3 J, E, z
- #include <linux/init.h>$ n/ d5 H3 R0 B, }9 N
- #include <linux/errno.h>
4 b& o/ x0 G+ W* }0 ?3 H - #include <linux/types.h>
$ `/ Q+ \- I* P/ h* {$ {, P - #include <linux/interrupt.h>8 p" x ^, _: k# V% Q, F0 W
- #include <asm/io.h>& A5 U; ~/ A$ [: W" \
- #include <linux/moduleparam.h>; o$ @) B u* d: f0 G; f
- #include <linux/sysctl.h>' @4 Y, | X( C6 k$ F
- #include <linux/mm.h>
! i8 q) N- X# k+ |5 ]5 M - #include <linux/dma-mapping.h>, N8 r3 q, f# `/ i' O- U
- ! R5 x; ^7 G: u% E) u
- #include <mach/memory.h>4 e1 T9 K' {9 ^6 h/ {
- #include <mach/hardware.h>. f( M; M2 x" i6 M D
- #include <mach/irqs.h>
1 Z8 `/ M' z0 j3 Q, k - #include <asm/hardware/edma.h>- l! z3 Q) p0 p. \( t, a+ j) p0 m
' W& O" u; [# I5 F& e1 R- #undef EDMA3_DEBUG( _- a. R) R- m \
- /*#define EDMA3_DEBUG*/
+ q" V: r) y3 j0 s' ^( y8 W* Q( E
2 ]" j9 m) k. I! |- #ifdef EDMA3_DEBUG4 d) W; N9 Q6 J+ _4 H, Q8 D; t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) w0 e2 |4 N9 u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) w" B7 j" ~0 c' L; I+ z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), V0 R+ k& }. `: }( k% r7 m" k
- #else6 n/ @! B' K% B/ ?
- #define DMA_PRINTK( x... ); {/ M3 m* ~3 ^. n' g2 ?' k
- #define DMA_FN_IN
; X$ K/ R! ` v1 a. U! u - #define DMA_FN_OUT
1 b; p+ [: ]. d$ F: n - #endif
`" Q% D7 C( }: ~& |( l
. L1 c8 [3 L$ q1 ^ f) ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! c$ Q8 E* E# V7 q' Q - #define STATIC_SHIFT 3
^. L" X h/ V5 F' \) Y7 A - #define TCINTEN_SHIFT 20
# h- t/ ^: z4 r ^ - #define ITCINTEN_SHIFT 21
, L8 Z v( a h - #define TCCHEN_SHIFT 228 F8 \) d8 w) @8 h7 G
- #define ITCCHEN_SHIFT 231 n9 i7 _1 H+ M0 E, N$ `
- / p- e4 w/ G5 s
- static volatile int irqraised1 = 0;' A0 O& g+ K9 N! X' l2 l
- static volatile int irqraised2 = 0;
7 f/ [3 r5 y- r# n. P! I! z
6 U% x3 i- V f, E+ _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 u* |5 ^& H7 K; r$ o7 J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- f8 }6 L& }# g; k3 o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 r5 ]; O, w% J8 x2 n! o9 g, t% g/ g
1 \ q: v- U. T- m- dma_addr_t dmaphyssrc1 = 0;
- x* ~0 [5 z P" ]4 e - dma_addr_t dmaphyssrc2 = 0;
) O( a5 V8 o P. a, M - dma_addr_t dmaphysdest1 = 0;% S3 N% E M; C- z
- dma_addr_t dmaphysdest2 = 0;
3 ]/ v$ Y0 C8 o# g
9 J$ T5 `5 ~1 I; \' \- char *dmabufsrc1 = NULL;
: T5 F& y! Q. w, o- l - char *dmabufsrc2 = NULL;
1 E$ B- Q4 W9 Y. T0 L$ U - char *dmabufdest1 = NULL;
3 {$ B. }6 E/ ?# |* q" k- U0 o - char *dmabufdest2 = NULL;
$ ^" e4 u1 `2 f9 d
3 @. Q2 A5 r; ~9 T9 J F: D- static int acnt = 512;
( P, r7 I/ m$ k k( y - static int bcnt = 8;
% q. b) N! a" A; E# M' A7 E - static int ccnt = 8;
1 ^8 i R" H8 y$ A; Q( d - 0 f9 r. L" d" j2 O0 ]
- module_param(acnt, int, S_IRUGO);
P+ C- n5 A2 [8 K/ t q - module_param(bcnt, int, S_IRUGO);
% I$ \& R* {: s" d) ?, N- }$ t - module_param(ccnt, int, S_IRUGO);
复制代码
$ ]9 J* E) j8 j# ~: S4 S
- C1 ~% k' c, u! ^$ L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; A V1 z! i& L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- h+ C# u! \. _# `4 {3 f3 T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 j1 r. D3 D0 @& ]4 `8 C$ V; y
8 r9 e3 |* Y+ K, t5 [! g' }& B0 |
|
|