|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 K* N' ~( G) y8 c7 O
- [code]EDMA sample test application9 `: H, B; i4 M& o
- /*9 k7 l. J. x( W
- * edma_test.c+ c( d/ |* ~5 l8 l/ y! ~
- *
( _4 h8 r9 S: \8 {& W8 Q# |5 I" @* K% z - * brief EDMA3 Test Application
& A' P6 D" w" w5 H! O7 @ - *3 \! b5 ^1 E& }9 t2 ^0 S
- * This file contains EDMA3 Test code.
/ b h" y7 @! r, O$ q8 q - *) `, X9 }2 T0 t' y* ^5 |* @, n G
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ L. I! ]: B6 ?( U1 ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 v/ u! Y9 F& T1 u7 ^: O
- * TO CHANGE.
, ?; [. n. Y* P. M$ d% I8 A - *+ e- i H$ ? @. E' I G! T; H# K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 ~9 i9 F& }7 _ - *
% }* g. g4 V. l% S$ L - * This program is free software; you can redistribute it and/or$ t& h& I6 b2 Y+ j) }8 T; n. O% A
- * modify it under the terms of the GNU General Public License as
* _& W6 _# Y `# H. ~ \3 J - * published by the Free Software Foundation version 2.
% l- ]3 q: g/ f( n, s - *
( t; V! K5 a0 v+ |/ f! S J6 g3 L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# y! `6 p# M; k) t
- * kind, whether express or implied; without even the implied warranty
; G s7 m3 D+ \4 ^- C) I! W& l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Y# }' Z) t) S - * GNU General Public License for more details. O. s9 t! w) S1 e% L3 [$ s
- */+ y& D$ S+ t$ D+ D
& r9 @1 ^7 H( u# ^! O# k* _- #include <linux/module.h>
# d. K0 D* T6 m9 r. f5 }7 u& f8 W - #include <linux/init.h>
/ `4 g) W& |$ O+ X - #include <linux/errno.h>
# d( A4 ^" P$ [ - #include <linux/types.h>
* P8 j3 Y% J; v% K! C - #include <linux/interrupt.h>' a- i' C b7 {* i( \
- #include <asm/io.h>
' ^6 W: H3 U+ ?2 O& M& g7 P - #include <linux/moduleparam.h>
- j# y$ T/ e0 C, e5 ~/ ?: X5 J y - #include <linux/sysctl.h>
, ?6 A7 r5 _0 A0 ]& t- i - #include <linux/mm.h> o, o& X" k- R8 P& U# I
- #include <linux/dma-mapping.h>
8 R* q' s. o# L, r
3 ^9 _2 K: |/ F9 D, s- #include <mach/memory.h>
9 g C, W9 L6 x! P9 `9 N N - #include <mach/hardware.h>- @# _8 y! y% f* p
- #include <mach/irqs.h>% E1 d- I2 t' G A8 M) P
- #include <asm/hardware/edma.h>
) D9 G5 K7 V- F& v# C3 D
0 D7 z) _- t4 V! F; ~7 V4 N% `/ ]- #undef EDMA3_DEBUG
* H+ v6 G! M+ S" W7 b6 v - /*#define EDMA3_DEBUG*/
7 r0 u6 \: ]8 o2 g, @
0 G9 X, s' f8 _* i* |4 s: K; }- #ifdef EDMA3_DEBUG! X7 F" _9 E' S, W" z h2 B" J; j" \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ l; W- j0 c5 J2 O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) I8 @. s: ?$ Y6 B5 n/ G+ T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 ~/ F- b) g: c$ |$ Z - #else7 H/ E9 S0 e% s( Z
- #define DMA_PRINTK( x... )( f' y* [' T3 v; E) _0 ~
- #define DMA_FN_IN
3 V8 g* _ s6 E - #define DMA_FN_OUT
- Y! ?8 F) K% T) O' ?- C$ Z - #endif
/ ^$ p' S6 e. Q$ b# o; Z- n' C" v - / a6 o! L* E5 E1 y$ Z$ q l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! L" t! z+ V- e7 }
- #define STATIC_SHIFT 3
3 O% V9 u- M$ S2 A - #define TCINTEN_SHIFT 20$ v* q. s, A% g. x1 o
- #define ITCINTEN_SHIFT 21
5 \; M* {) `) f& _" x$ s - #define TCCHEN_SHIFT 22/ f) u0 i3 M' X+ G' B0 K' c! |8 a
- #define ITCCHEN_SHIFT 23 }; U# r# ~" G! P1 r
- ; I1 V$ E/ x7 I, L
- static volatile int irqraised1 = 0;/ D3 B- g4 d# \, h: e* b* S
- static volatile int irqraised2 = 0;# X, ]' W6 J" w5 g |- e, Q
) j* b) R$ v$ ~1 X$ E- U( p; x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: L. |0 A0 b. Z" @, V" r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 H: V- O; N: n1 a7 R0 l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 N- |2 z0 U% ~) \+ Z
l- w- w r, V0 p+ m- dma_addr_t dmaphyssrc1 = 0;' G7 n% ~, X* W y% r
- dma_addr_t dmaphyssrc2 = 0;
+ H5 S _0 V+ u - dma_addr_t dmaphysdest1 = 0;4 H3 I1 A! n" H5 |
- dma_addr_t dmaphysdest2 = 0;
" ~( ?3 I9 X" C. J2 \ - % r8 ? ~7 N0 l/ J: `7 B
- char *dmabufsrc1 = NULL;% s: ~0 e: d) ~% X% T
- char *dmabufsrc2 = NULL;: x" _0 X8 A. K6 W' v9 O5 t; i
- char *dmabufdest1 = NULL;
* g) `" f( n; y& D8 p - char *dmabufdest2 = NULL;
3 P& K: }* }3 r/ N" O5 P, N' F
3 L& a- O* H, \7 U X& L1 S- static int acnt = 512;
4 G {9 w: {2 E/ } - static int bcnt = 8;6 q; ]! O# f9 E L. O
- static int ccnt = 8;. Y! a" H! P4 M1 [
- . Y/ Y) h5 P' V
- module_param(acnt, int, S_IRUGO);
# J8 \5 t( S2 ~# F f4 N - module_param(bcnt, int, S_IRUGO);
( d5 N9 ~# c8 H _9 T - module_param(ccnt, int, S_IRUGO);
复制代码 * D& P, P- R& f% l
6 ` @( {$ |9 S, u# D z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" {/ w# c5 |7 Z- k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' J) p/ d! l! F( Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' M! Y1 A* s/ }* b5 H% \: w& K2 r3 Z% ?) N3 n( H: g+ g# K
; w+ q6 T6 v9 l- {+ w
|
|