|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ s- ~$ y8 A4 l5 s6 X- [code]EDMA sample test application6 U5 N7 n; D6 X
- /*; _! A4 {- [1 A8 P! [; B
- * edma_test.c
( z, ?9 j* @3 c! D; {2 p - *
( Y: ?8 w8 C2 L9 m, Z. ] - * brief EDMA3 Test Application
" h4 S' i# [" h% b# i6 Z# M2 { M - *
) R$ Z& Q* s) F* T - * This file contains EDMA3 Test code., k! b8 C' t2 }3 o* ]# W
- *) y' ?4 a0 h% z, N! i5 S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ _; F8 l, y: U/ ]9 V$ ^; I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" [' L0 v* p1 c5 X: P
- * TO CHANGE.2 {+ y3 ]1 x3 u/ J& l7 R+ L
- *
; C6 D8 p% G( Q: j6 A( ?( }, K6 V) P6 i; n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, G) m5 Y3 o0 k - *
1 R. C f! \& S - * This program is free software; you can redistribute it and/or
$ p7 _8 }$ [# O6 D$ w - * modify it under the terms of the GNU General Public License as
# \3 i! T( e; X: G# l& m; ^! Q+ E - * published by the Free Software Foundation version 2.
+ c0 |2 u: g1 h, _$ O1 x - *9 q2 x/ }. Q" O, L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" p' T/ G/ W& ?8 j+ [ v - * kind, whether express or implied; without even the implied warranty; g% ]+ I& y% k* E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" B) S4 e$ E& \- K - * GNU General Public License for more details.
- x! Z8 K: |4 Q3 K9 _& M) T4 ? - */0 c# k5 H. w, R! a. ?# _
- 1 I8 B2 @6 ]. P: p5 r
- #include <linux/module.h>/ C6 U- _/ L9 z9 R2 B3 L" j
- #include <linux/init.h>0 j7 G& W7 g; s- r1 K
- #include <linux/errno.h>
) E0 t4 B- `5 ?! \" l6 I7 ~ - #include <linux/types.h>
7 r3 m! ^8 H4 q; ` - #include <linux/interrupt.h>. W" M7 M) A3 ]" P
- #include <asm/io.h>2 }" u7 S! A" f T
- #include <linux/moduleparam.h>
" g3 H k$ x8 ]" L# c - #include <linux/sysctl.h>/ m6 M3 @7 q6 ^0 G
- #include <linux/mm.h>
- [9 `) I) m! }2 {5 f - #include <linux/dma-mapping.h>2 Q# G. C0 o3 f( ^% g
- 3 y! U( c0 o) h6 l
- #include <mach/memory.h>0 x, y; P. |, a$ `$ I
- #include <mach/hardware.h>
' x8 W2 H5 n( Z - #include <mach/irqs.h>
3 T& c- V+ i9 h% D6 o- p - #include <asm/hardware/edma.h>7 }- l! q+ z S& j a& O, U
- 5 v- n5 _8 H' w7 F3 Q
- #undef EDMA3_DEBUG$ r" }# N% S4 `( k# }8 C& Q
- /*#define EDMA3_DEBUG*/# Z/ L. C; j+ \2 \: P' Q
- ( e; F: P8 F8 b, f+ |6 t) f( B3 l8 e
- #ifdef EDMA3_DEBUG: d: d: t; y7 ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" V0 e2 P8 b! v4 _8 ^" w/ p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% b: J+ V: b4 W6 W A9 T* O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 m- H* G& w* I7 n" n - #else: ]+ C V/ }3 I! G2 Y
- #define DMA_PRINTK( x... )
8 d5 \' K2 W( T6 ?. c* S - #define DMA_FN_IN
' _. b9 N9 s9 r* z. j. } - #define DMA_FN_OUT% o" X* D: t& v
- #endif: U+ h# I( N. P% ~5 v5 t
+ U5 j7 q6 D! b2 w- #define MAX_DMA_TRANSFER_IN_BYTES (32768): G& t1 F3 S0 A/ z' [
- #define STATIC_SHIFT 3
: l' \( u' I" A3 ]0 x - #define TCINTEN_SHIFT 20
+ ?' I9 } |, V( q5 {" \+ }( j - #define ITCINTEN_SHIFT 21
8 A; f$ \/ A4 Z - #define TCCHEN_SHIFT 227 ]4 k R/ u4 H$ p3 o
- #define ITCCHEN_SHIFT 23
+ V% r& |8 m: A! L& v - * S* S* r$ J3 p# a. z" J* E
- static volatile int irqraised1 = 0;' r) H/ h$ F! \- f" H; ?) |9 j( F. f3 A
- static volatile int irqraised2 = 0;
, E( \2 }( C" c7 _
( u: e7 X( g+ @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# W3 V ]& i5 Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* y6 ]; K* J/ ]* Y* J) L0 E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* _# n5 G0 ~ Z% S - 3 J$ ?4 N+ d% }. U. s G' g: x
- dma_addr_t dmaphyssrc1 = 0;
3 |; }5 d/ M, D3 B) C - dma_addr_t dmaphyssrc2 = 0;7 l1 E$ a% t4 K' M
- dma_addr_t dmaphysdest1 = 0;5 Q& n& I+ s% N0 l
- dma_addr_t dmaphysdest2 = 0;
' E6 a6 n* }8 B0 S& ^2 r - - ^" O2 M: g: Q; f. {3 t1 w6 I
- char *dmabufsrc1 = NULL;9 f0 J& l9 C+ [# R' Q
- char *dmabufsrc2 = NULL;; ~- z3 P/ m. Q# h* s0 O* t
- char *dmabufdest1 = NULL;* g2 X, e# u" o; N
- char *dmabufdest2 = NULL;
, j+ E, J8 j; Q* ~' J - # G' b6 p7 R2 I0 L8 G, u4 }
- static int acnt = 512;
5 V9 ?. j3 i! m - static int bcnt = 8;
+ v& _" |4 q9 P' F9 i - static int ccnt = 8;# p k# l0 {( g% D- n
1 h9 U- L t* B8 L4 L- module_param(acnt, int, S_IRUGO);8 A9 B& b/ F" B7 m& R9 d* v8 X
- module_param(bcnt, int, S_IRUGO);& y( y1 `4 g/ P x$ {# |
- module_param(ccnt, int, S_IRUGO);
复制代码 & B% H. b, Z0 y
5 w b' A- H9 d3 ~5 i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ e {4 K4 X+ @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* t0 l( m$ k8 q i. T$ {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- o. C" {( K5 l9 ~, _2 @
/ T% u* i3 l* ~" k) b
2 B! q( j3 H+ g( }. P; t |
|