|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( x( \( w$ `" w# G/ L% b5 C ?7 a
- [code]EDMA sample test application
; \$ e) {% V" h5 `* I5 X - /*
( c# G& X4 Z. o; s" L2 i1 G: p* A - * edma_test.c9 ~. {1 n! f3 z
- *
$ S/ s U; b/ _+ Q0 A# G3 y. D+ g8 M - * brief EDMA3 Test Application
& [9 Y7 \6 v+ i% g3 x: R - *0 N+ v0 |( P+ s( G; `0 j: v
- * This file contains EDMA3 Test code.
: n6 c( R$ N3 o" z8 H9 N - *
: p9 b9 O) V. `* J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: v& t. Y4 @6 {+ ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& v7 O/ N- ], y( W6 X
- * TO CHANGE.
1 g6 t5 o) S" W, _. B$ f" N! t5 Q- ` - *0 V$ T" Z$ Y0 g0 Z4 ^4 L! \' x% i6 j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' k: y- l/ \1 ?+ z% Q
- *& \) Q& G2 }5 B5 V+ \0 Z# @
- * This program is free software; you can redistribute it and/or1 h! C! _" [* K' B* g
- * modify it under the terms of the GNU General Public License as- U9 A5 r; S0 h4 p% }6 k4 E& ~
- * published by the Free Software Foundation version 2., X7 T) r2 ~! Y
- *+ i* t1 m- O6 `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% O& r8 X6 n% o
- * kind, whether express or implied; without even the implied warranty! D4 e7 m# N- S7 g; @* ^6 ^. J* _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 D! [# O( e, S
- * GNU General Public License for more details.4 D4 P, C& k3 S7 B2 t0 [
- */
7 I& c: T" G2 a% f( k2 O ^
. L) g# c3 _( b+ `0 Z# x; O& g) S- #include <linux/module.h>1 e& c8 n" d& Z
- #include <linux/init.h>
3 H6 S$ C2 f3 w( o - #include <linux/errno.h># A" q% D$ h/ V- `4 e, x. s
- #include <linux/types.h>
% I" w* H7 W% w: F - #include <linux/interrupt.h>
9 ~1 q, P2 z A! ] - #include <asm/io.h>
! e- L6 @+ h: v5 P - #include <linux/moduleparam.h>5 y P$ [/ z. k3 {4 q) l
- #include <linux/sysctl.h>; S+ \4 H! {* I) H5 S( ?
- #include <linux/mm.h>4 h$ W1 ^: c: i# N
- #include <linux/dma-mapping.h>
+ L# ?3 q) U& A1 A! _
# X; l& C3 z' n1 S- #include <mach/memory.h>
" h. v4 ~3 u$ r& ^$ A3 B8 g1 ? - #include <mach/hardware.h>
* w4 F: m5 G* ~& _# [9 k) p6 o - #include <mach/irqs.h>' s) y' [7 D7 @- R- O
- #include <asm/hardware/edma.h>$ n, u2 S+ E9 V* }% F: U. N
- 2 w9 x6 X3 w* x ]7 v) U2 V; X; u
- #undef EDMA3_DEBUG
6 j+ u) I% F- y0 F: I) {7 ? - /*#define EDMA3_DEBUG*/
8 P/ v, Y L( L - ! L# d- U7 e2 Q- n" ?- ?' i
- #ifdef EDMA3_DEBUG
4 ^, h" f7 \. g$ r6 v6 M ~0 o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): i" ~6 a( Q' b- |8 Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, W1 Z0 J9 Y* [) S& A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 x: o6 e' n, |& z
- #else
, f- w, s6 J' b% L0 r - #define DMA_PRINTK( x... )
& ^) u% Z0 \+ f# k4 B0 | - #define DMA_FN_IN
" N9 {7 M3 x/ C W. h! l! V5 @ - #define DMA_FN_OUT5 W; V- r& P+ `0 B0 f( U5 E1 K
- #endif
; K2 w6 h% ?6 B" d: j2 v - ( P9 ]0 }) D3 X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 y, k/ G# v& ~* i* p7 M7 }! K - #define STATIC_SHIFT 3
+ | y- B3 P3 A - #define TCINTEN_SHIFT 20
# ?0 R+ c" a- A% R9 E2 h$ Z - #define ITCINTEN_SHIFT 21
5 \: z' P. f3 j' f. s - #define TCCHEN_SHIFT 22
* Q8 `. C/ L% a: Q1 v - #define ITCCHEN_SHIFT 235 X d' k3 E5 q z
- % f. ?0 b1 b9 ~. s1 z' O$ d
- static volatile int irqraised1 = 0;
8 x, _" b4 j' q% t1 W5 M1 M - static volatile int irqraised2 = 0;
- i) |6 L+ h3 m8 n: j) R - 1 D& `% B N# V0 W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" V2 G; j. [% O8 O* B& o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 l; A9 h- Y0 A0 a6 w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 `# o9 d) e9 ]/ P; h+ Y3 j - 1 \6 S# `# W3 ^5 r6 D
- dma_addr_t dmaphyssrc1 = 0;
, o' o, }. t! y# a - dma_addr_t dmaphyssrc2 = 0;
Q% D& S% ?& z - dma_addr_t dmaphysdest1 = 0;0 K: U, j( ?) M
- dma_addr_t dmaphysdest2 = 0;
! E* g6 I5 F+ ~2 V
$ {% d- D; H' ]0 ]. Q3 g7 w- char *dmabufsrc1 = NULL;
$ g% I6 m3 J: i - char *dmabufsrc2 = NULL;
) A' _- H. i3 a3 [# B! U - char *dmabufdest1 = NULL;
1 p! `; u+ E2 i0 a0 R/ {; P - char *dmabufdest2 = NULL;/ s; r2 E9 S+ |2 h
- 4 b4 ]& y" L4 P
- static int acnt = 512;/ N( i ~% ~& J4 H4 ~
- static int bcnt = 8;- }% K. C" l# Y6 g+ a& `+ F
- static int ccnt = 8;
$ g3 {% _- C0 W - ' o6 l7 ~8 z% @7 N8 V
- module_param(acnt, int, S_IRUGO);" A7 T! x( Z& c7 E: m
- module_param(bcnt, int, S_IRUGO);
8 R* W9 E" F' o) V8 @/ W - module_param(ccnt, int, S_IRUGO);
复制代码 ( S' i' M p) @0 ~9 D
" `% a, E* e" T6 g. d" X/ w; l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: w$ H e: a7 u7 k0 Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. e& W, f |2 L! ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ g$ Q/ P' X$ P9 a
9 q) p/ ?* C/ {# a5 G; ^" c0 u. u4 p5 [$ l
|
|