|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 w+ E$ v9 j# c7 ]: W9 X; m/ ^
- [code]EDMA sample test application& _% ]) X, _* P6 X4 Z6 R( A
- /*
7 ~1 F- @/ h A, P M- E# \: w - * edma_test.c
6 z! z6 P; V$ ~; i5 y - *
$ m0 {) H: z3 d1 x& S9 A - * brief EDMA3 Test Application2 x5 L. ?, f* i% F& j" v' c- U
- *
8 [/ {" V6 |- q - * This file contains EDMA3 Test code.
2 M; o' B6 F3 R8 ?& G" F - *
% ?" _2 ?. i! I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 z o- w( g; a! y. g3 | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* M& X' i; O, ^! B5 o0 A, t - * TO CHANGE.! A! l$ {! r: y: K6 d
- *7 v9 n" t# m- B1 {3 C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! f0 |; v$ k3 f% X6 c- L - *0 b4 y7 [# p( C3 k# g. Y! H
- * This program is free software; you can redistribute it and/or
% v% r2 \# I& w" x - * modify it under the terms of the GNU General Public License as
$ Q$ I' e- }9 ~. E8 F - * published by the Free Software Foundation version 2.
2 t( _1 a }' p: X+ t - *
6 x6 X$ S6 S. z$ | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, z( Q7 K, V6 B( H1 O& J
- * kind, whether express or implied; without even the implied warranty
+ {2 ~# k1 T0 r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# D; c& Q9 `! U - * GNU General Public License for more details.
6 j- K) d6 b- j$ U( ~; q, o - */' e g# W2 M3 e: _+ y6 Q0 ]
9 m* Z; p) j9 g2 p- #include <linux/module.h>
3 r( S/ _3 K$ L2 q - #include <linux/init.h>* |7 i; z# t; O* H- B: A h D
- #include <linux/errno.h>& b: x' E& p4 y' c& G
- #include <linux/types.h>" A" D6 T0 b: o
- #include <linux/interrupt.h>
0 L) j9 y3 S+ n5 g - #include <asm/io.h>
" q0 }- g" |+ ]! z' T' o - #include <linux/moduleparam.h>2 H+ e4 F( J/ G: b0 u/ F
- #include <linux/sysctl.h>2 |6 v' x/ C( \
- #include <linux/mm.h>. y9 i1 W+ X B" }
- #include <linux/dma-mapping.h>
! b# V: l, I$ ?0 n! m; ?6 ]! b - 3 ^; I% N/ p0 r; G5 p* U
- #include <mach/memory.h>. {, D( w( J% x
- #include <mach/hardware.h>& \. s, `7 A" M! G
- #include <mach/irqs.h>8 B7 z) Z: ^9 x7 f0 E
- #include <asm/hardware/edma.h># c1 O" \7 G+ C& B
- 8 d$ E+ p' O/ T/ T- G. {6 n4 N
- #undef EDMA3_DEBUG
& U5 {4 X8 P% q, j# H& [ - /*#define EDMA3_DEBUG*/
( Z# V2 g% G$ s9 y6 [9 z& N/ g' y
4 S. \ Y5 ~# l) m& D$ Q( s- #ifdef EDMA3_DEBUG2 K# @- V9 t8 L% ^' U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 Q) B. [0 t, |4 ~4 I" Q8 u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- t: b" K; U+ i5 Q, L8 R' e$ g# d9 j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 w: ^, y4 y9 l% M- u: \; R; D
- #else
6 Q/ `: u; |" C5 E - #define DMA_PRINTK( x... )
* R- b7 o; u8 c& |! L - #define DMA_FN_IN
3 }/ }' `$ z2 g+ V) Q3 G k- r - #define DMA_FN_OUT
( Y! J6 _& W% V$ C$ R" b - #endif& |) v c9 F8 \$ `1 q8 }' N" j
- 9 w" J" I G9 x. P j2 [* A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) v8 h6 K0 ]8 m - #define STATIC_SHIFT 3
) E4 V$ o% E8 C) ^! T: ] - #define TCINTEN_SHIFT 205 h) L7 H# }8 I5 L
- #define ITCINTEN_SHIFT 21
0 c& K% w" y; A3 P% n1 @( J - #define TCCHEN_SHIFT 224 Q9 H2 ]2 x, A8 R2 C, g, l
- #define ITCCHEN_SHIFT 23
6 W1 V h5 J% `, ~* h; Q
P! y/ B! D" k- static volatile int irqraised1 = 0;
8 A5 p2 C! c. v, d- F - static volatile int irqraised2 = 0;, D1 j: ]* O) y) ]3 Q
4 [* y; m3 T0 c- N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 t6 H5 S* v. ]4 P6 v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" U1 E6 @) g5 c- q* }' U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: b6 q! k- P$ M) m# @3 z- u1 w
, Z* g' i/ g6 F- E3 c6 Y0 D- dma_addr_t dmaphyssrc1 = 0;! R5 h3 O" [/ G; X
- dma_addr_t dmaphyssrc2 = 0;
5 Q5 |/ e5 p7 }0 C9 Z3 s0 D7 ? - dma_addr_t dmaphysdest1 = 0;0 P% _* J8 u" \4 a, p
- dma_addr_t dmaphysdest2 = 0;
" E) Y1 V6 X; I O0 J5 a) g+ q4 L - j) ~' p& y/ B9 h
- char *dmabufsrc1 = NULL;8 a) J; C* v0 b u
- char *dmabufsrc2 = NULL;
2 H* g6 o* Y( \6 L* k$ H$ u' p v - char *dmabufdest1 = NULL;
5 x* h: t( A1 n- b; E* X/ B; R - char *dmabufdest2 = NULL;8 j' `( k* t( O
C& I$ G' t9 I3 X$ ]- static int acnt = 512;
$ ?& Z/ ?4 C! S$ \' ` - static int bcnt = 8;) S! n8 o) z% h& ^$ B
- static int ccnt = 8;$ ?$ N4 R6 Z& M& B3 f
9 K3 b3 s# c x4 m) Z9 F; \- module_param(acnt, int, S_IRUGO);
' p$ N% {; a8 q4 H2 v6 a8 @ - module_param(bcnt, int, S_IRUGO);
7 ^( x# ]! P' Q. w" \* j - module_param(ccnt, int, S_IRUGO);
复制代码 % E+ t$ S/ E7 Q" i ]
7 A7 W1 y r* M C2 X4 U l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 L" F. n- t% F4 A) g% `2 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ s) U3 p/ @; \: L+ C) d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" @( _9 r- q9 ?7 H0 y7 k% Q
9 J+ o3 v7 Q. p5 |6 H) P3 l
; v* {* H& a# l0 y
|
|