|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 o' l& Z6 g& y, x# `9 C- [code]EDMA sample test application( P3 p' P- P/ j- ~1 b8 a
- /*/ N. ?& ~1 }+ S- K+ w- J. |
- * edma_test.c
2 c, ~, c3 r$ x( W; _/ T1 n - *
' x/ f# D" i( e9 w2 v% G% Q# c - * brief EDMA3 Test Application" ?5 n* K$ P* Y% c7 }$ K
- *$ K# F1 A5 u: c, R1 K
- * This file contains EDMA3 Test code.+ \4 ~$ G d* I+ g- ]/ r% x
- *
0 I- ]9 N' @% i8 v+ w8 J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( y% G# l3 m1 e% Y& W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
w2 k! w7 s i* S/ B& Y2 [! I - * TO CHANGE.+ I) O, z9 }/ }5 c; Q9 @5 T
- *
) I" ]1 Y' k' }+ a' C, F5 d! g' Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' o' h+ N! M* E" F) a9 ~9 Z* e - *
/ c+ s( h5 @* e - * This program is free software; you can redistribute it and/or
2 z/ R* Y8 ` p - * modify it under the terms of the GNU General Public License as
' f$ n1 T4 N) Z# p$ R) _ - * published by the Free Software Foundation version 2.! y. }1 _. }, S4 J5 x/ P1 u
- *
7 \5 h" e, Y7 ~; J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 S- z. T. ?& j7 v
- * kind, whether express or implied; without even the implied warranty
8 \, c! d K2 w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ b$ ^4 W+ s) W3 x# F
- * GNU General Public License for more details.$ Y4 I7 v0 O) i$ \1 r
- */
; M3 R! h2 r, M" ?. k
2 c, [! E! s! z- #include <linux/module.h>
7 L& b* b4 }! ]* I1 e: F - #include <linux/init.h>
6 {! \+ I9 f% [2 Z/ R. N' E# {. L; ~ - #include <linux/errno.h>7 z# E5 @8 G5 X& a7 t8 |
- #include <linux/types.h>
" V( g( a3 C j1 ]) [1 M6 t - #include <linux/interrupt.h>
7 h, W, g& a% k1 z" I8 ] - #include <asm/io.h>1 V# @. t9 t& u2 } o
- #include <linux/moduleparam.h>
T3 A( d |) n5 q [8 E6 q - #include <linux/sysctl.h>1 G2 ]0 |6 q# u$ _+ |( o
- #include <linux/mm.h>+ w& D# A/ ?3 `0 z- K6 g
- #include <linux/dma-mapping.h>7 t/ g I5 j% I) H. A4 z
' O3 z0 j* X+ u9 \ V- #include <mach/memory.h>2 M& v. y" T' F' H
- #include <mach/hardware.h>/ U' ^/ e1 E' v ?
- #include <mach/irqs.h>2 o; y0 c2 h% n$ W- x
- #include <asm/hardware/edma.h>
& N4 N6 z4 Q% x. J% A7 d( m# y - ) p3 o1 [$ w% ]. R8 x+ ^
- #undef EDMA3_DEBUG
; Z6 n+ g, F& d# R( p+ _. K - /*#define EDMA3_DEBUG*/3 k$ Z2 z& [ p. T/ G! J
- 1 m) q5 Q9 l, J( s
- #ifdef EDMA3_DEBUG; ?( z p( Y" t$ R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ B/ ?. X1 c# ^1 z# l; a% D) j& o! N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( S* W3 J- M3 P) L% W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: `6 X, N8 }- O/ I4 K - #else9 u U% N( L* X* E+ c% n0 S
- #define DMA_PRINTK( x... )
- }7 f; E3 g/ m U+ L1 B - #define DMA_FN_IN+ B4 _8 }6 ~& }/ T4 @' J+ I
- #define DMA_FN_OUT! a5 h$ f6 s# d4 T7 h. D2 I: o
- #endif4 {1 E0 B. I4 y9 `. d
@% J# C. X- C* r/ O3 m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" J5 d6 @7 y* K8 G2 T
- #define STATIC_SHIFT 3
, a" M8 F% q# i8 d, N) D - #define TCINTEN_SHIFT 20
, S" h6 m5 L) r7 ?2 ?% G' t& M, K - #define ITCINTEN_SHIFT 212 Q4 o4 q a5 G2 {5 ?
- #define TCCHEN_SHIFT 222 R2 \8 V. X8 |% B/ V2 J- p* p. [
- #define ITCCHEN_SHIFT 23
+ @3 w" P: d8 H; h- R! r
4 ?. t2 G4 ^( |- static volatile int irqraised1 = 0;/ u9 j4 ]7 A' w, ~' m: A, U
- static volatile int irqraised2 = 0;
7 {- ?2 S; L" ?2 x% { - ; Z! l! J+ r" P% U8 L& v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- g+ b# i8 d! m0 o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ u9 @* k7 g3 a/ h0 c' M& X w! g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& F L! A% _* U. L5 `: z* q& s# R
- 2 b, K# D3 v2 p. T# ~0 ?
- dma_addr_t dmaphyssrc1 = 0;5 u6 Q9 d% w9 c( u5 H& ?* ?
- dma_addr_t dmaphyssrc2 = 0;( P% p) n8 s" U0 w
- dma_addr_t dmaphysdest1 = 0;0 \4 `5 h+ K. F. y) I: d. J6 G) O
- dma_addr_t dmaphysdest2 = 0;. i+ f( w( u* c" ]9 c
& p1 W8 t* j6 _4 Z( Y- char *dmabufsrc1 = NULL;) b" a4 m( t# J2 ]% t" H8 D
- char *dmabufsrc2 = NULL;2 I" r1 u5 }$ R! A; J$ z
- char *dmabufdest1 = NULL;
! a' C4 Y5 |2 N9 l* a - char *dmabufdest2 = NULL;' d+ T1 B9 d3 A7 s2 u; x
! S( C& d8 ?- L2 }$ B1 k- static int acnt = 512;
( D, c; Y0 I' K# x2 [% d, H - static int bcnt = 8;
) |& @: z) e6 P6 B* C3 y4 P - static int ccnt = 8;# t0 u9 O6 Z2 j8 w$ Q I% k4 t
- ! v' y+ |% ]% s0 p* m! a
- module_param(acnt, int, S_IRUGO);' r+ S. g, t1 V. D( K
- module_param(bcnt, int, S_IRUGO);
# ?1 e$ g; F5 s3 z - module_param(ccnt, int, S_IRUGO);
复制代码 n, X; n/ I3 c9 j+ d
8 S% k+ z7 U7 i- K7 S4 U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# q* [; A7 R) t3 rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& H- M7 w* V, V" `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 K9 G& w% Z! z6 S5 J- H8 w7 G
, ]. n/ K$ i3 K! ^" V
7 ` D' g% R/ O' J, m |
|