|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 m0 n. r) i9 s' J1 w- r- [code]EDMA sample test application
7 {7 o- v& o1 g3 D. x: G7 d - /*
' o9 B1 f) F: ^4 {/ q - * edma_test.c
, x8 T8 O+ T* ~/ A1 q - *
; K' f, U$ s! {5 j - * brief EDMA3 Test Application
* R" l( E- E6 N% g* w - *
7 E3 Y% Z& ]7 [+ `+ t7 Z8 @- s - * This file contains EDMA3 Test code., U1 E- C. K& a) b3 m
- *; X2 ^' d- L3 F! T! y1 I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 M5 ?; [/ N. }, n0 \* U! ?' V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; ^# o% o0 P6 M" U& ]; F; W6 M0 u. k
- * TO CHANGE.7 r0 v- ?, q0 Z4 a) ?4 o2 I8 ]
- *; F: _; F5 N+ k) S, c# I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 ~* |$ ]7 m2 g6 G7 z - *
$ [" }* d$ v' m0 N( u - * This program is free software; you can redistribute it and/or
( o. a$ Z- Q# v6 j - * modify it under the terms of the GNU General Public License as8 V' d9 D' [; ~% |# h3 _* w. o
- * published by the Free Software Foundation version 2.: v+ n+ c8 k4 a3 `
- *: j9 b+ A8 ~% {0 Z% O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 ~7 a6 A: C! A4 {9 T
- * kind, whether express or implied; without even the implied warranty
! T) H! F% _1 I- o, B; f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
U \2 p! E% ^ - * GNU General Public License for more details.
O/ G! W/ ?' T' K - */
8 E, Z/ r6 q k8 P1 l$ J& H
" R$ K/ J) y5 ?8 S5 t$ V- #include <linux/module.h>7 q0 l% \! g: m( u; B9 q
- #include <linux/init.h>
2 A' J* ~7 Y5 r. `0 O+ z1 y - #include <linux/errno.h>
0 S+ R8 \% }" ?7 Z - #include <linux/types.h>
3 X* |: Q9 ?+ r- u# B - #include <linux/interrupt.h>( j) Y, u, J: F) z
- #include <asm/io.h>. ]: j+ r8 y: @. g# [- U6 A, b, G3 T
- #include <linux/moduleparam.h>5 V, T' e2 c" }8 x! a) p& D1 u0 X
- #include <linux/sysctl.h>) ]7 B2 x( D4 K& L8 q' p8 V3 M
- #include <linux/mm.h> H8 B$ P3 [% N0 U1 O5 t% t$ n1 v
- #include <linux/dma-mapping.h>
; _7 C. y: p: _. k2 H& ~ - 4 b. @! h1 z: H5 ]
- #include <mach/memory.h>3 W* r% W8 I; Z0 m
- #include <mach/hardware.h>' T/ e5 U" @! u$ h
- #include <mach/irqs.h>
* P& m8 ^2 Y1 ~" r - #include <asm/hardware/edma.h>
! p9 N: t# O8 \# t, r - 2 @8 [2 S# z+ N U' n
- #undef EDMA3_DEBUG/ t0 \# Z* K4 n& f" k
- /*#define EDMA3_DEBUG*/6 i/ m3 L2 U5 H6 L
}' t6 W8 h2 [4 l+ s( ?- #ifdef EDMA3_DEBUG
& H5 }: }+ R: p2 z" N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 a8 a$ e! D6 X4 g" x- b. ^( I. h) A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* O" ]! [+ u7 g) w8 A Q+ q( t' i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ ?3 c6 U( A5 J( w/ z" y - #else
6 G+ C6 V% H4 h* j, }1 a0 L - #define DMA_PRINTK( x... )
& m3 q4 m, J; ^! c. }0 I" | L5 n6 M - #define DMA_FN_IN
% s- \$ A2 H W( v8 A/ y - #define DMA_FN_OUT
! R( O0 Y' ?9 c% n" d* C9 Z! \0 m - #endif
3 p W: M3 |: ?2 x4 e - & X! [% U/ {. h! h5 c4 Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* \ h, h* H7 q- @5 _' v - #define STATIC_SHIFT 3, Z5 Z: h$ C% f# L- w: ]0 A
- #define TCINTEN_SHIFT 201 A: p; s* `4 e( z6 i9 M
- #define ITCINTEN_SHIFT 21
$ O5 R2 Y! D; \5 x - #define TCCHEN_SHIFT 22$ u. \- Z x- s, G" I5 Q
- #define ITCCHEN_SHIFT 23
3 R. W1 f/ ]7 X& r. B
N, l+ p- Y( x: r- static volatile int irqraised1 = 0;& B% i; X5 E. N! E& m
- static volatile int irqraised2 = 0;
/ ^+ O0 ^' j, H+ Y# O e - c. V4 b" w0 y# Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ ]: V2 ^- [$ D0 T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ], n- [) W: a. [) [( \1 h: D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 |0 l7 u2 x" Q: d3 j* I - 3 v8 F9 u. Q9 |4 w8 j/ I# h
- dma_addr_t dmaphyssrc1 = 0;
6 S1 y& s1 p k: T+ l0 S - dma_addr_t dmaphyssrc2 = 0;
5 H; U6 P, K2 O& A - dma_addr_t dmaphysdest1 = 0;
/ g: i- s& A0 X - dma_addr_t dmaphysdest2 = 0;+ u* R, _5 `$ k$ V0 i7 Z0 W
- E( b4 S6 y6 v n" T9 X' Q
- char *dmabufsrc1 = NULL;9 v0 v$ j0 b8 j+ E, Y) a
- char *dmabufsrc2 = NULL;( M- T& m5 V4 [) Z
- char *dmabufdest1 = NULL;4 P# }, {1 i) O! w: `
- char *dmabufdest2 = NULL;
& F0 p: ]4 J2 S; @0 V - 5 b+ ~6 f) h/ b3 x3 W0 E
- static int acnt = 512;
' F' G6 N% I( V$ j! T2 c7 c' w - static int bcnt = 8;3 N5 X& m) q0 w. Q
- static int ccnt = 8;# S0 u; X) F. I% _( W
- . t3 [; D$ ]9 m; y( M, S5 t/ |7 \" p% r
- module_param(acnt, int, S_IRUGO);
$ t7 `$ ~5 w, g& R/ U: M# H - module_param(bcnt, int, S_IRUGO);
+ Q A, \7 z; t - module_param(ccnt, int, S_IRUGO);
复制代码
* c) [- `+ s+ c; H7 G6 m7 Y! p9 Z. W+ f$ z5 o. ?% x1 v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 d3 g3 L. A$ [, S0 a) F7 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 Z# U; f* U/ [3 g, a$ W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# J# B$ t- U! E' e3 ?% K5 b6 o3 F/ o+ [# R6 K* k
! H! V. x9 Z5 a" r8 V" X
|
|