|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 a' S# [4 U1 m2 u$ b; [
- [code]EDMA sample test application# v o) l8 ~- n$ a; B- U7 d
- /*1 Z5 P% t# z* e8 I' C6 L: F
- * edma_test.c2 }3 s' B/ V# k
- *
/ f" i$ _% X1 V; y- V5 [4 D/ t% D - * brief EDMA3 Test Application$ E* S) ^: _1 E( e1 j6 x- O
- *
9 i+ P7 C* `1 [ - * This file contains EDMA3 Test code.0 ?2 n* j' M4 h. z5 \) f
- *: O. a* ~6 `; |0 K8 T: I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ ^" U4 a8 c+ Z1 p: P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" t* R3 `2 g t
- * TO CHANGE.
4 v5 q; I3 e& X+ X - *; g9 S% L& {: @3 _5 q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 V) |( }4 N& b% T* |
- *7 F( E% H* }1 U0 [' m5 G
- * This program is free software; you can redistribute it and/or
2 F' y1 G# q3 c. S5 E' r1 h' f - * modify it under the terms of the GNU General Public License as
* s5 f ?4 K2 a3 J2 F - * published by the Free Software Foundation version 2.
( b0 M4 U; T6 A, U3 O8 _1 J z - *
$ w0 U, p: N) i/ F: \1 u. \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 @4 Y/ n' D6 C; W - * kind, whether express or implied; without even the implied warranty8 e! k$ `0 y8 ?! H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ |5 {# P* u6 J" Z! L' c9 d" j
- * GNU General Public License for more details.
/ B ^, C% J2 x1 L9 G4 N9 }9 Q - */
9 n( B# I/ u" Z) T" E1 H - 1 b; b! u9 w3 ]- K7 n* K
- #include <linux/module.h>; f( i3 H# J, [ T! w
- #include <linux/init.h># n( E+ T' H7 e4 i" R! \
- #include <linux/errno.h>8 K7 F' I$ z% M0 b% P( @7 Y
- #include <linux/types.h>
( n3 J( \2 U3 C( k - #include <linux/interrupt.h>' e+ n; Y$ T3 l: E# _) M+ k$ q
- #include <asm/io.h>
) a- I, P: y7 E( l7 \. B - #include <linux/moduleparam.h>6 Q V' Y" Y# a: y" R; z! D0 E
- #include <linux/sysctl.h>
( d7 n9 ^ e" v - #include <linux/mm.h>
) t# ?7 }6 v& A$ p - #include <linux/dma-mapping.h>2 ]" t7 A2 U- d4 I: v! d7 ^7 u
" U, ^/ G* q: j0 c- #include <mach/memory.h>" m( L5 o$ e3 X, Z/ u, E2 q
- #include <mach/hardware.h>* F0 M3 M2 a* o4 v! s
- #include <mach/irqs.h>
. N9 A) L& u* Y7 R( L; n: L4 R5 Z - #include <asm/hardware/edma.h>
8 m) S4 |) I# \# y! p - ; L# I- }. V/ o. p8 x! {7 N0 m# q
- #undef EDMA3_DEBUG/ ]) U. K3 \+ v Y+ F% J6 ]- f. w
- /*#define EDMA3_DEBUG*/6 B) @ F0 M+ x2 F
! T: x( f& {( | w- J( D- c; V- #ifdef EDMA3_DEBUG
, F6 B+ J+ K$ F! Z$ {4 o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% [+ B4 N b3 W% d- V* u* |$ s' F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 H- Q5 ?9 z. c3 ]' d5 g/ w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& r7 c# F1 V( t0 a - #else$ Q% B+ u8 S) Z" G+ F! q; B
- #define DMA_PRINTK( x... )& L3 t$ `& y1 Z! x, S* ?6 M
- #define DMA_FN_IN7 [2 E* X0 y- g5 v+ |! r
- #define DMA_FN_OUT% Z7 F3 w" v* f$ L3 p1 Z9 p
- #endif1 ?# x0 C. j) j# @) L ^6 S
- 4 y2 Y. N Q9 r; ]. k; \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; Q6 q, u$ b$ a2 ? - #define STATIC_SHIFT 3
" ^* _! V9 h9 M4 s/ k# {6 Z - #define TCINTEN_SHIFT 20
5 a B4 N+ P$ r4 m, G - #define ITCINTEN_SHIFT 21
! c$ e: o- H9 T, E4 D - #define TCCHEN_SHIFT 22
) h- ?3 ~1 K+ W3 H3 Z8 a - #define ITCCHEN_SHIFT 23
. x2 h4 |% Z: `2 o
5 I% x% g7 ~0 u# m- j6 p. W9 d8 ^- static volatile int irqraised1 = 0;
! ~& ]7 L' ]8 u - static volatile int irqraised2 = 0;% p+ O0 X& e; H( ^ v1 t/ m5 f4 Z: b5 c
; L9 D# K/ A7 r2 f I( a# c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) j0 Y3 {3 B% Q9 ?. l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 A1 x3 V7 A k w2 R9 Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% W5 E" r8 U' r: `8 {) g/ F* p
, n9 h! L e' D0 \( {; R& j; o' I- dma_addr_t dmaphyssrc1 = 0;
4 G7 u/ }, j% r. H - dma_addr_t dmaphyssrc2 = 0;
" d/ g6 E# C9 ], H: u# Z. l - dma_addr_t dmaphysdest1 = 0;
# n* |; f5 u9 C - dma_addr_t dmaphysdest2 = 0;
/ R$ ~/ l: f' r, ~7 s - Y, a! I- I" b& u k, y9 w) \
- char *dmabufsrc1 = NULL;
# n/ P1 d! _, S# B5 B - char *dmabufsrc2 = NULL;
( e4 i0 x t" ~7 { - char *dmabufdest1 = NULL;5 h2 h3 G8 y$ \3 S s; N4 z0 x
- char *dmabufdest2 = NULL;3 x9 y/ ]( v6 c
# A2 ^& X) y) D6 ^8 d) N( x1 E- static int acnt = 512;3 B( T: G) e* ?2 ]0 E
- static int bcnt = 8;
F r3 b7 @ { - static int ccnt = 8;
7 w- Q5 y- b6 X - ; l, f6 B& @) \0 X& F$ t# P
- module_param(acnt, int, S_IRUGO); Z( e* o) \) l4 d+ D. S! Z: @) C
- module_param(bcnt, int, S_IRUGO);
! d: N& L) E; N) k; ` - module_param(ccnt, int, S_IRUGO);
复制代码
1 u1 y* g/ W X) O7 Z. n( x; z$ F4 E0 y0 O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ R3 V9 I, a( k7 V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. n1 e1 O2 ?( e8 Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 |" C3 k+ b. e/ }5 M& p5 i
- H+ M1 g- P( Z }* d# ]2 O- g3 r) ]! ]: ]" E; j$ n
|
|