|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; I4 _* }( i; R& h
- [code]EDMA sample test application8 h& H) }; z. D# a& L) \) p
- /** H2 l. D; I: I0 c9 @
- * edma_test.c
6 ~; ^% }6 D' g: _3 W' K - *# Z, l6 q, q5 W
- * brief EDMA3 Test Application
/ C! I9 Z; d" ?- w" y7 F - *
9 t# s. n: c& [+ V - * This file contains EDMA3 Test code.. y8 t. h3 Y3 H$ S, {
- *2 H K" N$ `) ^+ Y% T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ [4 @% h- N, O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' r& g7 H2 @' l8 M* H9 M# r# Q& `
- * TO CHANGE.
( y* O o1 ^% A h - *
& {/ |& Q( q' \! y; l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 H& s3 I3 l1 E5 H1 I - *) Q$ a! k8 h2 w; {9 {! ^
- * This program is free software; you can redistribute it and/or5 a3 B6 M7 H! g+ |' y
- * modify it under the terms of the GNU General Public License as
+ v6 m- J+ I8 j+ H - * published by the Free Software Foundation version 2.6 R% R/ \+ h+ V+ W8 O
- *8 m# [ @, P& a) P8 _" H* M4 U" \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 c* o+ C, t# N; e6 L; N6 K! c) K - * kind, whether express or implied; without even the implied warranty
: f% M+ \4 ~5 _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( _; @+ ~$ j7 S, ]5 r
- * GNU General Public License for more details.
1 j: V l [3 e: }1 L& T3 r8 N - */
[/ E( L$ ?. [; C
4 d5 g/ i8 K0 ~' h' }3 \- #include <linux/module.h>
/ f" j! s$ w$ _( M1 p - #include <linux/init.h>
: o* V9 J, `9 D( x$ \3 M - #include <linux/errno.h>" ~# y2 B% N: `1 O
- #include <linux/types.h>
6 X3 L9 O* R% W/ h* u0 k( V4 `6 o - #include <linux/interrupt.h>* z3 A! u1 s, U# ]6 w+ n5 ?
- #include <asm/io.h>
1 r/ [3 b, N H, g - #include <linux/moduleparam.h>
$ Z+ v" N- f6 Q; _ - #include <linux/sysctl.h>/ H2 P9 W- x: O* X+ R
- #include <linux/mm.h>& m- U* `4 r' @; b; z6 p
- #include <linux/dma-mapping.h>
) L$ c$ K* o/ V
" }3 j; ^4 l0 d. Q7 H- #include <mach/memory.h>6 F5 g4 j- b4 ~* G, ~
- #include <mach/hardware.h>: ~$ L7 `1 v& q2 h Z! y
- #include <mach/irqs.h>
, c% O" L/ F; k3 a - #include <asm/hardware/edma.h>$ b; q% }; G/ C/ j1 B1 A9 E- _
- 2 b& n9 v U9 A5 J
- #undef EDMA3_DEBUG" w. Y! j1 K5 Y: g7 w
- /*#define EDMA3_DEBUG*/' C) H9 w& I0 L1 E
]! P# e3 S* Z8 D; {$ j& k1 R- #ifdef EDMA3_DEBUG2 H* W& m7 I4 e5 ^7 u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 E2 C o1 K* `+ Z6 G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ ]% A; i: A# K! u! ]3 E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, L. C e5 C( c2 L" j" E - #else
8 J0 g# l4 q: }2 Y - #define DMA_PRINTK( x... )
9 H. A* V" j- ~ - #define DMA_FN_IN
" d1 U% l0 ]2 N _- l; L - #define DMA_FN_OUT
0 U A7 Q9 ?1 ]% ^ - #endif
6 r; M# V& @8 k. r1 ~) v
; W3 P L& U9 }; D9 @# n( j5 n/ v8 ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" F7 o- q- M& G: I- u! Q4 _
- #define STATIC_SHIFT 3. A. c' r8 ^% K* K4 Y
- #define TCINTEN_SHIFT 20
( E- X6 k- s& L, ]+ b; ?) Y8 P3 G+ s - #define ITCINTEN_SHIFT 21
, A$ r n8 s8 T4 @. F8 k' g - #define TCCHEN_SHIFT 22
5 F/ J9 e, e& N+ W# ~0 X) J1 S - #define ITCCHEN_SHIFT 23
: O+ u) H0 r, l8 Y0 ?7 f6 ?
7 N5 g. I, S8 \# z- static volatile int irqraised1 = 0;6 R$ [8 N' u& W0 U {
- static volatile int irqraised2 = 0;
, W/ D8 j9 g+ O - ) a, y# Q8 p2 o( C9 ]+ v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. A/ u9 ]6 e9 D: z3 l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! a6 S( e$ T: _6 V) W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ o- z) c! f% a* c6 R4 u- p% @' V: j
; A* E8 d" t- U# r1 A- dma_addr_t dmaphyssrc1 = 0;8 \2 n# n# b/ k: o" I- m) T4 g
- dma_addr_t dmaphyssrc2 = 0;. S6 |$ ?# ]& j- {$ J
- dma_addr_t dmaphysdest1 = 0;; J. _+ ]. C. f0 o6 _
- dma_addr_t dmaphysdest2 = 0;
, G* W) S" m0 G Y) C2 Y6 _' D - + }! t/ Z8 V5 h' l0 D
- char *dmabufsrc1 = NULL;& E- p- X7 _6 \8 \
- char *dmabufsrc2 = NULL;1 U: l5 |- G" }1 E, V
- char *dmabufdest1 = NULL;
' I& M7 F$ r$ x' Y( ]; \ - char *dmabufdest2 = NULL;
: Z9 ?5 e. h; [! W1 R% [ - 5 u- z' [/ `) S4 X. R; g+ a: J
- static int acnt = 512;1 x! b+ o- v% ~. b
- static int bcnt = 8;* d/ h+ ]' {# c# X7 J# e3 C
- static int ccnt = 8;
7 D E+ N) I- U7 `7 M
* S) _ m* L: h' L& M- q- module_param(acnt, int, S_IRUGO);& g% Y! _( Z% K- n( Q# E& }. a
- module_param(bcnt, int, S_IRUGO);
- b9 _- K3 R% j# Y( F, ~ - module_param(ccnt, int, S_IRUGO);
复制代码 Y$ d- w3 f! `0 H8 o
+ Z6 t& V$ I2 [7 q6 A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! \& e( ?" H- [# s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" _. J' o' ^2 q3 A. h7 v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 Y# O! O- n6 h* i; O; d ~; ~
% v4 {# Y& J1 n
' L! u& h! r- ?+ i |
|