|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 _: T& g3 v) F. E E; O$ w) \% b
- [code]EDMA sample test application( P6 ^. \* n6 h. R7 ^
- /*2 I5 \% e! U ]) k
- * edma_test.c
( D0 C3 e% |$ }' T0 r5 ^ - *
5 J- O: G$ k- d' C3 \ - * brief EDMA3 Test Application
8 l4 O9 O8 c/ N - *1 X( ` ?' ]5 b/ Q }
- * This file contains EDMA3 Test code.; M/ N0 q3 Y! s2 T7 A+ Y
- *9 F4 u3 n8 r* e9 h: [" a# J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 s0 M8 ?& J/ z0 { \ J/ m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' @' n: a: c1 q0 z, c - * TO CHANGE.
( v4 Z& h& M) p. Q - *( \" l& i3 {- A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" a( E$ p' y* _7 @* A - *
7 Q5 v) a" M4 ^% L5 G! [5 W - * This program is free software; you can redistribute it and/or
$ A R8 e3 u0 x( I# @" s; K" ^1 P& l - * modify it under the terms of the GNU General Public License as' U! Z7 o2 ~6 V! B) Y+ K: @
- * published by the Free Software Foundation version 2.
: ^ H( d L: e" x+ H - *
" L/ G2 p" e. C( X6 } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 j# u4 B8 B. O4 B: Y8 l! d+ {
- * kind, whether express or implied; without even the implied warranty
, l; g& E! X. A$ y3 W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the F+ D4 z8 _$ q* u, U
- * GNU General Public License for more details.; V- [- ^6 ?3 T
- */0 K+ Y+ F/ h& R
- 7 Y) H9 V3 Z3 A" F, T
- #include <linux/module.h>3 I# P; M/ L- [7 z0 N! q$ w9 u
- #include <linux/init.h>$ _- Q& a! |8 m( m3 b; D
- #include <linux/errno.h>
} ~! G/ B7 K8 i5 s - #include <linux/types.h>
8 d& c6 I t U# }1 A5 C - #include <linux/interrupt.h>
. }/ e; e, R% z' S, u m, \. U/ G) G - #include <asm/io.h>
# B6 a# [5 Q' Q9 o! J$ ~" _2 ] - #include <linux/moduleparam.h>
# i* K! j1 J F s8 @ - #include <linux/sysctl.h>3 v j. ]4 j: Q$ ?, l; u! i! j
- #include <linux/mm.h>
, v* j" H+ ?1 U7 W/ N& d - #include <linux/dma-mapping.h>0 ?" ]5 [5 V9 _$ p; @) @ }/ i
C1 A2 {: j$ f f% {+ `- #include <mach/memory.h>
' i1 V, M2 q; C& s/ \4 c( L - #include <mach/hardware.h>) R- U: D* _8 r# V: W
- #include <mach/irqs.h>/ p& J" G* q. q2 k; b
- #include <asm/hardware/edma.h>
2 C* ?" F: y0 G' x - # ?) x' ]; e3 }' r4 ^
- #undef EDMA3_DEBUG
& b+ R/ y% o. E - /*#define EDMA3_DEBUG*/9 u8 R2 k; z" z7 }. v2 l% S
- : V+ I6 u3 H# j! y! F
- #ifdef EDMA3_DEBUG) D! y$ ^ l; F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 E {/ C# K+ F' h/ x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 w; ?7 |. o% B0 o7 \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& h, e: L1 \4 z7 @
- #else8 g8 G7 y- i i2 {/ ?' [# C+ R3 ^
- #define DMA_PRINTK( x... )
, @. C F9 D& p# n% R& \ - #define DMA_FN_IN
# a: `) _1 o( x - #define DMA_FN_OUT9 ^3 @+ r8 |3 @# r
- #endif
2 W* H C. L |6 o5 I4 { - . b- X+ q/ Q4 A: _) q$ Y+ M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, F' ^- B& B" z - #define STATIC_SHIFT 3
& M4 H v9 y; }8 Q1 Z+ i- F - #define TCINTEN_SHIFT 203 f3 q9 D! b7 b9 N
- #define ITCINTEN_SHIFT 216 K8 V6 d a/ P3 I
- #define TCCHEN_SHIFT 22
3 d3 @# @1 N4 V" ^* D' h - #define ITCCHEN_SHIFT 23, F) ~ c! X8 `9 |
- 9 A1 ?0 L' K. c
- static volatile int irqraised1 = 0;
5 E$ I' x* ^5 _+ F" ^/ l0 N0 } - static volatile int irqraised2 = 0;
% P( Y4 T; B7 h! o. k, F - 1 W! N/ O7 Z$ J( V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; Y2 x( D" m" G+ t& L4 d% ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ U0 a. \. P( A- C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, u. E! R" S; [; P- s
- 1 |6 `. o0 d) f" e
- dma_addr_t dmaphyssrc1 = 0;
u- I2 h! D9 U% H% v- Y8 E - dma_addr_t dmaphyssrc2 = 0;
& w3 y3 o' _9 Z b) s0 j* H0 S - dma_addr_t dmaphysdest1 = 0;
$ a" u0 t, A: H: Y& ~4 S# M! k, [" @ - dma_addr_t dmaphysdest2 = 0;/ H0 E2 o% r* w
- H0 S2 V8 _" ?0 [4 a
- char *dmabufsrc1 = NULL;
$ Y2 C7 H2 p! ~/ Z0 B3 x4 |* P - char *dmabufsrc2 = NULL;
. V3 M" Q G4 w- U* @" G - char *dmabufdest1 = NULL;
! ]) B" ]5 y+ a& U' s - char *dmabufdest2 = NULL;
- t- a* [2 O' {. d+ c |- u
: Q' s7 c) o$ p) Z9 N% t( ]- static int acnt = 512;
+ `* _* Y) B( _" ^; }* ` - static int bcnt = 8;
8 Q2 ]' v# S5 x5 h - static int ccnt = 8;3 U) Q" J" h! ?0 u# f1 H) u+ i
6 F6 N5 U6 C' `0 }, F- module_param(acnt, int, S_IRUGO);2 z: F% l6 M! u: F
- module_param(bcnt, int, S_IRUGO);) p$ K! p1 E$ \# A+ x8 G1 K: V
- module_param(ccnt, int, S_IRUGO);
复制代码 5 `# k; G6 R) N
, u" M' A9 F3 V/ S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 p/ P: [2 ?9 e/ @( V- Z. t% b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, t; J3 Y: Y0 V/ s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 u" K$ |9 h/ D0 E9 Y; ^# U& {* N p+ _& t' c) M$ l+ J
4 e$ H$ H3 W7 O/ f |
|