|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , m8 y; m1 K, P6 G$ ?0 v' K
- [code]EDMA sample test application! P, {- ?! U, E/ Q9 D
- /*
& f" }' U1 B# a! U - * edma_test.c
( A2 L x( K! F( r - *
* ~* {5 G: N9 J ^2 K7 P8 z5 @ - * brief EDMA3 Test Application
* M3 O5 D6 ]3 H; ~ - *
* ]1 f3 I/ m) m7 v& m7 Z* _ - * This file contains EDMA3 Test code.
3 _* |/ ~* w' b4 m - *
0 X: w! d* w2 B8 b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 o- l. k3 d6 D9 U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 a! s/ ?9 K, e7 O6 f- B - * TO CHANGE.) O- Y9 P$ R; S X% f. ^: R( k
- *: G% o7 `* F4 ~0 O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 |2 _1 C3 a8 k" y
- *3 S3 D+ D% E3 M2 y/ @
- * This program is free software; you can redistribute it and/or; B7 C% k" ?( {: k' N- i7 f
- * modify it under the terms of the GNU General Public License as3 g. @% L& h' x$ w
- * published by the Free Software Foundation version 2.
" g# l: A" N3 T - *
' g% g: r* A9 h& T2 S. ]+ I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* ]+ c7 t( x% ~ - * kind, whether express or implied; without even the implied warranty
5 C# ?% u& Y4 h7 I- s6 I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 x2 n+ B& s* E( [ - * GNU General Public License for more details.# D/ V% @2 p0 ^
- */
" ^; r. Q4 Z8 m& r! `: ` - : ]7 Z1 n& h& [) h
- #include <linux/module.h>9 K4 a9 y- q% P4 N ? ^
- #include <linux/init.h>
! D' N- j2 a: Q+ Q: ]/ X' s - #include <linux/errno.h>' Z2 Y7 S" m8 f4 H- j/ {" G1 B6 L
- #include <linux/types.h>. N: }- m5 @2 K* u& F+ h
- #include <linux/interrupt.h>7 _$ X) I' o2 t& V7 E0 U* u+ B e. j
- #include <asm/io.h>
, \$ W) q& ]# j& u- L# t - #include <linux/moduleparam.h>
9 }) a! I% T Z( R6 u! z5 h" F* l - #include <linux/sysctl.h>/ s3 T7 D6 V5 u" R( K: F
- #include <linux/mm.h>$ b) k. r0 s8 Q$ L. `
- #include <linux/dma-mapping.h>
4 K! O$ @# s- r- R0 s! M# r" K. ?
" P! G) o& h8 _- #include <mach/memory.h>
: d9 M& I; e& x# Q - #include <mach/hardware.h>
* ~( ?! @3 \: F - #include <mach/irqs.h>) ~6 {; ~' M) B: C9 |- X
- #include <asm/hardware/edma.h>
A+ A- D6 c) ? x7 ~& G! d
% R0 G6 f9 t7 _4 E" o: L4 g$ p- #undef EDMA3_DEBUG; U6 y9 ^: }4 ?; h0 @9 I
- /*#define EDMA3_DEBUG*/, q' d+ y0 ?0 }. p4 _
$ j3 a3 c m7 D- #ifdef EDMA3_DEBUG& S! m1 J V/ B" s6 G5 ^2 P5 Y! Z( s1 Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 L/ C: h3 n5 a6 g* f$ }+ |) C% D- y, k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; L0 j% Z) R8 ^# B: X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" B2 @+ v- k' w
- #else2 c! i( }: j& m: ]3 ] _5 @$ P
- #define DMA_PRINTK( x... ), `, O! K) ~; L9 X0 c
- #define DMA_FN_IN6 r0 h7 y3 @8 E* e. _8 K( M2 w, W
- #define DMA_FN_OUT
6 ~% {1 {% |8 X6 _+ k5 D ^ - #endif
, m+ J) S0 \! r6 u5 H
/ Q/ W; D/ R4 K! Y. ~9 B; l a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 A1 y3 V+ r. @/ }* ~5 [7 p" C - #define STATIC_SHIFT 3
5 [8 r- V7 N$ V4 u% K+ p - #define TCINTEN_SHIFT 20
6 H4 L- z+ B3 s J5 t9 B - #define ITCINTEN_SHIFT 21
* ^3 t0 c5 X2 L9 G4 X4 T2 d9 u - #define TCCHEN_SHIFT 228 I% d. w9 c0 Q; {% M; K: e& ]6 B+ a U
- #define ITCCHEN_SHIFT 237 `/ e M6 X8 c9 Z6 P
- 1 Y2 f+ A3 V2 `5 u! [+ J# Y O
- static volatile int irqraised1 = 0;
) n# q# V g& @1 r& x8 e - static volatile int irqraised2 = 0;: g0 ~' h7 e+ y& _* j: G8 G3 _ m
- 3 g6 {. z& g. V: ]) T7 H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 D+ _. A0 D5 d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 }' V/ f4 k4 U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 N% s+ X: F' T2 H, I
7 m- N! W1 ]# M) e5 |+ o- dma_addr_t dmaphyssrc1 = 0;
4 g: F, d' Y) @' J. b - dma_addr_t dmaphyssrc2 = 0;0 ? C: W; t5 W! z. r
- dma_addr_t dmaphysdest1 = 0;! Y* r$ u: O2 ]2 l! @+ S+ j: u
- dma_addr_t dmaphysdest2 = 0;) F8 [" L, S2 p% ~3 ~. g* y
- ( e1 V1 v; H$ R2 X" g6 O- M" K
- char *dmabufsrc1 = NULL;# f+ M' ?$ c; f1 p/ {* o
- char *dmabufsrc2 = NULL;
6 b, v: L6 z$ \! i; ]7 T2 m% W - char *dmabufdest1 = NULL;2 @* v: a1 P5 o6 I, x5 H* |
- char *dmabufdest2 = NULL;' n' j7 H% t4 J1 H: f
* M& T4 Q& q$ n* o, S- static int acnt = 512;
; A% Z9 @# G/ S# `2 i& Z! {" j - static int bcnt = 8;
4 q; e; \( o' Y0 d2 D* X: g - static int ccnt = 8;
: W' _! }5 ^; Q# A/ X9 M - : T5 A8 P6 m# b( I0 O1 J7 W
- module_param(acnt, int, S_IRUGO);, H1 ^+ }% [/ i$ f5 H. q
- module_param(bcnt, int, S_IRUGO);: q/ H# j5 v' M) k7 E4 F( d
- module_param(ccnt, int, S_IRUGO);
复制代码 ' I# b# M, X! |' ~0 v
3 x* y" X( E* V" ]5 {* L2 v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& c/ i9 d7 ]# e) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ [% \/ y0 O; | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" s4 l- h8 U" p$ P' b8 P q* a, z- R$ @# t5 h5 e
5 \# j: k" `4 L$ T |
|