|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + L, ?: y6 k8 Z+ Z1 }$ m y
- [code]EDMA sample test application
# M7 `# o- ~; I3 \5 L* ^: M - /*$ E* O x% ~( Y- @, C2 u0 T
- * edma_test.c
5 D ^. G; Y3 P! P; T - *
$ w' P0 k' c$ W' P$ q! K) k - * brief EDMA3 Test Application6 I7 O! ~* r: N( e: E
- *
/ B& l- z1 R' l( J& |- m$ ^* { - * This file contains EDMA3 Test code.3 m$ H" T9 _8 v& g( ^
- *6 H0 t9 m3 ^6 e$ m8 p, g8 Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE {" k7 Z7 M' i& ]" q3 C
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% e& b+ B0 X: _0 I" r
- * TO CHANGE./ L. z; ~; r n5 k0 {4 b6 m, j/ ?
- *8 x& l4 c+ v, N4 }6 R
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
T. G$ [9 B" l2 o0 B9 o - *7 D% r5 h( [, n' P O$ ~
- * This program is free software; you can redistribute it and/or
9 i6 |1 Y$ F$ L - * modify it under the terms of the GNU General Public License as
; a" T2 y' i K$ s6 h1 S; L - * published by the Free Software Foundation version 2.
9 u; g9 ?* p# W" D& W4 t6 X - *7 L; W- [7 i( K$ o4 ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' o' K) S! H+ S+ V6 w3 j, n
- * kind, whether express or implied; without even the implied warranty7 O' _: G" N0 U) f! x u# F( W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* x% P6 s5 h# Y5 @% E0 o! C2 R
- * GNU General Public License for more details.
& L8 Z6 W) Y3 }6 I# L - */
6 S# M) [! j6 Q% X- W* ~1 b" F2 h
+ Y2 P' H! j. K$ M" H2 m" ?* W- #include <linux/module.h>
% t' C0 G, x v3 j) n; q" R - #include <linux/init.h>
3 N, p# H2 G0 q" y$ { - #include <linux/errno.h>, }& `+ @8 X' w! w+ B5 y9 ]; }
- #include <linux/types.h>
% H3 V& y6 k9 }" Z - #include <linux/interrupt.h> a" D. x! @% E$ l
- #include <asm/io.h>
2 I* A, P5 K7 _- I. R% Q" J - #include <linux/moduleparam.h>
0 y, r) O& y+ K- I) ~ - #include <linux/sysctl.h>
' U6 u: p, \# S# Z4 q& B - #include <linux/mm.h>, m/ |" {3 G- Y2 |" v' G
- #include <linux/dma-mapping.h>* x$ `6 u: g, q% [
- g8 d* U7 f" K7 s& P8 @
- #include <mach/memory.h>
# f0 B7 O* q) U3 w+ f. i - #include <mach/hardware.h>! H! B6 S& z2 o w, Y- q* I. H* i2 k
- #include <mach/irqs.h>* `4 f. ] @7 E( c$ t( K3 @
- #include <asm/hardware/edma.h>
$ }' I3 x6 i8 n" d- Y- r8 T
$ b' N ?8 R a- Z8 l7 t7 D# ^- #undef EDMA3_DEBUG
& F! r S% X. j$ t - /*#define EDMA3_DEBUG*/
5 s5 u5 J1 u/ x: |, b' c6 C4 z
) t. m N1 D. Y+ U8 [1 J- c9 O- #ifdef EDMA3_DEBUG
9 S& _" c/ \: O" ~( k0 v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# s* n( t: F' C; p$ V" @1 x+ x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' e2 q7 C$ ? t6 L! @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( I- Q! I9 Q( W1 b3 p6 t - #else) _: |# l( N7 O4 D2 K# X! y& P
- #define DMA_PRINTK( x... )2 ^0 F: N9 @& m& m+ S3 H! @
- #define DMA_FN_IN; t6 r/ Z; c# f. ^
- #define DMA_FN_OUT; q0 p# \% { S9 k% T
- #endif- a8 [5 F) o& [
! u4 T; V2 }6 G1 l8 {, }0 |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 X) P b0 A# t! `: u: O
- #define STATIC_SHIFT 3
A+ p, F ]1 U, D - #define TCINTEN_SHIFT 20
9 L* `- `, E; v; P; s `2 o - #define ITCINTEN_SHIFT 21" Y8 G+ ~* b u! z
- #define TCCHEN_SHIFT 22& H# K4 r" g) V+ I% n8 Y
- #define ITCCHEN_SHIFT 23& c" Y! s( J+ Z7 ]5 J. R& i- W
! O8 o% j) B' t3 _$ g9 b+ h6 l- static volatile int irqraised1 = 0;
* L% D2 \$ n$ _7 z* b, D* m - static volatile int irqraised2 = 0;
% e0 L- J, k6 r- K. } |
% J( ~ \* w& q9 E# n3 l; G( b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ [( F$ t! e1 Q$ @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- E* b# ?0 g2 y0 U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. k1 n9 R$ |4 W, |# Y A
2 a7 W }! ?1 W5 D7 O- dma_addr_t dmaphyssrc1 = 0;
% b. L g; D+ {; J9 e( a. e7 J - dma_addr_t dmaphyssrc2 = 0;0 z- v1 i& C* ?6 p: M3 p1 F$ Z) t
- dma_addr_t dmaphysdest1 = 0;# a9 s" B' k+ ~" [2 r
- dma_addr_t dmaphysdest2 = 0;$ c$ [. l/ S" P# p* o$ C$ c! p% _
) [7 b2 r- f& p% S s" f( }- char *dmabufsrc1 = NULL;6 t9 i1 `% K' v c( l1 F' J0 p
- char *dmabufsrc2 = NULL;
- C% Q3 C+ T: N( j6 q* M - char *dmabufdest1 = NULL;
, D, y& r% `# E ~( I - char *dmabufdest2 = NULL;* \8 J; f6 T3 W( C L
- + I- ~5 K& {* J
- static int acnt = 512;3 _2 X7 N' L, V; W
- static int bcnt = 8;
' w+ {6 @; }7 H5 c - static int ccnt = 8;
1 X, N" j1 b. F0 ^4 c' ?7 h$ T- M
- u$ z3 [$ j7 T- module_param(acnt, int, S_IRUGO);& Q3 u, [# j5 c- i6 X3 B
- module_param(bcnt, int, S_IRUGO);5 o$ t. w5 R/ S3 }2 ?+ i
- module_param(ccnt, int, S_IRUGO);
复制代码 4 k- E8 R- [ r% I: _$ H
2 w) ?5 b6 L6 F7 G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; N7 I) x7 D, \7 S: o% o, o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* H5 e# z7 f; l- f. V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 w; D$ m; D9 m$ h3 M F5 t8 l
6 Y" X* V: P' V) E: [2 @9 a9 E* [, B9 I/ }! T$ C
|
|