|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! t2 Y8 n7 X1 `3 H$ T
- [code]EDMA sample test application
# Z) _. u6 n) G/ V1 ^ b; {) j - /*
) }8 e* {) t+ j& ]7 Q2 L2 ]) j - * edma_test.c
% e8 I/ |9 I7 ^ - *9 B7 D$ ]3 R6 p* V% E5 C0 r5 J
- * brief EDMA3 Test Application
+ {; Z" P, h- Y+ F0 _ - *& C% f3 g8 D' h4 u4 a
- * This file contains EDMA3 Test code.
0 [, [( C; P) ^ - *) Q) U, w! h, M) _' k* W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. ~7 j% n' z7 R7 P8 s0 L6 i: s D/ j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 S+ K, x% o7 i3 a - * TO CHANGE.
0 M S2 ~& U1 |6 R2 ~0 ]* ]9 y. D - *; I* v5 R# ^0 r9 s2 z, b* F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" |$ p$ w7 o( Z- d - * ?+ l' H$ D0 R) w7 E6 t
- * This program is free software; you can redistribute it and/or
U( o" d- P! \& k/ t( c. U - * modify it under the terms of the GNU General Public License as
) f6 C! j$ g& o P3 Z - * published by the Free Software Foundation version 2.
- _, H$ w' G& b" ]8 ]/ |1 A - *; L% c1 e, z) F. t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ }. v1 N3 ^8 R - * kind, whether express or implied; without even the implied warranty
: }. _0 o7 O/ m3 T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ D& f$ L p) U
- * GNU General Public License for more details.+ \& J8 Y: D- _7 B" Y# G3 K2 D+ K) B
- */+ u$ d( o# t* \, Y/ L8 l
( n* R; M1 S. q- #include <linux/module.h>
- |6 K4 ~) ?/ g) N) X# v - #include <linux/init.h>+ j+ G* l: c8 x, g$ a3 ]
- #include <linux/errno.h>
. p) J, K6 W. N1 O4 ?9 O - #include <linux/types.h>( w, z% S7 a' C' y# s: j2 X7 M
- #include <linux/interrupt.h>
6 ~! o9 D8 Y7 z+ R" | - #include <asm/io.h>3 ?* ~4 e0 X5 y7 _+ {3 Y6 N* ]1 u
- #include <linux/moduleparam.h>
. v. A7 O0 n7 a, \3 r - #include <linux/sysctl.h>0 X* D4 O" `5 I. k
- #include <linux/mm.h>9 q/ b9 E' F+ k/ ]; \) X0 a
- #include <linux/dma-mapping.h>7 s2 q' h' _6 N& j! K
4 g7 L8 d6 K! @8 K- #include <mach/memory.h>
7 C q1 ~# c2 o, ` - #include <mach/hardware.h>
: m( {% C( H O - #include <mach/irqs.h>
/ I# v5 b3 F+ F& g& P- Z9 K# v+ m - #include <asm/hardware/edma.h>
+ q+ Z5 Q0 W; [$ Z - ! o6 C& a5 V0 p2 q! J) C
- #undef EDMA3_DEBUG
. G- _# V- B7 l+ ~2 k7 p) u - /*#define EDMA3_DEBUG*/
* L7 S- P* c: a" d8 o" o
( e! d; |2 P$ R- t- #ifdef EDMA3_DEBUG
! F4 A5 e0 I$ _1 @5 } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 W* y/ ^ @8 K3 i; G6 u& n1 S6 K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 y8 s- l$ G% ?8 o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 ~1 C2 X z0 c1 s# `6 X- C' {
- #else
. Q& N9 h$ q- Q5 A" d: X7 Q: ?/ A - #define DMA_PRINTK( x... ). p u+ T9 K# N
- #define DMA_FN_IN6 D: A! a" T' }* A# `4 y% v
- #define DMA_FN_OUT/ g* ^, y6 N9 W# t& v" n$ R. X
- #endif$ m3 |& l( g5 v! Q% w( F* V
8 I: N* f, c) I" L' d+ s L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 D Z l9 i( U, V1 M - #define STATIC_SHIFT 32 B. A' d9 s& f8 N( g: U/ ^
- #define TCINTEN_SHIFT 208 C. Q9 ]/ U) g* N& R
- #define ITCINTEN_SHIFT 21/ X7 c* M+ J- T6 e; E8 P
- #define TCCHEN_SHIFT 22
3 e* ^& P! X9 s2 f( T - #define ITCCHEN_SHIFT 23 m2 V( f3 p0 O# j
' w% i' v j5 p; @- static volatile int irqraised1 = 0; n0 h# Q) t- r3 z
- static volatile int irqraised2 = 0;1 n9 a9 {9 j! p9 ~2 x% k- \
- ! ]. y( Q5 C- Q4 e9 p$ s' S& [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; l% b6 T+ d' E! b( d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 z: a! r$ C6 r0 i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
X# ]+ Y% J; c7 o' T, |, q6 A: D - ! g) y6 h" a$ w. X( W
- dma_addr_t dmaphyssrc1 = 0;
4 \# C3 I! X. V" d& a3 H- ^ - dma_addr_t dmaphyssrc2 = 0;
- I$ \: U8 s' h2 O K7 { - dma_addr_t dmaphysdest1 = 0;
1 a( H- M/ t# w$ M2 h+ r" a5 F" T - dma_addr_t dmaphysdest2 = 0;
/ p. F& ^* R; g" v! a
: k1 F, y5 x/ s. T; m- char *dmabufsrc1 = NULL;
/ m |5 i' {; i2 }# Y - char *dmabufsrc2 = NULL;
& E X" o; A" `- G0 ? - char *dmabufdest1 = NULL;
9 q5 b2 h& Q+ Q$ x( x - char *dmabufdest2 = NULL;
S; q* K0 a4 H3 R" v
1 q4 `5 w3 p" k4 D& ?5 \) ?) j- static int acnt = 512;
& R( j2 D" b1 m! a - static int bcnt = 8; L! p/ `0 B0 k& U- Z
- static int ccnt = 8;, T u* Y6 h1 K! N; t7 p% i# i7 x, X
- 9 q+ ~3 L1 |" E/ c
- module_param(acnt, int, S_IRUGO);; s: m- h5 |8 M5 i: A$ n5 z
- module_param(bcnt, int, S_IRUGO);# ?3 m6 Y( v- V3 l3 ^8 x) t1 |
- module_param(ccnt, int, S_IRUGO);
复制代码
# p9 W, Q8 }% d4 ~
* r8 E8 f# a1 h2 ]$ V/ p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- Y6 L6 q% r* |" J' I/ Q! o' ~9 Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 x- c9 u- c6 r/ h% l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, {# A* a( y, L7 Q7 j: I$ @
8 M; e" |: q" z/ D9 k! @0 ~& f$ \$ C3 A, x! h" z) t
|
|