|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( O: @# T" x; p) l5 y8 `5 {- [code]EDMA sample test application: X; y7 s! F$ Q# n' }' {( {9 ?
- /*
. P* }" R' n6 F) g% V* o4 ~ - * edma_test.c6 }. v' z. e2 V/ Z4 V+ A+ r) ]- e
- *
+ G- E5 M4 W( ~. X. Q" P ^ - * brief EDMA3 Test Application5 W, [- O8 m: B" e
- *( @, J, Y7 Q/ E. H; N' e
- * This file contains EDMA3 Test code.+ n3 Y t. u1 s- Z4 ~
- ** O1 o& w- ?- b g) |3 h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 H/ Z0 Z6 `/ X3 b+ n [* H/ X* R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ Q, P2 T: A* j- S+ t" ~9 P* t
- * TO CHANGE.
0 i% `: U6 K8 M5 p/ ] P$ s - *% W3 o; w. `) r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 [$ T4 U+ Y3 n" A. d - *
) H5 S% K9 n% R/ j5 A - * This program is free software; you can redistribute it and/or4 Q1 ?4 q% P9 t: H! \& x: I
- * modify it under the terms of the GNU General Public License as6 I ~/ U& X- c
- * published by the Free Software Foundation version 2.6 f3 m) ?$ L- N
- *
) x, o- C( ~1 h; q/ @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: W/ q3 {- n/ S0 Y7 J - * kind, whether express or implied; without even the implied warranty4 r' N( |8 L, \; I0 u$ S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ z! k6 |. q* h - * GNU General Public License for more details.. ?2 r3 }6 O) C$ p. A
- */& J5 L5 Q1 K, v, F/ M5 M" N" r
" E# W4 ~3 L1 j: r- #include <linux/module.h>
% W- T8 `& {$ ]5 x9 h6 ] - #include <linux/init.h>
; g3 U* K( p; G6 q6 R7 R - #include <linux/errno.h>
3 z( X$ A8 g, h( Z! X- z - #include <linux/types.h>
) s' z; F, K+ Q- b* [3 p, T - #include <linux/interrupt.h>" x' a9 ]# f0 `
- #include <asm/io.h>
+ ~/ D R2 H4 s U - #include <linux/moduleparam.h>
" G9 Z9 O; a$ p/ ]8 `9 I" r - #include <linux/sysctl.h>
9 U" S, q' v$ k4 j3 `% x - #include <linux/mm.h>+ [/ Z X: L; Y
- #include <linux/dma-mapping.h>- ?" u' O& g D5 {
" E4 u4 y1 x8 B3 F, a* @0 H0 I- #include <mach/memory.h>2 P! D1 X% u$ o% F( N8 ]! D; V
- #include <mach/hardware.h>9 V* |) _6 I, v# }/ d0 ^5 y/ R3 r
- #include <mach/irqs.h>" M& x0 D4 ?: N( ^0 ]- B6 T- `, \# C
- #include <asm/hardware/edma.h>1 u; J. `" M* U! S
/ p+ ~2 j# P- u; a6 o- #undef EDMA3_DEBUG; r+ h8 M% G0 u" {' ^3 R
- /*#define EDMA3_DEBUG*/
7 Y$ z9 L9 Z# x/ b - k+ B; `9 _9 u# A6 B
- #ifdef EDMA3_DEBUG# q% h: M! s7 U% J4 W; V: K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 ^% \" A1 ?" W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 Y9 m& N& k. l/ [6 d; l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 h v: L& g, B/ Y7 c+ |, i
- #else* U9 p4 R! w- S
- #define DMA_PRINTK( x... )
7 m0 i( e+ W d+ e - #define DMA_FN_IN
* B4 ^8 ~' Q6 H5 R5 \0 d - #define DMA_FN_OUT
7 n9 I/ ^8 T7 @* E) ~, u8 j/ ` - #endif
! y5 T- h) p$ i0 g& H; c0 {6 } d+ a
7 L3 `& P1 w- w% ^0 H, X( o' E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ d j+ l( T7 o& r - #define STATIC_SHIFT 3* }+ l. P0 X# o2 J: }8 t) v
- #define TCINTEN_SHIFT 20( ?8 Z8 l4 o1 R/ l
- #define ITCINTEN_SHIFT 215 O* u& ~0 m" W5 _) r& F
- #define TCCHEN_SHIFT 22
) \5 V# V+ Y# E$ k4 y- V5 f9 N - #define ITCCHEN_SHIFT 23% ^* Q. E3 G w
# ~" b) C! V2 U3 k; Y5 W- static volatile int irqraised1 = 0; U# a# G/ q1 ^- X' D
- static volatile int irqraised2 = 0;
* t8 R- h" x' W5 w; Q& s6 x
; v" `6 G( F* a4 z7 S7 @% }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; O7 n4 `! I/ i) I; t2 b8 A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& l2 V4 m B$ F3 T0 W1 {8 V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% i5 ~5 f! a/ q1 L0 K
# C6 I8 d" S* j( }& k- Q; {% |9 J3 i- dma_addr_t dmaphyssrc1 = 0;
% k0 E: {+ N; R - dma_addr_t dmaphyssrc2 = 0;5 o. Y! Q0 F$ ^3 j4 C5 K
- dma_addr_t dmaphysdest1 = 0;7 q1 `+ t* u0 _" h6 f' w
- dma_addr_t dmaphysdest2 = 0;
- b: T0 ~9 }) b - * _& C1 j4 z& o7 w
- char *dmabufsrc1 = NULL;
: n7 T9 y2 ~' @# J, M* d3 W9 V7 | - char *dmabufsrc2 = NULL;
6 g6 ]. z) s$ S$ ] - char *dmabufdest1 = NULL;. u g. l Y# X9 A8 @
- char *dmabufdest2 = NULL;
3 s2 Z& _1 N8 |9 y+ P$ j+ C
8 i( s1 l2 c. J, w" G- static int acnt = 512;
M! p4 ~7 [' ~$ U - static int bcnt = 8;* G0 t3 A0 w" ]& ]
- static int ccnt = 8;$ K& Y$ G5 l: R
- " E; H' Z$ X# S& z' s
- module_param(acnt, int, S_IRUGO);
' y; n" R& O! c. f7 i+ c - module_param(bcnt, int, S_IRUGO);) d1 n( Z2 r A2 ]! z6 z X
- module_param(ccnt, int, S_IRUGO);
复制代码 - T1 e+ { C- V0 N$ s5 [3 a
$ M. b! Y, F8 t) R( @1 F1 ]( _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( G8 b* P% n- ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; q# A/ w/ y! B( A3 u G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 [) S6 M- B* T6 h6 X4 v( L& |6 i) v# Z: q s S& s- [
% u0 {$ F4 \1 W" X$ N: d7 Q6 _# A |
|