|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: K$ I) M$ ]: ?- [code]EDMA sample test application; H, x1 b' t% R% n% o ^4 [
- /*
$ \0 M# K8 u; [% `* v0 | - * edma_test.c( c3 b& @" c8 a0 H5 n8 }! V
- *
2 a# e3 ^( d0 R M8 E7 B - * brief EDMA3 Test Application4 [- c3 L- ~: Z1 r
- *
6 w: p' C; C( w& U, W5 E" } - * This file contains EDMA3 Test code.9 e( e5 |$ E- r: E5 J3 P
- *
; n( ^% l) q7 v% x7 M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& j/ K! a4 w6 S6 S3 x# H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ @+ V9 l' J- x! X* b0 i
- * TO CHANGE.% Z( R2 }( I* S
- *4 n+ ]+ q4 @$ p- z/ n8 o: S& D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; P3 i% ^" Q! G! [
- *
, G5 \9 `/ a# u( W8 o" q - * This program is free software; you can redistribute it and/or% I x Q4 b; ~5 h% i+ G
- * modify it under the terms of the GNU General Public License as9 [7 i: c H j# R- ]
- * published by the Free Software Foundation version 2.
) C, a# X1 z" n3 |# H* v - *
) Z* r. W0 P& `' @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 G/ E1 ]2 H6 X% N* f - * kind, whether express or implied; without even the implied warranty
; |" W* B, K0 F; Y/ B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* V5 Z% A0 D" v- b
- * GNU General Public License for more details.1 e5 e& q# O3 u: L/ e. ?# _* p' Z
- */+ t& }1 K3 u: I$ b( ^
- 2 y: m! Q( L) h8 K3 l
- #include <linux/module.h>
* r& e" `& n7 C, U. G- \; r* Q9 E - #include <linux/init.h> M' j* Q: ]0 p+ v! v+ [2 i
- #include <linux/errno.h>; l" T0 V7 A1 U* N
- #include <linux/types.h>( z1 y; y3 J7 O
- #include <linux/interrupt.h>4 c- P( n# M* e+ s
- #include <asm/io.h>
8 W+ ~) p) K8 a% @* ^: o - #include <linux/moduleparam.h>) [6 p% j& C# K" O1 e8 n8 Q- |0 ^
- #include <linux/sysctl.h>
# z3 \+ A1 {0 l# \1 d* a4 c - #include <linux/mm.h>, q+ C) [4 B0 ]+ x n% s
- #include <linux/dma-mapping.h>
* w( S% T! m& K6 Y9 [4 k# L - 8 f3 G2 ^8 N7 q& S" u7 O
- #include <mach/memory.h>
6 H+ G4 s: O6 P( o - #include <mach/hardware.h>" N- @" W- A$ i
- #include <mach/irqs.h>9 [3 L) L) |, h& X; {& h
- #include <asm/hardware/edma.h>3 l4 P) }& s" \3 x5 ?3 V p% {' r; q3 }
- % F9 c4 ^* X- \& ~ H) k1 t" q# V
- #undef EDMA3_DEBUG) q( R2 V( [ F- X$ J. z
- /*#define EDMA3_DEBUG*/9 ]* g. G& Z( d* _8 x4 m8 o& \* k
- 8 x& f1 e7 y, L2 M0 y
- #ifdef EDMA3_DEBUG
) V0 t5 q' b( S, @ Q# c) S* G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 I# `+ [. _- C% {! e/ {4 R% b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 D2 h5 L6 c, E& X( Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. b! h6 e; f( t" z1 C0 e8 k - #else3 ^3 m0 Z: I# y/ c! T6 H g( i+ x
- #define DMA_PRINTK( x... )
. s! W) Z1 [9 c) A - #define DMA_FN_IN
$ X+ ^' U& S% m - #define DMA_FN_OUT
0 n& K& u/ O G/ c; f - #endif' c9 X* g( l1 T! D* P( D' W; M1 Q4 m
, `/ R4 b6 K: d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% {/ z3 m& }$ I1 q0 h2 \ - #define STATIC_SHIFT 3
1 q; _3 E; S2 A: G( b) G/ N* j - #define TCINTEN_SHIFT 20
) Q" F* M# F) ~: x4 A5 g5 j - #define ITCINTEN_SHIFT 21
! }2 t4 G3 e. O( | - #define TCCHEN_SHIFT 22' k& C3 p$ F$ U1 n
- #define ITCCHEN_SHIFT 23
, `: M5 v, R$ {* i( m9 D - : v7 u6 S5 T/ c5 u
- static volatile int irqraised1 = 0;+ G2 [! p# M+ Y7 n
- static volatile int irqraised2 = 0;' ~& @. D! g9 @4 e! J* B7 w0 ] U3 W
9 k }0 B3 {# A3 \: ^+ Q* B2 Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, y1 h3 e( o. _+ P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! T+ ]& q8 K# V$ x) n5 j' r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 V" J) s% T" R& `6 S$ W4 l& i) ]% R! o - 3 N2 Q) p; y9 W G6 T
- dma_addr_t dmaphyssrc1 = 0;( K: c9 P8 {7 R, h
- dma_addr_t dmaphyssrc2 = 0;4 Q7 Z4 G7 o" x1 y: j3 |
- dma_addr_t dmaphysdest1 = 0;2 f9 J) W; J0 L6 }2 O' B
- dma_addr_t dmaphysdest2 = 0;
, B4 z: g3 z2 ~# ]: J3 V% Z" |0 }! C
' K% ~+ V3 r/ I, ]- char *dmabufsrc1 = NULL;
5 W$ R* _4 h+ _8 \) E8 Q. h! ` - char *dmabufsrc2 = NULL;
K# ?4 W: h0 d p - char *dmabufdest1 = NULL;7 n/ x' Y) D+ F7 M
- char *dmabufdest2 = NULL;
3 v& u$ f! v2 {. y/ }4 X9 f
' c6 \& Q% c- w- static int acnt = 512;, \1 s3 K+ E9 W2 B2 K* Z# M O
- static int bcnt = 8;: L; q9 \ V+ S& y/ \
- static int ccnt = 8;; ~$ Z9 t9 Q# B8 W+ ?, E8 z
- + l$ o! |" {1 [8 f
- module_param(acnt, int, S_IRUGO); g+ E2 u- ]3 u. N B
- module_param(bcnt, int, S_IRUGO);
, x' A# R3 M3 F* _- { - module_param(ccnt, int, S_IRUGO);
复制代码 _& R6 v( d; H% I
3 H. {6 M" u$ `/ i8 T& B- [8 r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" R" t, |8 H: t# S! P4 w3 Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 j c- t+ Q- f* d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ _/ `$ F0 t6 g% G Q' M: w3 B6 G+ t4 H/ S/ p8 C
+ K; H/ \3 {* p3 n+ T. w |
|