|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 m! p; _" ?1 j7 v Y- [code]EDMA sample test application. ?" i# V3 Q1 d* f1 V
- /*
% J9 i& R% r8 g" g9 _ - * edma_test.c9 Z5 [ t, `8 s# p2 N$ \
- *" R$ B: A2 c0 g/ r$ R% A* I
- * brief EDMA3 Test Application; A. b$ C+ t8 ^. e
- *
1 }" U5 |; l% y2 F, O$ j - * This file contains EDMA3 Test code.7 P" C& a) `+ Y% e: U
- *
0 l5 j, R5 H3 U ?' I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 }4 ~/ ~4 D- m: _+ |! }, o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ t* h: j) h- b" X' K
- * TO CHANGE.
( _0 @6 m$ `+ K3 q" ? - *
4 V! b/ \1 T5 I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# J; ~1 d. b1 t3 s2 f% ~ - *
1 P& O; c/ v9 N% m( @! W: H - * This program is free software; you can redistribute it and/or) m# ]/ w0 P4 q& b; D1 D
- * modify it under the terms of the GNU General Public License as1 P$ Z# F5 ~, i8 l* e
- * published by the Free Software Foundation version 2.
( r1 P \+ z3 A - *8 j% E5 d9 H; u# |4 P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" ~1 P; W) S/ p
- * kind, whether express or implied; without even the implied warranty
+ G' b# V+ z7 k) [ E1 u, Z" | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; g$ v | B0 e$ ~% h - * GNU General Public License for more details.
6 n* y9 N; F* Z5 L+ C - */
) l# E( F0 \' O& h8 f( x
. b6 q; r/ z7 V5 R- #include <linux/module.h>
! x( ~! {1 H$ S! n - #include <linux/init.h>7 p8 q3 k) `8 \- K) g' h: j" w
- #include <linux/errno.h>$ v9 F9 z( B {$ I' p7 r
- #include <linux/types.h>0 U* S# ?+ ^7 O! Q7 o
- #include <linux/interrupt.h>
8 Z" g3 Y2 q5 M) A- {$ o* m - #include <asm/io.h>' z( ^$ L; i2 Z
- #include <linux/moduleparam.h>
( U- j3 K. ]2 R$ J - #include <linux/sysctl.h>1 H0 F+ J1 U+ R9 @
- #include <linux/mm.h>3 D, c3 k" g+ J U4 q) W1 I x
- #include <linux/dma-mapping.h>/ A% u5 P) g+ ?
0 _( H+ a) O! Y, Z- b0 H- #include <mach/memory.h>& |7 Z3 h- D. L) X1 ^
- #include <mach/hardware.h>
3 r9 A1 ~3 b" Q s+ [9 p* ]3 ^: j - #include <mach/irqs.h>
6 [$ k5 U/ d" y, \ r. w! x; O - #include <asm/hardware/edma.h>2 f! L. s) b, g% O/ H6 p
7 {; g. L X( T- #undef EDMA3_DEBUG
3 T: t& Y, J0 o7 x - /*#define EDMA3_DEBUG*/
5 ?2 [; y, h4 D8 S) `
4 i, T* D3 J# j" K7 [3 H* m: u- #ifdef EDMA3_DEBUG
( d8 J7 g6 }; c8 o' @$ R+ r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ M. o' b- m# y, _5 a5 q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 i! [2 i# y: a2 O2 ]6 ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 D9 p7 |2 Q6 u - #else( w2 v1 `' r3 v$ {0 k
- #define DMA_PRINTK( x... )% S# e! o+ O7 Q+ f2 H7 h
- #define DMA_FN_IN0 i' a. [ y3 q/ {+ B
- #define DMA_FN_OUT
& v( H* N- H3 P. Z2 [ - #endif
+ M- o2 t! k; S% E+ q - 3 |+ M* P8 t, ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ W( G5 W4 z5 `: R' w - #define STATIC_SHIFT 3
9 h5 p' m% d& H+ w0 n/ A0 w - #define TCINTEN_SHIFT 20( K, ~# p( n, x4 U) g! H
- #define ITCINTEN_SHIFT 21+ M) z y, k/ p) P( _4 R4 f' p
- #define TCCHEN_SHIFT 22
6 L9 c% D3 v: b# ?7 N) Y4 c1 S% c - #define ITCCHEN_SHIFT 23 d5 @+ L, x a& ]# W# Z2 ?
+ x; N! W8 N$ i7 k& D- static volatile int irqraised1 = 0;
- V5 g) g/ f! q1 k e - static volatile int irqraised2 = 0;
( B2 s7 j* w8 K7 g
8 L G) |+ I5 [" L2 U3 z: x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ c; g$ K& P3 w' [: S; j/ I1 P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! s7 C2 O; v8 |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 Z8 g3 |. x# E; C
! x3 A; S$ H2 o% M0 m2 ]- dma_addr_t dmaphyssrc1 = 0;% _9 Z6 g* O& A& u/ u; ^
- dma_addr_t dmaphyssrc2 = 0;1 F, q& n! `; |( z, B, @& c$ O- {
- dma_addr_t dmaphysdest1 = 0;
1 q8 v. Q( {0 c - dma_addr_t dmaphysdest2 = 0;
0 K! c5 E. I6 t, y; f% e - 9 N% M" ^/ z6 w& q( i- W
- char *dmabufsrc1 = NULL;5 I, o1 J" F7 n( [8 L) w t4 [3 ^
- char *dmabufsrc2 = NULL;
8 _4 V; `) D, n7 [, Q - char *dmabufdest1 = NULL;
) |! B8 ^9 z' r8 x! q; b/ _ - char *dmabufdest2 = NULL;
/ I- G" g; }) A9 a1 }9 v
x! N. _! d& w9 W, o+ _- static int acnt = 512;
0 p6 v+ O! Q8 i6 C- z - static int bcnt = 8;
$ u$ E* o6 v! o7 I3 g - static int ccnt = 8;
* E5 C" `( l8 n8 a7 h' w - 8 [7 C( K F% S
- module_param(acnt, int, S_IRUGO);- |2 j9 @# {' h3 _3 m4 D) T
- module_param(bcnt, int, S_IRUGO);8 Y# W: ]& G* U7 ?: o
- module_param(ccnt, int, S_IRUGO);
复制代码 " m' O- f7 R5 ]# h$ ]
2 O; _, s0 j4 I, R. I; R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ u0 B, ^9 l: Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 g* h- N- G6 `- [+ B" A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 c: z2 q# P7 s* ]5 b, z
; H3 u9 c' p. u- R* A4 \6 a3 R- [
- |+ m) R0 _, X: U( c |
|