|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - u$ r5 w1 G, X! f; C$ H1 Q
- [code]EDMA sample test application! x/ f/ Y9 ], o: C6 u- X
- /*& [: _7 Z5 t" B9 W+ r) ]
- * edma_test.c
# j$ V' u6 Y7 u/ p( v G - *5 @, @0 \5 g5 Z( \' ?! N
- * brief EDMA3 Test Application
. j9 ^- `- A" m& U - *8 f( O4 \7 N( Z8 X- [8 H
- * This file contains EDMA3 Test code.# U' J: X: H$ ]# z
- *1 ]3 \/ Y0 d! H2 j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 d$ z- N! a8 W% A* | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ T# T, u! v9 x P! r/ O8 M1 K
- * TO CHANGE.
5 X9 g* A. w7 o+ @+ T. L, R - *# b$ U b) z" h; [) r$ ~$ V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 h" _5 C9 l- S+ U7 d6 {0 f1 I0 W
- *
* _8 a" R0 v) X7 q2 ^) B& S - * This program is free software; you can redistribute it and/or j. i0 j* @, R& Y3 ~
- * modify it under the terms of the GNU General Public License as& D. y9 p! B( v
- * published by the Free Software Foundation version 2.
- F; x, ~/ T3 A) Z, ? p3 [) g, { - *
# j* ]: I8 u! l' K! f+ j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- g3 s5 [( q, j7 K - * kind, whether express or implied; without even the implied warranty
. Y- p I: O X* a9 I, m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; m' i+ B3 h2 E' f; d$ R6 P5 C - * GNU General Public License for more details.
! J3 _4 K5 v, m- m - */
) z9 ?; D: W. I" a/ _
% h2 q, y M# g! d& S' z5 V- #include <linux/module.h>
# e" g, K& O5 e$ E9 c) q3 i! O - #include <linux/init.h>8 }: T9 q+ y4 V
- #include <linux/errno.h>( c: ?/ j# q& j, {& V; {! l
- #include <linux/types.h>
% Q; K+ w. U( \0 K; g3 ~- L8 ` - #include <linux/interrupt.h>
$ f5 j) Y7 t) b" V5 { - #include <asm/io.h>
- i" B& E- D/ g% [/ V. R4 S - #include <linux/moduleparam.h>; F8 c' q* {% ^" n/ i+ x
- #include <linux/sysctl.h>; K& ?# k% G( J9 D
- #include <linux/mm.h>
, }, G) g. N. |" l I8 m( k" K/ z - #include <linux/dma-mapping.h>- I1 U0 b+ c. V1 ~, f8 U' D/ I
( i8 I5 E) ~7 d% O* ?/ ?- b1 b3 ^- #include <mach/memory.h>; _& f3 T/ [5 D2 `! @; B `& @
- #include <mach/hardware.h>! R7 t9 Q7 E4 E! g V
- #include <mach/irqs.h>( n; b V2 o2 X, O! l: O/ r! S6 C9 H
- #include <asm/hardware/edma.h>" C1 w! h0 [6 ~$ [9 D
9 g' b9 O2 R' j6 L" Y5 w. K* ^0 }; h- #undef EDMA3_DEBUG8 I" ?; W& G: e7 S: e
- /*#define EDMA3_DEBUG*/
. b& i; K( |6 v! j& x - & ^7 m/ y& J+ h/ J/ O% m0 L( W* n: B
- #ifdef EDMA3_DEBUG
v$ s- R/ `. q% S9 j. N& d7 F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: t; R% b* x% R- S+ j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! k7 Q$ ^) x& K+ f; @3 U- k s" @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
C/ p# G! u) `, U/ A8 w" E - #else: R( m$ ?1 ~$ l: n( h9 Q; B
- #define DMA_PRINTK( x... )0 A5 \6 `$ q( p& w
- #define DMA_FN_IN
6 k N. L' C; Z9 E, y0 F9 N - #define DMA_FN_OUT. r$ F( l# N G
- #endif
~2 b U# y+ r' v3 n J
4 M& c2 a$ g) H5 b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' N5 o+ l& j' ^& e6 j/ {$ `4 b - #define STATIC_SHIFT 3
, N0 u2 h* r i$ ^8 t3 g - #define TCINTEN_SHIFT 20" V/ ?1 n# c' @2 c& M* `
- #define ITCINTEN_SHIFT 212 f1 Q1 z" e0 A( r
- #define TCCHEN_SHIFT 22
, X3 s" {( Z4 L: Y E; s - #define ITCCHEN_SHIFT 23
* L' D' N. U' u2 U% h7 N
8 y- g" z' Z# `( @6 w- static volatile int irqraised1 = 0;
$ D( L/ m- B2 f' N2 g1 c9 h y - static volatile int irqraised2 = 0;
! e0 @9 m4 \: T& _0 I
/ H* a5 N, H. H* S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' W: @ h7 \$ k- q+ ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); r- |' b) f) y$ U; N0 y- r0 @; O3 C2 a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ r, O& [# C: f: t8 T+ t# h2 Q9 U
- ' I/ v2 a( W1 _5 ^ P/ N
- dma_addr_t dmaphyssrc1 = 0;
) U7 g8 Q! O+ F - dma_addr_t dmaphyssrc2 = 0;
5 J8 D" [" i) u3 e- P+ G - dma_addr_t dmaphysdest1 = 0;4 a: |8 e; h+ _# G5 ^% q
- dma_addr_t dmaphysdest2 = 0;
) V6 k7 m3 v9 s+ X+ _6 M - 6 L- E+ Y! t- C
- char *dmabufsrc1 = NULL;' A7 n2 g+ f/ t/ M$ }
- char *dmabufsrc2 = NULL;4 z: A( E% E" @
- char *dmabufdest1 = NULL;! T$ |. D4 H) z; ]1 m
- char *dmabufdest2 = NULL;
8 H. Y. j( r+ g, |. w$ f+ u
0 s! L* ?7 q! m' v# a1 R6 a; V4 U- static int acnt = 512;( }1 @: X: ?! W2 s. D! m) N) w6 j
- static int bcnt = 8;
4 R( P3 v& _4 v; p6 ]+ Q - static int ccnt = 8;
8 K8 P# D0 u9 X* U
) A- K% A* ?3 W. s8 X; \6 g- module_param(acnt, int, S_IRUGO);
( S: t. k! f7 E: r: a - module_param(bcnt, int, S_IRUGO);" y7 h9 H. x( }0 i
- module_param(ccnt, int, S_IRUGO);
复制代码
/ u t. i; {! @$ T& m* ]; ]% Z1 E& B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" _ d. ?& ? k$ U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 J6 q+ i/ L' a% v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* `- O( d" P+ b( e0 _# j0 z$ N7 I5 P$ F, j$ R% p
+ r7 o m% h5 ~/ d0 F |
|