|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " {: {) j7 p- ~1 K+ n( J
- [code]EDMA sample test application
1 N1 V% L1 r, X2 L3 } - /* N% E4 l% C: U2 `
- * edma_test.c
3 K# T9 Y, [7 Y% T3 t - *. Q1 q2 ` [! K# M% W4 M
- * brief EDMA3 Test Application
/ k3 _- p$ j( n# B; z( W) {7 d, y1 _ - *6 s s- z9 @: h% _
- * This file contains EDMA3 Test code.4 x: o {' Q2 c1 A2 h8 ^- q
- *: g, c& J% y4 ]2 _7 ~ K- } t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* q7 G6 W% \& a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 R/ \! n% v- _8 r( s0 ]9 n4 s
- * TO CHANGE.( J( V( p/ U# b5 [7 J4 Y
- *! _& g! g2 W7 r0 E- ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ c' H7 P; X4 f: f( z - *# n: w1 v% Y. u3 d7 `
- * This program is free software; you can redistribute it and/or+ X' u, a: E6 J2 U
- * modify it under the terms of the GNU General Public License as% u( F+ B$ z( D- s% ?
- * published by the Free Software Foundation version 2.
. f" p6 D6 l% i% I! G - *+ Y0 ^% N* \! D5 A A' [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" g, V# W, X; q! {% l; C" T
- * kind, whether express or implied; without even the implied warranty2 M B) E1 i" a+ \/ o1 M0 h6 ~# v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; e0 S" V3 Z' A. q8 ]0 }; d1 T - * GNU General Public License for more details.
' d- j0 K9 U. V; V - */
6 H, K3 j* ~0 C9 r( N3 `' `
& s6 L) z) g' Z" ^# S @' _- #include <linux/module.h>2 f8 b6 n5 M/ t2 N: u
- #include <linux/init.h>
0 U+ f' F9 N9 A. ?1 T - #include <linux/errno.h>2 R2 A$ q$ t' [# F2 `
- #include <linux/types.h>
2 d( N9 n$ B% L/ c+ C4 x1 |% ^ - #include <linux/interrupt.h>
6 ?! B* i y) Q# X& j - #include <asm/io.h>
- O$ J) n: L# n8 E - #include <linux/moduleparam.h>
`4 N2 ^2 H, W1 J2 w - #include <linux/sysctl.h>
( h; p* s5 _; S2 z) E" p - #include <linux/mm.h>
% q q, N7 j' B7 X6 p+ v: m - #include <linux/dma-mapping.h>
6 O& R" E3 Y- x% ?7 c - & F# N; \) j% p& P% L( {$ U
- #include <mach/memory.h>
& v* ~! q* o. y; _ b% c - #include <mach/hardware.h>( @6 b' y4 _6 n3 {4 ^/ w& @
- #include <mach/irqs.h>
3 X* U9 L5 R% T% c( _! | - #include <asm/hardware/edma.h>
6 [# o/ U8 V1 e b1 c7 Y8 V - : H' {' b4 y) S% b$ d8 s8 S; k( x
- #undef EDMA3_DEBUG
, K* Z8 v" d8 ]+ T; Z0 }0 T* L3 v - /*#define EDMA3_DEBUG*/* R3 I/ L0 y. h1 S, i# M
- ' H$ b& r" N' y) X' U0 r
- #ifdef EDMA3_DEBUG
# A1 h0 o l; C- {$ d. f/ P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ z+ T6 W# y7 d& K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ V4 l0 u% g2 S* V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* D& O4 ^0 O4 t r; T$ |" U1 \3 k7 M
- #else
8 {' R& a# T. |6 U- t' O) B - #define DMA_PRINTK( x... )
9 [( K, @2 R" ~" m! R, { - #define DMA_FN_IN
6 P: _$ H; m' d - #define DMA_FN_OUT
9 C) `: N+ P& {" y* q: K - #endif7 r# N- s# e3 X9 L& R
- % { P, o: O2 b7 z! a4 M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 W9 I) {6 w6 p
- #define STATIC_SHIFT 3- Y% p; [$ \1 J) G# T
- #define TCINTEN_SHIFT 20
3 N- J, o- o) `( d2 r7 r - #define ITCINTEN_SHIFT 21
3 f! D! ?6 J/ B9 U, m - #define TCCHEN_SHIFT 22% i+ H1 ]3 i" E1 L
- #define ITCCHEN_SHIFT 23
) K9 C6 V2 N$ j8 I$ e2 z5 g
! d6 o; ?# E# h; ~2 U- static volatile int irqraised1 = 0;
! R/ X+ M( `: M2 e, s+ H8 b - static volatile int irqraised2 = 0;
: c; A( z! x5 f! P. t! D' t* V9 g - 2 `" {0 s0 h; l. C0 K$ p) v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; h3 u; ^0 Y. C+ V* i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 _) y8 e |$ i& s$ t3 | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 S0 J9 f# `: n n
6 K5 g1 \9 K% `- dma_addr_t dmaphyssrc1 = 0;
. \$ c2 F# O8 M - dma_addr_t dmaphyssrc2 = 0;
! H4 X. b7 |, ~' m0 c3 Z - dma_addr_t dmaphysdest1 = 0;' h0 X( z) A8 y# ~! \9 I
- dma_addr_t dmaphysdest2 = 0;9 Q4 m* r# c! E# w# F/ f2 H' Y% _* ~
- % j9 o! @0 c6 B4 b; M# P
- char *dmabufsrc1 = NULL;* J5 W% ?/ y* |8 e, o
- char *dmabufsrc2 = NULL;
/ c1 R* R0 ~6 ?! j9 o0 G) x - char *dmabufdest1 = NULL;
0 F+ S& C( G3 {/ W - char *dmabufdest2 = NULL;
& ]+ i3 [" ]8 v. b7 |; Z - : ~2 s6 n, c% k* S7 }
- static int acnt = 512;' T @, k1 W, `% U0 |& c9 A- Q
- static int bcnt = 8;1 i# i! x1 t) p; L
- static int ccnt = 8;
, s h# I: y/ k4 `5 H- }+ H
" {4 K# ?6 I; V( B4 Z- module_param(acnt, int, S_IRUGO);. a3 U/ f4 Y# t% {) B
- module_param(bcnt, int, S_IRUGO);0 F! w! C3 \; i6 z
- module_param(ccnt, int, S_IRUGO);
复制代码
^) v9 B0 I" ]+ v. D, O% a3 S( l5 p: B9 P7 k2 b( J+ ]. ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) G- A) x) u# I2 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* N* v5 }. }, s* ^8 a) a$ h; p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* x7 q+ @4 k' ?# }& d& i9 V4 _7 |$ x1 \ ^% w% `: t
! H ?, l4 M6 d, ^' \3 } |
|