|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ t5 } b1 Q5 s1 w6 {# X- [code]EDMA sample test application
, b+ ?3 m; {$ V. I% m* M - /*5 z) p i$ s) {) k. _% f5 k
- * edma_test.c3 | U! ^2 z2 U" l+ z0 @
- *
0 S7 D+ Q6 Z& b& } i0 F | - * brief EDMA3 Test Application& k* F6 C1 Q' L
- *
9 v6 o& i" B& t! W; A - * This file contains EDMA3 Test code.! v7 j1 K' a( Y/ p3 V2 a
- *
" i; Q0 r5 J f5 H5 j8 z$ |/ ?7 B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; @/ B3 v* n$ l+ |7 n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ q, x1 m$ m( M+ y9 \; q; Q
- * TO CHANGE.
; L. i' p# `& D2 ?* K5 ^+ L - ** G) Y+ Y0 g) d% N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
f6 o. l5 s' X; e3 R8 ^5 d" P$ C - *
% B' O% b, D; _# ?1 F' [ - * This program is free software; you can redistribute it and/or
# [. @1 O) ^. D& R( ~7 {- p" y: M - * modify it under the terms of the GNU General Public License as7 b) u1 w) _3 I4 Q) @% h
- * published by the Free Software Foundation version 2.9 _2 o. g% c+ T
- *+ g/ w* t/ m8 n+ j' n1 e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 V4 `& J, ~/ p! Y$ p" Z
- * kind, whether express or implied; without even the implied warranty5 u3 N: G* G. ]' d+ b; E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* W- B/ g, K0 S8 U' u% {2 p; g( N. n - * GNU General Public License for more details.# f f3 h0 K% V5 J
- */
* F2 l; J/ R3 \5 X. W0 G - : f7 u( m0 Z+ |0 ]
- #include <linux/module.h>+ o7 D+ P0 m5 f% @. l4 n. \( _
- #include <linux/init.h>
8 R i; ], @" T5 W8 h - #include <linux/errno.h>
" u( z9 t$ f; s& M9 j- { - #include <linux/types.h>
+ Y" q, F: }. P5 l. ]7 l - #include <linux/interrupt.h>. |8 x5 g6 y5 A0 I1 u1 [
- #include <asm/io.h>
7 o/ Y; r3 [$ ?" k: i2 s! l - #include <linux/moduleparam.h>
' f$ q0 X; C$ w' H2 P - #include <linux/sysctl.h>
- `4 L2 h" | i$ { - #include <linux/mm.h>
3 N( F# d+ Q+ c) x1 I" y8 ]4 N - #include <linux/dma-mapping.h>8 `6 J8 ?9 C# W
- ( O; [8 {# A0 D5 u7 W
- #include <mach/memory.h>! w3 [- u: O0 f6 b5 n4 G
- #include <mach/hardware.h>
1 ~% |, M- _! M( U0 V& r1 | - #include <mach/irqs.h>, @8 T9 T5 \. h( \3 r/ q
- #include <asm/hardware/edma.h>; A8 }" m/ X; H0 |
8 q- o3 |* U4 L$ a- Z5 r- #undef EDMA3_DEBUG
# `: g o: T4 l5 g2 t - /*#define EDMA3_DEBUG*/& L$ Q c/ R$ b2 V( H2 M
! r9 n8 u2 G# p- p; c0 r5 Q- #ifdef EDMA3_DEBUG
0 W" ~4 o9 \9 A. b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): @1 _: T% s( Q0 a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. X: M" a+ |1 i [: ]6 i; ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 T: X0 O! {! n/ j3 W- b) q6 J' h& F
- #else
7 w8 o4 S7 T* _" @4 v2 l - #define DMA_PRINTK( x... )
; A* ]7 j0 K( x. W - #define DMA_FN_IN
3 |& Y" T. x4 r - #define DMA_FN_OUT
0 s/ X9 W6 ^6 ~ - #endif& i. a5 f" i y1 [/ K8 Z" \( G
- 8 y2 `" V: p* z; }8 a+ {& g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 k; D4 G# z6 m4 d( Y# _
- #define STATIC_SHIFT 3
3 n4 Q- n- c! o7 b! u. P7 @; ] - #define TCINTEN_SHIFT 20
- x% m8 x$ A" M; ?8 u2 b, S - #define ITCINTEN_SHIFT 21
" R: b. Y$ V8 _# \4 V' ] - #define TCCHEN_SHIFT 22& w e+ Q' V' G8 ~
- #define ITCCHEN_SHIFT 23
6 e' C2 G" |2 J5 U
5 r: [6 ^6 } v+ S# q- static volatile int irqraised1 = 0;. d3 l* `4 s6 v! ]( {
- static volatile int irqraised2 = 0;, {/ s$ H( ]0 r1 x
- 7 A4 K) s" g0 ?! I. ^2 C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% |7 x. N d$ o' l+ }% l$ ~+ J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: P: F$ g3 Z) E& V5 f1 F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; i; M, h. d3 Z5 x* @9 l
9 u) ^0 B3 H- x, i. A- dma_addr_t dmaphyssrc1 = 0;% i2 s1 C) o% a o/ l/ m8 N. `
- dma_addr_t dmaphyssrc2 = 0;" D/ w9 i) I1 f" M1 Y' ^
- dma_addr_t dmaphysdest1 = 0;3 S+ d) m! q/ }& v/ I8 F5 D0 W
- dma_addr_t dmaphysdest2 = 0;
# {$ G5 t% R0 G) ?% q$ p/ v9 M - $ ^# n: k- a! P) |
- char *dmabufsrc1 = NULL;% j, f5 L, t7 e& M0 e% c
- char *dmabufsrc2 = NULL;
& p+ Y. y5 i# \ - char *dmabufdest1 = NULL;" r* Z( @* K9 V' g: ^. s
- char *dmabufdest2 = NULL;. `& E( y8 r( }# k. [% _
- 6 c- h% ?' b2 q) `6 |) x* a
- static int acnt = 512;
: s( {5 q/ O7 m1 E3 m - static int bcnt = 8;7 h) R- |( l3 b; h# n, m, p
- static int ccnt = 8;
" ^5 r- F' Z7 P- G* L& t5 q
+ E7 j5 s/ k% v3 V3 D8 e6 D- module_param(acnt, int, S_IRUGO);; n5 g) r7 s6 v$ I6 o# X
- module_param(bcnt, int, S_IRUGO);$ X+ P9 C+ T# J
- module_param(ccnt, int, S_IRUGO);
复制代码 5 n. m& c5 p ?
1 P w. }6 C+ t+ @9 L. P0 Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 x0 a$ p2 f$ X* @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 g2 o8 m+ Z3 p& U+ j: ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 P( D* a* a0 t8 \9 M" Q
/ d( S# I/ h2 Q
9 \" v2 g% L' b: R. w" C |
|