|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% F( z" g, g1 a9 m, b# V& g8 [- [code]EDMA sample test application' c# S' N- @8 w+ d! u
- /*
! v; k& s/ A4 `* _& C9 I( o - * edma_test.c& e& ~& i' `) t) f' Z# a0 w
- *
* Z' N: B6 x1 A1 l' @: q - * brief EDMA3 Test Application/ m' W, j1 ]2 ^
- *- e# b/ {0 ~4 h2 m m) M) K& `
- * This file contains EDMA3 Test code.
( y- j8 k2 i3 _3 h; b f - *
4 t8 H& Z' K3 \* | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% h H1 p( `% g1 b/ f" K2 i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 f9 E. q% @: c( b! R0 m! g; t
- * TO CHANGE., K: J- z$ k/ K9 n9 C
- *; ]+ h$ N, K& l7 y8 M% `% J5 t1 ~5 }' B5 l* @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 {! M7 C# \! w% k" H - *3 K% m- W, t& I1 d! a, o2 e
- * This program is free software; you can redistribute it and/or
! _' j9 {2 L7 ^* `/ [ e! y" K - * modify it under the terms of the GNU General Public License as' c/ h8 H6 r+ E- ~
- * published by the Free Software Foundation version 2.
% ^7 T0 X9 r: r& P - *
3 l$ R9 F# m0 L2 r; @6 m1 W0 h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 e$ y3 L/ X# f/ F. @# z - * kind, whether express or implied; without even the implied warranty5 K0 e' E+ [/ [0 A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- Z2 L( a( ], f - * GNU General Public License for more details.
; s6 H Z: P& W( B" D - */2 X3 [1 d" B0 E2 T2 }
1 b9 q0 X9 W9 g9 I- U( k+ ~- #include <linux/module.h>' Z' T% o3 p! t* W# t
- #include <linux/init.h>7 g0 ^% p$ P- n$ G, B
- #include <linux/errno.h>" m3 Q2 [, |# R& e: C* X
- #include <linux/types.h>
u5 |8 _; m8 B, @/ ^9 L - #include <linux/interrupt.h>
( c% a! H3 E+ s- D( [8 x& b8 | - #include <asm/io.h>0 x* p/ Z5 A9 ~$ @
- #include <linux/moduleparam.h>
5 A" r/ Y) v0 S$ F- S9 s - #include <linux/sysctl.h> u% M0 F' y2 i! B' a; x- X* x* W
- #include <linux/mm.h>
% |5 p0 Y4 L# G7 ] - #include <linux/dma-mapping.h>
1 Q/ i0 l8 q, @8 l2 B, R9 E - 0 e8 ?! `; q: Z) E4 `* C Y
- #include <mach/memory.h>7 _6 k+ G* |, a
- #include <mach/hardware.h># M$ t+ t4 }6 v* O
- #include <mach/irqs.h>
" _0 s) L- \( ^: e4 J9 [" M - #include <asm/hardware/edma.h>
9 S! b3 [. A0 @# s9 I( C9 X
3 I# h, A2 j3 K/ s9 V/ O5 E0 q2 z- #undef EDMA3_DEBUG- t9 [- s- p0 o' R5 E0 E
- /*#define EDMA3_DEBUG*/
# h3 D: j8 g8 r+ M - - [! U+ r1 m. r% P" E
- #ifdef EDMA3_DEBUG$ f4 z$ _9 G) @) g/ {" Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; q/ _" ]) }0 g1 U9 A! t/ D5 K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- D: g; T3 c, k' ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 p, n1 n; j2 F( e1 j( T8 x
- #else
6 G3 b1 n1 }( Z$ Q - #define DMA_PRINTK( x... )
( u J' ?: g* R9 W2 F7 Y: D7 e - #define DMA_FN_IN
; ^0 m" X3 s" d9 J - #define DMA_FN_OUT- h8 b0 G1 D. D: [5 m$ G* q
- #endif
% }9 a! ^" ~! l# e$ B% W% T
+ C! k3 m- C$ Z& x" `' u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ [# g9 {6 j" {: h) Z - #define STATIC_SHIFT 39 V$ x) j, r5 j7 X9 e' o0 ~: a8 ?
- #define TCINTEN_SHIFT 206 K" k* D# q# _6 e: H6 b
- #define ITCINTEN_SHIFT 21: i& [ ~7 U1 k/ e; l/ g
- #define TCCHEN_SHIFT 22
3 y$ g& T0 u' s! T3 M, q: T$ H& p0 E - #define ITCCHEN_SHIFT 23
* {' g' ]; `3 w
; k' u2 k$ W2 w- static volatile int irqraised1 = 0;
. z0 c1 F8 W/ ]% f% }. J - static volatile int irqraised2 = 0;
! x" r( V! a) q& h$ x5 a - + o) M _ L# d, j6 T: \% z4 Y% |! j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) P6 U% G! T; ?$ K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& }* s1 W5 Q$ ^! P4 C' R) P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; `. B$ s2 F+ y- _3 a! s
+ G; ?# }. O" U* N- dma_addr_t dmaphyssrc1 = 0;. w' g4 M1 L" G* k" }
- dma_addr_t dmaphyssrc2 = 0;. {4 Z0 P& I& X9 M1 f1 s3 I6 Z# ]
- dma_addr_t dmaphysdest1 = 0;$ g. a" U; |1 g0 S: {
- dma_addr_t dmaphysdest2 = 0;
. v$ {* `. ] J+ G- e: S
% Q& L% @) u+ a8 e" j9 d5 m( w$ L- char *dmabufsrc1 = NULL;% H) i& w$ _( l% ?$ r; C4 i
- char *dmabufsrc2 = NULL;
2 i2 i2 i b5 @ - char *dmabufdest1 = NULL; p' i% C$ X% B) w" x7 S0 g9 p
- char *dmabufdest2 = NULL;
2 Q( u: e! _6 Q: B
" a8 } B b$ Z; V- static int acnt = 512;4 T8 V7 X4 ?, N5 c. t, |
- static int bcnt = 8;% H* a' q: x5 a; \+ |
- static int ccnt = 8;
. I, z& e" ]3 Q - $ [* I: y0 B' t; i' v3 o2 e
- module_param(acnt, int, S_IRUGO);! t& k' o& o1 ]- y+ P( A2 C- x
- module_param(bcnt, int, S_IRUGO);) B( z. `" ]) m7 Z) [7 B
- module_param(ccnt, int, S_IRUGO);
复制代码
) b1 X, I1 X& t) z/ g6 i" y- J! @6 a/ H! C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 k/ q8 e* P$ m+ E' F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 }2 N" {% q# f5 O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% \: ?$ g5 t# C$ L, N }$ v' ^
]: x, L$ {. @0 C- }/ H. v+ q2 Z" Y3 K- y0 f) M" I' W9 D) U
|
|