|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) l( @ j1 m" C. B: H
- [code]EDMA sample test application& V* C8 b" [- a: C# l5 C' P
- /*) \" G1 {4 F5 f
- * edma_test.c2 n: s. G7 U+ c3 E2 I# j' J
- *. X5 Z# u- ~* h7 b
- * brief EDMA3 Test Application
1 d' }) x8 _& u3 b - *
* ]) Z5 z8 Y& q1 m9 a - * This file contains EDMA3 Test code.7 L, O+ T3 d. `7 @* o
- *5 P& Z+ O6 ^ ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) Y, c! h3 [1 y \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 h l( D, [/ i y4 l; y
- * TO CHANGE.
4 [. F, V4 }! B4 @) M. W* g: a q - *
/ ~: D4 m6 b' r/ W- ^: ^/ J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, f# `+ @6 T" J - *# M6 M, ~" q! `
- * This program is free software; you can redistribute it and/or: Y Z& K' }7 ]5 t8 V
- * modify it under the terms of the GNU General Public License as
; C( i/ U! _: I0 s* [: M* v) L - * published by the Free Software Foundation version 2.7 _0 A& D8 Q( o' X
- *
7 i1 ?( c. X% {" _, s; ~5 y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 J& [4 O3 X8 h# W$ Y! C
- * kind, whether express or implied; without even the implied warranty, H3 [. c6 _" j9 C* L( {' o6 T; `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. C. z: P: G7 q. ?0 H - * GNU General Public License for more details.
' u/ M/ k6 i) Y- Z8 F( B5 o0 m - */
# I* N( v" w; I* M. c6 d - + @8 ]: J2 j+ o+ u
- #include <linux/module.h>
. |7 Y' x& o3 ^6 t# G - #include <linux/init.h>
4 ~. R8 s/ `, f: b5 f - #include <linux/errno.h>
& {/ }' C5 _ ^' P v - #include <linux/types.h>9 _6 Y8 @! u4 O' W
- #include <linux/interrupt.h>
% H( o' ^/ F( c/ H x - #include <asm/io.h>7 t- }/ r- i- ^) ~3 L
- #include <linux/moduleparam.h>
3 [2 l( j* |: @4 P; m/ g4 } - #include <linux/sysctl.h>: L& F3 z' F+ ~, @6 L7 R2 R9 z
- #include <linux/mm.h>, ~1 L M h6 q4 s1 W/ r, s
- #include <linux/dma-mapping.h>
\( N4 w) e8 E: u - 8 _- {8 W7 L9 r+ g$ M, c1 C/ O7 Q
- #include <mach/memory.h>
: t. g8 \0 E* F# h- b8 Z5 y$ D - #include <mach/hardware.h>3 I6 s$ e, S; Z5 G' J3 e* x; ]
- #include <mach/irqs.h>! P8 t2 r( Y- ?& T' L: I8 G
- #include <asm/hardware/edma.h>8 }3 a. ^. N9 L) T( f2 u
' t0 x2 q" C _, B- #undef EDMA3_DEBUG
& h3 U) R4 G9 I; E+ N3 L9 b6 b: B - /*#define EDMA3_DEBUG*/. o- B1 L5 S* k! \. B
% V5 w' M- j7 l# D- #ifdef EDMA3_DEBUG- `$ r" b* \# g" L+ F0 A# q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ r: @; A8 m, k4 x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. q1 t# }# J/ Z+ L9 l, @; x9 k( m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- N# r7 i+ b1 I. b" M- ?2 w
- #else$ b; ?2 L4 k. |* U
- #define DMA_PRINTK( x... )3 b) S) o8 H& s8 g+ T2 G# o4 D6 a
- #define DMA_FN_IN8 a! C4 Y+ ?0 }1 _) Z/ S1 M
- #define DMA_FN_OUT
( ]0 V# `1 D4 k Q% P% f! T - #endif
" H# @& F$ Z& j4 k I8 x1 V - . N- {* G+ T; \" @: r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 t! q) h0 j& c* U1 v' @: _ - #define STATIC_SHIFT 3
6 [! @( m: r2 }8 m; K - #define TCINTEN_SHIFT 204 f* e& J. Z U5 D+ Q) Y; O
- #define ITCINTEN_SHIFT 21
4 C9 _* E! e6 W ?- J* J- } - #define TCCHEN_SHIFT 22
& T* ^( C E1 P# L - #define ITCCHEN_SHIFT 23( X% w8 }7 X$ x" t
2 ?/ z" F, I" v0 b7 ~" f* c- static volatile int irqraised1 = 0;& A; p7 f3 y9 |/ ?" \: x5 D* X( I
- static volatile int irqraised2 = 0;
* C. V9 x' a$ n' S# Q - " |5 d9 ^+ N. q6 Q1 F8 p" S7 v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 y5 A8 H; I1 R! i& T: s9 l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* { J K. }* q4 V" |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 D3 `& J e" q$ O8 o3 ]; q
6 a" z9 A2 ]. s3 b- dma_addr_t dmaphyssrc1 = 0;
+ {0 [" F, D) l+ \! h, f( H3 T" G& a - dma_addr_t dmaphyssrc2 = 0;
# e5 u5 `6 r5 O. U - dma_addr_t dmaphysdest1 = 0;, t0 L. Z+ {' I/ p0 [1 u* U
- dma_addr_t dmaphysdest2 = 0;1 l8 H( a8 @7 n' B% B
- 9 v) r* c& F% y& w8 M
- char *dmabufsrc1 = NULL;
, K( ^) g- d! p# L9 G+ j0 X - char *dmabufsrc2 = NULL;
: P M3 x1 Z, ]5 c - char *dmabufdest1 = NULL;, ?0 S1 t2 p* P+ K* S$ l- d
- char *dmabufdest2 = NULL;1 j( |3 ~0 K) S" r* {
- , G8 Y9 z$ S9 W. R. ~
- static int acnt = 512;
! Q- |& l( `0 T1 R, P, Q: N - static int bcnt = 8;
6 j! h' B4 R0 y# Q* c5 f - static int ccnt = 8; @/ |1 H+ [( D$ a w( [/ f
- D9 v3 a1 l" c6 t$ U- module_param(acnt, int, S_IRUGO);* ]) v4 J! ?0 o3 a6 |7 t
- module_param(bcnt, int, S_IRUGO);0 N) I0 @3 X5 L5 m
- module_param(ccnt, int, S_IRUGO);
复制代码 ) O& F; i! X# i8 s% K2 ?
. K3 R: }) n, X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) f, W3 x8 F9 h' y2 s! @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: [' @- ?7 t, i" Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 n2 D. _# V; O- W! g) v/ c' _
, n5 j/ h( n7 H% s! x$ ?0 C q1 m" f7 z0 g' a4 O$ v, Z& _% V, c0 h% K
|
|