|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; U* C' i; I/ T. b0 v7 t
- [code]EDMA sample test application
; B# V7 @ P7 p; j - /*7 a$ Z9 X i ?& j& t5 `2 K
- * edma_test.c3 b9 N! M0 ]4 g1 L
- ** h$ r8 \1 {, |/ l6 S$ b i5 i# M
- * brief EDMA3 Test Application& |* A( a! t7 ]( t- [% K5 b3 n
- *, q$ |% P' N' r% v/ N% G
- * This file contains EDMA3 Test code.
4 b/ `% B n2 ]$ S7 q - *) B$ d9 c1 N) f& r' Y" o, K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 `5 U6 W* i. `$ i4 W$ r" f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 E1 D' H* i- o5 x o, }5 k: U
- * TO CHANGE.
6 ^0 O5 Y2 T! D+ Z% w3 u8 a - *
; w) I+ B0 A! M7 l3 }; l7 e7 y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 x8 T6 j* ~' f8 f
- *
3 _8 B1 W8 S5 X - * This program is free software; you can redistribute it and/or
, c4 Q# r" X% F) D6 U! Q6 k6 m - * modify it under the terms of the GNU General Public License as
+ d5 s6 h2 G1 t4 T4 p8 M - * published by the Free Software Foundation version 2.7 g# X$ b: I5 w0 t
- *1 M9 w& x+ K I/ }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, o, H: }' l) J/ s
- * kind, whether express or implied; without even the implied warranty
; f- w0 H- l' V" t- ?2 j4 L% @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* g' j3 g: R) E2 c) m9 @* V - * GNU General Public License for more details.
) Q" P% w/ p9 r* ] - */
4 E: q: a( \$ d# n' Y" l1 \- { - 5 g1 f* t& x: h7 a2 ?" V& d: d
- #include <linux/module.h>
' r, `2 `8 B) Y% Y* R - #include <linux/init.h>1 y9 n( a: O; d0 v# Y
- #include <linux/errno.h>
+ V! U4 G: y# L2 Y- s& ^$ [ ^ - #include <linux/types.h>
- G- w u$ X/ a - #include <linux/interrupt.h>/ m+ z7 x/ ?% B C" h
- #include <asm/io.h>
- ^& O& A( J+ h" e w6 j - #include <linux/moduleparam.h>% W! p: ^2 S% H. p$ P; E7 A2 ?
- #include <linux/sysctl.h>, y( `2 S7 U' Y/ p0 F
- #include <linux/mm.h>
5 w7 d3 s- `. p9 U' G3 Z4 M# X) M( m0 f - #include <linux/dma-mapping.h>
# {! M+ l# _. d$ B* N
) q' q3 s0 A& |0 K3 S/ L0 t6 F- #include <mach/memory.h>4 {" Q. a* @, \, B" u$ V8 e
- #include <mach/hardware.h># i3 x; m9 {- l& P" i
- #include <mach/irqs.h>' N. l% m( n- `, h; t* D
- #include <asm/hardware/edma.h>9 R+ h! ]1 V& a. |" v) ]) ?! I
- + R, d9 p. }1 U5 @: t* Z1 @; K
- #undef EDMA3_DEBUG
! D9 F$ V g8 [ e. U" Z. U+ j3 c - /*#define EDMA3_DEBUG*/
+ h, H+ k3 f# g, o5 y2 u j
4 Y% X$ n: z' I- #ifdef EDMA3_DEBUG
7 q: L* h0 A& z1 c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) o3 W$ |$ C1 y( z" s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' Y1 @/ o- \3 u. n& j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 m* U0 b0 {* ]1 @4 L - #else
. _6 e8 C$ F4 W, X( J* Z/ R* o - #define DMA_PRINTK( x... )/ H+ t: \0 g P( b5 v# R
- #define DMA_FN_IN+ z# y4 \5 U0 \' {+ Q9 H! w9 \
- #define DMA_FN_OUT) y; I% I- Y- j- s2 H8 T
- #endif
0 M* Z+ Q- z8 M9 l. {5 D" r2 n4 f
, j# r* B! d4 w2 w5 m# o* L( p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# m1 B, X A: ^( `2 V. k, O" c4 w - #define STATIC_SHIFT 3, W& N7 r1 l. I; J
- #define TCINTEN_SHIFT 20
3 i6 f* u/ ~5 R3 R5 a+ _+ `1 ^6 N - #define ITCINTEN_SHIFT 21
+ E: r* e( V- Z! D6 l w1 o - #define TCCHEN_SHIFT 22
/ [ V/ j" [- A; q - #define ITCCHEN_SHIFT 23
, ^7 g1 \9 \/ W3 q% \: r: R
) k& V" n- y8 t: r" E1 e) Q$ n- static volatile int irqraised1 = 0;
) W7 [1 R7 B0 Q+ I, F - static volatile int irqraised2 = 0;
3 o9 }* u1 j/ [. r8 r4 d - - l8 x9 g- }! E u: A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 s8 U/ m2 O! l5 q" S0 p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' r8 O) D; k5 { u3 a$ E% m; q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 [8 u# b" [2 D! K2 Q. z - ) p' S) ]8 n8 ?
- dma_addr_t dmaphyssrc1 = 0;0 t1 A4 Y. q! R) |& W! T
- dma_addr_t dmaphyssrc2 = 0;7 v7 w. v) E( @) i
- dma_addr_t dmaphysdest1 = 0;, V3 w/ v+ A: i# j
- dma_addr_t dmaphysdest2 = 0;) k" H) ~" u5 A1 t& k
- ! m1 J( a( g9 F g, K& N
- char *dmabufsrc1 = NULL;
3 C& U: h5 I' \- r - char *dmabufsrc2 = NULL;! |0 J1 \) R0 `
- char *dmabufdest1 = NULL;
# F5 |. e b1 f! H3 V: C; q - char *dmabufdest2 = NULL;5 ?) ^7 Q# U" V( T, n) O
! K! s ^* x7 z- static int acnt = 512;/ V8 B& A+ D2 N
- static int bcnt = 8;
( i; {* \3 ?' x% |: c% o - static int ccnt = 8;
2 o/ P5 C6 S1 b$ {3 Y7 \
4 K. P K" }- Y% U" T0 {- module_param(acnt, int, S_IRUGO);
6 Z- U* b* [' w, t) A9 K. x$ u - module_param(bcnt, int, S_IRUGO);5 Z( }9 O( m9 f; F
- module_param(ccnt, int, S_IRUGO);
复制代码
% e4 E; s0 i, T" D* D
, F# N9 e, N/ V2 ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& Y' F5 [0 G( d4 Q( oarm-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% p. T+ r, Q3 k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: k0 B! i4 O- h+ l6 D
+ R6 D- a& U8 n( c% O3 w5 u0 v" \ Y3 P3 ~5 M: _( Q" i
|
|