|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) Y3 h( C: c, \2 O/ E: P- [code]EDMA sample test application# h4 t0 L" C* U! j8 B" M
- /*; o5 A0 n# k* u( s6 L7 O
- * edma_test.c
+ ^9 p6 k/ y7 x - *( n* K9 ]# `8 }0 T5 g1 [/ @
- * brief EDMA3 Test Application
' s- f" s0 W! d" F - *
; n. x8 f: g( F* Z - * This file contains EDMA3 Test code.6 J* }# z X2 S) W$ N
- *0 q y. w3 Q& Y x: Q/ Y! c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. O) e8 |; A, e& v: n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 V; } v% j. i. b
- * TO CHANGE.
, u+ ]* `1 d' a2 q8 T7 O - *
1 S" g3 G N2 P3 d: U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 @' |% J# l' {" V( \" D
- *' g. l- B% e0 |6 Z3 v
- * This program is free software; you can redistribute it and/or
& [7 z; B! B7 Q: n2 t) v% a - * modify it under the terms of the GNU General Public License as5 Y4 I1 m7 @( C
- * published by the Free Software Foundation version 2.3 M6 ?8 e$ e0 U, P$ R/ {
- *
- o1 h/ A: l7 P0 o0 n' T% G! o7 Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 L6 b' h8 s/ c+ X - * kind, whether express or implied; without even the implied warranty5 s2 G. L/ q/ e$ R' Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 H; o2 x; H0 U" W* r1 `: Z - * GNU General Public License for more details.
& o* g1 V% P5 N( K- m - */8 \6 c: O. d: `9 U U; b
9 ?/ u3 ^) I% \+ y5 O. o- #include <linux/module.h>/ P# [# A$ ~) H# h( r2 S
- #include <linux/init.h>
6 s7 a' N" M/ J; a, Q - #include <linux/errno.h>3 j2 Y+ w8 B# r0 i3 }
- #include <linux/types.h>
5 x3 i) C# c0 j3 s3 s - #include <linux/interrupt.h>
$ c, h6 C$ `) s. N - #include <asm/io.h>: N0 ~ i" {; F+ h
- #include <linux/moduleparam.h>
5 I/ |$ @' X7 Q3 f' V+ ? - #include <linux/sysctl.h>$ D) f/ A5 z+ C* S$ k- `
- #include <linux/mm.h>
0 f1 t m/ b, Y: o - #include <linux/dma-mapping.h>7 k/ l$ B! U1 X2 H3 l5 k. O
' o- Y6 Z ]" V! J& J, ~. M- #include <mach/memory.h>2 U) s+ v- i1 D4 e! F4 D
- #include <mach/hardware.h>8 u6 T) e) z/ G# B
- #include <mach/irqs.h>' A$ V7 F' L0 f! p8 ?$ I
- #include <asm/hardware/edma.h>
, s1 c& d; t6 l% n8 X u
/ e# w" l/ P% _2 ^- #undef EDMA3_DEBUG0 e J; S6 Y h9 B; e" d/ J
- /*#define EDMA3_DEBUG*/
5 b7 Q2 B9 }. O1 v. m$ H- G - ; n) N9 c0 b9 v. B2 q9 b
- #ifdef EDMA3_DEBUG
& L2 \8 w1 w, Q, {! S) ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 c: C+ w2 w9 @% j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 K" g9 Z% a! A' ^& T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 B1 `1 ~1 @/ i - #else
3 Z- D9 T" d+ g0 i/ P" g - #define DMA_PRINTK( x... )" F0 e+ M4 F2 j& M4 j% f
- #define DMA_FN_IN- h5 L7 A J% m/ v
- #define DMA_FN_OUT
! |4 t1 t& e6 t3 z$ _/ d - #endif- u$ s& D; i8 m; e' Q3 N) _! {
- 4 O1 y% M- j) r F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* h: ? v% p5 c( ^- u5 V6 r - #define STATIC_SHIFT 3
0 H& H& o/ z( _' z, J$ ?/ G% e - #define TCINTEN_SHIFT 20
" }# c3 m1 o; ?8 c0 a% P+ H v: R - #define ITCINTEN_SHIFT 21& N, I9 N# `9 ?7 l9 I. A$ f1 D
- #define TCCHEN_SHIFT 22
! h& E1 ?7 k4 x; v( q6 R& L- ~ - #define ITCCHEN_SHIFT 23: [% O9 A2 h# i$ u/ e. T
" K3 v; m0 h' u4 T; [" d- static volatile int irqraised1 = 0;
4 Z7 h% L6 j( b% Y$ A: t1 H/ ` - static volatile int irqraised2 = 0;3 V2 |5 l, n/ y- v$ k
- - {. x1 y7 f7 d, w5 |* ~' s* H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! ^& ?- x3 W7 G. L7 u! {" v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 }3 c( V. V$ R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); ]4 k2 T8 L" I4 F+ p4 h. @
- * W( f4 a: E. U
- dma_addr_t dmaphyssrc1 = 0;& h* \- E; R4 x8 R
- dma_addr_t dmaphyssrc2 = 0;2 C- W# z# `4 O: w: M
- dma_addr_t dmaphysdest1 = 0;
$ F, e) B7 s$ D) Z* Z! }. C/ S7 U- v - dma_addr_t dmaphysdest2 = 0;
- V+ d) y0 U5 B1 ] - $ p _& z/ x- i( y: W5 K
- char *dmabufsrc1 = NULL;1 q+ Q& T$ d) q' d9 V! K! X( d
- char *dmabufsrc2 = NULL;
0 k, Z9 R, q: ^( S - char *dmabufdest1 = NULL;
% p6 R- |8 V' M: M9 y/ z& Q - char *dmabufdest2 = NULL;
! R9 i2 d% O. M- b, i! r - 4 l: e1 l5 D! s5 f x: G
- static int acnt = 512;, I2 Q$ p; J, E6 F8 F0 A' k
- static int bcnt = 8;
/ P M f. H7 H1 w0 ^6 K B - static int ccnt = 8;( v+ P; \: ~4 I" G* E
- ; {9 e: t6 D/ @: x
- module_param(acnt, int, S_IRUGO);6 b$ `% [1 ^0 X% w
- module_param(bcnt, int, S_IRUGO);
3 p$ B, \! V; a- a - module_param(ccnt, int, S_IRUGO);
复制代码 % y! b0 }" C) ]: ]) ?$ [/ t l
1 k. _! i3 w9 P- i* w' S+ p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 C; J3 v' G2 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' M$ T m; s& n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. M' y, O9 [, a7 v$ Y
6 ^' K+ P* y( s' s! Q W
" A( y7 {' i1 S, T7 \
|
|