|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 w+ n& J" z9 G4 B) _
- [code]EDMA sample test application
* ?: u7 c5 R. \8 ]( c - /*
% y j) s# }( z, ]" G0 ` - * edma_test.c
2 E' w' F8 H$ S/ m6 m7 i& x - *
& ~, P% ^1 |" R( w - * brief EDMA3 Test Application
% l* h( i" {0 a, G+ ] - *( y( h3 {! `' w7 x5 }
- * This file contains EDMA3 Test code. c* G5 B/ @' ^2 y( J' D# ?
- *0 v C- Y6 c r! Y/ \8 F- ^; o3 P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 K; R6 f# N2 n- X& d! A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 T2 f4 i3 h1 r
- * TO CHANGE.
9 c+ W$ i7 |7 E$ F - *
7 `6 H3 K; o9 A6 x8 V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% g& G: ~) T( P5 U# z3 E2 Z J
- *+ q% O0 i5 o) X1 H8 S3 N- ~
- * This program is free software; you can redistribute it and/or2 _) F$ j. B1 }& n' H
- * modify it under the terms of the GNU General Public License as; W* J& h4 g' h. O% T. w2 G! m
- * published by the Free Software Foundation version 2.
8 j) {' v+ J F4 ` - *
- S2 o1 x$ ]7 ], [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: Z" }" Y# z% S6 p8 Q) Z - * kind, whether express or implied; without even the implied warranty0 |; R0 t: `) `. R* ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 i: D. u8 f1 J& t ?4 L9 C
- * GNU General Public License for more details.
( ^& a. O2 u, B4 Y. y, x! E. x - */+ [8 W7 L% k! t( X" B+ s" U
- 4 t/ h3 {- P. d" K5 _
- #include <linux/module.h># T3 Y* R' o$ W- A/ M9 s9 l
- #include <linux/init.h>
+ K5 J! L" s3 T9 R5 p) _ - #include <linux/errno.h>8 L0 W7 g3 Z- Q) V, H+ T7 K
- #include <linux/types.h>
2 r% Y8 u! O* u) S - #include <linux/interrupt.h>7 J. m) \( Y! p# A6 e4 w0 s
- #include <asm/io.h>
! \8 C9 o% x, r, Q - #include <linux/moduleparam.h>
1 p. C) h! X& u4 C1 ]7 j - #include <linux/sysctl.h>
3 s3 L+ [- ^+ ]; u9 H, s - #include <linux/mm.h>' p5 y& @6 C' u2 n) T" h
- #include <linux/dma-mapping.h>
, d) n& T* C& L) p: r
9 }, [9 ?3 ?+ t$ _* i+ ?3 x2 {- #include <mach/memory.h>& ` Q0 k& Z! f7 a& {, b
- #include <mach/hardware.h>
) a* S/ R9 g+ M, m8 v - #include <mach/irqs.h>7 l, r% `9 [% W1 f& t! M) }3 _" f
- #include <asm/hardware/edma.h>; H/ c t3 e$ |- u& i
4 B" }# m# _- F* _( t7 r& b5 Q* r8 R- #undef EDMA3_DEBUG
0 t) M6 P( o" z5 A L4 K - /*#define EDMA3_DEBUG*/
: C) ?4 ~7 u l% }9 p7 [9 w$ F: F( T - + h' {/ G; |6 s- K
- #ifdef EDMA3_DEBUG! h: Y3 p6 `8 ?( Z% z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 V* V# m: r( i' a7 b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 G# e( }( k+ F7 L& H% g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 f* Q0 ^) U7 W* ]4 c7 ~8 r
- #else1 L& \: Q' T# Z
- #define DMA_PRINTK( x... )0 j+ h$ C% D$ M$ |0 \! I6 S( J
- #define DMA_FN_IN; u7 j/ m2 L: ^8 d
- #define DMA_FN_OUT
( L o4 l; E. d, j2 |# g5 L p - #endif; j2 Z5 C% I$ X
0 o5 [* Y- `9 [/ Y- @) y; l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 \3 F2 y, G4 V - #define STATIC_SHIFT 3
2 U' L/ q; h; ?! g1 Y" o - #define TCINTEN_SHIFT 20
8 |4 t2 i* C& |, N# G* O( P( z - #define ITCINTEN_SHIFT 21' Q' e1 Q$ e4 K; f w% |9 a! w
- #define TCCHEN_SHIFT 22' ~4 ], j+ a' y0 F- k
- #define ITCCHEN_SHIFT 23
) U9 x: J. `2 m$ N, t
& ~( z7 f* \8 @4 |* y- static volatile int irqraised1 = 0;2 N0 ^& z* T9 I3 [
- static volatile int irqraised2 = 0;; E( ^2 h' s: I- ]8 X4 b7 J
- ! n, _3 Y( K6 V% O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ \% B4 `5 W2 B1 \% X# A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 v. _0 n& {" c) P/ U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 D* D# X2 R. ^! x1 X
- ) T4 ?# d: `6 `' N4 T$ ~# b3 s5 n
- dma_addr_t dmaphyssrc1 = 0;
\7 x) U9 n5 \- ~0 { - dma_addr_t dmaphyssrc2 = 0;# T+ _1 y' K3 ]+ i
- dma_addr_t dmaphysdest1 = 0;5 u* W4 A* j' ^# `- d [
- dma_addr_t dmaphysdest2 = 0;
2 d, L. g( y( E! w+ R" ? - 2 l0 _) n2 k/ y2 A5 U6 f/ {
- char *dmabufsrc1 = NULL; a- w9 ?2 A: Q- C* I' B; B
- char *dmabufsrc2 = NULL;5 x# @' `* [1 y- C
- char *dmabufdest1 = NULL;5 L# J0 t& z1 ?* J3 `
- char *dmabufdest2 = NULL;+ [8 D) \/ R/ r
2 v% K+ H' a) I, `+ S' e9 O" V \- static int acnt = 512;
4 ?) W+ P& M( r' L - static int bcnt = 8;8 s; S, o. d- _! ?+ q6 m0 o$ j! d
- static int ccnt = 8;
V" a; F7 P! \ - - U2 R) c- s; K
- module_param(acnt, int, S_IRUGO);0 v2 ?/ o2 _4 K( r
- module_param(bcnt, int, S_IRUGO);! Z2 u( U7 u7 M# \' C8 c- H
- module_param(ccnt, int, S_IRUGO);
复制代码
. w7 I& V+ C: w0 g
5 R1 T5 W' g6 \ g7 k+ D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ h! O/ V, k9 h7 q! o5 d% e. u9 Q' j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ t) F' B. G. R4 M5 m% ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! ~4 `8 s2 I# ]- G+ C$ Z2 ]
5 z& k! e+ a3 E" u$ q6 Z1 [' e- h
9 c2 w3 G* a; r1 J) y |
|