|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 r/ K* ^1 s0 ]% H
- [code]EDMA sample test application
\, F/ ^ B% S3 u - /*
. `& a' ^# g. Q - * edma_test.c
# N4 d3 Y, ~/ _6 H ]/ D - *
0 H* I! _/ R: q - * brief EDMA3 Test Application
) p9 x( T+ t6 p- x+ w - *
) u7 ]0 S3 d- T - * This file contains EDMA3 Test code.
Y( l5 y" q3 C* {* W# H, [! B* M - */ P+ @' L9 u! N6 h0 l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& T* _; Z) @: m* i1 q. G5 @7 a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- N' e; K5 ^# G) O7 I+ C
- * TO CHANGE.
7 P. h$ N \9 f1 ~ - *
$ M' H. O4 a2 B. {6 L, C/ O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ }) }$ D, R! R* i# h# B - *# o4 v3 U! i2 s7 C& a( P" y
- * This program is free software; you can redistribute it and/or
# j- ]7 o$ w5 u6 E6 O" b# N) L% K - * modify it under the terms of the GNU General Public License as; x" c0 U% | L2 n3 g
- * published by the Free Software Foundation version 2.
# r& W3 A$ {9 n7 _$ d, w& b - *: i; q: x$ z; {% Y2 Y# \$ W5 P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( e3 {- q( f9 L% J2 p9 Z - * kind, whether express or implied; without even the implied warranty
, c8 j% c+ _, \6 o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# S4 G1 `; `- {* e - * GNU General Public License for more details.
9 y! M+ V5 H8 N - */( d, P) M4 \; @( B" V( U# y5 z
- $ u& Z' Q N) i3 S2 c6 C, @5 M+ R
- #include <linux/module.h>; t$ ^/ _ h" U$ Z/ L' f9 a
- #include <linux/init.h>
: p. i, C ~# J, D& a - #include <linux/errno.h>! u* ?; ^) d2 \" d% n
- #include <linux/types.h>, g; |( {0 c9 F1 { X
- #include <linux/interrupt.h>
: \8 C: W# b4 A* D - #include <asm/io.h>+ w) e8 P7 t& l* g
- #include <linux/moduleparam.h>
/ j+ U5 U' \" x' [6 x - #include <linux/sysctl.h>
2 ^; j. I i! R6 J& Y$ i - #include <linux/mm.h>
o+ W. f6 m6 v2 R3 @ - #include <linux/dma-mapping.h>
3 E3 R f7 U* d0 I' Q
/ {/ I. E2 i7 @; S: t1 Q6 X% T2 h- #include <mach/memory.h>* J! {( m- D& n% ~
- #include <mach/hardware.h>
, L( R( i; \+ L. @4 P1 z: X - #include <mach/irqs.h>
0 ]' Z! C6 q, G" `5 j7 N5 Q3 l - #include <asm/hardware/edma.h>
6 l) w1 u0 F! K
7 L5 g8 x- p$ _! H$ ~( i- #undef EDMA3_DEBUG# _4 M0 @2 |" ~& a7 E0 c
- /*#define EDMA3_DEBUG*/
2 b# g e3 I8 }' f: E, S - 0 I; D# J% i: y
- #ifdef EDMA3_DEBUG
. |8 {6 e+ i) B6 s6 X8 R- g* P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) e: q$ ^, X! n% R9 @ E- k$ Q4 B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ D3 f4 |4 f& M1 \8 T$ Y6 Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 G9 o6 B& u& X# {" j$ w: z - #else( j% y8 m. Y. i; t! t% h6 K1 U
- #define DMA_PRINTK( x... )5 Z8 i8 r2 c0 F. l0 S3 ~
- #define DMA_FN_IN
1 e+ o5 |+ |' m% c - #define DMA_FN_OUT/ ~' d8 e2 P+ @6 G. @
- #endif, G" x6 D1 X+ y# C
- x% R7 v" ]+ c& l/ c K0 H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): f# j+ e- h5 l+ {8 N" u* H( n' s) K
- #define STATIC_SHIFT 3" c' J( [# `& A( d. J
- #define TCINTEN_SHIFT 20
$ f8 \, R3 Y B8 Z" Y% t9 ~ - #define ITCINTEN_SHIFT 21; u- u) w: p6 `: Y* `6 } {1 P
- #define TCCHEN_SHIFT 22
- S, _, y# r" T - #define ITCCHEN_SHIFT 23
& g2 L0 F \; h7 X' y; d" [ - # b: W# A: W( A# _, {
- static volatile int irqraised1 = 0;7 `/ [1 c3 F _8 m4 y8 l
- static volatile int irqraised2 = 0;1 j3 o( C( }8 j& a* ^8 _
- " W7 {7 i8 d4 t6 \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; \, [, m! C! m# h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# |: T% l/ N* ]- E4 H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" N3 s2 c" k0 y% k
: f2 B6 E9 U H- dma_addr_t dmaphyssrc1 = 0;
% c' o6 }9 J& X! @# i - dma_addr_t dmaphyssrc2 = 0;: |0 b! j- Z: Q) E! o ]% m% c
- dma_addr_t dmaphysdest1 = 0;
5 @; U, p" V) z$ \! i" `0 { - dma_addr_t dmaphysdest2 = 0;
0 ]. l( T! P6 z& L' I$ j
! f( ]" l Q. T- char *dmabufsrc1 = NULL;
5 s9 K# Y2 M- P* j8 N - char *dmabufsrc2 = NULL;
% s6 M. S4 A% `" b4 H9 z$ t2 O - char *dmabufdest1 = NULL;
6 v0 O6 v7 Q u5 S! q, T; M& f/ B - char *dmabufdest2 = NULL;: C; G! C3 p# B& q3 a
- V7 [5 u x6 t8 B- p- static int acnt = 512;: V: C! p. q- h+ ~
- static int bcnt = 8;
1 E8 s/ a, _) }( p! V; K9 c. n - static int ccnt = 8;( a- x" z. g1 m$ h2 D9 D: A
- ( K; w& f$ m) s1 ~
- module_param(acnt, int, S_IRUGO);8 ^, F: Q! D6 a% ^3 m J# C
- module_param(bcnt, int, S_IRUGO);
( S) `' ^6 F/ I1 K1 p3 i/ w - module_param(ccnt, int, S_IRUGO);
复制代码
3 w. _5 j& B' L, U# h+ b) h9 |# F: P
9 N" I& W) M% D! o% r2 _$ m" w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! K, k7 ^1 ]3 C3 c( j& r+ C; F( Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! D! h4 I' f* B' \5 W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) p/ J# {5 x2 g/ l; r+ ?6 C8 a2 x7 w; W: K: B
4 s+ l/ P* d( C6 G3 i5 |" D |
|