|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 W% `' i% Y5 ^1 j* p
- [code]EDMA sample test application
6 q2 D5 m6 E# ^2 D `5 M7 y - /*
/ [* R' v7 r# Z2 A4 j - * edma_test.c
# O9 E5 s! J1 y - *
p/ K+ G' P' @: T+ L - * brief EDMA3 Test Application
% O' F* v8 w+ Y0 Q6 ] - *4 Q: P" S3 T6 E7 q4 v8 {5 c' ]
- * This file contains EDMA3 Test code.
8 _ R; n% f' M& \7 Q+ R* U N$ w - *
& H5 v. V3 N2 i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 t" L5 `2 x& T2 Z) N1 U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ o: q0 B: B6 y: ~% p$ ?: Z) p
- * TO CHANGE.! P0 s7 J5 K7 q. E8 C. \" i# _& m) L% M
- *
; Y1 [" S. G$ z# @/ ` - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% q6 R" T1 t4 m; I0 R+ l5 Y. P: H! I
- *
) B/ g: _+ v" ]' V4 b- B - * This program is free software; you can redistribute it and/or" h' C$ F# s S/ k* e$ ]+ A6 I& Q
- * modify it under the terms of the GNU General Public License as
7 l; K6 c3 Z9 v0 Q: ` k6 w: Q - * published by the Free Software Foundation version 2.
1 b# I# i( i5 [% y' e' g! D& y - *
. ^+ ~/ z+ M6 k" e _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 |, X6 F) K2 c) O3 c ^2 X
- * kind, whether express or implied; without even the implied warranty
6 t0 G3 D9 N% H. I) q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 c, ~. f- J2 _. N - * GNU General Public License for more details.% n& X: v# I6 @3 l0 W) {$ o
- */
: \, X: h* X0 u$ s$ W2 n: }
- T( l4 X3 V4 s% n% V- #include <linux/module.h>( l& u7 D5 F7 m- A ~ \/ @ ^7 v
- #include <linux/init.h>
) l) T) B" X# S. |$ q8 X, V - #include <linux/errno.h># {4 U$ L1 p# h P Z: q# q
- #include <linux/types.h>
) g. f" k$ t* A - #include <linux/interrupt.h>% S+ J- w: {2 g( H
- #include <asm/io.h>
7 [4 \9 t2 g6 R4 A4 u - #include <linux/moduleparam.h>
5 K. J7 A x" ] - #include <linux/sysctl.h>
6 S. s. H% i! [4 {3 Y: Z! W - #include <linux/mm.h>( f ?' Y. W2 s" H) ?# l1 h
- #include <linux/dma-mapping.h>
( d- A1 R9 c) X- g! k - : L" v# C* z1 X5 X* m2 F
- #include <mach/memory.h>& A2 c& {1 Y* B' g/ Y3 N. X2 M
- #include <mach/hardware.h>- q1 [' W! s+ d# T/ v, h
- #include <mach/irqs.h>/ s0 z, P+ f4 t: q& H8 H s5 \1 O! D
- #include <asm/hardware/edma.h>
0 T& _6 W9 A( B/ j
1 `3 E8 X! h! m4 Z, t$ t1 e- #undef EDMA3_DEBUG8 J a: G) R G: @/ z) e8 K
- /*#define EDMA3_DEBUG*/" R8 m, p0 t8 V- D0 g6 J5 Y9 V) o
- u2 j- w( M. _2 O' \
- #ifdef EDMA3_DEBUG
0 Y1 x9 ?, N! O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: J+ A1 m/ t; l& K- M' _! o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: q. V" F, U a3 }6 n& f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 R% x% \; g& H2 ~2 C
- #else# r4 W: ~. f' B" w, C
- #define DMA_PRINTK( x... )
4 s! H" D {5 F+ d - #define DMA_FN_IN
, Z5 k9 j3 \6 w9 b - #define DMA_FN_OUT1 z9 s9 }/ A9 f0 [, j; ~
- #endif
) \6 i; d: F7 f+ k2 J( D8 F7 b - . h% K+ {! _# L/ C2 _- ^# S4 K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, C7 m/ N% S1 o2 n! h1 J - #define STATIC_SHIFT 35 `% ]$ T; h( G$ J* Z% P& ^% f
- #define TCINTEN_SHIFT 20
E0 {6 L5 P, R ]7 W+ d - #define ITCINTEN_SHIFT 21
( p7 j x3 m/ B" N2 T5 d& X - #define TCCHEN_SHIFT 22
2 Z ?* R! D5 p s3 D# L! f% s/ @ - #define ITCCHEN_SHIFT 234 U0 }5 n# l1 I
* z5 p- {. i- G/ g& S- static volatile int irqraised1 = 0;+ z( \1 E& E& k" P# r, S
- static volatile int irqraised2 = 0;
# U' W7 i- [; j9 n$ O" Q- [$ P4 ?0 } - 2 u! u( p- ^6 n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" T0 I* {8 {* c3 m# l$ B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 N: h7 B+ U3 F0 o; f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& d B2 A# l, o) D) k
8 ~" z- W! `1 K- dma_addr_t dmaphyssrc1 = 0;' g" `" g. ?2 o4 y. y9 c, z$ E6 S
- dma_addr_t dmaphyssrc2 = 0;/ L! k; b6 R" C% l# r# t
- dma_addr_t dmaphysdest1 = 0;
4 @. p: B5 v6 z - dma_addr_t dmaphysdest2 = 0;
$ t: i0 M/ H8 l& T3 W
- A( i% N% S- o" P0 e- char *dmabufsrc1 = NULL;
( D3 g$ A- V2 C! M( f6 _3 k - char *dmabufsrc2 = NULL;5 h6 \6 ]6 I$ a8 {+ o! k5 i
- char *dmabufdest1 = NULL;$ ?1 @" u& [% N5 d4 e% D- j/ w7 H$ w
- char *dmabufdest2 = NULL;
' P; d: u* b3 ]5 [7 u - # y" ~2 i3 `/ ], F
- static int acnt = 512;
; E2 Y, V5 n7 E$ \) S - static int bcnt = 8;
: V' M; ~# k6 q- V) j - static int ccnt = 8;) t0 A) B; U& ~ s
, W4 G6 t) ?! j/ I8 S$ F1 \% G- module_param(acnt, int, S_IRUGO);# N4 H5 A! t- A& S' `( w# [
- module_param(bcnt, int, S_IRUGO);2 P" f2 Q6 J$ A
- module_param(ccnt, int, S_IRUGO);
复制代码 ( Y& l6 Z; ?- L% H2 s
$ H3 s: Y0 W8 N, ^( R" c2 ]/ `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 g" Q# m+ S: i1 Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! p* a& i" _( ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: n- G/ d9 c- x) e" b% B+ s v
. ^' Y0 D( f* b* Y
3 _; a" ]; S& P' A# Y! K
|
|