|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / o& w" ~- g9 Z( e: J
- [code]EDMA sample test application1 V" `0 I2 Q( F! r3 x7 q
- /*
+ H" S* |. A c/ F! ?: o } - * edma_test.c
( S4 ?) i' K8 _' a' s" J - *8 D! [2 c6 L9 G8 S* P2 `/ Q2 I! M
- * brief EDMA3 Test Application
9 T. C/ p0 n8 [9 |: j: m - *- M6 K ^8 t1 r( W5 k. c( a
- * This file contains EDMA3 Test code.
# F* R$ ~3 r1 V - *, K2 I, g6 V. N( ]7 y- n! Q, L% O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 w/ N% @7 \. i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ J- ^; T; M, n* @; I
- * TO CHANGE.4 X. q9 {5 E: h/ x; z0 {& O# w: t
- *
4 A2 m3 i$ r) Q' E8 y6 c5 n- V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 ~8 t+ a1 J( n; I6 @
- *
, v z4 ?2 T. U5 V - * This program is free software; you can redistribute it and/or
: }* g- D7 t% Y0 ?# x - * modify it under the terms of the GNU General Public License as, L" [# O; ^1 b6 A7 ~( J8 T
- * published by the Free Software Foundation version 2.
! F+ ?( f5 A7 U" J6 P5 ]; c4 P - *' s( o- h, r( }& t' e: f5 Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& m1 B4 t* K, A) {" W- J - * kind, whether express or implied; without even the implied warranty
; L) q# m$ ?- b) U: c& G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* d. [! J! ?6 E" W/ w* B. X @
- * GNU General Public License for more details.1 m! J; \, s3 V$ {5 X& L
- */7 \% S' @0 g0 t7 x" I6 w. S7 c7 \
# s( E3 d) U9 R" _- #include <linux/module.h>7 X# ?* ~8 x! h( j r
- #include <linux/init.h>' B9 B! G# r- p
- #include <linux/errno.h>
) X% ^2 D+ }8 Q: } - #include <linux/types.h>4 X3 B' Z2 {9 u6 [0 }4 B7 R
- #include <linux/interrupt.h>
7 R0 l( ^' _6 s/ G0 U- y9 y! g8 I - #include <asm/io.h># F J, S1 X4 o
- #include <linux/moduleparam.h>
3 I ]" Y1 ?8 Z; j \8 A' ` - #include <linux/sysctl.h>
& j+ l9 @- a4 @( Q, _ - #include <linux/mm.h>
, K9 Z4 S9 G! V' N - #include <linux/dma-mapping.h>
& e3 L* {# e7 Z5 C, h% z - ; R) W4 ]$ }4 ~+ \
- #include <mach/memory.h>7 e8 I: @5 }3 K& ?: |1 U& ?. z
- #include <mach/hardware.h>: s$ ~0 N- C+ K
- #include <mach/irqs.h>. _' m" s3 c1 q
- #include <asm/hardware/edma.h>- e6 ]( u8 I+ B3 o
- * m5 u. V; ?) B0 Y
- #undef EDMA3_DEBUG
& d) J# o9 D3 a8 i+ N- ~6 C - /*#define EDMA3_DEBUG*/8 ]- Q) [- E# I& k2 ]
- 1 a& V! S; z i* n( Z) e5 ~ H; I
- #ifdef EDMA3_DEBUG9 S9 a" G6 e& _( B6 |( c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! J9 d* e# @+ P L6 \3 C3 H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ y0 W& X9 W. W& E3 I1 V7 I4 D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ n' I! h4 u2 g2 r Z3 ] - #else
% j& ^" J% Z# i; [2 g. V2 Z. G4 V - #define DMA_PRINTK( x... )" v4 t# Q' j" g i1 t% U9 K5 Z
- #define DMA_FN_IN
5 h: K/ R- l, Q o( x* {( O - #define DMA_FN_OUT& D& b( ?& `8 q
- #endif
$ \4 J, J9 h- k: ]6 p" @. r' o - ; j! |) M2 T( w. E) O' Y. z7 a v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! N2 T: F# T) h4 x t- x
- #define STATIC_SHIFT 3
Y* S1 W2 f& {1 F" Z. H - #define TCINTEN_SHIFT 201 E9 y( p4 j0 ?- y
- #define ITCINTEN_SHIFT 21
{. Z! s: A e - #define TCCHEN_SHIFT 22
5 Y! I1 Z. I+ [* I9 Q9 t - #define ITCCHEN_SHIFT 23
: M. U( ^' ?4 h; u! O1 a0 Y+ k5 J4 _
2 A+ @( ^* w {2 \6 r1 B# |- static volatile int irqraised1 = 0;
+ _0 u+ @; {: w9 v8 M- s) N1 O8 _ - static volatile int irqraised2 = 0;
# p1 l0 u7 c% Y" p5 L4 C1 }+ n: u - ) ]% y4 Q; A/ @8 V7 [1 [; _7 D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, l1 ^3 D: \7 { U* z8 z7 | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 b" e9 X) H* Q7 y$ E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( L O2 o4 O4 b8 a' `
3 {# F% A1 S5 f; Y1 }3 f" j- dma_addr_t dmaphyssrc1 = 0;1 B1 M9 p0 O, L4 D- b/ Y
- dma_addr_t dmaphyssrc2 = 0;
( x7 }; ?+ q- O3 W3 [9 ^ - dma_addr_t dmaphysdest1 = 0;0 f( l4 K/ E, g; b$ W: l+ E6 [% b2 y
- dma_addr_t dmaphysdest2 = 0;; l3 k) K. C l! P% t5 z, b
- 2 K# N. v2 L: r) n6 ~% a
- char *dmabufsrc1 = NULL;6 F* Y( `9 p( @# t8 W
- char *dmabufsrc2 = NULL;
% t1 _* M& L& l - char *dmabufdest1 = NULL;
, _ \- v8 t6 T, c6 [8 P: l9 A2 e - char *dmabufdest2 = NULL;. V' W! l: N. Y4 i
& [! o) z) o3 ] ]7 T- static int acnt = 512;
: e& E* Q2 b& f - static int bcnt = 8;; f5 U2 b) b9 v% i
- static int ccnt = 8;8 \( ~" N/ f0 x! T! K. O
- : ]& ?# y e8 t% a( _, V8 @
- module_param(acnt, int, S_IRUGO);! h( W! H7 w% T) t8 R( ?' @
- module_param(bcnt, int, S_IRUGO);/ d7 W# ?% K, I; ]& x6 k( j
- module_param(ccnt, int, S_IRUGO);
复制代码 3 `8 h/ x; y1 A
- ^& N' k8 B! c0 r- i& N& M& l& e6 r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 ^: ]7 @( w; A$ V1 x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ q; p6 l# k3 y) C- V6 m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: u: d+ w6 ^4 b" L' s$ n+ a
3 n0 g* Z+ O" ]- E2 \8 O% y$ w8 ^, ^: ^1 s
|
|