|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 f6 n) {6 l0 p+ I9 R/ S
- [code]EDMA sample test application
) z) L2 N/ _$ z7 h: j* n* K6 u f/ V# I - /*( A8 N6 c0 \$ d; M) d' _
- * edma_test.c
. c i& m" z, F- V( s6 v6 J - *
7 ?8 G6 w2 ]0 }/ ^0 s - * brief EDMA3 Test Application. ^6 K) [# k: U
- *+ g9 |. B. n3 U c+ j8 W
- * This file contains EDMA3 Test code.
$ S; z$ s0 p, v* _ - *
0 X: ]! _6 q1 \5 ^- e& | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; Q* w4 G1 m+ {% G' f& D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- b: V4 r+ Z$ b
- * TO CHANGE.: A8 B$ M9 \- V# @& Y
- */ |+ y. [+ C" N( J s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( Y1 ?6 V, _& W2 I2 x. W0 H - *
, m3 u9 A& I- F+ R% ]3 W - * This program is free software; you can redistribute it and/or" n/ g2 {1 [1 u. e& u' w4 Q; ]4 g
- * modify it under the terms of the GNU General Public License as
& G. p8 u6 a* H9 E - * published by the Free Software Foundation version 2.
3 T4 m) F5 ]. i - ** g1 z! ?" k5 B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' U- f! z; j' }$ v
- * kind, whether express or implied; without even the implied warranty
! f: _. N7 C5 U( u5 U( O r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ [5 Y$ Z h8 q ?" c - * GNU General Public License for more details.
) f. h: `; `' [( K - */& T+ I+ x# F4 r ~
# n& \1 b* E! a$ @- #include <linux/module.h>
. R$ x9 Y0 ^0 i/ @4 R - #include <linux/init.h>: n4 I/ {5 ?, L& I
- #include <linux/errno.h>
) H8 w8 E3 E. ~+ P: {( ^) o - #include <linux/types.h>
; c5 E) K8 a C3 u8 v, L - #include <linux/interrupt.h>5 e; m4 b) v' C0 z
- #include <asm/io.h>; J" _4 m+ G# s! F
- #include <linux/moduleparam.h>2 K& j# F# ~7 q" o4 e
- #include <linux/sysctl.h>. X1 x0 Y+ J1 J: m7 K
- #include <linux/mm.h>; I5 D( J# W# N
- #include <linux/dma-mapping.h>& `/ h& }* v/ O: P! X& @
- , w! g; H8 b: }, q
- #include <mach/memory.h>
0 U7 @. l# F8 p. E4 i1 M- R* q3 h - #include <mach/hardware.h>
& h, V" a8 [- H( ` - #include <mach/irqs.h> E1 M, N* r+ e3 v
- #include <asm/hardware/edma.h>& i: H2 |( k3 U. }; l4 t
- + a4 ?0 O& t7 K6 @& q l
- #undef EDMA3_DEBUG
& z( \+ j: N r2 ` - /*#define EDMA3_DEBUG*/# k( x. ?6 c3 _9 F# q; ^
- 7 ?8 ?$ h: O; M1 S
- #ifdef EDMA3_DEBUG) {: p( v1 a" G" b) }3 g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( t1 q0 X6 n$ Y0 ^% y. v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 ?7 R* N- S# Y# I) V7 [% f2 e" f* r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' g% l9 C0 o; a, B1 W0 X
- #else
- x# S- I5 z$ f' v4 R - #define DMA_PRINTK( x... )( U$ q" {5 b0 t3 B3 {( ?7 {" X
- #define DMA_FN_IN2 G2 a& S; o3 \5 K0 r' G) Z) a
- #define DMA_FN_OUT0 K& M) V+ T9 V: L; r9 V* o7 @
- #endif
$ m# p$ ]4 t; g. ^" r. C
6 Y3 c, l n2 C- _: W. P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 G3 I9 U: Q- n W - #define STATIC_SHIFT 3
8 J$ W4 }& j! [9 J# j) V! @4 b - #define TCINTEN_SHIFT 20
6 M7 X& `' t2 h( Q - #define ITCINTEN_SHIFT 21% \# p0 i* k1 V+ a
- #define TCCHEN_SHIFT 22# F% L4 O3 i( z9 L, a
- #define ITCCHEN_SHIFT 23
9 w. @9 q! N8 M# `: o# f
+ E1 G8 D6 l* |7 \/ f- static volatile int irqraised1 = 0;
2 i/ t E, y6 Z8 M' p) F - static volatile int irqraised2 = 0;5 O, E# J# `" f. c& }
- 1 K! Z! M9 N' h& `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. Y/ x+ Q( q5 h! G9 b8 p4 R$ P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) E& N3 m P/ F$ ?9 a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 b- a& o9 l* W M8 N5 W* F4 h - ; ^; v% y3 U% l- e0 W
- dma_addr_t dmaphyssrc1 = 0;: l3 e% n0 v% g% Y7 s" Y
- dma_addr_t dmaphyssrc2 = 0;4 q& J, g* |7 R3 l( K3 F4 W9 ?
- dma_addr_t dmaphysdest1 = 0;
; D0 M( P; s# M4 s, n - dma_addr_t dmaphysdest2 = 0;2 [: o- l4 x1 _
- . K$ M/ N" ` d. r1 }9 j1 D
- char *dmabufsrc1 = NULL;5 V4 i( ^# V9 |; _
- char *dmabufsrc2 = NULL; i+ i$ Y! o) Q/ g
- char *dmabufdest1 = NULL;
0 X% H/ x( C: t! ~" l) e/ s# } - char *dmabufdest2 = NULL;
; n M* d, N! ^. F - 7 L0 T1 a' e7 c4 @3 N; A
- static int acnt = 512;
8 x8 J1 v: [ i7 n! _ - static int bcnt = 8;/ v5 M) |7 R5 \2 e h
- static int ccnt = 8;* r- k/ X0 P! }# \! v
6 b, `+ x$ s Z5 @- module_param(acnt, int, S_IRUGO);
- g8 [+ ?6 f. r( o& `' f f/ i - module_param(bcnt, int, S_IRUGO);
; s- C0 B6 e* Q' S0 t2 O - module_param(ccnt, int, S_IRUGO);
复制代码
5 }2 k# o# v% o
9 [6 G2 c6 r7 w% @' E+ Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 x/ R& ^. V X/ O3 }' ]8 [9 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& d8 N1 }0 B7 z1 l" L8 G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; C( M4 _; g3 D8 _! _9 D& O; X
: U5 x2 A$ _0 t
1 `3 q6 P" u* {+ c1 ? \7 X% }' }
|
|