|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: q" b2 P& }/ f. g% w4 v- [code]EDMA sample test application
6 Q r, m/ G1 u9 l' @/ w3 p1 L0 F0 W4 k - /*; L8 z: n1 i) c. T3 q- s7 S; n6 {
- * edma_test.c
& p3 Z$ o8 Y2 G/ f% P - *# f; D% b% R: T6 y8 W& e
- * brief EDMA3 Test Application) {, g+ M. `$ n# l: c8 R
- *
& {) o1 P# B; Q) v1 k1 ]" Y2 s - * This file contains EDMA3 Test code.0 O7 ?. I% O4 P! I/ v a
- *
9 Z8 h& t- q: \" [3 J, V$ [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 |9 ]& c5 x7 R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 t! |9 ]4 I7 b" P) s' r+ M - * TO CHANGE.
( n, r' w; V5 k7 W - *
- b! j3 ~8 y1 g ^6 D) j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 b6 i5 ?" \; h' c# b, D. a8 x - *4 [+ z0 v6 t, _4 V* j4 r% f& ]( i
- * This program is free software; you can redistribute it and/or. I, |" a! _2 z7 ^0 V7 q
- * modify it under the terms of the GNU General Public License as% B, B( E5 m! J4 h% m9 c) f* _4 i' ^1 [1 P
- * published by the Free Software Foundation version 2.
0 [9 l0 ]3 u, z, P- o% w" c - *
# N. V! J9 S6 [ `' N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ A* N- G# x( ^6 l/ \ p
- * kind, whether express or implied; without even the implied warranty% h& E) j/ o: q' w) N9 o( B$ D) f0 Z. ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 j9 o# l# M. u/ C! @6 s
- * GNU General Public License for more details.2 }/ h8 u' T }: a) Q
- */
1 g* _6 b" M; T! F3 g$ W% R - 8 W% V! Q6 T5 D6 v
- #include <linux/module.h>
" e7 T5 P6 B) {7 C- o - #include <linux/init.h>1 V/ e) J2 m% \ S% l( g% {
- #include <linux/errno.h>& I% i% b+ p2 s1 e( N9 _) Q2 E* G
- #include <linux/types.h>
3 e' A. G6 s: J" k3 j- X - #include <linux/interrupt.h>7 A2 ^' S+ a1 c
- #include <asm/io.h>
6 N* A: Y, V0 R; t - #include <linux/moduleparam.h>
' R J/ N e4 X9 e9 ]7 } - #include <linux/sysctl.h>
& ]1 ~6 s" I' f$ p2 b5 j0 A$ P h - #include <linux/mm.h>
7 @) \; P; C7 _- J# e; _, O - #include <linux/dma-mapping.h>
$ W, s4 ^6 M" i - b+ t& r( t( x( z4 ]% V
- #include <mach/memory.h>
L& \7 @, v9 e5 c# a1 M - #include <mach/hardware.h>* W% s' o) B! V; p
- #include <mach/irqs.h>' `+ D7 T( p/ f p% h8 E9 U1 l
- #include <asm/hardware/edma.h>
& W0 s# i) A* [$ c/ r - ; b, o7 g$ E$ R; @# m) p9 I0 |
- #undef EDMA3_DEBUG6 U- y. Q) f4 {7 c( M( |( `
- /*#define EDMA3_DEBUG*/4 i3 E) @5 \# y& x& `
) k, x! \5 r- y6 g7 g, [* `- #ifdef EDMA3_DEBUG
* w/ w1 h' M& B' G* w+ {; n5 i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' M! C& `4 i1 N0 n; ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 S" o+ |% J% y. S% N8 ^6 D" q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& N! g& N2 j* E& v6 S' |7 R# p - #else: X7 b0 w: W2 O# P* ~ b
- #define DMA_PRINTK( x... )& M- ]% M2 h6 M+ f/ m1 V
- #define DMA_FN_IN
6 d7 C3 @! F( H! ]7 F4 c3 L. C - #define DMA_FN_OUT1 \% v' i' H( C% u- z
- #endif7 Z2 G6 w# v4 ~1 Z( i0 c! d
2 Y# ^ ?! {! d9 |8 ~ d# @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# V. z) I) Q: ~! c3 R; y
- #define STATIC_SHIFT 3
5 J; A* D* C2 t+ R# v: K - #define TCINTEN_SHIFT 20
" |2 H/ `' _/ l7 _: V0 H0 q j - #define ITCINTEN_SHIFT 21( o6 o, R+ u9 r# }
- #define TCCHEN_SHIFT 22
" t1 N3 M; J0 B8 V1 ] - #define ITCCHEN_SHIFT 239 z" }. ]" c) R# [9 O0 b
- . w* n8 e0 {$ g8 j1 w
- static volatile int irqraised1 = 0;- a" ^' Z: u$ C& [* p7 I
- static volatile int irqraised2 = 0;) F5 H: ~- u7 F: q9 k6 k
& f7 e3 I$ T" i( y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: M1 ^- @, b# c3 }$ F) a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; [. I, b9 {" l# [6 Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) B; p: G. b1 u" c- P0 H+ s6 {9 K/ B
2 }7 Z0 ~ {. m+ \( r- dma_addr_t dmaphyssrc1 = 0;
0 K6 ~5 e) f! _+ o - dma_addr_t dmaphyssrc2 = 0;
; ^# L w7 m6 b: @2 D5 u - dma_addr_t dmaphysdest1 = 0;
( N) v) ~+ S" P% q. M: @- E - dma_addr_t dmaphysdest2 = 0;
; c. f1 m' p$ i+ y
, m) m! }; N; i- char *dmabufsrc1 = NULL;) y$ i/ K7 G3 p
- char *dmabufsrc2 = NULL;
9 S% c7 G3 c# k& `4 h - char *dmabufdest1 = NULL;
, J2 k d. n) y8 o5 V - char *dmabufdest2 = NULL;
1 ^, V' @; G! B2 H$ h' ? d
- S' B' D$ w; N- static int acnt = 512;
: D! Q7 a; W1 P - static int bcnt = 8;" ^/ g* `8 d0 [. X7 Z$ |+ E
- static int ccnt = 8;
H1 E& v6 @. Y. }6 Q- q0 F
9 y8 w4 P# s" ?; ]' P8 O: g- module_param(acnt, int, S_IRUGO);+ e+ N) [ e( [3 S7 P( ^5 J
- module_param(bcnt, int, S_IRUGO);. h( x# {) L& J4 ^
- module_param(ccnt, int, S_IRUGO);
复制代码 2 e; u. U# P" ]5 U
% g1 Y2 R F$ L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 R! A: U( E; p( y) }+ ?; q7 j& sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; `4 u, D' I6 C. U4 C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& M, \( P5 k6 C6 u( ?2 f
3 M( q. R2 B7 s4 @+ w! D# C" o' A; ^# z7 p! F
|
|