|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 o7 y5 I4 [/ ]$ Q" `7 V
- [code]EDMA sample test application
6 Q9 [/ S! U3 ^" u" b' M% ] - /*
' K0 v5 V9 e5 K- Y9 K$ Z e - * edma_test.c
* ^+ v" ?' f( N1 x& o8 B9 P - *
/ F$ r& ?% S2 {" z, M2 _ - * brief EDMA3 Test Application
' Q2 E! `' `0 P% O8 \1 p3 {( c - *
9 h0 _7 s. W# ~2 G5 v - * This file contains EDMA3 Test code.
1 m5 x2 E2 K/ \& M/ j; g - *5 c6 a$ w$ R" j [4 c$ ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ p6 p* m g+ n$ C k: Y/ X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( o2 [% w% i$ P# j* p! k
- * TO CHANGE. V* K% }# B! T3 u+ T( p5 C
- *2 u) f ^0 z' }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 r! \5 O# ~! a q% D5 l' m: U - *: I: V% P3 ~3 n; S
- * This program is free software; you can redistribute it and/or A2 ]' i1 u7 e. b3 x1 K$ E- }/ J0 n
- * modify it under the terms of the GNU General Public License as
0 E, s C/ |; o: ~0 M2 R' L - * published by the Free Software Foundation version 2.3 A. _9 O" Y: V2 X
- * a4 H4 H7 W5 \! ]5 y# X3 B. J) y) r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 S8 W5 _' d6 [0 d1 u! D' P - * kind, whether express or implied; without even the implied warranty( e/ k; K# V. x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 K7 ^. {! u5 } B u5 c
- * GNU General Public License for more details.
, L7 ^0 C- c" Y }4 O - */
- B0 D* i: V1 ~- E
# G8 C3 R. O4 n. c: Y- #include <linux/module.h>; f: W: Q/ n) E! j
- #include <linux/init.h>
n, H. I0 f9 ~& H1 V( O9 v - #include <linux/errno.h>
1 t0 w" w9 \4 e( I& g9 }: R' _; } - #include <linux/types.h>
. [* B+ f# ^# H( }' M - #include <linux/interrupt.h>
4 A; @$ p! J# \9 P7 n, T - #include <asm/io.h>
# |( f; {, e r% r4 C2 G4 N L - #include <linux/moduleparam.h>: J" o( Z L# v s/ o) W, s7 v2 }7 x
- #include <linux/sysctl.h>% g1 f4 C5 e' N# l& \; u
- #include <linux/mm.h>7 E9 c% l- Q$ q* r9 s# G0 [
- #include <linux/dma-mapping.h>- C' X7 z, g4 T; P# N; F/ r5 N! y' P/ z
- 4 Q0 j; d$ p0 S0 U4 u
- #include <mach/memory.h>
% A3 J/ c, {' U, x3 t s - #include <mach/hardware.h>
8 o( i) y. x& o- L+ o/ n! Y - #include <mach/irqs.h>
) b f5 T8 z& o% C0 R( S# V - #include <asm/hardware/edma.h>$ k" |6 v q2 L2 R q$ a+ A3 q
3 c2 M9 b. B3 m- #undef EDMA3_DEBUG4 ^9 l1 |5 ^& _: h6 X; N7 {5 v
- /*#define EDMA3_DEBUG*/$ J1 P# q$ X9 b% C
- , _5 v t) v4 _& H7 {+ h! a1 b; e+ K
- #ifdef EDMA3_DEBUG
5 R! Y' q: m& u; a3 i+ A4 | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 P! V9 a9 k3 }" M* I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 W& ?! J2 r3 y& T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" b0 u+ ^: R0 E) G4 A3 K - #else
) x4 _3 B0 n# j! t& K, z& m - #define DMA_PRINTK( x... )6 w; w+ D. M/ [' T& d( ]# K8 Y. f
- #define DMA_FN_IN
9 M8 k0 @$ I8 w: G& P, T/ R - #define DMA_FN_OUT2 _! y- z+ b+ v! K. @2 ^
- #endif
: r- J! L+ _, @. x7 T) i+ T - . ^2 d" r4 H9 i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 R) V1 p8 Z0 b' V - #define STATIC_SHIFT 3
% i2 r G9 b/ S8 \6 U - #define TCINTEN_SHIFT 20
& P, ?5 r; r# @4 c, t) ] - #define ITCINTEN_SHIFT 21* L% E$ V- o% `6 l- M
- #define TCCHEN_SHIFT 22, c0 n" _' L$ ^6 m
- #define ITCCHEN_SHIFT 239 e4 ]+ B3 k0 i& ^; u
- : i* b1 [' O5 t' C$ Y% F& Y
- static volatile int irqraised1 = 0;
# M2 Z2 |* D: r; H5 u: Y - static volatile int irqraised2 = 0;, z; }: k3 x r5 V% O O
- 0 I" M9 @2 L- T7 b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 v& `) C/ } S/ \7 ]: n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. p1 L f; j8 z3 q/ K4 @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; N( g( T8 t1 T3 X0 j2 u
4 n$ G V/ ]1 C. B# f) ?: L- dma_addr_t dmaphyssrc1 = 0;
& Z+ _& X4 F0 a8 r- c - dma_addr_t dmaphyssrc2 = 0;
1 Q' O/ ]; c& r6 J' n0 t - dma_addr_t dmaphysdest1 = 0;
, ?' V. W2 S2 T& k& Y. X2 U - dma_addr_t dmaphysdest2 = 0;- X. P3 @5 O4 ^ `1 A( m' ^
- : @! R& N: R( R: u2 l3 D
- char *dmabufsrc1 = NULL;
" S( T0 f2 w. V9 G) R! P - char *dmabufsrc2 = NULL;1 G# W. J& x6 u \) @
- char *dmabufdest1 = NULL;
; r% q V, u. D( K9 q - char *dmabufdest2 = NULL;
6 U/ r$ O( J# g( T) k5 ?: q X - 0 X# b: v6 F! t/ ?: D9 |2 t0 Q
- static int acnt = 512;8 L, I0 {7 u& [3 f' j: b. C \
- static int bcnt = 8;- {- b$ l: S& N- h) D# U4 G
- static int ccnt = 8;
, t& O6 M0 \- E8 Y! B - ( X* [9 J" i% Z
- module_param(acnt, int, S_IRUGO);5 f7 T" }6 x' @3 r; I' v' p3 h5 h
- module_param(bcnt, int, S_IRUGO);6 J6 L) ]! p/ ?. Y. C7 s
- module_param(ccnt, int, S_IRUGO);
复制代码 / C T. t3 Y2 C z, s8 K
2 s9 c% b* f8 H9 z; W% `6 _/ S: R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" @, j$ w- [/ _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, O- j) M4 O* p3 B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) G" N& |# c6 f1 D- G
, z/ t6 C, |) r s( Z$ _# }2 W, b1 W/ m5 R( f3 |
|
|