|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* a! ]9 D. Y' D- {; W1 {5 T. c! {/ _, W- [code]EDMA sample test application
) w% P* H: W8 m: N" C; q: r' } - /*
3 }$ m! N$ u' ^. O$ r+ p! q - * edma_test.c7 m, B+ R$ d" K4 G* B
- *
7 U/ n0 t# @: y- C" B5 U. P - * brief EDMA3 Test Application* y/ B, K* Q8 c3 N+ S- i
- *
+ |2 J7 ~( A B' v9 b) T# s - * This file contains EDMA3 Test code.4 d( W6 a+ ~: |3 D- O
- *$ R, d' I4 X `$ x$ J, q5 ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( F- m+ A4 @+ b1 Q, m( u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 O7 u: Y0 f/ H8 w9 f
- * TO CHANGE.0 f9 O1 ^4 O) x" J. S6 b1 v! ~
- *
* R' S+ a! |5 d& W+ z- ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 f8 W% S# \6 m6 v - *. t! K; U' l- [1 A2 O: _8 X
- * This program is free software; you can redistribute it and/or
$ B! T; `- L" P* d2 Q7 T& L - * modify it under the terms of the GNU General Public License as8 B6 }1 w# e8 H# V- |9 K' C
- * published by the Free Software Foundation version 2.
1 B0 x( ]6 f& E$ i% Y - *
: e' e% X( E. g: G j, f2 f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& b+ p* a( h% D( W6 U
- * kind, whether express or implied; without even the implied warranty
" p' ]) S, M' n1 Q; X& U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ P: ?! G& G. `( u. E" B7 J - * GNU General Public License for more details.6 f W$ J7 K" l# ?2 g0 K# I* T
- */' p( E! c6 G& i& [8 ^3 L9 I
2 l! i7 N0 C- E9 t& B- #include <linux/module.h>
% S/ }2 e) {, T7 [ - #include <linux/init.h>
" h. Y3 l3 m$ ^ - #include <linux/errno.h>
# {; |9 a# f0 f - #include <linux/types.h>
: \5 [! a" m m6 H6 O - #include <linux/interrupt.h>& k. X0 |/ J- c Q9 {8 O6 `2 h
- #include <asm/io.h>& _' y' Z/ k1 u9 j6 k
- #include <linux/moduleparam.h>8 O8 u: k0 S! t+ M
- #include <linux/sysctl.h>8 I' X4 J. v! C" N* T# ^
- #include <linux/mm.h>' v2 F/ q' A: Q5 B2 V2 z: w
- #include <linux/dma-mapping.h>/ \. M- |; M s
# i' @8 Z+ l: ]; ^6 ^( |1 d, z- #include <mach/memory.h>
* `; G1 A# n" | - #include <mach/hardware.h>& ~9 {% a, B8 P( z2 x! L T- b
- #include <mach/irqs.h>
* F4 n& x6 c+ r7 @* Y - #include <asm/hardware/edma.h>
) B0 y" `/ p1 h" t% j9 i2 Z. w - * `4 u2 c" ?2 a: O' U2 m
- #undef EDMA3_DEBUG8 ^9 O3 |: p. i7 _
- /*#define EDMA3_DEBUG*/# ^; V$ x1 ^# l0 P+ d" @" p
0 t' p8 R9 h2 ~$ Z* l, z1 x2 J- #ifdef EDMA3_DEBUG
9 _% F% @# ~$ S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 ]) v9 N* ` j+ Y2 N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' H4 x/ k$ ~2 l. I8 a7 j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 [* s0 S* N8 J9 j5 ^6 T - #else& g: B% w+ ]5 e8 t8 V5 l- _3 H
- #define DMA_PRINTK( x... )2 |- f1 F; `7 t( ~3 J/ w3 X6 g& [% s
- #define DMA_FN_IN
1 f, @6 M$ X! Y: _7 `' q% d - #define DMA_FN_OUT0 r- Y9 e9 ~3 }" m
- #endif* r0 `4 \0 @* s) |# S
- " J0 W. i; @% I, [2 t( C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- V& Q/ \$ ~2 O0 e0 s }' l
- #define STATIC_SHIFT 3
" j% \% Z+ @# `& f( | - #define TCINTEN_SHIFT 20
# j v) h( i# D2 W- a) p |: f - #define ITCINTEN_SHIFT 21* R5 \; ~# @9 B- { t1 p, {
- #define TCCHEN_SHIFT 22% y. J( w+ g4 n A& }
- #define ITCCHEN_SHIFT 23
6 ~% K/ D% f' r; Q% T* X - 8 W$ s( y, H5 ], i0 q3 V
- static volatile int irqraised1 = 0;
9 {$ L9 D6 ^8 X5 q - static volatile int irqraised2 = 0;1 u3 z% n! i1 M4 G
, q' o9 [- F' L' @4 }$ }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& D7 _" S% X K! u& |! } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ p, \8 D$ g6 H6 a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! p" o) m1 l( }0 _/ Q1 G$ {
- z1 n3 ~) b) a( I- dma_addr_t dmaphyssrc1 = 0;4 A3 H E! s# ]; V( u# x
- dma_addr_t dmaphyssrc2 = 0;( W4 h. D: B$ Z: ^
- dma_addr_t dmaphysdest1 = 0;
: z5 q4 S( d( B: D# ` - dma_addr_t dmaphysdest2 = 0;
( b) t# Y2 _4 g" ?; F) V
: R7 C3 u+ w! b, e7 b% a9 V- char *dmabufsrc1 = NULL;
/ V9 o4 U9 \4 U) b* k7 w - char *dmabufsrc2 = NULL; M2 _+ j$ ^0 \& ?' t+ V! m
- char *dmabufdest1 = NULL;$ c/ l5 ~/ X" j7 w% F
- char *dmabufdest2 = NULL;
) M+ F5 P" |/ m; j
( Y5 E3 O6 o2 N$ [9 C# i- static int acnt = 512;5 o- y5 t! k' e1 X I5 H5 ^( r
- static int bcnt = 8;
- Q8 s4 k9 k' u5 g" t: L - static int ccnt = 8;' J M% y6 m( k/ U% U% w
- ) J0 }1 B! F. {2 T" ^" ^0 P
- module_param(acnt, int, S_IRUGO);
4 t5 w4 ^+ }( d6 B# f7 _. b - module_param(bcnt, int, S_IRUGO);1 ~, Z$ r( y( A/ o9 S, E
- module_param(ccnt, int, S_IRUGO);
复制代码 % x# e. a W) e' `0 L5 E5 ?
0 q9 G- `- \" }0 J3 g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# s4 g2 L% {3 x" [( k8 {7 T8 r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 r B0 m, Y/ x" h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 G c: Y2 D+ w! o1 a. x
. ]5 @ y: Y t' l! Z; v( c% r: e& f8 |' m
|
|