|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 B7 x4 b8 M! X% G( [; F7 H3 H6 c! h* d- [code]EDMA sample test application& g& H4 \ b' M, K$ l
- /*
* Y4 s8 @- y8 v. q. y1 j - * edma_test.c
7 `( I: m: P: P - *
1 N/ W X4 [) f- j - * brief EDMA3 Test Application$ R- S& R' Y* Z5 U
- *. }1 H- R* V/ O2 _" H' |. s s
- * This file contains EDMA3 Test code.+ s+ s8 L7 ~& d# J. R+ z7 ~
- *
- C' X/ O1 ?, ?* s- P: r. z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 p/ U, c! G( }: E7 V! h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 k+ d$ C- b( O- y. l( i- `: L - * TO CHANGE.
- ~: @ ?6 m5 R# M/ y& T; N. w7 l - *
) J# c4 [2 j! k. q5 h& ?9 a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. U9 i/ u. K, o0 i$ M! J4 e
- *- M: x7 ]2 ]3 L+ X. Z: H) n
- * This program is free software; you can redistribute it and/or9 m$ Y" M& I0 V. i0 |
- * modify it under the terms of the GNU General Public License as1 s$ f z+ T& P7 x; R
- * published by the Free Software Foundation version 2.
% X' F7 e) Q! \. |. ?$ h* {+ t - *
: n, y8 T" _' H4 c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# }: e9 @9 ]! g3 G0 k$ N# N, |
- * kind, whether express or implied; without even the implied warranty
" K; ^( D6 |$ X - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" f& ]* ]3 h* U/ I$ B
- * GNU General Public License for more details.
1 r3 y) J! E7 D* \& g - */
- v, I- a: U; X2 o - 7 _' V7 k+ [8 d. {$ Q# _: ^9 Y
- #include <linux/module.h>
2 c( L! J: y$ A, F, s - #include <linux/init.h>
' q' }! D6 n/ B - #include <linux/errno.h>
9 k2 ~0 K1 r0 y3 N0 D; ` - #include <linux/types.h>
% W9 d: t" P& E - #include <linux/interrupt.h>0 K$ i8 b8 I. O9 q
- #include <asm/io.h>
, b" \/ R- ]9 o - #include <linux/moduleparam.h>
- D: i2 ]' H$ \# A- c+ a - #include <linux/sysctl.h>
* a0 W1 c8 C6 t" ~/ k- k - #include <linux/mm.h>
G6 a3 \8 ?: e% q) [. z - #include <linux/dma-mapping.h>0 { ?4 c- f3 G! g# p, v; V# O
4 h: A( w9 h! h# r8 ~- #include <mach/memory.h>8 R+ q5 J5 F; k$ D3 j/ k
- #include <mach/hardware.h>& E; G# ]" P- x) G
- #include <mach/irqs.h>
1 |( H# h* U" F% y - #include <asm/hardware/edma.h># Q" i1 A* ]" l% A" {. N
- , X8 c: ]* ?: Z8 P
- #undef EDMA3_DEBUG
- a! {; P+ e/ g# b! T - /*#define EDMA3_DEBUG*/
F, k: ?# _% q) V0 B
5 m" ~; J2 t. M/ e* C0 A p8 W2 n+ z- #ifdef EDMA3_DEBUG$ U4 Z( \, C( u3 g" {: ?% K: E7 W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% D# L) c& U- d$ l4 ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 {% @: E0 T8 \8 T) h9 N) }2 ]' r; d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' I. f5 q3 a; Q# N7 a) b9 s8 `& @ - #else
+ p$ L6 \2 y) Q1 E: \ - #define DMA_PRINTK( x... )3 ?# |" V8 q6 Q v5 a4 A2 X! c
- #define DMA_FN_IN$ L+ ]; \; u# v" C' |
- #define DMA_FN_OUT4 d J% D/ I# p* l( L$ n" D2 u
- #endif
% g, u% R# T/ t1 n% z+ E
; J, I1 d$ P* J @) j- _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 w; Z7 E. `& u - #define STATIC_SHIFT 3
6 d M! L% u: p, Z - #define TCINTEN_SHIFT 20
Z/ t4 O5 U: T - #define ITCINTEN_SHIFT 21
, d9 z* ~; e8 t& o& R( w - #define TCCHEN_SHIFT 225 c V! }: t3 `/ x0 u: ^% s
- #define ITCCHEN_SHIFT 23
- J( O7 h+ p0 Z% e0 j7 x& K5 T, F% d9 i4 z - . j' f7 E3 g; N# D1 m+ b
- static volatile int irqraised1 = 0;
) k" X P$ d0 P; ? - static volatile int irqraised2 = 0;6 v$ R, K; a% {$ q7 l* B7 w9 B
- 7 s) p6 ~+ N- j$ b0 C5 e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# P1 S- [. w$ e0 x% P: Z1 p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. @0 w% ^/ P+ N. f+ ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 \: m5 ?- j+ l! j/ `* S - ( _, B1 b3 R; J! n/ d; S* Z
- dma_addr_t dmaphyssrc1 = 0;$ M1 A* S$ y' s2 |
- dma_addr_t dmaphyssrc2 = 0;5 {) e4 f7 D7 T0 E7 k1 g
- dma_addr_t dmaphysdest1 = 0;7 F4 W4 N1 S8 O2 j
- dma_addr_t dmaphysdest2 = 0;
9 o4 [. S" O& ^& @" s# ]+ R
' B" A0 m1 b4 e- char *dmabufsrc1 = NULL;
0 E& O9 A1 U+ R4 X6 g! V3 g9 Z% ~4 y - char *dmabufsrc2 = NULL;
Z2 g3 H( R; f$ c( {- B& Z C6 w - char *dmabufdest1 = NULL;
3 K/ ^( x2 l# N - char *dmabufdest2 = NULL;; p1 G7 z$ N* d7 k$ e2 b
! _' z; a3 |' V7 Q- static int acnt = 512;
& ]$ t( B x* W - static int bcnt = 8;" P# t: F8 r, f1 \3 i) g
- static int ccnt = 8;
* c4 [( T4 q C - ; K4 A5 H H' b; e/ a
- module_param(acnt, int, S_IRUGO);
4 _9 K4 [. @0 M+ _, ]6 c. N - module_param(bcnt, int, S_IRUGO);: N, B5 b; i" Y( ^' P* N
- module_param(ccnt, int, S_IRUGO);
复制代码
# m9 q) q) i ]. F" m5 g6 p* N$ q+ N5 S L8 W- n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; B6 [) W0 k' C& R* _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" W9 ?# m& G( V$ n9 P* {# w% A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' r3 l6 N2 q, L
: A( E5 B1 F* b; t
6 b l5 V. Q! f O |
|