|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) s) A# @4 ?1 ^4 W9 u- [code]EDMA sample test application: s `* C. H7 s5 U5 x. \& V6 R
- /*
! x3 f7 R3 P/ {1 U ~' B - * edma_test.c
. ~$ j8 Y' r6 m8 B& [ - *
& [- e4 \& F. ?2 E+ s; f' L - * brief EDMA3 Test Application/ O3 _6 L6 V& V: {0 }
- *
2 K' r* k) k4 T/ y- ` - * This file contains EDMA3 Test code.: M3 H, a" D! E/ N% c* J0 X) m- L
- *) @8 g L! }* S$ _8 C( e# W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" S7 A8 d- U1 e2 `, ~! ~: x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 {# Q* O7 u/ T' ?" t2 x3 }4 G
- * TO CHANGE.
1 L1 B/ Y: o. U( ?: x4 j- e - *" J' _* L% ~5 ]/ r: p* i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ C# Q5 _8 \9 [8 Q - *7 i7 ?9 S6 c1 P
- * This program is free software; you can redistribute it and/or
% Z9 s+ }& `6 s! Z: M* Q - * modify it under the terms of the GNU General Public License as% W- A! i) d7 l& j; X6 b, i# L O
- * published by the Free Software Foundation version 2.
! a( E$ X7 {( D, F - *
, x$ e! c! f+ R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ e u, M) G4 z; X! D- j4 P
- * kind, whether express or implied; without even the implied warranty
4 T9 \& `5 Y- T5 P: m; a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. K; S* {+ w8 P; e0 D1 ~. O5 T - * GNU General Public License for more details.0 N& h9 K2 L$ W# V0 M
- *// z+ O2 T! ]5 k- h- g( i- i) Y
8 F' V3 v5 r( Z u- #include <linux/module.h>
; Y& p1 ]% |+ {$ l: y+ ?( d - #include <linux/init.h>
& W3 \) |. d3 |# J; u5 ] - #include <linux/errno.h>8 T( E3 N/ k F/ P5 ?* V; C3 e
- #include <linux/types.h>4 [" r8 P" o# _- K
- #include <linux/interrupt.h>
6 `6 @: g. G2 d+ o7 N" g - #include <asm/io.h>8 W; n1 ?' C% [" w
- #include <linux/moduleparam.h>+ }: J4 [3 A; [* f
- #include <linux/sysctl.h>- g6 _2 n9 ~ `8 O' [/ Q% i8 Q
- #include <linux/mm.h>! N" y Q2 w7 c8 n8 U
- #include <linux/dma-mapping.h>
( R& n! [0 s2 c+ B - 8 c o/ [6 a6 B% u) b
- #include <mach/memory.h>9 |. {. i0 R- j2 ?7 D K9 ?! X
- #include <mach/hardware.h>
% Q [0 V; l9 W1 Z' [ ~; A3 A - #include <mach/irqs.h>
' Y! Y) ?' L3 j3 ^1 c) U2 }7 f1 M Q - #include <asm/hardware/edma.h>' f7 z# o! t' F8 V: R4 w3 P
5 h$ e. z! M, W9 E7 j- R3 a9 ~- #undef EDMA3_DEBUG* g/ R; j6 Q, K( t" _0 O+ ^
- /*#define EDMA3_DEBUG*/
) X1 i" _( C6 H; w. f9 M - X6 u1 j' T+ D! Q9 w% t! ]2 W
- #ifdef EDMA3_DEBUG
3 I. X5 c" V6 u |1 n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 r( W, E* c! b4 \# A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); X* p- P/ P; N7 z& V* U8 L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 Q3 D) j9 f2 S, o8 `# b; a+ ]" ]
- #else$ }+ F7 ~. R) Z( C) E2 V8 H
- #define DMA_PRINTK( x... )
8 ?# G+ a( h9 j" H- P - #define DMA_FN_IN2 g* P# g3 ?: G+ }2 I; E2 m
- #define DMA_FN_OUT7 [, I7 e( A- k
- #endif& I# @# g% `2 V2 N
9 C0 L. Y# t! D5 m2 H- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; a) ?2 J. N, D& z - #define STATIC_SHIFT 3' a& b. n7 E: m7 i! c' {2 L
- #define TCINTEN_SHIFT 206 e% Y9 _2 x6 e0 y9 Z! f* t
- #define ITCINTEN_SHIFT 21
; @, `; i% J3 ]1 t - #define TCCHEN_SHIFT 22
' f- ~4 Z6 A# I @9 E - #define ITCCHEN_SHIFT 23) `' I! e% _) A! O
; Y' g& M" T' r3 S& n" P- static volatile int irqraised1 = 0;' A; S3 {3 ^- {6 y
- static volatile int irqraised2 = 0;
) j% @8 R# Y% {
8 A9 [8 D: i% _# T, t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# P4 {+ V+ r1 W+ y4 T0 s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, m4 r) e: D0 D0 y8 g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 }& Z4 u) c; m# V8 x/ w
- % o& d3 x* \4 L* V5 U* a# O+ w
- dma_addr_t dmaphyssrc1 = 0;
) S) W- K& O& u ?' W1 }0 ? - dma_addr_t dmaphyssrc2 = 0;
; m0 |4 i- q2 n" k0 o% B* x - dma_addr_t dmaphysdest1 = 0;
6 @: [1 d% ?! @$ j7 ^8 T5 i - dma_addr_t dmaphysdest2 = 0;* V5 }) }# G4 n$ o
* d6 _0 Q+ N0 g% x( U$ Y9 E% Z" f- char *dmabufsrc1 = NULL;- I" W7 ^2 _+ O% p
- char *dmabufsrc2 = NULL;8 X2 H5 D$ z' J: b6 v, J/ \
- char *dmabufdest1 = NULL;1 \" j7 h5 H& _0 i/ q1 Y9 f$ D0 _
- char *dmabufdest2 = NULL;3 Y. A/ W) ]% w4 Z }4 S# @& w
4 L, _7 i3 ?+ \- static int acnt = 512;
" U. o2 m: g* S- _. y6 A - static int bcnt = 8;, o9 ~6 S9 i5 E o
- static int ccnt = 8;
% Z1 E$ r0 h9 s- N& n6 x
0 B3 B n/ n" C+ k( y' g- module_param(acnt, int, S_IRUGO);6 w3 a% m: o, O1 b8 P. o/ c
- module_param(bcnt, int, S_IRUGO);4 i% D, }9 I: b) S& g
- module_param(ccnt, int, S_IRUGO);
复制代码
' o3 P K# J, P0 H& t r+ F! h9 T# _8 p, f- \8 o1 A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ e+ K K7 h; j7 V5 Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. x/ _% ~$ N$ s, n$ S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* X. e! v @; o! ?8 V
( i" g6 i6 K, G' n9 q! o# A, W6 c# b- p3 F' e/ W- |$ v3 R1 T
|
|