|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' m [' h' Y! {; I V. i- [code]EDMA sample test application/ V, n4 {( U6 w$ f' B) v" O& A
- /*" u0 ]4 b( s- T, `) Y
- * edma_test.c E. T- U# s# a8 _0 J4 e
- *' K5 ]+ R z% x* y1 y: l
- * brief EDMA3 Test Application
9 v4 T- W& J: K/ H5 z - ** d7 [0 | M, }# t$ \" m
- * This file contains EDMA3 Test code.
9 q3 I! K" M M4 q0 G3 ? L$ x - *+ {- c) D; Z) N" U5 T" E/ X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ D% j# A5 {8 a# U; {" Q5 {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
P r i" A! w - * TO CHANGE.! D9 Z1 }1 w% v# U) L5 J1 F5 Y8 C
- *
+ `9 k w8 c$ U3 f0 S7 d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 p, x6 u" N! x2 A4 ~1 X
- *
; ?1 L; ?- P$ z2 n - * This program is free software; you can redistribute it and/or
% a* p9 G* t! h1 u - * modify it under the terms of the GNU General Public License as$ c5 E* l0 Q6 g1 z
- * published by the Free Software Foundation version 2.2 W& z' G- N! ?' D/ x9 U
- *
( {- }% x! H: X5 e; n9 { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 ~: {, O* q! | z
- * kind, whether express or implied; without even the implied warranty( ^2 [5 B/ e, j( @2 ?# |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 J7 b; G; H+ _% A. R. `
- * GNU General Public License for more details.
e+ R; s' |2 j+ A$ q/ r - */
5 ?3 b$ X: p4 q7 I) N8 @! d - ' Y1 ^7 ?* G" d
- #include <linux/module.h>
6 C, R7 F7 l7 R8 |- X$ m2 q, E - #include <linux/init.h>
) O. e! h9 q9 K* [+ x - #include <linux/errno.h>0 }. Q0 [! H7 I4 u: l- w# E
- #include <linux/types.h>+ J1 m8 B) d3 a" i4 U
- #include <linux/interrupt.h>
- L4 @/ m/ M& k+ D( f - #include <asm/io.h>
% ?! `& \, N5 A6 h7 V8 }: B* k1 ?* D - #include <linux/moduleparam.h>9 ]4 r3 V8 b& o: ^% [
- #include <linux/sysctl.h>, G2 n0 Y* s+ X
- #include <linux/mm.h>2 {- m+ }- }0 c) c+ x: x& a, C p" H
- #include <linux/dma-mapping.h>8 |! \5 X4 g6 X. i/ {/ Y% H' k
- . a3 |% [1 C7 _" Z! q
- #include <mach/memory.h>, \( M- O% ]* Z: \! s# t: P
- #include <mach/hardware.h>
# @$ n2 A" s1 ?0 m# N - #include <mach/irqs.h>- R7 I1 `0 `9 L: W- Q$ m& s
- #include <asm/hardware/edma.h>
# f k5 x5 E3 y6 W( |
; Q, a1 W, u$ ]2 L9 g- #undef EDMA3_DEBUG
, V! i3 j0 _! b7 \" z3 A2 P - /*#define EDMA3_DEBUG*/
3 \: M* ?4 G2 v. [3 A5 G9 m; P. i
: S4 p' }7 e4 w8 q; B) I- #ifdef EDMA3_DEBUG" e2 a k8 M N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" L8 T7 d2 S- ?0 x2 Y5 g" G' y6 \6 L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# s( N$ A# U6 Z& v' }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) x: \4 V, j9 } - #else' d Q' A2 g, G! H: [9 A
- #define DMA_PRINTK( x... ). a, m# g- r7 @, w
- #define DMA_FN_IN
0 o2 r8 Y* e7 I" ^: { - #define DMA_FN_OUT( B& \+ j$ H+ E" T) [; ?
- #endif5 s3 A8 q5 l; c+ Z
0 J2 e; C1 }. _2 v: M, D- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 J% f/ f$ r, K& `9 c( z6 S+ [ O
- #define STATIC_SHIFT 3
. \" v. }. u1 D' k - #define TCINTEN_SHIFT 20
9 f4 v8 o6 u1 U+ C: I - #define ITCINTEN_SHIFT 21
, [' l h4 P: l' N' o z - #define TCCHEN_SHIFT 22
8 u4 z1 j% {! i8 G - #define ITCCHEN_SHIFT 23
1 E3 i/ N, T: V; S
. E0 }, I* B5 Y- static volatile int irqraised1 = 0;& x* B% m& m; f
- static volatile int irqraised2 = 0;
6 I; U7 w3 G$ h% ~( }. x% M - ; r; a/ l. _+ j8 O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; }* |# s7 s. ?! U, k: u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 o2 k4 C, R7 t- g$ m' O# j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ W! g6 z( J! G1 h1 V5 p
( I9 y# ]4 u/ I- S" M a- dma_addr_t dmaphyssrc1 = 0;2 X/ c7 @2 e$ y
- dma_addr_t dmaphyssrc2 = 0; ?$ |" ^+ x, D" A7 |) `
- dma_addr_t dmaphysdest1 = 0;
- ?( P8 J1 e! G" L% f( M - dma_addr_t dmaphysdest2 = 0;0 T( h% X/ ]3 g& ~( ~
1 B! {6 ?9 n( p. j! i* _& Q: ?- char *dmabufsrc1 = NULL;! J. q0 n k+ ?1 ~) |9 ?7 D) B
- char *dmabufsrc2 = NULL;2 ^- Q, M5 `" k" W% N9 m% G
- char *dmabufdest1 = NULL;
5 q1 k5 x0 V- ]# S4 {: m - char *dmabufdest2 = NULL;
- Y, W1 l4 G# F1 h - ; M$ n9 ^0 f* I8 f. o7 x
- static int acnt = 512;( u$ f& s" `; Z0 |) C
- static int bcnt = 8;
3 ]+ Z. Z' h: v1 N3 F; G% h" ~ - static int ccnt = 8;2 g2 t# [% @& ]5 M6 Y; I
0 z0 h& |( W8 `- o$ F- module_param(acnt, int, S_IRUGO);- `4 W8 x/ J* Q- [+ S& F
- module_param(bcnt, int, S_IRUGO);( P) G- M' s u& L( p, {
- module_param(ccnt, int, S_IRUGO);
复制代码
$ u4 q) U/ D9 B5 m: r, D+ L/ T) T, X6 l v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 t3 {3 h& ]+ |4 _/ l; F- o" Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! v4 d# p( ~3 u0 W, g0 v$ y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ C( C- `: h8 e% A/ ^
1 a. a8 m0 W: y9 H7 _) ]
6 E4 u+ d* P E. K8 d+ \" _2 L |
|