|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' X: ~; |3 X: B" }
- [code]EDMA sample test application
5 v5 y6 j, F* }3 |# B6 e - /*6 ?+ G+ Y, i+ j3 o
- * edma_test.c* u1 Y4 B" z& _9 O% q
- *8 b$ j/ H/ Y+ T/ c8 t, ~: I! G
- * brief EDMA3 Test Application
# @$ h& v; T0 Z7 S - *
5 }5 ^# o& ]6 u7 d1 J3 D- M - * This file contains EDMA3 Test code.$ n) `& }- `. S; A: X2 c8 D
- *) ^! o6 W( x. P& C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' p3 u% t6 t6 }8 t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 s3 b o, v/ {3 k: s - * TO CHANGE.
\9 R) [1 r7 v/ x( |) X - *7 u x3 U) x4 L8 B# k8 ]. |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 D5 @! @+ B; \4 K/ S- `
- *2 ]+ D$ t q/ Z; r2 N5 `: W
- * This program is free software; you can redistribute it and/or4 x6 F) F; q& d* i+ X# u @) i Y x. \" d
- * modify it under the terms of the GNU General Public License as
2 X7 ]# i. v* }( Z; M3 t6 E - * published by the Free Software Foundation version 2.& z7 B9 Q) ? H5 U
- *
2 P0 [3 }" t' B h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
h/ x+ _- K6 b, T( I3 {/ S8 Y - * kind, whether express or implied; without even the implied warranty5 `2 X# A# X8 g4 S, e, B8 B/ w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ ?( K6 T% b/ x& @7 u' X8 v& g; u - * GNU General Public License for more details.
0 s. a. h3 l7 I; t) {( G - */3 P( i0 V* Q5 d/ r0 Z; r9 T
5 @0 a. R6 x+ C* L$ N- #include <linux/module.h>( _9 D8 S e0 n+ Y& d
- #include <linux/init.h>
, y- x( _9 g# x5 z# t8 { - #include <linux/errno.h>6 ?3 [9 b- }; u' H7 C6 o
- #include <linux/types.h>( e& C0 t: r/ H, ^& Q5 `# d
- #include <linux/interrupt.h>/ C8 I* \& L# w& D: e' X7 U" d
- #include <asm/io.h>
9 V# e' N# B7 @! U* n/ x( Y- @" } - #include <linux/moduleparam.h>
% X3 d/ M% p3 @& R8 ?" q( @ - #include <linux/sysctl.h> x2 {. y: s( [) \8 f. V
- #include <linux/mm.h>
- p& h; `/ l# e2 Y% U3 q. ` - #include <linux/dma-mapping.h>
" W' {, I! n$ o7 K" G! J8 g1 q - # g% r# i5 \$ I) o
- #include <mach/memory.h>( F o+ M: D6 B
- #include <mach/hardware.h>/ K5 [+ P1 | c2 {" |3 h e
- #include <mach/irqs.h>0 l8 g% Q, O; X" e+ V4 j
- #include <asm/hardware/edma.h>
7 X7 n% M1 w: i" m, { - 6 V. d/ R; T4 N: O
- #undef EDMA3_DEBUG
, z `% _' z6 w, k/ C - /*#define EDMA3_DEBUG*/1 B! c& Z* w( q5 L# D* h7 m4 H7 A
! a5 T" h# g& F- #ifdef EDMA3_DEBUG* v, c: f# Y @9 k; B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& g# U9 ^9 o$ L6 q6 }/ h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& p% B# |7 G" P: b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' ]$ [8 t5 s) C/ L8 ]4 c - #else: r9 a( ]$ `+ n5 N+ Z* d8 l' ~
- #define DMA_PRINTK( x... )
+ O! C- e8 b# J6 t2 q: i - #define DMA_FN_IN
; Y% c) G n) s( E. O, }1 `. E - #define DMA_FN_OUT5 t5 u1 D! i, S
- #endif% e3 y1 b+ ~* F5 U
2 ~2 d/ u, G& @3 }8 H- #define MAX_DMA_TRANSFER_IN_BYTES (32768); N! R! f1 }& w% ~- x) F
- #define STATIC_SHIFT 3 U, A- C: W% @, t
- #define TCINTEN_SHIFT 20
" h5 \! Q: }" s- Y+ J" ^3 _1 j - #define ITCINTEN_SHIFT 21
3 ~4 k$ ]9 V! l" R - #define TCCHEN_SHIFT 22
6 R- b& d, l& ~6 N$ g$ S0 m - #define ITCCHEN_SHIFT 23
7 U# z% S( [1 J. `0 u" b
9 p$ N2 b6 `! K Z w- static volatile int irqraised1 = 0;$ v$ e$ k; @6 P% @9 M
- static volatile int irqraised2 = 0;! Q$ v9 I4 n0 i8 Z
- ) q \4 M, q5 [' a2 e, G+ a6 ]# O8 E# _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 o% \6 t; ]* D9 l' Q- S J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 H2 z7 |5 `, n& F r: w2 D9 E8 d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 c: t# J1 u" X+ c8 p
& s$ Q% e; _# k3 k- Q- dma_addr_t dmaphyssrc1 = 0; x1 i" j/ L0 o% y8 o- D0 P
- dma_addr_t dmaphyssrc2 = 0;
7 }6 R3 _% ]* T& N' }/ ~ - dma_addr_t dmaphysdest1 = 0;. U- ^3 ~+ v" Q
- dma_addr_t dmaphysdest2 = 0;7 C9 k( T U3 J* ]: ?$ E
- # C# k* a: w6 c) V' I& T
- char *dmabufsrc1 = NULL;
. c, }# ?2 N7 ~0 o- Z8 B - char *dmabufsrc2 = NULL;" ^' R0 A/ n5 K* U: M t
- char *dmabufdest1 = NULL;
3 u7 ]9 y( P% E- z ^6 Y - char *dmabufdest2 = NULL;3 h# Y: p( }5 ^5 a
. ?6 k& K$ O2 c7 q- static int acnt = 512;- E9 ?4 Y A( c4 O3 E' ~- C
- static int bcnt = 8;, N/ |$ M% X0 l Q j7 u! K) [& D
- static int ccnt = 8;
; G! c5 I& o& j, N - 4 j% g# S' Q7 V
- module_param(acnt, int, S_IRUGO);4 R" Z0 f K. v6 `/ o8 b1 C, |
- module_param(bcnt, int, S_IRUGO);2 N" z3 ^8 T$ _* ~1 }+ o& T
- module_param(ccnt, int, S_IRUGO);
复制代码 % S- o \3 m) b2 e1 _; _: G
$ H( O& b( v# a5 H8 C1 Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 S5 V2 J& p/ b" N1 S2 Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ b0 R& y+ M& v& G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 k5 K# F: p% I9 b! d
+ Q! Y& I1 i- L( r! H
: D# o0 b( O7 C) a. O# h
|
|