|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ r9 A5 }9 C( ?7 [$ |+ R3 ^- [code]EDMA sample test application
( g6 _4 G. @" F8 j - /*5 ]8 p. K! E) e3 D7 b5 V f
- * edma_test.c& ~7 ]: i% r! G$ } p
- *
0 b$ A* ]% k/ X9 J3 e2 F) ] - * brief EDMA3 Test Application& K4 ~ }* o' e! b: N# s. ^
- *1 k6 t% J2 w' `0 C/ P" q
- * This file contains EDMA3 Test code.
+ A7 A/ g5 z8 b9 N - *
7 h& L5 t) H- b; [ B6 ] e. @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, @( T& K& j' ?( I6 W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ f/ R) {$ L! Z4 ^9 \
- * TO CHANGE.
# W% F$ |" o: ^& i6 E: ` - *
6 Z6 i7 Q6 x9 Q# c6 m4 N/ T$ h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ c+ O1 x, i, f0 I+ A$ J
- *
+ k) J3 O+ p- D4 e( [5 m( O - * This program is free software; you can redistribute it and/or
' t$ R8 B% M& j) s3 i - * modify it under the terms of the GNU General Public License as& P; d# B! o q, C) M; E
- * published by the Free Software Foundation version 2.. Z# k: g- I k% g3 o
- *
9 \# J( A3 N- j! `+ w6 x; r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 O5 L% f' N }' O* J - * kind, whether express or implied; without even the implied warranty
- z- |$ X5 ^, J# J6 y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Y0 u! U6 L0 w9 Z( Z
- * GNU General Public License for more details.: Y0 ^5 [; }- j4 ^" ~) d& z# z2 a
- */1 [( |; U" H: k- c1 O
4 F- j8 h3 G6 g9 i, I% t4 M& W- #include <linux/module.h>5 i$ c/ C y* C* I: b
- #include <linux/init.h>
1 S. T7 g( L& `, ]3 m" z - #include <linux/errno.h>
2 n. }7 b. G% h - #include <linux/types.h>7 J$ |" C9 @% @% h$ V( x
- #include <linux/interrupt.h>
6 e. }5 T8 z8 r - #include <asm/io.h>2 I1 l3 Z: e3 x; Z5 `% t
- #include <linux/moduleparam.h>7 {' E5 x5 b q! {+ }) Z0 h
- #include <linux/sysctl.h>$ Z9 F& v* t0 ]$ h4 K' _' S
- #include <linux/mm.h>4 Z' F/ r, o$ t M
- #include <linux/dma-mapping.h>& b8 M R2 _3 Q) c/ j
- ! o. [* d4 X0 G
- #include <mach/memory.h>
/ x+ O9 j {5 X+ p, b* F2 l) i4 g - #include <mach/hardware.h>
* Q% d% q3 h9 o" T - #include <mach/irqs.h>% g* h! t) M7 }2 Z, t) ^$ ]$ [
- #include <asm/hardware/edma.h>
! E& g6 ~% R2 m0 x* ~4 N - 0 i3 U) F3 ^# k( b( _% F4 O [; C
- #undef EDMA3_DEBUG
6 F% ]" y/ i! g, ~" Y# v2 Z - /*#define EDMA3_DEBUG*/! m* O2 y9 _7 v' ` K2 T9 r" ], K& k
& B" e) ]( ]2 N5 m, K+ B- #ifdef EDMA3_DEBUG
& B' ^: F: [" T0 c( O2 ~2 [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, U+ d, O/ G) w6 W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% \) D' x' ^: N a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 r- m7 v$ l" N* ^+ K% G8 ~) ~
- #else/ \7 L6 \! p6 j# S) }. y$ R( ^
- #define DMA_PRINTK( x... )
. Q9 A( O% c9 m5 \ - #define DMA_FN_IN
+ X9 F# Y4 y- l# }( _" t! J( C - #define DMA_FN_OUT# D: X. M& ^" i+ r
- #endif9 j6 \6 R: Y& q9 Z8 @& z k
- / E3 X t& R7 G" A8 J$ N* ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 l8 x" D5 J# }9 x
- #define STATIC_SHIFT 38 ]$ ^0 |5 d: P; z$ ~, l$ n
- #define TCINTEN_SHIFT 208 @2 Y7 L) ~5 y0 w+ J! h& ^
- #define ITCINTEN_SHIFT 21( m$ o, W1 O, v! [6 I$ [* |
- #define TCCHEN_SHIFT 22
4 z' I0 Q+ E9 S/ O( a/ Q - #define ITCCHEN_SHIFT 23
# t* O+ o6 `+ b# E
3 i& O9 {# f2 h# o4 o' V9 s4 D' t9 ^- static volatile int irqraised1 = 0;
4 k/ {' g! t# y# O% j - static volatile int irqraised2 = 0;* s; U4 w, y, p- a& I' D! d
& I8 |& v) `9 ?1 y6 x! t* f P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) T3 T4 z! W+ C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: V# p, F) s" a4 C% }1 a& j3 m2 F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ~; m' w0 c! E7 D, b+ n* g
) v; T4 R% {" z% l# [, I- dma_addr_t dmaphyssrc1 = 0;
$ ^/ \0 P6 V5 Q1 Z8 \& m - dma_addr_t dmaphyssrc2 = 0;
, D$ n1 F% Y0 q, N; z3 r - dma_addr_t dmaphysdest1 = 0;, K" g% Q1 p6 S. O; p
- dma_addr_t dmaphysdest2 = 0;: ?* G, X# f& @. e; T$ a8 ~4 k7 g* a
/ D7 c6 l" G6 d" `- char *dmabufsrc1 = NULL;( f# j8 D! @, ~0 @
- char *dmabufsrc2 = NULL;9 E( V( Y# N( [% t4 `
- char *dmabufdest1 = NULL;1 L0 y a: g% J4 }7 f2 j: x
- char *dmabufdest2 = NULL;
) y- U/ {9 O s5 G4 o! o
9 w3 J# g( w1 Y3 O) N! k- static int acnt = 512;$ L9 M, v8 j6 L9 B
- static int bcnt = 8;
8 L7 C; u: |. ?4 v - static int ccnt = 8;
' t1 p, i. }8 K; f2 ~6 f1 h1 m - " ~, @2 h9 q3 u q) v) }
- module_param(acnt, int, S_IRUGO);
4 X; ~. k0 [* l4 B) P# A f - module_param(bcnt, int, S_IRUGO);2 l/ I( `3 m8 U
- module_param(ccnt, int, S_IRUGO);
复制代码
. ^) j- {' l5 u0 }
( M! e$ t2 D$ b# w8 ?% }$ p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 w/ u( N) v8 o3 b* H' t3 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" g' X9 L( s5 A7 O$ [7 b; G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 G: ^) E9 x" q7 [+ j9 O" S
3 ]$ [; F; m; w0 M3 z+ S* t7 C8 _; [& I5 w; D4 Q$ p
|
|