|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 i: |2 ^3 c: L1 Y% X0 f! v0 m- [code]EDMA sample test application
3 r N) X' m7 j/ X - /*
7 b- w& {4 O& b+ x% J( P - * edma_test.c
9 F' Y6 \5 J+ l) \ - *
5 m3 k: o6 i1 r* L: r. ]. @ - * brief EDMA3 Test Application9 m5 a& I# I) F8 U. r
- *0 X s3 h) o) ~) X! R, _
- * This file contains EDMA3 Test code.( c2 A& M* ~/ n
- *
( }5 r) r* i" h! l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. X2 n: ?/ s& u c D% V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% t/ ^2 J7 I! V2 `9 h - * TO CHANGE.3 H9 P7 K1 p3 o9 {7 B
- *1 [! {& w# m. m9 b7 j7 I9 g' O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 c+ F9 O. B9 g) e! e) f: g
- *
% N6 {9 h/ n" A# m/ J$ F - * This program is free software; you can redistribute it and/or2 D$ Q! g+ c. w0 o
- * modify it under the terms of the GNU General Public License as
$ k' f( B: O" c' w6 y* O( R4 q - * published by the Free Software Foundation version 2.
7 N' Y! J/ m% _( U' X3 T4 E - *
) h+ S6 n/ e1 J& K: u! l9 S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% `/ x% b8 I+ y1 h" e - * kind, whether express or implied; without even the implied warranty2 @, @" \0 Y6 [. N+ @0 R! W( z5 T: X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& }5 G. F+ A- P" R - * GNU General Public License for more details.4 P, e, R4 b7 ?8 K' {
- */7 n8 ~. J2 D' O, u; d" V ^
8 A0 J" }! O# n. d. Y4 A; c- #include <linux/module.h>8 Q; B e! J& ~ C8 K8 h& ~5 k
- #include <linux/init.h>
$ B* c% w$ }4 J; w- }. p - #include <linux/errno.h>
& R8 ?& j" r/ { - #include <linux/types.h>! G" [- G4 I8 h* X9 D. n
- #include <linux/interrupt.h> |0 ]0 C' I8 f! G: @
- #include <asm/io.h>! }( k; ?' b( a
- #include <linux/moduleparam.h>
# z6 r; b5 e) H! O6 F+ P - #include <linux/sysctl.h>) s2 e5 T$ R) q( w7 L
- #include <linux/mm.h>4 U& ~# k. Z G& e9 s% A [, W
- #include <linux/dma-mapping.h>
$ r5 w7 B& c# m' A+ ]! S$ Z
% A/ l' q6 M4 e1 t0 i B/ Y- #include <mach/memory.h> _3 v; o1 Z4 _8 h
- #include <mach/hardware.h>
+ M6 p& l8 h# R6 U) ]+ U3 J# j* T9 o - #include <mach/irqs.h>
2 ^" `2 S& X6 U - #include <asm/hardware/edma.h>* @$ r( i& M! e! i5 t- I Z) r
- r2 ^4 W1 A/ Y
- #undef EDMA3_DEBUG# ?4 O! U% {4 @1 t5 v4 ~
- /*#define EDMA3_DEBUG*/& Y! \3 X4 x4 F: ?" d
5 V! R# N/ ^$ Q" _8 S# O- #ifdef EDMA3_DEBUG
! @: O/ a7 C* p1 E' {" e" o- m% I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% T5 P2 R5 A- b X, p- y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 Q6 w) u! I6 \$ u T4 Q7 y; A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 K3 m2 \- p/ H/ c
- #else* k+ m/ I) b& J0 ?& i" l/ c
- #define DMA_PRINTK( x... )
" h) W: H. D. K! @! y - #define DMA_FN_IN
5 N0 @- h/ R' m. E - #define DMA_FN_OUT# i2 q7 I$ j ?
- #endif
* S" [9 A: t# C
' s0 ~2 z- C5 k+ M' Y1 ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: k' ]8 j7 q' V - #define STATIC_SHIFT 3, [1 h. B0 R" v: r+ B/ a( {4 W# s
- #define TCINTEN_SHIFT 20' w. \7 f0 s0 Q0 X O
- #define ITCINTEN_SHIFT 21
& Z4 O" `8 v1 l6 y: o2 p - #define TCCHEN_SHIFT 22
$ \. B. O Z7 Y! J% V" i+ y& ^ - #define ITCCHEN_SHIFT 23
0 v7 [ o3 o1 y' F
- L* \: t0 R* L) E6 I/ R/ N- static volatile int irqraised1 = 0;
9 D- t8 d$ G$ p - static volatile int irqraised2 = 0;+ M: W$ A% C8 f8 _1 g w# E
- % {5 n% x0 i2 U' Z* Y7 A3 T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! Z7 R( {6 a m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ n# e1 p6 S3 L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" q. e" I# {% i: p9 Q3 q- h; P' N
/ p* e" h) i9 q# e* \3 }. W. r5 N- dma_addr_t dmaphyssrc1 = 0;
" o& X( @8 @4 j2 b3 y# P - dma_addr_t dmaphyssrc2 = 0;
3 u! n) t' w1 B. w - dma_addr_t dmaphysdest1 = 0;
% ?: D. {: N3 c/ X/ E - dma_addr_t dmaphysdest2 = 0;2 l/ c7 g9 {+ C& w
. \2 t* s; S% t- E$ N- char *dmabufsrc1 = NULL;
6 \8 T: F% k" }7 F+ P - char *dmabufsrc2 = NULL;
9 y' h& r8 o2 e, l - char *dmabufdest1 = NULL;/ {! W7 M2 o" T5 }& p( \
- char *dmabufdest2 = NULL;
- U" S, W- r l) h3 Q+ z/ ]4 p - & B) F1 r9 B7 ~0 N
- static int acnt = 512;/ e2 i; p; Y6 p$ X" ^4 C5 g a
- static int bcnt = 8;% F2 X0 U( j0 [7 r9 t0 K! U0 @# t
- static int ccnt = 8;
( |% U( Y- S7 x
0 I: b8 [" R- f' t- module_param(acnt, int, S_IRUGO);9 F$ o2 X. Q9 H, U4 M# L7 n O
- module_param(bcnt, int, S_IRUGO);
! S# }2 J# E( s& d - module_param(ccnt, int, S_IRUGO);
复制代码 ; o& \6 Q$ h5 f5 B0 z
, e- L* p1 Z6 U# f
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 q) h9 x! ~0 D, ]! L, Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! V6 r# Y$ m* [' F( H F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. _ P7 F# K A$ V
6 G$ r3 k9 m7 X: _5 s% `% q2 [
5 ~- S0 ^ t ^) X8 ? |
|