|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* F( n; V8 A" D5 G- [code]EDMA sample test application
6 y3 i) P) Z' d6 \- R - /*
- ?/ l* |7 O, T3 ^) m3 `8 ` - * edma_test.c
- g/ U% m8 x4 q6 e; ] - *' f2 N' g* S$ R3 T8 E
- * brief EDMA3 Test Application
$ t0 H# a: t5 e: e" K) a" C - *
7 u, b! t- F7 f% W) t0 L - * This file contains EDMA3 Test code." P4 @$ e9 J! @% a+ B! w
- *% Y# N$ }, R4 E( V5 { L4 W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% X+ \; n1 K1 a& f2 j8 ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 ^3 C- l! E& f, ]6 a( `
- * TO CHANGE.& D& l1 T7 ~/ H$ N. e& u
- *( E$ N! h5 j0 X B" v7 t9 v0 n) }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 G$ P' i# {* J - *5 J4 R7 P* ~' ? v+ b2 t
- * This program is free software; you can redistribute it and/or
6 Q U' t3 X6 G& l+ ?' O! f p3 B - * modify it under the terms of the GNU General Public License as
( H" v I8 D) U% z. ~+ ^5 a* x8 R - * published by the Free Software Foundation version 2.
% x$ u# V5 @2 L, d' W- ^% _ - *$ H1 ]/ r: v7 |2 j, a. {9 M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. H* ?# V; K4 v8 k7 u8 c( _ - * kind, whether express or implied; without even the implied warranty
1 H3 u2 I/ f5 c6 v7 x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" Z3 M5 a% `( ]! Q* Q/ b) [
- * GNU General Public License for more details.
8 p% u% n) r' M. i$ q - */7 A7 ?8 z5 f2 V* Q- _5 K6 g" o
; _; ~2 M$ v- u' l3 b$ H" T( |& h- #include <linux/module.h>! K' I8 j2 D" v8 O& U n
- #include <linux/init.h>; N1 D7 K# @! z) P$ W( T% V
- #include <linux/errno.h>5 \+ b2 Y% Q$ w: o1 f
- #include <linux/types.h>
- c4 G7 h, d& F3 r' _: s) V - #include <linux/interrupt.h>: B& R z6 D# E4 J: C0 V2 e4 X
- #include <asm/io.h>+ K7 e, x: S& Z
- #include <linux/moduleparam.h>
* [: s3 ^% k9 X$ J6 R- _ - #include <linux/sysctl.h>) ^" [! f& Q% h5 n" ~' d6 {) J
- #include <linux/mm.h>
6 f; b+ v; `- S. W' C- \( ^ - #include <linux/dma-mapping.h>
& b7 |! |/ ?" J
& a/ Z! ~1 t* O$ b/ o+ E- #include <mach/memory.h>
2 P: T0 F& D+ k! h( U4 | - #include <mach/hardware.h>3 t2 y' n- q2 N4 {# t: s
- #include <mach/irqs.h>
" ^2 `+ L& i6 K! x - #include <asm/hardware/edma.h>- b+ T+ @3 Z0 o$ h# ?$ ]
- 9 H% ~( `* f! F1 M; F
- #undef EDMA3_DEBUG9 |' \. ^0 J+ x4 P+ A
- /*#define EDMA3_DEBUG*/5 G, o5 q1 e' n; j1 X4 h4 `+ `
7 B- `( E' G, v# ]1 s! e; b" T" ]- #ifdef EDMA3_DEBUG ~+ v/ M! ^% E+ V6 g% n! F: K4 \' D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 F' |1 a3 p: v6 ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ u. d4 j- Q1 k) t8 I |% ~7 |+ M) l) D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ p0 Q# H7 J8 t! Y# l. d
- #else
' }" h7 k0 O: o7 P - #define DMA_PRINTK( x... )
0 U$ Q4 ~$ J8 W, { - #define DMA_FN_IN
* f4 I* N; c2 z - #define DMA_FN_OUT- N& `+ _/ r$ T8 Q3 k% ?
- #endif2 \4 S: e! P- Y8 |5 r
! p" X8 o6 b6 z' h1 k8 Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 Q* }0 E3 R# V6 f - #define STATIC_SHIFT 3 r# x$ D5 O! ]7 }9 X
- #define TCINTEN_SHIFT 20/ N. z5 m( o0 b0 }6 b' x' b
- #define ITCINTEN_SHIFT 21
( S7 P6 c' A$ S2 {& ?/ } c, [ - #define TCCHEN_SHIFT 22
2 D* h' ^( r" U8 X3 K& r - #define ITCCHEN_SHIFT 23
. T5 w- r0 H% Q5 v8 r( r
: Z. V1 I4 g8 X1 F- static volatile int irqraised1 = 0;
, l, {0 M" j* S - static volatile int irqraised2 = 0;
; V g& _% p8 e) }9 X
0 v1 h& }+ c5 F% A3 h- V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ k4 D: n; F& B$ t0 M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. J0 ^. w! J$ \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 }4 h; w) _# q. \7 A, P
- 4 h' U1 [3 R* k! y
- dma_addr_t dmaphyssrc1 = 0;6 W1 |9 z. ]5 U" G. K
- dma_addr_t dmaphyssrc2 = 0;2 K- C# U I3 w% a5 Z
- dma_addr_t dmaphysdest1 = 0;
% D. \$ ?% r2 ~1 _' t# i, v R; l - dma_addr_t dmaphysdest2 = 0;
5 O5 y8 a( S7 \8 g% P2 d! G) A
8 Q5 I% A+ G5 O- char *dmabufsrc1 = NULL;& a$ W* l: X5 K. O+ C- t7 E
- char *dmabufsrc2 = NULL;
' B( k1 B4 y1 q+ }3 o- J+ u; A - char *dmabufdest1 = NULL;
U% E0 y, L# v4 D- C7 E - char *dmabufdest2 = NULL;# b" i }5 M) _
; D" n) E, C1 V* M* `: u9 T- static int acnt = 512;
3 o" T; M, m5 m4 V& P, ^4 U/ { - static int bcnt = 8;
% w: }% R8 B$ ^: p6 M0 z) o - static int ccnt = 8;, N* u1 ?) _7 |( c
7 e6 P3 V/ M2 X" J/ m& F* ]# u- module_param(acnt, int, S_IRUGO);
! ~" w! L# F, K# w( ~3 B( _ - module_param(bcnt, int, S_IRUGO);
+ T5 ?- L6 z b' s9 f# R - module_param(ccnt, int, S_IRUGO);
复制代码
4 g7 [( Y. V1 i7 J7 b
; P2 ?8 H5 a. j6 M( C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- N# g) Z6 i# [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, [# L& M6 l! r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" b2 P! \! n+ y& E, d* v. {
& M0 u# Y7 h; l# \0 K$ i
0 _+ b) U8 @% k. [$ ^2 T |
|