|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! B6 K& g9 c! i) s- [code]EDMA sample test application
9 s2 m" H9 m" Z; L, B& x& k c - /*/ S& `4 e- N/ U' |& w7 m
- * edma_test.c5 w' R0 b* \, }. B; z
- *
. |; @5 w. ?; H5 I" z - * brief EDMA3 Test Application5 z/ H1 @1 m2 `' L0 H& o
- *0 I2 y3 k1 U/ y
- * This file contains EDMA3 Test code.
5 \7 [5 W* R3 F; W5 q' u) \& v - *
: S+ R/ c$ |' @+ ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" E& _& N" q+ s. [" ~ B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; L( _, w$ g" S7 E, ^ - * TO CHANGE. J" R8 \. a" u3 W
- *
" f9 J* n8 y8 i9 ]7 S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# t, S: K. w0 i2 |, p
- *% ~5 Q; @5 A& {$ b
- * This program is free software; you can redistribute it and/or0 e9 m) U0 z- @9 \' G
- * modify it under the terms of the GNU General Public License as3 R B5 u# I/ J+ r0 o6 |3 ^' T
- * published by the Free Software Foundation version 2.
2 x7 N% z6 t$ J, y' C& F. { - *9 S1 z1 E9 z8 U! } S( D* c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. _5 \+ a x- ]: Y4 q - * kind, whether express or implied; without even the implied warranty
; h7 d i. _) v Z( K ]5 H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& ]. \ }3 K1 F$ C( G: q
- * GNU General Public License for more details.
4 z* S& \; A: K - */. C/ M) L: x5 p# \
- * }& A3 E" q8 A% H& m
- #include <linux/module.h>, d @, B% X0 c4 L% b
- #include <linux/init.h>/ c# r: R8 j. @9 M3 @' m
- #include <linux/errno.h>
- O2 k) g0 J2 b0 U, I* p" q) g9 w9 S - #include <linux/types.h>/ y* s( ^3 j' Y5 ~8 d
- #include <linux/interrupt.h>
! b$ g& c0 ^3 @% q. b4 C$ } - #include <asm/io.h>
( \5 b" v4 c) a) k' ]9 C2 _ - #include <linux/moduleparam.h>
; n8 r) M X, R8 i: _: r) A1 O- P - #include <linux/sysctl.h>
& ]: C3 g( _, n( N% y/ w2 u3 D j - #include <linux/mm.h>" `3 Q+ p' U+ @
- #include <linux/dma-mapping.h>& I, q6 t, ~8 \
- 8 p% \' M3 o$ z- C% w
- #include <mach/memory.h>
# ^/ F" }( m) ?1 `9 w - #include <mach/hardware.h>
* H g+ R0 @" E$ G - #include <mach/irqs.h>
( c/ f" u; P6 b3 c. a - #include <asm/hardware/edma.h>
; \3 [) k% X g( E" X
$ P' r5 Z3 o: z* L% d ?8 H- #undef EDMA3_DEBUG# l( a; e9 ^+ m3 O" K
- /*#define EDMA3_DEBUG*/
, [. g# K; n! ` - 8 C7 I# z& |3 N3 Q, w# v0 b
- #ifdef EDMA3_DEBUG h9 Q# b. m% e+ d: T! _; j, D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( \. v) h- W+ V' G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 E& U/ C' H* t3 n8 K7 g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' o4 W- [9 v) G' S h$ F# P - #else e9 R8 N' i" ~" Z+ Z! X4 S* g
- #define DMA_PRINTK( x... )
- [, e5 z4 N# x5 m - #define DMA_FN_IN
( [* O: a( E' i$ q& ?& U3 w6 S - #define DMA_FN_OUT
R$ D! I- M! L+ ` - #endif
- U5 x1 I! w7 m9 { - + p8 ~( k/ b6 J* x5 P+ j- t. ]' r. B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ m6 S# H8 p m9 |7 c0 W7 }; x
- #define STATIC_SHIFT 3' S% ?3 r$ K" y* ~1 V
- #define TCINTEN_SHIFT 20
; y" @" \; [, {; {( B - #define ITCINTEN_SHIFT 217 x. l( [& I" C1 h
- #define TCCHEN_SHIFT 22
2 O# A& f6 r& W2 k: a6 W - #define ITCCHEN_SHIFT 23; X' B# w" ~- J0 S, {
- 6 p6 q+ ?2 X p, o2 L
- static volatile int irqraised1 = 0;
5 G% H0 [" @) q - static volatile int irqraised2 = 0;
. g0 a" M e9 ^' a) |, E- m5 ^
! n- K9 Y M2 p. `: [' r) T; A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Z/ R2 V7 {1 G- A8 h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; S9 \) t) S: f; s - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 y6 [9 G, h/ { p
0 H( N0 I# A% @8 Y7 `1 j, e- dma_addr_t dmaphyssrc1 = 0;! B# t$ N1 S$ }& N$ _+ `5 u. I
- dma_addr_t dmaphyssrc2 = 0;
3 o( r% X; F1 l+ A - dma_addr_t dmaphysdest1 = 0;
" ]' L, ?; z& K- o8 z! R - dma_addr_t dmaphysdest2 = 0;( K) d) j8 s& f
- . \" S+ M3 c& w, b
- char *dmabufsrc1 = NULL;$ l6 E& |) _. w" Z
- char *dmabufsrc2 = NULL;
g1 S- ^2 {5 X! k7 L7 R& o' Z: a6 { - char *dmabufdest1 = NULL;
4 S1 {! f# |, L. } - char *dmabufdest2 = NULL;
! T( E0 F3 _1 y A/ R3 G& h3 b2 H
: t8 {/ Z' K1 r& L% V5 T- static int acnt = 512;
8 m' A4 ~% v3 W - static int bcnt = 8;
5 }7 S6 s# f8 J, i7 c- b - static int ccnt = 8;
( v+ X0 Q. D8 c, A - $ ~& G D& z7 I7 r/ i; o
- module_param(acnt, int, S_IRUGO);* S+ I5 t+ p1 A
- module_param(bcnt, int, S_IRUGO);4 W9 C! k9 Q2 k; |8 O; c
- module_param(ccnt, int, S_IRUGO);
复制代码 ( z0 o4 H! Z/ H# K& D$ r* \1 f4 Y
# J0 v- t/ L/ v8 i6 L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! q2 N6 ?( O8 P7 N0 p- Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 F8 p0 l4 f9 b7 r( t; B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 D+ z0 o# S% I* y2 I {' a" n& T6 l4 X! S2 c; _7 e. E
9 A# }& R6 ?- B+ N" P5 y0 O# R
|
|