|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / u' T, v1 A; ?( H& U6 B% i; Q
- [code]EDMA sample test application
* s, L4 T% E+ n _: L - /*
' A, M3 H2 z5 [% z" N! L& C9 n+ o( { - * edma_test.c( }/ g7 @* K. H% I6 T3 h8 j# A
- *
5 u6 b* L$ p; E8 ~# }. y9 M - * brief EDMA3 Test Application, [# w% k6 l9 M' ], o# X( U& h
- *
" t+ B( y2 A/ ^4 Y9 T' g# W - * This file contains EDMA3 Test code.
" m3 F. G% [# F) v - *
5 n7 }! b+ N9 L( W. n8 j9 g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' }( S* N6 j1 V( F" g' K4 l9 M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 W; _* u1 q" j( v; H$ Y) K( N0 {/ X
- * TO CHANGE.
2 q! _. o6 j* B( b) Z - *& H2 H3 Z: d- n% j( Q6 X2 g4 |9 w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 K$ R( T/ S) x; S
- *, d' E# G8 t* M2 x$ L1 S* c
- * This program is free software; you can redistribute it and/or: U4 z; T+ w& C' Y1 v+ d _
- * modify it under the terms of the GNU General Public License as
5 M6 K! E$ |2 c - * published by the Free Software Foundation version 2.) u/ l3 }0 X# @. r/ r
- *
" s- O) s3 X9 y/ r: M+ t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 X( J" j# e' h0 e: _' ?0 u6 ` - * kind, whether express or implied; without even the implied warranty
6 }) s7 C; D7 T( q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" c& X$ v, u* Q' S) T$ p) j" ` - * GNU General Public License for more details.7 L; F4 l1 w7 N: X/ b
- */
+ s8 v9 W- ~( n) S9 t+ f - $ z( B' r* C* I+ `" j' S) f
- #include <linux/module.h>
' G5 ]3 `) N+ l0 {( L- V' s - #include <linux/init.h>/ F. {# C: Q' R! R- }
- #include <linux/errno.h>
- I$ m3 a# c/ R& w) D! Q+ p - #include <linux/types.h>& R$ h" z+ ~7 @- {( D% v
- #include <linux/interrupt.h>6 d; B8 b r8 P( d& z2 R5 @8 F
- #include <asm/io.h>& p( _; L$ S2 _1 o+ @5 b
- #include <linux/moduleparam.h>
3 X, o4 F3 C4 Y& M4 M6 i) v0 | - #include <linux/sysctl.h>
5 N' S- b( m4 u - #include <linux/mm.h>
; D% z: k# |5 z) m8 e# ~/ |0 p - #include <linux/dma-mapping.h>3 i* r8 m" f; F, F3 H
( _' P8 K/ _2 q& a( z$ m1 J- #include <mach/memory.h>
$ U# E- Y$ j5 N# E) V8 d - #include <mach/hardware.h>0 V9 N5 a7 e; c/ m; q
- #include <mach/irqs.h>
) J0 W; y! M6 y4 f) C - #include <asm/hardware/edma.h>
8 d5 s" l* G+ A/ c% c$ E1 W- S
) L' P3 k, m9 x5 k7 f2 W- #undef EDMA3_DEBUG
# Y2 t, J" ^. T/ M! R - /*#define EDMA3_DEBUG*/. f# u0 C6 S2 H( E
/ _1 D! K: {4 a- h* ?( f- #ifdef EDMA3_DEBUG+ |1 {1 p, g: ^8 L( g3 h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 I; j! d) |5 b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 U0 R) L! d8 K2 i \- T9 R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 @0 d q2 G9 h) M2 E8 m
- #else
- {) ]: S2 ~$ \4 g - #define DMA_PRINTK( x... )+ s4 ?! L: X2 I# L1 d: h4 w( V
- #define DMA_FN_IN0 k9 g$ c/ g8 A V! ?! r, x
- #define DMA_FN_OUT
5 ]1 ~, U7 l/ @+ f3 q - #endif
8 t: `% r) [' S' g! n
- y) P Y2 ]2 \+ |! _1 m9 i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( D$ U2 a% D& g+ b& c W, H
- #define STATIC_SHIFT 3
# d6 a1 v, n1 a# K' o2 C - #define TCINTEN_SHIFT 20
" _6 t: _. d/ t" E- ^ m - #define ITCINTEN_SHIFT 21
& @$ C7 f' y# y; v& x - #define TCCHEN_SHIFT 22- M. d m! \8 T' ]% H7 u5 Q/ {
- #define ITCCHEN_SHIFT 23+ B! U& Z5 d. ^$ D( K# T; d* x% V7 Y
# V- `. L" N* F" J" D- static volatile int irqraised1 = 0;
/ p/ l( _" o& o% w% d* A - static volatile int irqraised2 = 0;
8 I5 D7 p; h u" N/ _. o - $ X1 K, {& Z/ [' W( A& n- m( P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' k( _# E1 W/ Z# w/ E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ]- k" H% F( F3 V; G1 a5 b$ |* G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! @+ U( A2 Z* U2 i# I5 h4 ^
- & f* g J) d# m4 k
- dma_addr_t dmaphyssrc1 = 0;
+ Z8 H# a( c R - dma_addr_t dmaphyssrc2 = 0;+ {/ ?: M0 p% ]8 v2 W
- dma_addr_t dmaphysdest1 = 0;
3 ]" m( P5 P. H1 s' e0 F - dma_addr_t dmaphysdest2 = 0;
' c" }; j' F# l- q4 q. w - / r+ R( ^, d- |, m$ C
- char *dmabufsrc1 = NULL;
$ c5 v" |: {- x. `, V R - char *dmabufsrc2 = NULL;
% F8 K. L+ y( C" F - char *dmabufdest1 = NULL;
& d0 U% |8 G {' U) O/ @ - char *dmabufdest2 = NULL;7 K/ f2 }( _9 s8 \5 u" ~ ]- n
' L# n! j8 T5 q9 G7 A+ h- static int acnt = 512;# ?7 l4 V. k" \3 F& w7 B
- static int bcnt = 8;
3 j; D( K" x7 n' u5 a - static int ccnt = 8;6 z6 X, _, x, q. l) Z
6 q9 S- M3 `7 V) \% v- module_param(acnt, int, S_IRUGO);. n. L- [2 b2 u- ?
- module_param(bcnt, int, S_IRUGO);. [# B6 Y8 m. M. b
- module_param(ccnt, int, S_IRUGO);
复制代码
7 N5 R: o2 g R2 c3 f7 Q: U7 J' O; K/ A4 g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* H! w; Z0 u9 `0 a. Z( j2 Z2 Jarm-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 j% H+ b# V6 F* H( a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 c$ s; K' X5 s/ U( S1 k! R% i5 T0 W. n
+ A; ^; Y- E4 z; |. v1 Y7 m |
|