|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - L) A2 l% p0 f
- [code]EDMA sample test application
' w. G. L8 L8 x8 T - /*# m6 f2 b% _. O! ^; I$ i1 U0 u
- * edma_test.c
6 R% w7 _8 H4 b: N* G - *6 N3 D e) _9 z+ n
- * brief EDMA3 Test Application3 W1 q0 v1 Z4 E9 F
- *1 G! a _& N8 m: x3 G) q3 q/ K- E
- * This file contains EDMA3 Test code.9 M, u: K$ b/ V' X, q8 S
- * Q3 m* o/ O( c) B- E1 `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% E: E; L0 j% R4 G, {; F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 t. |& L% `* a
- * TO CHANGE.3 h7 [/ G3 y, K
- *6 V* G+ i7 Z/ k3 T' _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& K: A/ H5 Z" }. |: J6 j( E - *0 U8 J, Q) ?1 v/ \3 [' z1 \
- * This program is free software; you can redistribute it and/or! v. V Y: Y7 _' e, I
- * modify it under the terms of the GNU General Public License as
^, A. Z, h6 s* F2 M - * published by the Free Software Foundation version 2.& z5 y) r+ G& f" w# ]/ @/ U X
- *
/ ^* G* |1 u* g8 {# M" }0 j8 Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% j# I) `$ c. E9 @) X - * kind, whether express or implied; without even the implied warranty
9 m% ]! {/ R" v( m' O' d, y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* b( S0 h Q* w- S3 c+ H+ z" a - * GNU General Public License for more details.9 a6 Y$ P& f- Z0 H
- */$ |, v1 D$ g$ u4 E8 A
- 9 ^# I; h$ E4 I6 x/ j1 c
- #include <linux/module.h>, R) z& v# W1 H9 Q
- #include <linux/init.h>( `1 G5 h% p6 o5 J
- #include <linux/errno.h>
) d" M; C* @, X; u+ ~4 I - #include <linux/types.h>1 C9 U9 y3 Z2 Y+ a" C$ K
- #include <linux/interrupt.h>$ [) d* Y, E5 N* @* U
- #include <asm/io.h>( b* c8 T% w, T: M6 S& p
- #include <linux/moduleparam.h>! F% q( q* L8 K+ p1 U
- #include <linux/sysctl.h>3 U4 Z6 C; o3 [ U# M. O8 @( G' [2 Z" ?
- #include <linux/mm.h>: {, n: W2 T! j" {8 ^- J# D* I
- #include <linux/dma-mapping.h>
* G1 z3 _! ^2 S) Z, I! Z
4 X0 O6 x7 W s; s( s- #include <mach/memory.h>! ]6 Q/ N. H7 a
- #include <mach/hardware.h> }7 n( r( n. \) b
- #include <mach/irqs.h>
: @( z2 J/ @3 ~1 O6 Z1 o - #include <asm/hardware/edma.h>
, X3 f; \& j7 }. J - 2 o K7 T( A$ p x
- #undef EDMA3_DEBUG
6 B5 I0 G, K# Y, X2 d# Z - /*#define EDMA3_DEBUG*/
- l* ]" V1 c' C9 r
! U9 |4 l2 @$ O: L1 ?- G1 y$ U- #ifdef EDMA3_DEBUG% g4 y0 Z# |4 j2 c& R; Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 O/ i9 b# h( ^7 g7 L" S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). k B) N) ? e5 z) B% `' q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* G1 N# T+ U& ~% C8 n/ a: V3 B! r - #else
D0 o% _7 T% g- Z1 O& X; o- L - #define DMA_PRINTK( x... )
1 U, l+ M3 g5 a! T1 Z; u% { - #define DMA_FN_IN( g% Z2 h: V& F% R: J3 B
- #define DMA_FN_OUT4 ?3 P' A# _1 P* f% ^& m; Z8 b
- #endif, Y# O& _5 n1 D& Q$ X: D3 s+ V
3 `! O! P9 K, }- #define MAX_DMA_TRANSFER_IN_BYTES (32768), Q! K1 e" Y d* y6 U5 g4 G
- #define STATIC_SHIFT 3# S+ I4 N9 n9 T( U7 Y
- #define TCINTEN_SHIFT 202 [- _9 d- |# c# U }0 c
- #define ITCINTEN_SHIFT 21
$ Z9 r7 c7 w; O8 H) W" _& S - #define TCCHEN_SHIFT 22% H, R! L' D, h, p, l+ c/ g
- #define ITCCHEN_SHIFT 23: A2 E9 m2 j+ p# m1 D& Y. O% \
5 l4 l' y$ v& l/ u% s# q- static volatile int irqraised1 = 0;' v1 ]1 C6 n# p2 j
- static volatile int irqraised2 = 0;# ]0 l( b% G* K- S7 i1 q. D# \* s" N
- + E) H0 b; O1 h* k" Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) }5 m+ W# {* B, e3 V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- m9 X, ?. z, P3 r0 r: g1 L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 @0 v2 j- ]3 y; p2 w0 R+ L. B2 e
$ E. n& {, d* Q& s: A- dma_addr_t dmaphyssrc1 = 0;
7 A7 |* z! k5 s C* g - dma_addr_t dmaphyssrc2 = 0;3 ~/ K8 y; L, J) i; X0 ?; }
- dma_addr_t dmaphysdest1 = 0;3 R) V6 B/ c$ I" \8 |1 _
- dma_addr_t dmaphysdest2 = 0;9 ?; ^' A1 G& t ?$ |# y5 \& ?3 T
- 4 \& r' a l; r0 ^8 C* O. J" O! o
- char *dmabufsrc1 = NULL;
( a4 L6 F4 \: k" U4 X3 {7 a; n - char *dmabufsrc2 = NULL;9 n5 |: V8 z" N1 R
- char *dmabufdest1 = NULL;
+ d7 a; W7 Z5 [8 ~% E% M - char *dmabufdest2 = NULL;$ S: E& b1 V) m& C3 N3 I- Z# ~7 `# G
- $ F# `+ t2 q- X; {+ K* i) o
- static int acnt = 512;" u; k& R! d0 c: N1 V# W& R
- static int bcnt = 8;8 H, I7 D7 @* `% ]
- static int ccnt = 8;9 C1 {8 l$ v4 ^# L5 ~8 y8 n) f
- 0 N x1 c! t8 m7 r
- module_param(acnt, int, S_IRUGO);4 m/ ^4 O% n0 R. A9 u
- module_param(bcnt, int, S_IRUGO);+ x6 n/ u u& t7 m# O$ g
- module_param(ccnt, int, S_IRUGO);
复制代码 9 A# u: i( }1 I. N( g
8 ?& y7 C$ |2 Q% w+ c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ M: n" b& A8 r# ~) X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: {1 j' Y3 J) ?' M+ j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 u$ n7 g, ~9 R) S
8 K6 x7 ^# J6 m/ K6 V! R0 ~& J7 m6 s) ]
|
|