|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 s" ~9 z. ]& H
- [code]EDMA sample test application
+ ?1 K& Q7 [( } - /*# G; @7 X4 z, X- M
- * edma_test.c
1 e/ w2 O* f% {! a" a; q - *$ I' N+ A4 b8 ~) L7 }
- * brief EDMA3 Test Application
' x, ^, Q& N5 R8 T - *$ \0 ?0 }9 b: @4 U( T: J; q
- * This file contains EDMA3 Test code.. `4 m, B( D0 v' r# \1 x
- *: N! H: m: [9 X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 m. |3 t- h# }7 d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( \7 I* t! C; q; m) o3 ]0 ?
- * TO CHANGE.% a% _; f2 R$ u4 X2 j' @' H
- *$ w# `5 E7 a: C8 V2 ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 s2 b; h+ R+ J* u) J" R1 U0 b, _ - *5 q" W2 O( ~7 r: l' F) B2 W% I( a8 c$ L
- * This program is free software; you can redistribute it and/or
( v: k5 Q8 l3 I! [, Q. Y+ [ - * modify it under the terms of the GNU General Public License as5 L! C& G# `' Q3 A8 q# \
- * published by the Free Software Foundation version 2.
; H. U3 R9 K9 L* I9 J1 z3 x6 X - *- H4 n. w3 N) h4 e) I& ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 q$ R' {) L7 E3 S6 [8 l - * kind, whether express or implied; without even the implied warranty4 v% @) T! j1 T: M% C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& w. F4 ^( G- `# q" t$ a
- * GNU General Public License for more details.9 @5 g8 m$ }0 L T
- */
9 h( a2 U- h9 P' Y! d3 ^+ j2 P
! \1 i5 A" \/ p* {8 Q- #include <linux/module.h># y7 n* N2 |4 X
- #include <linux/init.h>& o! T+ _3 _1 w
- #include <linux/errno.h>( x. _6 l; V8 n% h
- #include <linux/types.h>
: K0 v+ U) f4 ]( u9 u5 v U - #include <linux/interrupt.h>5 C' b1 T9 W. R/ T# @; C
- #include <asm/io.h>) g r' R5 b" m$ G8 a7 X4 J. n2 b
- #include <linux/moduleparam.h>
+ W8 L/ F, u6 M7 E( N8 e: p; y) \ - #include <linux/sysctl.h># J* d( u: |$ D d& c8 g
- #include <linux/mm.h>
$ ]$ |9 E, I4 }1 w& o - #include <linux/dma-mapping.h>8 l8 F; n, T5 g" \& G) Y
" h# Y; y" l/ ~. i _- #include <mach/memory.h>' l6 ~. P& C4 x3 F1 ^9 R. b$ F
- #include <mach/hardware.h>; N' l: i' s% F5 D4 S
- #include <mach/irqs.h>" g6 w8 k. c9 z4 k$ D3 R
- #include <asm/hardware/edma.h>( n+ `4 k& K5 j& |7 j' V% C
- $ c9 k4 r; ] S' ]& P5 k
- #undef EDMA3_DEBUG4 [1 K' c( g9 v6 v
- /*#define EDMA3_DEBUG*/
7 F/ r7 z1 {# A3 Y9 n5 Q; v; W5 l
[+ {/ Z$ ~+ z7 N0 z8 G- #ifdef EDMA3_DEBUG
% ^. I) v- f$ u) G f2 x6 j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 R8 q( T$ z& C( x2 b* ~6 {/ n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 l6 Q2 k1 {0 {2 f) z& ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 j8 A9 t0 j& X' ^ a - #else$ `6 `5 m. w/ K5 G1 i$ d: o
- #define DMA_PRINTK( x... )
' V1 H3 m' w* o, f* i - #define DMA_FN_IN
: e5 H& Y/ O I - #define DMA_FN_OUT
. k1 G( X5 K2 t - #endif/ o2 j, M0 B/ x
' X4 a6 ]1 Z7 x0 p: Y2 d' v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: Q6 N i* u$ Q% u. b - #define STATIC_SHIFT 3
* N6 k; h7 ^$ P' P+ R - #define TCINTEN_SHIFT 20
3 m' B* D" p" a - #define ITCINTEN_SHIFT 21
6 s0 @& {3 h$ B - #define TCCHEN_SHIFT 22' j4 U! F) t$ X* q3 a( B
- #define ITCCHEN_SHIFT 23
6 C$ V. r5 h% a9 g ]% ~
: v, Q G- f$ u2 F- static volatile int irqraised1 = 0;
& g& P' `7 B' [/ t5 r [ - static volatile int irqraised2 = 0;
! p+ j' O1 ~$ b. j' U' Q - 7 N* i5 M+ D6 p* }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, N) b$ v* o6 A1 ^3 F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) H5 y$ g. ?- g- F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% C: Z" K! y8 N0 O, t
- # A- K2 k1 H) Y9 ~ O+ p
- dma_addr_t dmaphyssrc1 = 0;; f# w- i' x1 ^+ X
- dma_addr_t dmaphyssrc2 = 0;' `! Z7 ^% I* d& M/ S
- dma_addr_t dmaphysdest1 = 0;
4 v$ c K4 ~6 \1 n8 c - dma_addr_t dmaphysdest2 = 0;" U1 ]5 l1 K& {: i. t; L
# ]1 }5 ? b h# N6 d/ Z8 i3 }; t6 s. d- char *dmabufsrc1 = NULL;; j7 r& U) P" p2 r# K9 H
- char *dmabufsrc2 = NULL;' ^$ J$ k, S. T3 @
- char *dmabufdest1 = NULL;
8 n- R2 ?' j+ I, i. m; u - char *dmabufdest2 = NULL;3 k) C" _2 { X1 |
- , N7 Y/ C1 E+ \: {3 W
- static int acnt = 512;& j) Z) m- A# M0 w Z
- static int bcnt = 8;
7 g u% S2 O4 I. Y - static int ccnt = 8;2 _- f( N1 D9 B0 q
/ @" Y( X' `% n8 Z6 e2 M- module_param(acnt, int, S_IRUGO);% m* p# ^3 J$ h) P7 ?* B
- module_param(bcnt, int, S_IRUGO);! L T/ f! t; v" M4 g
- module_param(ccnt, int, S_IRUGO);
复制代码
7 Q( F5 B5 u$ ~. {& ]3 z
# T) J1 L+ ~! W7 \! b. o% A2 I! d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' n) n$ M; m" \6 varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# h8 ]4 v1 p0 T8 C& I/ Q$ R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ p! \. m) ~, y8 ]3 g
4 \2 } e0 Y, X7 M2 b7 y
1 |' G1 N7 r. x9 g+ V7 j: X8 |/ f2 `
|
|