|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 }" t1 c6 \/ ?/ x$ ^# `( A- [code]EDMA sample test application+ y/ \3 L- c; _9 M, q4 m
- /*
" e. l+ ]) f! c: B0 ?/ a& C - * edma_test.c2 `7 t" N" Y3 j' D! G7 Z1 o
- *
! {3 m6 P3 s5 B - * brief EDMA3 Test Application3 ?0 y# Q; z% [ a( j
- *" Y4 A0 G. h& P `9 w( z% ^
- * This file contains EDMA3 Test code.- L1 ?. l; j6 {* ~
- *" F; _4 H/ j ~4 Y" W7 F6 k7 T; G
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE Z/ M5 V0 U4 P. W9 ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ l/ y8 f- L/ y) o9 g" B - * TO CHANGE." y9 f# ?# q0 l' @4 I+ K8 f
- *
1 e- Y( r# j1 }9 n/ q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 u. l) Z/ V$ K3 Y* I - *
" B- E7 G- y3 W; Z& q z/ O* [6 B - * This program is free software; you can redistribute it and/or
- L' R8 i! Y: K, [ - * modify it under the terms of the GNU General Public License as
; v" g9 h! _9 f) Q - * published by the Free Software Foundation version 2.. ^. {9 p4 O. _# R. Y4 T$ A
- *
! P# V) m- V& n: c @' l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. J+ L$ n* j" U( Q9 C
- * kind, whether express or implied; without even the implied warranty
. B$ l" P, A" b( q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, [9 ^1 t* i) g7 F9 I# U% f - * GNU General Public License for more details. v0 z8 m1 w9 O- K7 w6 f% d
- */
9 W. C( H4 b1 z: i" V7 {% R x- j
+ c3 | d0 O2 v/ |& _- #include <linux/module.h>+ V3 @) }( b: n3 x! c' h- E( G& [
- #include <linux/init.h>' b1 i1 d. w" A8 W& L s9 i
- #include <linux/errno.h>. }7 M$ I+ U) j, p5 ^
- #include <linux/types.h>" [7 ^ V# U7 `2 V" ?1 B$ O5 ~
- #include <linux/interrupt.h>
3 Q4 [; i, q+ U: D) i; o& h j - #include <asm/io.h>: i0 f- k& n' _3 w" r8 q4 i( o. s
- #include <linux/moduleparam.h>
# i& ~& w- }4 n+ B/ [5 d4 P - #include <linux/sysctl.h>0 A+ c, P! u3 k) M
- #include <linux/mm.h>5 Q) z8 p3 R% H. _8 O8 }9 X. H* _- {
- #include <linux/dma-mapping.h>
# ~2 g) Y* |# A3 O+ D$ J# e' h - ( }% C, J2 X; G2 ~$ R) w; k
- #include <mach/memory.h>
, q. e( E& {0 M - #include <mach/hardware.h>
0 P0 ?4 z W& t$ Y) z - #include <mach/irqs.h>
. Z/ D! j& E' Y! o6 g" {( ^ - #include <asm/hardware/edma.h>
) H/ A( ~6 s! n% c8 T* I& T+ U$ e7 P/ \ - : ]# H9 D8 X. E/ d/ O5 i, Z
- #undef EDMA3_DEBUG+ }6 f" U7 I5 @+ n
- /*#define EDMA3_DEBUG*/7 ], v4 y, k: ^0 {/ S/ u: N7 J! @; J
! F U* x, L0 e; O6 Y l9 a5 v- #ifdef EDMA3_DEBUG: o- V& U8 b1 E# p3 |6 Z& U4 P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: G! s- k0 t5 A L. U4 C. g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 }9 n, ^% H# m" O4 P5 z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ u1 _4 l+ ]9 T4 o/ V7 O! E - #else. ?1 G7 O c' i6 a
- #define DMA_PRINTK( x... )% ?* p/ {; l: q/ f) u1 f+ F
- #define DMA_FN_IN; k. S3 h ]0 \2 O8 O
- #define DMA_FN_OUT2 _1 l6 U& J9 p4 ]
- #endif
/ L' {4 H; d& o - 8 z, k* M$ q" w& X+ r! m, q& c* w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" R; V+ H" H! f* w' _4 S% w5 e
- #define STATIC_SHIFT 3
. c$ R6 @% J# A! Y' v+ H! B% T - #define TCINTEN_SHIFT 20
! H4 n. P/ \4 n( q g r$ k - #define ITCINTEN_SHIFT 21
+ g4 e f. R' V& U" n - #define TCCHEN_SHIFT 22
& ?' ^4 S( O* s( x0 P, v( @# w1 P* v - #define ITCCHEN_SHIFT 23; C* O% ~: z( X' Q- s; f& `
- C6 u5 R- J" N3 g6 t# {
- static volatile int irqraised1 = 0;8 e z# C3 Y3 x+ o( F
- static volatile int irqraised2 = 0;
, z8 ^. A5 v. D; C
" n/ {6 x A1 a! d& B3 o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 g1 _5 E0 t2 |2 J: b1 u6 r/ I+ l. M# ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% ?- ]" b* A4 S9 L2 D+ Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# N8 T! E9 b: A+ G& [
- ! i; X3 j A% e! ~* ^
- dma_addr_t dmaphyssrc1 = 0;
) [4 Z7 t _% v3 @, A2 N - dma_addr_t dmaphyssrc2 = 0;7 |3 V$ H% |; r! L9 s$ }2 o
- dma_addr_t dmaphysdest1 = 0;
6 n v! }1 h: t: T9 e( M - dma_addr_t dmaphysdest2 = 0;, l1 R3 y' b# R% `
- 2 u9 a' a* y3 k; Q: c% q
- char *dmabufsrc1 = NULL;
) ^+ X: A8 j) k) t5 x - char *dmabufsrc2 = NULL;
. d1 p1 J) T3 u' A0 W' U - char *dmabufdest1 = NULL;
# Y4 }4 L1 S& Z8 S! R: r/ U$ I { - char *dmabufdest2 = NULL;2 @$ w& q9 H W
- 1 o+ z: j% `) }
- static int acnt = 512;
2 Q$ s* h j- ~: l) c0 Y( i& F1 a$ G - static int bcnt = 8;
4 T' V( n; Z% a' d2 z - static int ccnt = 8;4 n9 a+ v6 ~- y' t, v
" U8 ]' @; f* x, p/ M- module_param(acnt, int, S_IRUGO);6 d1 Y8 Z7 o5 Y- v* J0 l
- module_param(bcnt, int, S_IRUGO);2 \1 o4 d* U [3 s5 U7 [5 G
- module_param(ccnt, int, S_IRUGO);
复制代码
+ b0 w% L5 [4 I2 z1 e9 p3 i
) \9 w) I+ {! \$ c% N( F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' v6 |3 e; Y$ ?* A! y# v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( J6 U6 `; b7 e$ J7 H0 A- w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- D, [' _1 K* {3 H. D9 \
: H3 Z5 l3 u) u5 `9 [6 Z& P. v0 D! j& ^5 z6 k7 n5 v- z! O
|
|