|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ E3 |- @+ N# {& W n$ d |/ D- [code]EDMA sample test application- h$ N: \: j9 ?- K3 l8 z1 ^5 E
- /*
1 h) u" B/ O' f, j - * edma_test.c
4 \' v& E6 a1 M! M3 p - *
2 z0 i1 R' f9 Y. S, |; H: ?" d - * brief EDMA3 Test Application% U8 |+ o( p5 ]* s
- *+ X( j' Q4 x; |* N& @- `
- * This file contains EDMA3 Test code.+ ^$ ]' _* @0 Q6 @
- *. M" j; w1 R! a) T* V, ]2 O3 f0 F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' b J( l! O/ z9 ^/ [* c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 J4 ~3 a2 ^- r9 |: j' \9 Q# u
- * TO CHANGE.
# k: h. }" [. m& [3 j1 p - *2 ?7 }# B, F. @: W" U; @4 m9 C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) s4 V7 K! x9 h - *
6 B1 A& g) O& h# a+ w% ~8 z - * This program is free software; you can redistribute it and/or7 O' a# P+ O8 j+ y, Y
- * modify it under the terms of the GNU General Public License as
) j) ?7 H4 u0 A3 o$ x - * published by the Free Software Foundation version 2.
w, {2 \2 ^0 Q* r+ Q7 k - *
6 o Q0 y) q3 w9 F7 T( w& i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 T2 q5 p' [5 _' S
- * kind, whether express or implied; without even the implied warranty$ Z# E, z# m8 r' [3 X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 x% `1 J% b% |
- * GNU General Public License for more details., W8 w$ d+ G/ {
- */# G$ M' |7 ?0 o6 m& I+ W
, w+ ?" ]+ I+ p- #include <linux/module.h>
8 \3 U: ]) f8 j' b/ y8 B+ N - #include <linux/init.h>
5 o# N- `% A( P) P - #include <linux/errno.h>
/ d. a, r. t: ~7 D; P f - #include <linux/types.h>: |8 E5 \+ Z! ?, O" A5 c: s" D7 N# W
- #include <linux/interrupt.h>& ~6 C2 l" T! M- L! z; ]4 K
- #include <asm/io.h>" @& t) @$ H* l* @5 p: b! s
- #include <linux/moduleparam.h>
3 i5 J# ?2 T3 P( a - #include <linux/sysctl.h># S8 w4 c4 h" O4 L0 G+ O; j
- #include <linux/mm.h>4 L( Y, S8 q, E# T5 h, h
- #include <linux/dma-mapping.h>
) ?# f$ |8 w9 h$ S
' S# p: K/ r: L; s( o. w- #include <mach/memory.h>
1 x7 G& `% Q7 u6 M, _ - #include <mach/hardware.h>
5 R* d$ L7 a, N! A, P, a9 p- Z - #include <mach/irqs.h>& W1 | W$ Z' t6 ^( x2 W1 x
- #include <asm/hardware/edma.h>8 W( ^* y) x0 Q5 e% h
' A: s M$ ?$ j& b R' A) m- #undef EDMA3_DEBUG
% m# A& |6 R; H8 l2 v+ z, j - /*#define EDMA3_DEBUG*/: H+ T4 G" l F& v7 p
# d/ B0 N) p; Q# b( m, V- #ifdef EDMA3_DEBUG
, X/ R% ~4 U' V; q2 Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); F% y% e& {4 @8 W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 c, K# ?# V2 _; V. ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) B' s& s( w# E4 J: l& \5 \ - #else" W! F/ s6 v, z+ Z$ K5 d2 x
- #define DMA_PRINTK( x... )
6 o' C! J& c2 \+ e - #define DMA_FN_IN: f Z6 \# d& _3 q
- #define DMA_FN_OUT1 p% f* X. W4 @2 ]8 P' x3 K5 \
- #endif
% ]9 d7 n' s/ ]' ]0 A - $ Z7 ?5 Q$ v! B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 Z' O; j& |: I8 s/ j - #define STATIC_SHIFT 30 p" m( y3 w8 z- S. ] L
- #define TCINTEN_SHIFT 20
" G N- o" ?* }$ i9 ?" L) m, w/ C - #define ITCINTEN_SHIFT 21# f9 e* t3 ~8 ~& D0 E5 e4 o4 U+ [
- #define TCCHEN_SHIFT 22' \6 I. m# x" v% B- v
- #define ITCCHEN_SHIFT 23& ]# n. v9 b& l" l: Z! x2 \
- + _5 P r ^5 Q$ O+ t
- static volatile int irqraised1 = 0;. R" Q2 V1 w i( d' X2 k
- static volatile int irqraised2 = 0;
7 _: _& ]( R2 i2 G - * H5 S% G9 S! X* J7 R5 E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Y0 t# h+ Q. A$ R' n: o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Z- t. C2 O! Y& C! z6 s# A( H. x+ V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% t+ l) m X& A* H7 _) N
8 b G# k) V) f1 S- dma_addr_t dmaphyssrc1 = 0;
, S" `5 _3 ~3 I/ J% u! c - dma_addr_t dmaphyssrc2 = 0;
/ N6 l" o7 k+ {: ^0 }5 f) ?4 r$ ] - dma_addr_t dmaphysdest1 = 0;1 t1 d& t) E/ ]
- dma_addr_t dmaphysdest2 = 0;
& s7 I' E" E- `1 X - 5 ~% G/ d _! g% i9 ~# S
- char *dmabufsrc1 = NULL; J4 K- x- U$ D1 w. u' `$ @
- char *dmabufsrc2 = NULL;! `7 r& k5 A- l
- char *dmabufdest1 = NULL;
' C" Z0 D4 o' ]! t2 R4 G! `: c - char *dmabufdest2 = NULL;- O) J( a- `/ M( J) g- P6 [
/ S* i6 W4 ?5 j. ?3 P* `- static int acnt = 512;8 {& ?$ ~% [; K5 [' u, D! }
- static int bcnt = 8;
5 ^# c. Z, U. \/ v# @1 K - static int ccnt = 8; \- ^% K3 ^3 D9 W
- . S0 A- X- `+ A. F& }, Z
- module_param(acnt, int, S_IRUGO);1 o! ?1 x1 v; E( R$ K7 u7 V
- module_param(bcnt, int, S_IRUGO);! o# g, G* k" m& [/ k+ Y1 t+ T
- module_param(ccnt, int, S_IRUGO);
复制代码
' W+ k+ X: H3 d* c
. `0 e2 ~& L+ L0 V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( R) Q+ w" r7 H3 n5 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! y6 f' d# q! T( {) B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* k- j; V5 B2 P/ W4 u% x$ Q
6 z' ^8 ^0 i/ V% G* E1 S: t$ M! x- B# e
|
|