|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' @0 z* s. ]5 v9 Y" K% W
- [code]EDMA sample test application
3 q& t) M: F; }; S4 d- {) @% [! p - /*. L* J" A! e6 Y' X, X
- * edma_test.c
; t4 ^2 s) n# ^ - *
' P4 l; ^$ ?' m" C0 A& k - * brief EDMA3 Test Application3 N% @, q* A" n5 A& c3 P
- */ ]( [' Q% O" Y- }
- * This file contains EDMA3 Test code.+ h# h+ p0 P, {/ Y$ }
- *
) ^' Y$ { c/ ]& A6 F) ^) \0 G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
g% y0 P0 j5 _3 W* r - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# T# {& \( X! ^$ y, w - * TO CHANGE.
" Z8 p$ n' B- E: P, v - *1 Z' {: @/ E, Y' A" O' R. N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) H& e$ D3 v6 K9 n- d - *8 h: ?6 x) D! ?, n* p7 x
- * This program is free software; you can redistribute it and/or
4 A/ w8 t+ _1 K$ g3 h - * modify it under the terms of the GNU General Public License as k' o, k6 w5 u) g
- * published by the Free Software Foundation version 2.
I5 h- z) x# i/ { - *
) ^- R9 B* U) C6 j* g# K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 C/ J4 h8 N4 A" `5 ^8 @6 ] - * kind, whether express or implied; without even the implied warranty# [$ G$ d! Z% Q( f; Q$ `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, C" u+ L. D, \: t- Y% C8 `
- * GNU General Public License for more details.# e* J. z+ t1 Q/ K( R' K: D
- */% |* X6 t) V% z
- ! J$ ?5 M" p3 K, \4 N' P
- #include <linux/module.h>. U0 g+ J. u/ e; j& ^2 R
- #include <linux/init.h>
$ u3 ^# T; S3 ` - #include <linux/errno.h>% f# q; Z. J0 I6 W# G
- #include <linux/types.h>6 \1 @1 Q' L$ O# K# F& \
- #include <linux/interrupt.h>
6 I7 l$ D, J7 j, e, E! z- [: ^ - #include <asm/io.h>
* }9 C/ Q! ?/ V( X, N4 n+ A# M - #include <linux/moduleparam.h>' P& L6 W( @- ~- j2 L7 ^
- #include <linux/sysctl.h>' C1 c+ B: L* i' U" r3 V- m
- #include <linux/mm.h>$ n$ O) _0 q6 ?
- #include <linux/dma-mapping.h>8 h2 Y& Y7 G( E
$ y( J3 y/ j4 R2 Q1 S: X8 }- #include <mach/memory.h>3 g4 Q: |2 q w
- #include <mach/hardware.h>, W4 m# [$ K9 }; c- n
- #include <mach/irqs.h>
/ N5 q* W+ ^$ I- r9 P' b0 A - #include <asm/hardware/edma.h>% r6 T0 D @! o+ X
- 1 y7 o7 h9 x' K8 W
- #undef EDMA3_DEBUG
2 W+ f+ j) C- d9 j" M - /*#define EDMA3_DEBUG*/7 Y# O+ \* A( C4 T: A
& |: e( r1 J3 m5 h1 ~- #ifdef EDMA3_DEBUG0 o6 |5 M5 r/ r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 n+ G" H* o- i) ^" J8 C! O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 V7 x& t1 g P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! h2 x# b; @* K4 `4 u
- #else
; r# B9 `8 f& `6 Y$ ]& [ - #define DMA_PRINTK( x... )
' t- p* U( F( ?$ r' M: ]) z2 y - #define DMA_FN_IN
! L4 U! P6 B" t2 L7 o - #define DMA_FN_OUT
8 o) Y2 \; P. v% p9 A6 B$ L3 y - #endif" K3 n1 G+ `7 r$ A2 M
; @* {" d6 j2 ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 B5 D) j; Y$ u1 c
- #define STATIC_SHIFT 3
" G8 d8 V( `4 \7 d% H! h+ I/ U* w2 r - #define TCINTEN_SHIFT 208 _4 p @! f! T( n
- #define ITCINTEN_SHIFT 21! P5 f# c& H% p3 x% C0 q8 @1 F6 F' Z
- #define TCCHEN_SHIFT 222 B/ M2 R. V) r% W
- #define ITCCHEN_SHIFT 23! X- a2 w4 T, E
- / i+ }2 L* s# q j% y2 k# l$ s
- static volatile int irqraised1 = 0;
0 e3 S* p i; ?) W1 g8 P1 e8 K - static volatile int irqraised2 = 0;. G: ?; B! A$ p$ }6 n
v. W* a, D* ~* c. m" @1 \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: Q$ X) K/ d8 w- z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 v( H( B! e% e" a5 G# \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 O' s/ m8 R: M p
5 N; W6 Y2 O5 Z% Y# P$ ?- dma_addr_t dmaphyssrc1 = 0;$ x( N, `" K) z9 ?. z$ j
- dma_addr_t dmaphyssrc2 = 0;
$ z7 r s' m- O! L# Z* g - dma_addr_t dmaphysdest1 = 0;
2 S" M" G, B% _& t9 X6 O - dma_addr_t dmaphysdest2 = 0;$ ]5 ~7 y. Y Y8 ]8 W' g9 |! C0 c
2 ~9 S' r6 A" p* n& Z3 C- char *dmabufsrc1 = NULL;
! c' X9 M! I4 E! ?2 a% Y - char *dmabufsrc2 = NULL;
- o r. A. ~7 k( |$ a7 l - char *dmabufdest1 = NULL;
- ~: a( e" I6 c7 c L" S+ \) h - char *dmabufdest2 = NULL;. k. o/ G U: [8 }
- + ?$ ^# _* x5 j$ P+ F* m$ r
- static int acnt = 512;/ l! k# z2 x) L0 k: X" h
- static int bcnt = 8;! W9 o: X5 T# P7 Z X9 n
- static int ccnt = 8;
. N' x/ l0 }8 j2 W4 B - 1 [/ S! ?' |% Q9 n; Z+ V
- module_param(acnt, int, S_IRUGO);' U1 X7 A7 _3 n' X- _
- module_param(bcnt, int, S_IRUGO);
' Y9 o3 d8 c6 W; ?$ T - module_param(ccnt, int, S_IRUGO);
复制代码 # d0 y: @8 c- B4 J* v6 R
9 H0 i% g- F8 `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 r. [; i' X5 @" h0 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: ^2 c7 v# P8 _5 ~% t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 F5 w6 Z" i S; U" r1 p
! F& e5 M0 [3 y: Y( E* M$ ?
4 ]' r2 ^) Z) ]2 D |
|