|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . } `6 ]. [* E% j$ C( `4 r2 [. o
- [code]EDMA sample test application
3 Y/ `9 @& l7 B8 N - /*
4 @& H8 L5 E) M: h) V) q$ d' U - * edma_test.c4 \3 U5 t5 ^5 r4 t. Y
- *
8 h; [% O' j6 K1 _ - * brief EDMA3 Test Application: ?0 J1 g1 L! o8 B% ~
- *# p7 \2 K n4 [& i* C/ k' N
- * This file contains EDMA3 Test code. M$ C# H! |; V- v9 y
- *
4 k9 F# H" a1 O- C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; a( v' f- B( ]$ R: j1 g) y* A* k! W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' I+ }$ n" w8 d$ J& m& ^ - * TO CHANGE.: A2 r0 r* A9 }; O6 N" U
- *
; _5 B' s: u& A- n5 G' f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 L8 Q- E; G, i& [
- *+ U; p: y* ~$ G! j0 n- y1 Q h
- * This program is free software; you can redistribute it and/or
% c/ t; i O" p% N0 @8 X: a - * modify it under the terms of the GNU General Public License as( o+ N5 l+ x. w0 d S0 B1 z
- * published by the Free Software Foundation version 2.
+ p4 S! C! d. H7 o. Z2 y# J - *
: \$ q2 |+ c& r* a# L/ F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. a) f" m& Q5 \4 H2 u, D& Y - * kind, whether express or implied; without even the implied warranty
5 U |; W. q! q. v8 h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 D0 p: ?' d% ~' ]2 I1 ^8 @5 B
- * GNU General Public License for more details.0 y9 t- y# T) z$ p: _' a
- */+ C7 O' I: S" C; W
; c. H- b' y& R- o1 h- #include <linux/module.h>
. ^9 e4 |- K4 v# n - #include <linux/init.h>6 R: p5 y0 v& c t
- #include <linux/errno.h>3 ~3 D3 n4 c0 G8 v( z. G- h
- #include <linux/types.h>
1 }. z* n1 E0 N# Q* A ] - #include <linux/interrupt.h>2 b8 F7 V+ j9 i/ p1 X. {
- #include <asm/io.h>
6 O2 l) U- W2 v4 ? - #include <linux/moduleparam.h>
# I2 w7 H* P5 @- B - #include <linux/sysctl.h>
- Q) w# Q; `( d- E( a - #include <linux/mm.h>
+ ~* |! R% ]" @$ O; [) ?! c# E6 T9 q - #include <linux/dma-mapping.h>
- P& ?' O. ^ p
0 y. Z( z! h" N5 J" A" G- #include <mach/memory.h>5 A1 q' |. A7 u: S
- #include <mach/hardware.h>$ u* \5 A4 N6 P$ R% H
- #include <mach/irqs.h>
/ m' x: d2 v& X% T- e - #include <asm/hardware/edma.h>
0 z5 \! ~- R4 O/ {0 J$ |
, d' Z; y) V7 Z. b- {! c4 y- #undef EDMA3_DEBUG
$ s( a" F# i3 z/ N. O( d - /*#define EDMA3_DEBUG*/: K; U7 l+ D+ P; T! I: n! S4 z# e
- ! H) Y# y+ Z0 d* i. }7 q; R
- #ifdef EDMA3_DEBUG5 \0 D; J8 Q7 i) s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
M5 ?6 a+ Z8 Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; S3 I; P7 Y+ t, R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, L( @- _9 t& t5 Y% }2 _ - #else
5 y$ z2 v: I( S3 z& z3 g" F - #define DMA_PRINTK( x... ), {1 ^0 l) d- k, Z o2 _( [- |7 u+ j. H# N
- #define DMA_FN_IN A+ V, x" j. V2 Z0 {
- #define DMA_FN_OUT
( t. o. s5 T3 J0 H* Z - #endif
& P4 p( g Q/ H6 `
" S8 o* `# E/ u- X0 b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 K# J6 K0 m% ^8 D: t& N* j7 ^$ A
- #define STATIC_SHIFT 3
# t/ W- q& j' V/ V, y K1 c2 E2 _ - #define TCINTEN_SHIFT 20
' X+ O' P! c7 V* Z6 ^% h - #define ITCINTEN_SHIFT 21
0 G; e2 u. }3 q0 ~ - #define TCCHEN_SHIFT 22
4 r0 j; U) }; `# Z0 B - #define ITCCHEN_SHIFT 235 j$ C8 h7 C6 ?; Q
- * y: @% U& @' V9 X7 G
- static volatile int irqraised1 = 0;1 _) {+ s4 i8 q" v
- static volatile int irqraised2 = 0;+ a4 ~- w; x: `, p$ d! J7 T
- O) e, O% r# l8 H9 }: z; ^" p: d1 b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 P/ b+ r: }. Z/ h+ P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
C1 Z" f6 }2 m- p" K- O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ [" O6 e3 f' \* n9 ]7 N
# r% `. p$ P% E/ n: y- l- Y- dma_addr_t dmaphyssrc1 = 0;
/ r2 S. W! ~# C6 W" T, x - dma_addr_t dmaphyssrc2 = 0;3 ^" e5 J3 M, _& _# j1 }* N
- dma_addr_t dmaphysdest1 = 0;9 k2 t x: A5 @( x+ i1 ~
- dma_addr_t dmaphysdest2 = 0;( W9 H- f* ]' p- [( s3 g1 w2 ]
5 T& \" D( C9 S7 j* s9 P- char *dmabufsrc1 = NULL;1 |5 ~1 y b' D" a3 \* Q
- char *dmabufsrc2 = NULL;
! k# X" N; B) u" G0 y$ k u3 l( e. z- F - char *dmabufdest1 = NULL;
# }5 R2 W, c% S2 L( B - char *dmabufdest2 = NULL; w' W: ~$ L: s3 r) s3 L* i5 f
- : r# M6 F; O! F7 v5 ^2 I
- static int acnt = 512;5 A/ Z6 M. j/ G, J( r
- static int bcnt = 8;+ t2 H3 e/ u2 Y) l
- static int ccnt = 8;, C, ] Q+ w0 R7 ]
( v# [/ J* I% f- module_param(acnt, int, S_IRUGO);) }. C e' D" U( e! r+ j. |
- module_param(bcnt, int, S_IRUGO);
( C) |1 i% E, N1 S - module_param(ccnt, int, S_IRUGO);
复制代码
% ?7 Y) W9 L' s" K0 u5 @3 a/ W' J! z9 t6 G- p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 x5 P; T( z) b% h0 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( E" m! I7 y5 k' y7 G" t9 Z5 O0 I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% V4 g( t# x: E8 V# R
' ~% X3 I. t z6 ?: i7 L* `8 X6 z3 p- y3 N, h3 q( v6 D
|
|