|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% m1 b* N' F' k" Y- x- [code]EDMA sample test application
1 v6 J: }0 k% k - /*7 P+ M/ J0 e) @8 y) A. x
- * edma_test.c& H5 M, K$ S9 X O8 `5 q4 s
- *
4 m2 @7 o1 Y3 W - * brief EDMA3 Test Application
. o/ \' j2 x9 c' h; p! F+ e - *
a$ A' T4 Z7 l/ A+ ~+ g - * This file contains EDMA3 Test code.
5 y+ E9 b1 C! h4 d - *0 j9 W5 V5 G* P2 P4 M% Q2 o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# U1 K: a& V& Y, _! U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ X0 _4 F# p$ y - * TO CHANGE.) {& c3 Z2 S$ J( D6 `
- *7 i+ B, J# O( L- c& H% f4 V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 m: n& u6 p# _* z/ ~0 U - *5 K q4 M m4 p% x
- * This program is free software; you can redistribute it and/or
$ l* O0 Q% W' s - * modify it under the terms of the GNU General Public License as" C2 a% W5 W1 M' B5 Q
- * published by the Free Software Foundation version 2.
: `/ S* ]! g$ A3 {8 \ - *
- A6 d! ~# \3 ]. }' z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' D2 n2 x! R% V: T. {+ O0 h6 h* K4 P - * kind, whether express or implied; without even the implied warranty
) i' H8 O: T8 H( v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; }: d* S7 X! c4 ^; }: A6 c( d - * GNU General Public License for more details.
: }- j6 g% \! ]# W& R$ Y7 O) A0 \ - */; ^( I5 P. \/ s7 l, O
0 b* A- n) p9 `3 n$ {' K5 M' U$ }- #include <linux/module.h>$ U( z! y3 f2 D
- #include <linux/init.h>
3 r# R. E$ w" |5 h' ^* p6 c - #include <linux/errno.h>& s6 l. Y& N* e% j. N+ d- |
- #include <linux/types.h>
' c1 c, a& i. h& n" ~+ i6 @ - #include <linux/interrupt.h> c6 |: w4 L7 x/ i. Z
- #include <asm/io.h>4 x* I3 B. n) ]3 [! ~- s& [
- #include <linux/moduleparam.h>
* }) f6 w, m/ R" m3 t/ h - #include <linux/sysctl.h>9 r* h! D% d. m* w
- #include <linux/mm.h>
0 q) \ b9 x! D: M" f* e - #include <linux/dma-mapping.h>% A; V' [. G+ p6 R7 c0 g3 `8 |
- ! m1 b( R. O% ?% H9 B: h9 R
- #include <mach/memory.h>: J% v1 H" S5 M; E2 D$ D6 E. ?
- #include <mach/hardware.h>
2 |# H# U4 j1 M" P* [ I, M1 g - #include <mach/irqs.h>
6 j; y$ Z8 l: @. t' b% I& \" E' w, T - #include <asm/hardware/edma.h>8 r* G. Z- l# ~$ c& L7 w
- % P$ m" Z" r% q7 B1 F
- #undef EDMA3_DEBUG
( P% ?! z( x ~# I3 R2 G2 }* \8 T - /*#define EDMA3_DEBUG*/# |9 h! p1 J; K, w ~ R
- / X# E9 g5 g+ T3 H7 a
- #ifdef EDMA3_DEBUG
) q1 A6 O4 W4 s$ z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), S9 i* W2 J7 h7 z2 S! p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% q8 W! ^' B3 k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" p& n* d; K6 _. A! ~" ]
- #else
x+ ?) p6 E1 E6 I3 {+ o - #define DMA_PRINTK( x... )
1 N1 D! o6 k0 U/ A" C% n - #define DMA_FN_IN
' u" F h) q" Z7 ]4 g1 q/ V - #define DMA_FN_OUT
6 m' ~; n6 j$ ] - #endif
, }* g1 e" K0 U3 v U. a
2 a& R4 ~3 ]$ L# X8 f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 Z, D7 m; V$ ]3 E
- #define STATIC_SHIFT 3* U4 l" B. I9 ~8 \# d
- #define TCINTEN_SHIFT 20: [1 [. G, C" f; U$ F4 Q
- #define ITCINTEN_SHIFT 21
" N4 o/ I" r$ {( I - #define TCCHEN_SHIFT 22: j6 {4 `3 d8 ~7 Y7 M& d
- #define ITCCHEN_SHIFT 23
. d4 U6 |8 ]) A - 2 I2 Y: {- r) y c' u9 \4 |
- static volatile int irqraised1 = 0;
. @' A( M8 @4 T6 @. g - static volatile int irqraised2 = 0;2 Q4 H7 A @+ w5 R p% T+ |- K5 @/ l
: I! a* |# M0 d* g* y, p, P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ G5 D, c8 h9 z& W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# ~# ]* n. ~. _+ p& ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! E0 y/ @2 I ]; }. W
- 6 {8 D' z7 Z; c# L- G0 R
- dma_addr_t dmaphyssrc1 = 0;
" i9 Y2 J1 [$ X$ Q* z - dma_addr_t dmaphyssrc2 = 0;- S/ N: l, }: v* f" Z
- dma_addr_t dmaphysdest1 = 0;
; G1 R: v# u" z! C3 ~2 U - dma_addr_t dmaphysdest2 = 0;1 \2 T b) S9 r- p2 l
- 3 m5 g4 |; t+ l0 ]. Z
- char *dmabufsrc1 = NULL;7 \: A" i1 F: d. Z
- char *dmabufsrc2 = NULL;
* P! N' P M! ~) c% e( L: T9 x - char *dmabufdest1 = NULL;
: B. q- ]) {" |6 f- r$ w - char *dmabufdest2 = NULL;% h1 \0 w8 j8 ~, m+ {* j
- 1 P& Q, O+ t" F0 A' V) i6 S) `
- static int acnt = 512;. r( ]- y/ i7 o0 I+ E6 F
- static int bcnt = 8;
# T2 m) f6 a( o - static int ccnt = 8;! g& [% l' s- z
( D$ m( _; C9 e$ L% Q7 q) T- module_param(acnt, int, S_IRUGO);
6 N1 [7 e d7 u8 e2 k - module_param(bcnt, int, S_IRUGO);
! R2 i& |: g. ^ - module_param(ccnt, int, S_IRUGO);
复制代码
7 \7 d2 U$ @4 v* a; X4 D z1 z" o. Y3 K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 N, m$ N1 i4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& `: x. [0 I& @1 K
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& M' y- d4 X0 x" e7 |- [+ g
) t% d: b$ S/ d9 z
& U8 w, A/ H _! N2 j3 Y, c; o4 Y+ H, u |
|