|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) M2 _( f d2 }: n5 T
- [code]EDMA sample test application: [4 f2 v8 x4 Z, `) E, F* _) E& N
- /*
) s4 Z7 `" D; r' o$ m - * edma_test.c
; W1 z9 }! L7 j t2 K( B/ a - *
! q0 }( B0 d! ]4 {+ J. B. \ - * brief EDMA3 Test Application" Q7 w! S+ y L# p% F) E6 F
- *- p( V. C& f8 S* J
- * This file contains EDMA3 Test code.8 \8 i2 I2 _4 v2 N/ u- y
- *5 S( C6 O1 l! j! |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 ?' w- t1 K6 w: W/ W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; C3 t3 D0 L" A6 h - * TO CHANGE.* i% D, s4 u6 Q0 p4 a* B$ s# f5 h
- *# o+ y) ?2 q" L* [! _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 C3 H' P" e- d$ {& P9 c) V2 W
- *7 \0 m) _$ E9 S
- * This program is free software; you can redistribute it and/or6 g* o- A" n$ h; m p
- * modify it under the terms of the GNU General Public License as# Y& m8 {/ Q) Z# n" S! R
- * published by the Free Software Foundation version 2.
7 i1 ?- x* X. Z0 V - *
. D3 W% R; x8 l, i5 d6 L5 k0 Z- z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, n1 {) D" J/ \( |; ~; H0 N* H - * kind, whether express or implied; without even the implied warranty% e. m7 T3 e% G* S/ N2 Y1 a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 U( m( I1 D8 N1 |3 _% y3 E$ M w$ g - * GNU General Public License for more details.
: @0 u: y7 t- O1 V7 Q& @' J4 q - */
4 f% B% G. N. K) x - " x7 c( }+ D8 O) e# O2 `
- #include <linux/module.h>
' _4 Z" i q( P7 R/ |- ] - #include <linux/init.h>4 _$ I: I% {; X% k( r! E3 {3 n
- #include <linux/errno.h>
7 S, l7 ?) r H6 P4 l' u+ v - #include <linux/types.h>$ Q4 [ W" W0 P/ b# ~
- #include <linux/interrupt.h>/ t ^3 U, i( S6 z8 o4 G* `5 |
- #include <asm/io.h>1 [* D# z4 b- j V! B4 [4 y
- #include <linux/moduleparam.h>2 z4 Q: @6 I) w0 |% W2 b
- #include <linux/sysctl.h>
: w0 ^, K5 ?( I" s3 X) m - #include <linux/mm.h>
: s( q$ @% J! F& d - #include <linux/dma-mapping.h>
6 e# V% c- g& s - |3 D. L6 }) M+ Z0 H8 u
- #include <mach/memory.h>
% m3 Y+ ~+ g6 ^6 S/ c# i g - #include <mach/hardware.h>
. Q9 i2 N; `' O2 L0 s& t0 ] - #include <mach/irqs.h>
B B0 Q; }) F& E. V7 B" W - #include <asm/hardware/edma.h>
; Z" V! y& h& B
* J5 F; Y: w0 R3 y e- #undef EDMA3_DEBUG7 l: R7 H- n% u+ M2 ?
- /*#define EDMA3_DEBUG*/% D7 d# ^ k! o: u- t
- + C6 n8 d& Y+ } W; W7 f6 g) @5 \
- #ifdef EDMA3_DEBUG
; ?1 P1 q4 A- S4 V1 D; x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 U+ H9 b2 \, X6 q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" p; n, y+ C9 O6 C, G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); S) p# t* K" M4 Z
- #else9 y& ?4 V/ I2 `- A- a$ p$ |
- #define DMA_PRINTK( x... )% R8 I( B9 d5 Y# [$ w
- #define DMA_FN_IN0 ~- j: @. W% t* a+ k- l
- #define DMA_FN_OUT
8 r* o6 ?6 k; W% i - #endif
4 e2 F7 B3 o( o) T+ ` - 9 s3 n+ R+ e2 ~6 {$ |, x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ C4 ^+ J1 h. j; ?, I/ ^; c! n' d
- #define STATIC_SHIFT 3
* a0 f! h! U& v2 G( @3 F' E& g' v/ M - #define TCINTEN_SHIFT 20
. m9 z* D* C4 d% k6 x# M - #define ITCINTEN_SHIFT 21
! \: P0 w4 a. {; a - #define TCCHEN_SHIFT 22
. E" F0 J9 C' C - #define ITCCHEN_SHIFT 23
; `, a) ]) ~, z) s1 k - - h2 J' r" ]3 Y5 {5 _/ p) w
- static volatile int irqraised1 = 0;
$ H9 H8 _* g; c0 A% b$ y - static volatile int irqraised2 = 0;$ q. x0 z) e8 K8 u; D( m6 U
, {; z8 q- w. o( S; ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) ^& m+ F2 s6 Z- u0 r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( w4 O. [6 M# y( L/ a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Q* i" }0 a1 ]6 l# m% r+ r
- 6 P0 B, |0 ]8 u. T7 f
- dma_addr_t dmaphyssrc1 = 0;
) }: v9 E" ?; r7 z- L - dma_addr_t dmaphyssrc2 = 0;
4 L8 ]/ U* M9 I+ t4 M) X - dma_addr_t dmaphysdest1 = 0;. K* o! x! w' I+ y. L
- dma_addr_t dmaphysdest2 = 0;
3 H$ _4 c7 \6 C# Q8 k/ a - ) P* x" k# J* R4 ~' ?/ E
- char *dmabufsrc1 = NULL;& D$ l( u% t, a2 b1 b
- char *dmabufsrc2 = NULL;
; z% r6 C. d( a$ t. Z0 j - char *dmabufdest1 = NULL;( P$ P8 {1 N, C8 B7 C1 G
- char *dmabufdest2 = NULL;
+ v N! J$ n; O! l9 y- k! t - " J0 p$ J/ }& F" H8 E) G
- static int acnt = 512;
6 e; l& ~4 G8 m2 w# t6 f' } - static int bcnt = 8;3 d P4 }4 @# n0 x' \2 [
- static int ccnt = 8; U4 G* ?3 c6 u
: A* S* b& k! E- @& ^$ T8 ]5 e+ `- module_param(acnt, int, S_IRUGO);
( R$ h3 Q: M" f+ |5 \ - module_param(bcnt, int, S_IRUGO);7 s8 d& j! z5 \* Q3 h9 k
- module_param(ccnt, int, S_IRUGO);
复制代码
3 Y% n2 E) f5 G7 [3 B8 \7 Y+ r' F" x/ f0 `. m7 k* `, j, k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, b- Q! S! ?+ N% Y' [
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 i$ Y Q" @1 |0 n: v5 k( P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: S/ j$ ]6 N: T; M& Z* H. ]
& L3 v; d- D; B" W2 j/ r1 P1 T" @& j
% O5 _' ?8 x" {6 } |
|