|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & q$ u7 t* [/ V& [# q
- [code]EDMA sample test application
9 a! W9 y) w0 y U - /*3 @- j* `8 u! |* h& W
- * edma_test.c
4 n" i# g: w1 Y3 a' e - *
6 F; }5 b( y% p6 P - * brief EDMA3 Test Application
+ y! X( d( A; A - *
* V9 p x0 F" |/ O5 w& K- ^. b7 Z* l - * This file contains EDMA3 Test code.
1 F4 L/ s7 J+ C Z - *9 p1 J, T7 r0 ?: o. B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ B, P9 F; q; ~" W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" A8 q5 r& B9 N/ p% ?
- * TO CHANGE.
: T& t# O/ }: _! z/ j5 d! B$ {6 u! ? - *
- C, L# S0 @& w8 m" M0 y' { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: N" Y3 L) V# S1 {/ M5 B
- *
! {: Z, ?$ P' m: L5 u - * This program is free software; you can redistribute it and/or
0 L. u) C, v. r: |9 w - * modify it under the terms of the GNU General Public License as; T$ Z) o) ]* X/ `2 ^6 {0 S+ ?
- * published by the Free Software Foundation version 2.
4 J& K) M a4 p; C/ [3 M! s - *+ Q% {0 A% `" b/ k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ D4 N0 s- {' O8 I
- * kind, whether express or implied; without even the implied warranty
\' [8 [( h/ e" A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 ?7 J4 r7 h: n* ] - * GNU General Public License for more details.
! u/ ?5 C( _9 W2 K/ P3 I - */
& Y5 p/ p' z+ d- o2 o( l4 w
& x6 |0 A& v& S4 I- #include <linux/module.h>
8 @0 N2 D) }7 O$ ~ - #include <linux/init.h>
, b0 G, ^ G+ n5 S. X$ c - #include <linux/errno.h>
1 F( }# s$ Z) h - #include <linux/types.h>
; u, I: |" J* e - #include <linux/interrupt.h>
5 ]( X9 s' D N* ` - #include <asm/io.h>5 }6 f3 v6 `, G! R6 \5 n& z
- #include <linux/moduleparam.h>1 ~' n* N9 A% I3 ~
- #include <linux/sysctl.h>; _3 t1 H ]1 ~
- #include <linux/mm.h>
6 n! }# j3 R2 m2 S0 H Y: Q, W - #include <linux/dma-mapping.h>! S" D2 S1 @; l' y
- ' |3 A; J) \2 m
- #include <mach/memory.h>
( o1 k8 X# i% b. ^" e( I - #include <mach/hardware.h>
3 |$ Z9 C( Z, [0 F4 \! i* d - #include <mach/irqs.h>/ |$ j! u7 o: \" F$ H
- #include <asm/hardware/edma.h># r3 k6 N M5 B) Y9 ?
% m( {5 g7 k* ~+ k, _# U0 C- i! C- #undef EDMA3_DEBUG
# a; ~& `, k# F+ _( W, y - /*#define EDMA3_DEBUG*/
, O( U# R8 I% @! Z0 b - 5 {$ T3 g0 B# k/ E
- #ifdef EDMA3_DEBUG8 N! p9 y" I, y4 ^) \# |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ p' |% @6 [$ S9 w) A h5 W/ g* T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 @+ M3 G. W* g- X& H; F, x' a# h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ \7 m! O! v" x
- #else) h4 O$ z& a [
- #define DMA_PRINTK( x... )
5 c; l( P1 Q( Y8 V, C - #define DMA_FN_IN1 j$ U4 I, }! }& ~9 J5 z
- #define DMA_FN_OUT
! ^. Q" D% }9 d6 a f - #endif: h% P; W4 y0 j( S6 \
7 W6 w+ e. A+ n( e; ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' p) \0 Q7 f! E9 O
- #define STATIC_SHIFT 3
2 N: G8 [. y. w: R# s( ], a! b - #define TCINTEN_SHIFT 20! j/ _1 |+ t5 Y
- #define ITCINTEN_SHIFT 21
( J" Q: G, H" Z* _; Z% ]/ X - #define TCCHEN_SHIFT 22+ j- N; C* y; ]6 Q2 _/ Z+ A2 p/ _
- #define ITCCHEN_SHIFT 23
9 l, y0 H* k/ L* v
^5 ~) _: F0 N! h- static volatile int irqraised1 = 0;
& x' ?' z4 F6 R* N1 U+ Q6 J - static volatile int irqraised2 = 0;, ~$ D e6 J. i& J, \1 U8 e
; |5 I, C$ t" @$ S6 u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- X$ L H* c( \3 C6 m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 w0 [% J6 t2 E5 _ }( \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, C/ C( i5 C; K$ L' m
x' l& @4 |, Z! r' R6 ?- dma_addr_t dmaphyssrc1 = 0;6 K2 f0 Y$ W' \8 e+ M: ~* [
- dma_addr_t dmaphyssrc2 = 0;
" @# i; ~) f4 I' S$ W+ b/ D - dma_addr_t dmaphysdest1 = 0;' c* S" H; d. |1 f$ v6 v$ i N
- dma_addr_t dmaphysdest2 = 0;
! ~/ N( C* J3 m3 b! o2 Q
/ B7 ~4 ^5 C. _, |: N% g- char *dmabufsrc1 = NULL;4 ~1 j& U! S, g" X7 ~
- char *dmabufsrc2 = NULL;
& |! T; { g4 A% g% S) d - char *dmabufdest1 = NULL;+ @" l' y* m; v D, k; Q
- char *dmabufdest2 = NULL;. b$ c) o4 p |
- ' s# ^; G, c$ z
- static int acnt = 512;8 Z3 D" a1 j4 C0 S7 N" R( e5 s# v
- static int bcnt = 8;, o4 N! c4 D7 {8 w* h) `8 J d
- static int ccnt = 8;
# [$ R* d. @. l% ?+ J - / c# J5 x+ n; ?) h
- module_param(acnt, int, S_IRUGO);
2 ]; X3 L( w3 f v4 {% |! c# p - module_param(bcnt, int, S_IRUGO);
$ ?8 D$ @. Y' s9 a - module_param(ccnt, int, S_IRUGO);
复制代码 w$ m* y% q9 q* u, W; {
4 j9 h3 j7 \, M% A/ v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 u# c7 B) x' _- y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ v: k1 j0 K/ Z- p8 r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 c9 t$ Y$ X2 K( D; w# z+ w
3 U& c8 l+ y, [
$ Q$ A3 O e: j1 ~& g$ F g: ^* K
|
|