|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + Z7 l5 i4 K; s x" I
- [code]EDMA sample test application3 k9 Y4 a& H. w( w/ s/ z- W; ^0 r! s
- /*
" M" k5 k& ^: {4 O! \ - * edma_test.c: B: N ~6 K7 d5 K* e' S I
- *
/ I# s' M* h( ?% }3 X - * brief EDMA3 Test Application! w; j) f0 B$ \5 _. Q! ~6 `) @$ A
- *# w9 J+ A' d/ v% W5 t$ j
- * This file contains EDMA3 Test code.- t% I, X# D# }! k" |
- *
3 ]6 s5 x4 p6 n, B j$ _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; m; D/ R4 E: @. n) \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: r8 q( g, `# C+ Q* N0 \ - * TO CHANGE.
1 S' ^8 W# {0 c$ u* M - *
) M. g: J. C" A6 p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 O0 [" z0 g0 D4 B1 `4 w0 H, D( v - *7 T$ K7 v& A& U1 Y) p$ @0 K' Y
- * This program is free software; you can redistribute it and/or
! e9 i& a& T" g3 @ - * modify it under the terms of the GNU General Public License as0 x3 m6 i- c3 b' r& \
- * published by the Free Software Foundation version 2.
$ j" j* ~+ G4 W# q - *+ n+ z9 E( L: t3 N( _* i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! }) y4 S7 M" S - * kind, whether express or implied; without even the implied warranty% f; y, X. Q( M2 ]5 ?2 R4 q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) T6 {! Z' Y2 H9 l% o - * GNU General Public License for more details.2 m8 A; y& b6 D0 u h( m4 v: z
- */. o' v! l8 |" z! A$ t9 Y( u% i, t, o
- 9 A3 @! [9 N1 Y3 i Z
- #include <linux/module.h># a0 B# D1 D- [% }9 U
- #include <linux/init.h>
. W/ O; M8 e" }7 o+ e$ h8 }; Z - #include <linux/errno.h>% S# g* q. j' k. k
- #include <linux/types.h>/ n4 a8 f7 w. I7 G- W7 j, {% u; G3 H
- #include <linux/interrupt.h>
* u% T: L' U& b' F - #include <asm/io.h>9 S5 A+ g+ r* A
- #include <linux/moduleparam.h>
& T/ C& ]* h+ P+ o - #include <linux/sysctl.h>3 _) h' O& ]) ~: X$ ?( r, V) U1 _
- #include <linux/mm.h>
$ s, G E+ S* u, p - #include <linux/dma-mapping.h>
) G) C7 D% L% n1 j
/ r- F+ T' U! m+ |8 x- #include <mach/memory.h>
7 B8 ^5 f; q. o7 x) q0 b( w6 K- t - #include <mach/hardware.h>
' ~! V; e/ W& m* d - #include <mach/irqs.h>! l! v1 S' M6 F. _
- #include <asm/hardware/edma.h>
1 {- C" H7 F% z$ K6 x$ k: b - . N! r1 q" @& y
- #undef EDMA3_DEBUG
% k% C* K; A& B' D$ W - /*#define EDMA3_DEBUG*/
- c# M2 E- U; S" [+ L6 @1 ] - 9 V) }* m I0 U9 R6 S4 w
- #ifdef EDMA3_DEBUG U/ R' b, A+ X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! O4 X" f" O& ^/ w" r$ y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 P. f7 d; L0 J/ p0 y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 E Z# I# }- B7 _8 Y - #else
* d9 V" J' F3 h. Y8 `8 S: i) D - #define DMA_PRINTK( x... )
% S* K! q1 b0 P" R8 @ ^; z/ K3 U - #define DMA_FN_IN! f, I3 w% \0 U% {
- #define DMA_FN_OUT$ U$ D) b; X( n+ h6 A8 a/ M
- #endif( ^. v- ]( I. S4 A& r
- * m# _4 H" m2 \ Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
_: ?# S9 j) m z: @ - #define STATIC_SHIFT 3
- f$ H* ]8 _- x- M0 t - #define TCINTEN_SHIFT 20
- u3 M9 ]0 l7 N( B( X7 z9 c& f - #define ITCINTEN_SHIFT 21+ C& J, w W# O. t) T1 s
- #define TCCHEN_SHIFT 22
4 L! ~8 I1 V6 E6 L6 c& X* D$ y - #define ITCCHEN_SHIFT 23
- J- {0 \2 ?) V
5 k. g2 A& ^& y- static volatile int irqraised1 = 0;
$ ^ j' Z6 v9 ]: }7 b" ?4 O - static volatile int irqraised2 = 0;4 G& q r3 ^" y1 z, }! z8 V, B$ |
% i' z3 p9 ?4 F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" _/ A8 x& L# Y% H3 r N6 p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% `! M$ J5 {* {8 H3 Y6 E3 | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; z `; C" `2 r; ^; w
. }0 Z0 Z( v9 y$ }% q! z- dma_addr_t dmaphyssrc1 = 0;
8 ^5 S8 O8 V- d - dma_addr_t dmaphyssrc2 = 0;
5 J" T) r5 f4 E+ c% z - dma_addr_t dmaphysdest1 = 0;
, A1 j9 ]" q) p( s# m# ]% A - dma_addr_t dmaphysdest2 = 0;
4 N, I/ \6 ?$ x0 V3 P" z! I C
5 ?5 m+ H, R; |3 p Z0 Y8 R2 x- char *dmabufsrc1 = NULL;+ z+ b! n; \' j! O* Q! _8 ^& E& l
- char *dmabufsrc2 = NULL;! u7 t4 o V5 ^0 C" a5 `
- char *dmabufdest1 = NULL;
, [* R' U4 _8 v! @" ~8 u - char *dmabufdest2 = NULL;3 D7 i& g1 B5 I2 N' m% e. U1 i
( k$ _8 d5 C, Y1 y- static int acnt = 512;
' j4 \& {1 G5 A f1 S - static int bcnt = 8;" j; E' Y5 o2 K
- static int ccnt = 8;
- k6 V( a$ I/ V& a: B8 y& H - $ Q( P( j I. y: v! ~
- module_param(acnt, int, S_IRUGO);
, |( b) ~! h- W# l1 T& \$ @ - module_param(bcnt, int, S_IRUGO);0 f$ @$ D! f7 A
- module_param(ccnt, int, S_IRUGO);
复制代码
1 H2 W1 |# ?7 @( \! v
0 d9 j% P* f4 ^8 K6 h/ P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 `/ [, @" z8 y$ } t& L" d8 {7 U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& k3 f" b7 R$ I7 n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 G4 q) p2 A9 e) @ a) G' `- W1 `$ Q: @
8 | I# ^4 n, w: Y4 F( d |
|