|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ [" b) [. n2 q* f8 f# }
- [code]EDMA sample test application" S: E8 J, _; V E9 M/ i; i e
- /*
( K1 v" d/ m/ p! o2 q- } - * edma_test.c" [) e N8 f1 @; N8 u
- *
* P% v: S% i3 W t+ o. j - * brief EDMA3 Test Application
" T0 C( y e( m6 l8 `* x3 O' _ - *. ?+ Q$ u$ X* I; S+ N3 _
- * This file contains EDMA3 Test code.
- H3 M7 I: ^; l+ k; I4 X - *# m$ i# ~2 p/ N/ j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: r0 Q# d+ s- x6 e% @% w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. e' j/ c7 e1 D0 U% M) H L - * TO CHANGE.; G7 a7 ^1 e, d% L* y- |% ^/ ?
- *2 h9 i4 z3 e0 ?9 k: E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& {0 z; r# T9 Q9 I
- *
! C9 o1 @! Q& ~+ l1 r - * This program is free software; you can redistribute it and/or( n; ]2 d8 a, [; U5 z
- * modify it under the terms of the GNU General Public License as2 P8 w2 E; y1 }" h. }
- * published by the Free Software Foundation version 2.
) V$ F# U/ c, u/ j - *( a O; L0 |1 o# a7 s9 G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any v/ A5 w7 b7 t4 A
- * kind, whether express or implied; without even the implied warranty! O9 |1 P1 j- B% ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! N3 R3 a" ~# {, p# D0 D
- * GNU General Public License for more details.2 G3 E% \% o" P
- */
2 p% H: C& `" D N, F- y
; j; }! e2 a3 @1 d0 F# F- #include <linux/module.h>' f) A3 U0 L y5 r$ k, _* \
- #include <linux/init.h>
, E' w3 D3 ~6 Z- V- s) Y - #include <linux/errno.h>
- ~6 f" Z3 w2 H9 a - #include <linux/types.h>1 y: Q" V$ `0 h z
- #include <linux/interrupt.h>+ k/ s* o. F7 I3 i, i+ A
- #include <asm/io.h>
O4 N8 E" n5 _ H, p* y - #include <linux/moduleparam.h>
& H0 k% s, R! i( E4 {9 d - #include <linux/sysctl.h> e, D! V6 n* {& ]5 v# Z) c
- #include <linux/mm.h>
& v- Z0 W q' @& @# |- | - #include <linux/dma-mapping.h>
- x1 [: U6 t o( R
h2 z1 [( G+ _7 J# ]6 N- #include <mach/memory.h>. ]$ Q) B1 `6 C1 {: _6 O% [0 D a5 [
- #include <mach/hardware.h>
) o' r1 z# f4 b% @3 k7 Z - #include <mach/irqs.h>9 p/ H8 g$ X( }1 [9 A9 j) `- G
- #include <asm/hardware/edma.h>
6 U" n6 H/ B `7 x( t/ B - / J$ V& U `5 Q2 t! J/ s
- #undef EDMA3_DEBUG
0 C) x% m: X: n8 X" G- h6 l* x - /*#define EDMA3_DEBUG*/1 u. e) }, }4 s9 p9 }- @
- ( W6 m0 z. _, ?5 `+ U" J& d
- #ifdef EDMA3_DEBUG5 c( R) t% W" B# Y+ I4 c" D: s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& Y4 q- @# o6 ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 ^- E8 u% j: W* c: j! K4 D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* C- `$ m6 J9 m# |
- #else' u' R# B0 }: z2 j$ G
- #define DMA_PRINTK( x... )7 Z( n7 P7 H2 Q4 S7 I$ S
- #define DMA_FN_IN
" D g5 D. M' }! [& w - #define DMA_FN_OUT4 \ D8 v' |2 G5 Q' T" M# ^0 ?! |3 R
- #endif
$ o5 q- J5 K$ d* O0 a5 d - }) S+ d2 I( u, z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; @; v& k; r' W3 p: E - #define STATIC_SHIFT 3
, J2 p5 ?2 P+ n" b6 r' H - #define TCINTEN_SHIFT 20
/ P$ \ l: t% L - #define ITCINTEN_SHIFT 210 b% L" y" F. {" \
- #define TCCHEN_SHIFT 22
0 n1 k3 o/ @ i - #define ITCCHEN_SHIFT 23: h0 b" b& G; N' M5 D! x3 T D) C
* V' m' b# |" q- static volatile int irqraised1 = 0;$ E4 n8 k, ^& k2 \$ G
- static volatile int irqraised2 = 0;
9 d3 t$ @5 X' _: y' R" k) g( o
3 X9 s6 r# @) E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) q: \# i6 O' R9 B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ?/ f o) G" h8 l. k, e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
F* N$ a2 o; W- L - ; {# O- R1 F1 d/ G# b
- dma_addr_t dmaphyssrc1 = 0;
. u7 W: q4 N& y/ a - dma_addr_t dmaphyssrc2 = 0;2 D3 M9 b$ E+ z% J
- dma_addr_t dmaphysdest1 = 0;' {" b' N( {* `% n
- dma_addr_t dmaphysdest2 = 0;9 a2 \. J2 w' K% j% L
- % r3 _& {/ Z% Q1 Z3 S6 {' j
- char *dmabufsrc1 = NULL;
n6 c6 |" r1 F6 z2 ] - char *dmabufsrc2 = NULL;
Z8 i/ Z" p6 s- V0 }3 ~ - char *dmabufdest1 = NULL;
5 a# T" \4 p) y }; ^' { - char *dmabufdest2 = NULL;0 P% U( r6 \; a6 o( r. g' a
- $ t. B2 B* f4 u
- static int acnt = 512;
- t. ?* C. d9 U8 I$ R4 A, m - static int bcnt = 8;3 P3 e% L7 y5 v/ O
- static int ccnt = 8;
1 ^% A9 o; e5 u8 g - + j4 b& w, f* {
- module_param(acnt, int, S_IRUGO);
# B( ~* r: h) J - module_param(bcnt, int, S_IRUGO);4 }& m4 I7 t+ X1 y, X! ^
- module_param(ccnt, int, S_IRUGO);
复制代码 & M3 p( L) {: ^
' D' b6 d+ k# c/ U: ~8 H5 P9 | z4 k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 e( J2 ^) W7 c8 C4 Y* F9 @0 Warm-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 r( f* x- x2 E7 H; C$ I8 k/ }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 f- y* O2 J, K- y0 i3 j, C" `: U
& ^9 U1 ?. p6 b! {9 i% q' D7 o2 @8 h( s! @. o, L- k" @7 Q
|
|