|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 `3 e3 j( i: g
- [code]EDMA sample test application; T1 W9 i3 u% g
- /*
: r2 I8 Y& x7 l: c& w& s - * edma_test.c& b7 \7 m5 H/ L3 X: M. B: T5 r
- *- ~4 d& W; w6 I7 `
- * brief EDMA3 Test Application
$ O& k6 X( B% d# Q3 b- @' o3 Q - *" j- H5 V& g% g' K% |1 F! |
- * This file contains EDMA3 Test code.5 |3 E3 _& h! C
- *( T2 X; i! C; y2 |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! y# j0 x6 T4 k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ ^9 Q. J6 s6 L6 w$ F% k, h - * TO CHANGE.
0 w6 M- Z) ~ k' U - *- r: s0 Y, F- \" L9 P. p) t# Q O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ o; ^' T- n/ X2 z# |) [ - *
3 X* E& I" w( b - * This program is free software; you can redistribute it and/or
: S. j! ]7 N: M( k1 X/ ~# ^ - * modify it under the terms of the GNU General Public License as8 Y$ e" R% [! Q2 U: \6 o4 o
- * published by the Free Software Foundation version 2.
0 P4 u$ K l- l( l: R - *7 S! M' m1 R& x; ^3 k) N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 G# O# `$ `5 A* p3 }9 @ - * kind, whether express or implied; without even the implied warranty8 p9 y) M' y& X% ]9 z9 b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# w; d2 Y0 ^0 P1 a( z0 [
- * GNU General Public License for more details.
$ Z) w# G" H: V9 T( [ l9 n3 \ - */
9 ]; x% ?: O( S) r4 f! Q7 A1 J2 H3 \
0 O) g$ F# c/ b3 d# R V- #include <linux/module.h>8 C- L$ D+ d' j# t
- #include <linux/init.h>5 W' m0 w* E: A6 |7 ?- ?! E' A4 O
- #include <linux/errno.h>
6 g( G- \' o4 x2 c$ `9 S6 F U. M - #include <linux/types.h>
1 {, g* U2 z0 s* ?0 [2 m - #include <linux/interrupt.h>* [2 m& _6 N9 q* `6 @
- #include <asm/io.h>1 O+ M5 R5 `# M
- #include <linux/moduleparam.h>
6 X/ [* Y+ ~) M+ f - #include <linux/sysctl.h>3 X4 e/ n! } R4 r2 C$ W- J
- #include <linux/mm.h>1 N. h% N2 _" i% }
- #include <linux/dma-mapping.h>
3 y' t2 W/ P) }+ Y" g - 4 C# E6 J; |. f4 D
- #include <mach/memory.h>! W. j. w9 K& b4 R6 M7 e: D
- #include <mach/hardware.h>( U7 M4 C3 }8 n$ v0 K8 |) z. I2 d
- #include <mach/irqs.h>
O1 t. c2 q8 o. i - #include <asm/hardware/edma.h>
/ u/ G3 _* ?) V/ q0 W0 M
! E% O3 P6 _1 b; s- #undef EDMA3_DEBUG
/ Z) e3 j# g/ o! U# Z8 ]( a2 W - /*#define EDMA3_DEBUG*/
' R, Q' ~1 b7 q/ O( X
% ?* I" O: n( M+ C( j: T- #ifdef EDMA3_DEBUG
9 }- }0 B2 P, }4 o& r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" |0 |5 k2 f8 D( a9 u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" U% E* w7 t' K$ _8 F# X- i* g+ P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): J' Q- G: S8 K/ Q* ?
- #else
6 N, \1 g" n2 u( ^. b& q3 l - #define DMA_PRINTK( x... )( U6 V" ]3 b b4 H4 ~& e/ G
- #define DMA_FN_IN+ k# m% S% E+ H8 N- R
- #define DMA_FN_OUT
/ O5 j* @* ^. P& O, v/ ~ - #endif
( |" N% @1 K' m; N ^* h) ] - - c4 [+ z! m1 H# p' l& v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); N( f% @8 d& D% H2 o2 e
- #define STATIC_SHIFT 3
; Z. U" e* x4 h! G, v. [ - #define TCINTEN_SHIFT 200 X; p9 S4 x6 Z$ G
- #define ITCINTEN_SHIFT 21
9 ~; c4 D+ N) f" O6 g0 U - #define TCCHEN_SHIFT 22
, h6 I# E" @+ _ - #define ITCCHEN_SHIFT 23' C3 P1 ? H8 ?+ b( x w( j
3 Z2 w- F3 N5 x4 ]: A: a- static volatile int irqraised1 = 0;) Z; ~& D$ h! v9 s* t. d8 }
- static volatile int irqraised2 = 0;
3 G V2 r1 Q6 f2 X* t: p
. e% j' C& S; J; T% L6 D/ Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 e- D! D, r/ o* A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 \) @0 k+ I7 y8 P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 r& _) @/ R# M
- $ ]6 R, `( C3 F
- dma_addr_t dmaphyssrc1 = 0;& k' [( P' O6 a0 A9 `5 d* |
- dma_addr_t dmaphyssrc2 = 0;0 n# G! B: m D
- dma_addr_t dmaphysdest1 = 0;% ~4 T' c3 l: u6 _- Z
- dma_addr_t dmaphysdest2 = 0;
/ W a* I( g- ?- d0 V9 t( j - 6 V3 j5 Z) w, d3 u6 C! l" E
- char *dmabufsrc1 = NULL;# ~! w% }$ z A( b
- char *dmabufsrc2 = NULL;+ Y9 S! E4 H" I7 \
- char *dmabufdest1 = NULL;5 ~5 _, A: x9 ^
- char *dmabufdest2 = NULL;
. M) }" i6 c: h( w5 o
1 O6 O2 Z' L7 n* A: Z6 Q- static int acnt = 512;$ L' ^; Z8 ^' h/ J# r
- static int bcnt = 8;+ a' H: T K6 h5 m$ L% |
- static int ccnt = 8;0 V! L: H$ K7 U
4 j4 a# s4 z: Z% E- module_param(acnt, int, S_IRUGO);
f) \) k2 i7 \6 @: @ - module_param(bcnt, int, S_IRUGO);
- L' R8 j: g; Z - module_param(ccnt, int, S_IRUGO);
复制代码 $ I: e- A- x5 M! {" T* ]/ |5 d5 {
0 ~3 B# Y; X: a t7 W5 d T/ P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 \, O4 D% K& ]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$ d% i0 f+ ?+ L- H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' b N; p2 F) E( H
' J3 F G% \3 B5 M% k+ r" x! ]: O. A+ k Y% c7 l; s
|
|