|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 a9 @. m* V2 B& p9 s
- [code]EDMA sample test application
; M% Z f1 l- I- I - /*2 x. N$ U3 A) c1 C! n2 `: C
- * edma_test.c) N% E" U% J9 ~' y5 A
- *: H' K! k$ b3 a0 d+ m
- * brief EDMA3 Test Application3 X( H, o# }$ K
- *
: l: d" ^* x5 U - * This file contains EDMA3 Test code.
/ M; J9 R3 W8 p6 X% { - *3 i1 h6 a1 \) t. Q9 S- ~9 Q% n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 s2 b# ?2 ?( F5 K' @! Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 Q5 j* p3 Z: o0 S5 T0 R3 _
- * TO CHANGE.7 d% [) ^" K9 x
- *) W# l7 c( A) _5 f6 l' n' }6 [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& R) R5 e \ r2 C - *) V3 }: M% G l& ~+ m' i
- * This program is free software; you can redistribute it and/or
' D% u7 O( l( V5 j5 q9 L - * modify it under the terms of the GNU General Public License as9 R; P2 a9 }9 L# {# l
- * published by the Free Software Foundation version 2.% G* U+ q3 d& h& V
- *
3 _1 | v2 j: L6 t4 a, ^. F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) O3 t# `; N- p$ I, V
- * kind, whether express or implied; without even the implied warranty3 N( X: t0 ?8 B: c% ] L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& |8 d. ]' s6 a' c# \5 C
- * GNU General Public License for more details.
4 k! u9 n! m8 O8 @$ E! u - */. K; l9 G3 a! \( g/ k
0 q! \6 T2 J, B% h+ d8 \& r3 i o4 D- #include <linux/module.h>" y* c# I9 ?) M: V+ c/ n
- #include <linux/init.h>! b- D: X, e' G5 Q! n! K D
- #include <linux/errno.h>
7 E8 Y" n% a1 B. E8 v2 ` - #include <linux/types.h>9 L( o+ c9 m! q
- #include <linux/interrupt.h>
y! N5 ~% ^# W+ |2 O6 R. T - #include <asm/io.h>! l& E4 L8 I" |) x
- #include <linux/moduleparam.h>0 X9 l! m* t4 C0 G# g* L
- #include <linux/sysctl.h>
+ |& A2 f& D/ W Y( W6 r( [ - #include <linux/mm.h>
+ k& H& ]8 q- o! l! b \& F - #include <linux/dma-mapping.h>
- s' p0 h. a& V/ [3 Y- J5 P - # _% X( D' b" V6 U# g3 H% U* U L
- #include <mach/memory.h>. ?: E! u& l. O0 K; x
- #include <mach/hardware.h>/ t) c; d- m: l# d2 R5 d% u+ R
- #include <mach/irqs.h>1 T- H8 _- R4 x. }/ ^5 a
- #include <asm/hardware/edma.h>; Y" s7 r9 Z$ S* x* c
* M' i3 b6 I# Z6 ~. G- #undef EDMA3_DEBUG
* r; d/ f {' y) V0 q* H7 V. w: O - /*#define EDMA3_DEBUG*/
J& }* w' P9 k# ~. n
7 w+ s9 ]7 x8 P S( o( |3 a' F7 d- #ifdef EDMA3_DEBUG
# v4 V3 i2 i- o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 Y9 [+ ^/ v; H2 B% |* ~; L8 L2 C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, \+ `2 G I9 r0 Z# |1 N3 } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 Z4 Z* C! b/ P# \9 b- ] - #else
4 v: G5 e9 _9 Z1 O J0 K - #define DMA_PRINTK( x... )
5 G& ^8 [- C ~, i+ l+ Z1 A1 B7 G - #define DMA_FN_IN$ U) ?! J- m' X) e2 V3 ~
- #define DMA_FN_OUT
7 t; V/ ?: M9 D - #endif, l/ o1 e% d2 }1 ~9 q+ t6 F4 G
- 6 B$ e" a/ _9 l' }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 q) s; `+ ?9 s& N7 e, c - #define STATIC_SHIFT 3
- j3 p5 v, y- _ - #define TCINTEN_SHIFT 20
' _7 B7 e5 C1 ^ - #define ITCINTEN_SHIFT 21' J. m2 G5 R; M( \8 x
- #define TCCHEN_SHIFT 22
$ c5 L3 d. s% m) Z5 h - #define ITCCHEN_SHIFT 23( F1 w1 b6 z% m7 S( o. u
2 S3 H( w: T! M- static volatile int irqraised1 = 0;7 m6 l4 H$ w- V# B" B6 w
- static volatile int irqraised2 = 0;
0 Q, F( v+ ?, Q& i - / J; t9 i. }# @2 E, l* t8 x0 s$ u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- d/ f' A! a, ?; m; q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 b, A4 O( @2 S. x: J. v4 [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' V5 l7 J, ^' y6 }* q- _8 `; C
- . `, q+ E0 i2 s
- dma_addr_t dmaphyssrc1 = 0;
2 z* E% z- Q% k0 ^4 d - dma_addr_t dmaphyssrc2 = 0;
% q4 n& l& Z1 [3 | - dma_addr_t dmaphysdest1 = 0;$ u" G. t, w; G/ j
- dma_addr_t dmaphysdest2 = 0;
, a' p! N- O8 i* B: |; i
- ~, Q/ a6 R# k8 h0 Q8 n- char *dmabufsrc1 = NULL;
( p0 u0 z6 e% R3 P- J: V - char *dmabufsrc2 = NULL;
_- d7 O8 B1 K8 p8 ?; r2 R6 }3 C - char *dmabufdest1 = NULL;
& C! F% R+ v- d, W' K - char *dmabufdest2 = NULL;
1 B W5 O2 V& L% _1 }- @( q
0 ]0 B* ~: p b- static int acnt = 512;3 Y I8 M6 d8 O, T9 ?
- static int bcnt = 8;
2 F" h( M( @3 R# w" a" r, t - static int ccnt = 8;
. o0 c1 I+ _: I: _; d
% b0 [7 j6 Y- ]: y& {4 e# R! |- module_param(acnt, int, S_IRUGO);( m S# d& C* q8 G1 p
- module_param(bcnt, int, S_IRUGO);
" R2 H- F7 k5 ]/ S0 J3 F) V" Z - module_param(ccnt, int, S_IRUGO);
复制代码 7 n) ]' G" ]* H; Z1 o
e" j% R9 x+ q+ U) O9 S6 ?# p0 N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% D5 U4 R& i R( E) ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. D# M: d4 R3 i3 ?( I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ v4 [; V5 q+ v. [ G# s
9 W! @( f( o4 Q( d% X% \+ p6 S) J2 h/ x
|
|