|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) b3 K f& p3 k3 N1 o2 W- [code]EDMA sample test application# x. \7 P" O, Q# F) @) B6 S* [
- /*
5 d- T, F0 Z5 d2 U+ G - * edma_test.c
: i4 g0 u. _" \$ g) b - *
$ E- G/ I0 q+ [3 | - * brief EDMA3 Test Application
7 k7 F6 ?% B* Q H# X - *
9 x9 i. ^( c% h0 X0 d" E( V0 Q0 S - * This file contains EDMA3 Test code.( m) ~& G9 Q) _% d# a
- *' J1 x1 f- y# y/ }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 ?- m0 ] K" R* N6 q0 f$ k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: d' ]# }4 @2 d7 l3 k; r
- * TO CHANGE.' u0 ?# g$ o7 E. ]+ Y
- *
8 x5 D. o3 }. O4 J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 v4 @) i0 G( a, T& h# U - *
3 i( a7 C1 Z+ M+ | - * This program is free software; you can redistribute it and/or
$ D+ s: e, M! q. ` - * modify it under the terms of the GNU General Public License as
: T1 u* x N |# k9 H4 B" O - * published by the Free Software Foundation version 2.
! e9 v! [, H( O) N$ u' y7 q - *: J L8 x5 R. S% q7 Y4 ~# {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 e" A2 Q1 L5 C% a
- * kind, whether express or implied; without even the implied warranty
: s( O: [2 a8 G. O; D3 ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) o# d0 }& ]8 X# u8 g. o6 W - * GNU General Public License for more details.
" s: [0 {8 X7 i8 P: X. v: v8 d - */
8 {" U- G" H" S) H* k ]7 p
/ t1 z. a/ F8 K8 q& z$ x; o- #include <linux/module.h>$ w$ @* N( p0 g" C8 V5 v5 ~
- #include <linux/init.h> L2 y. U5 d8 @
- #include <linux/errno.h>
4 t# W" h0 D+ h& Z - #include <linux/types.h>+ [9 H" p' i1 M9 g* v; @2 E% F
- #include <linux/interrupt.h>; b' c# v! ?$ W" m% W/ k/ s
- #include <asm/io.h>
% e# n; R# z; Z" L# u. r( ]1 b - #include <linux/moduleparam.h>" R( g0 C- `/ y6 r
- #include <linux/sysctl.h>
- L5 m: K2 ?0 k# z/ N: E* y ` - #include <linux/mm.h>
. @( y8 i1 ~/ e2 s# }8 p) K - #include <linux/dma-mapping.h>
; c8 y2 R% U$ x" J) L: ^1 X
% ^+ k ?9 L0 y- #include <mach/memory.h>
3 ?% ?7 d0 e2 a7 w4 w - #include <mach/hardware.h>
6 e& Y/ k+ W7 _( I - #include <mach/irqs.h>/ x( A8 N: o% c3 ]4 O
- #include <asm/hardware/edma.h>
( d) V, z8 P& G/ q: }* [9 D0 m- u
' n i4 y, V/ H1 y" H- #undef EDMA3_DEBUG S6 v/ b! g5 U" B/ A* b4 R( Y
- /*#define EDMA3_DEBUG*/
$ w+ g- ^9 P9 `* }7 ^, L' O
6 P1 @, X1 C; q5 y! C- #ifdef EDMA3_DEBUG
4 T- w- F0 m: j( O$ B0 g+ r! O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 M. b! y7 q# S1 o" B% k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 |' g/ |/ p! S+ U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): v" `1 Z i6 _6 d- O- F( L: e
- #else5 ]4 H p' {9 Q/ Z B. n2 W
- #define DMA_PRINTK( x... )/ t$ E7 j/ B; w+ l9 P
- #define DMA_FN_IN }, V* I: m. V2 A/ p# d% \
- #define DMA_FN_OUT, U! ]) t# y: H
- #endif( ]( n7 J5 n( n8 @( P" h
- % J L/ E, M, Y/ p# Z A( x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. x. }5 k2 s+ { [+ L+ a7 O - #define STATIC_SHIFT 3
* ]+ O& d/ ]" Q, `/ Z - #define TCINTEN_SHIFT 20# V" O, ]" S$ _& G P0 }' b% S
- #define ITCINTEN_SHIFT 21) n, H( _, z% J& a E1 {
- #define TCCHEN_SHIFT 22
' Y0 m# }' |( j' r8 z( k" H: n- P - #define ITCCHEN_SHIFT 23, c* n+ \8 g: D0 N9 o0 W
; A7 _) x- Z) H- static volatile int irqraised1 = 0;: M, M" {+ W% D+ b" q, E( H" G
- static volatile int irqraised2 = 0;2 O- P2 G& k* Y% H
4 b# F4 @ ?( q6 \0 ^& @+ [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" q2 f) U1 o. _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ P3 }6 @- }7 K* _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) F2 v- c, x4 d7 v- K) _6 F( K
7 c) x% `9 A) N$ i0 L7 h: d5 \- dma_addr_t dmaphyssrc1 = 0;
0 ]2 W! }2 _# M; h - dma_addr_t dmaphyssrc2 = 0;) u1 z) R' X: k0 d9 T1 ` M
- dma_addr_t dmaphysdest1 = 0;/ F9 N9 l7 [ {! A. A A" W
- dma_addr_t dmaphysdest2 = 0;$ B+ a" Z* b5 W7 f8 T% F* P* Q
- : f R4 c9 l( q! M. O
- char *dmabufsrc1 = NULL;
i4 I8 n& G# S! e D+ ^6 \ - char *dmabufsrc2 = NULL;
( F: i+ v- m p/ M |/ g6 u) C - char *dmabufdest1 = NULL;6 p/ H: @- n) T3 H6 k ]) ~9 A
- char *dmabufdest2 = NULL;- K( A. f$ B) e( m+ ]! P# _$ K
- ' [- t: A& o; c' H; `5 K0 ^6 E4 w
- static int acnt = 512;
2 F2 X0 R+ p- R8 n K- _, D - static int bcnt = 8;
# e% Z V0 d" r. s - static int ccnt = 8;
0 L E* I$ U- V/ L; S! d4 K
5 q$ \) j2 q( ^! K2 d: O" ?- L- module_param(acnt, int, S_IRUGO);
$ e7 ^; o. M" b ~2 b ` - module_param(bcnt, int, S_IRUGO);
! V4 O4 }& S8 M' f6 R - module_param(ccnt, int, S_IRUGO);
复制代码
3 {! X/ }/ b4 T ?2 X" I m% b$ a% q) b8 B% j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& U7 \, }5 c. @% H) Z2 q. o( S" darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 `9 S7 c* d1 u W& V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. V; Z1 x4 C: {! w, e/ T+ L
@& r9 ~3 r: i
1 V3 a/ |1 ]! ^
|
|