|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ x0 q1 v. |, n8 i4 `+ x2 n5 |
- [code]EDMA sample test application/ ?1 _7 l+ `$ t. b7 N
- /*
9 ^: i* q0 ?0 u5 ]# i! D, H - * edma_test.c" a$ E8 w: r1 E* Z# b
- *$ v: ?" \3 f& ~, I ?& K: R
- * brief EDMA3 Test Application
2 ?4 @9 O& W$ R0 z) p$ q - *
: \) I- M& Q2 v" ?: q4 ]6 f$ A - * This file contains EDMA3 Test code.
$ Z' |( u8 _# ` y$ { - *' E# ^, Q* D0 t1 x1 d! m1 J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) m, E4 b! F- m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. P& E: U+ k2 b. j - * TO CHANGE.
% w; x1 w. K* R, h, @" B/ |& v - *
! V5 P- T- s8 h! H0 \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. L4 A/ ?! Q$ p% Q9 J ~! }: Y - *
- U A8 Q, ~ ~7 S4 ~+ n/ h" ] - * This program is free software; you can redistribute it and/or
9 ?$ u7 v. W7 | - * modify it under the terms of the GNU General Public License as5 F- O3 C. _2 a, \2 K; c2 {
- * published by the Free Software Foundation version 2.! w9 f- i: _# w3 p) g
- *
( m* N0 M0 b6 j0 R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 W2 N- o/ t8 ~* c) B
- * kind, whether express or implied; without even the implied warranty0 b" I& n. v6 P% a2 y+ w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: o9 k+ H/ \0 q) \) p- m3 S6 X8 w - * GNU General Public License for more details.6 t) U8 M) \) D3 O
- */- Z$ q" ^0 S% _! \8 y5 K
- . E# h: M; e- }7 n4 O! f" `
- #include <linux/module.h>
2 D2 B% B1 q. U0 Z9 Q6 i6 n - #include <linux/init.h>/ R# O4 g, S8 A9 V) D/ C" @' z
- #include <linux/errno.h>
# i/ g7 A) G W1 V$ V - #include <linux/types.h>
6 _9 j- R1 g' g' v) }! [! C) C - #include <linux/interrupt.h>
6 q% f* |4 V6 F2 N( M - #include <asm/io.h>
* _; s; _7 O+ i/ h0 k7 f - #include <linux/moduleparam.h>
* T" P- k% J) a3 v0 J6 |9 i - #include <linux/sysctl.h>" u) m: A5 q: _$ Z i5 Z
- #include <linux/mm.h>7 R; r* X! h% h
- #include <linux/dma-mapping.h>$ S; V) T* L/ F0 ?
- 2 A' h0 v( B) j$ n
- #include <mach/memory.h>4 O& w* @- ?' i/ S) l0 k: ]* I
- #include <mach/hardware.h>) m/ U3 M$ P- r$ m# G9 Q
- #include <mach/irqs.h>
" E; P C" f3 E4 t - #include <asm/hardware/edma.h>
" {6 _" y( R- v - : J( ?$ k! j$ _
- #undef EDMA3_DEBUG8 j. c2 u2 U- l; h
- /*#define EDMA3_DEBUG*/
* c i- D) H* ]& \ - & [% J0 M5 A4 n0 X: M4 i0 i" D2 ^
- #ifdef EDMA3_DEBUG
; g& r2 n2 z; C+ p: @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 N) M3 a& w& x$ ]3 Z' W$ O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 j+ B- d( @2 ~0 T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). z% |! \* L/ C8 M
- #else& C+ B+ f3 m8 H3 p0 p; G
- #define DMA_PRINTK( x... )( o( E/ j" z3 g; d/ z; [
- #define DMA_FN_IN+ u7 \& s# Q0 G: z! j! j' \* \
- #define DMA_FN_OUT, ?( N# f* _0 K# }2 x. P$ n5 G0 d
- #endif& E; ~: u8 x% \; q' X7 j1 D* r# ^
- : M, Z' c2 [3 S T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ i6 P4 ~# {9 ^7 w& R3 } - #define STATIC_SHIFT 33 p* A1 ^" d# x8 i# Z& d, Z
- #define TCINTEN_SHIFT 201 W; X. A6 z2 k- d7 k
- #define ITCINTEN_SHIFT 215 q! D0 G5 q2 s w, ~7 [5 W
- #define TCCHEN_SHIFT 22- f( o: x5 t/ {/ l' O
- #define ITCCHEN_SHIFT 23+ I' w- w. T5 _/ z
- 7 K `1 V0 P0 _" H# i& C. ^
- static volatile int irqraised1 = 0;. L8 I- D& l4 \$ l z' D& J1 c0 a
- static volatile int irqraised2 = 0;
6 f# W. G+ v* f) S6 L: |
; U% m2 ^ n2 p# m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) h. N0 t9 `2 q S, d/ k( F& Y5 K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 e$ O4 ?" G) h V1 d: M- X6 L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 o9 P1 k' Y# q' g$ I% s9 ~3 V; p- y% \
; l4 o( x3 y G- dma_addr_t dmaphyssrc1 = 0;
b* ^- O; F3 g' K - dma_addr_t dmaphyssrc2 = 0;5 D8 m5 L/ B/ J4 D3 J3 U
- dma_addr_t dmaphysdest1 = 0;
$ v O% x3 i" [1 A" J - dma_addr_t dmaphysdest2 = 0;5 U0 P* v# _2 L5 P p& g
6 { ~ F: O/ w- char *dmabufsrc1 = NULL;
' W! e/ D& E0 }' ?5 c+ L8 ]" ] f - char *dmabufsrc2 = NULL;$ W7 f$ `, t& N. J( p
- char *dmabufdest1 = NULL;" |, }! _; a+ ^$ k
- char *dmabufdest2 = NULL;
7 r# k5 A* R( y) K - % s1 ^/ p' X$ d2 y
- static int acnt = 512;2 ?0 }* p9 D6 W) N" }8 R6 h$ g; I4 Q6 L
- static int bcnt = 8;& z* z1 }0 b, d0 G6 y
- static int ccnt = 8;/ @ _( q( n9 {4 H4 j- K( A' w
+ j# S. Z1 r8 ?' \; D9 j9 N) }" v S- module_param(acnt, int, S_IRUGO);5 E6 G& ~1 }( }- q" y, A" Q8 Q
- module_param(bcnt, int, S_IRUGO);
6 J+ k O$ z# [7 K - module_param(ccnt, int, S_IRUGO);
复制代码 : \( L- {. i9 Y$ f* f f! X A) b
) o2 K, h) P. p: g0 _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. P9 p2 o6 W2 Y/ Z/ T8 Q4 ~3 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( D% V! [7 P& m. [7 L3 E( u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 X0 t7 I- |' i/ q# K
2 l- z! H6 l6 ^5 p% N5 P% s4 N0 \
1 f; R' j" ^7 [( O; } a, [ |
|