|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 w6 l0 q5 E) V: x+ T
- [code]EDMA sample test application! ~# q5 M% F! U& @$ r
- /*
8 @0 J2 R, Z! k0 o: X# \+ V - * edma_test.c$ {4 I; X, C v6 C- B
- *
8 V% c l! p9 s) X; e- m, s; U - * brief EDMA3 Test Application$ h9 D2 _; J1 l
- *
" {7 G+ ?8 O4 F - * This file contains EDMA3 Test code.) ?. C- a; ]% @+ z p2 r
- * E% G0 u, }/ s! h) R6 d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) e W9 c2 x! _% U8 Z. i# D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) l$ ?' D' _4 }2 s7 v" R- _9 U - * TO CHANGE.
9 V4 @/ @& c& p7 A6 J0 `1 _" g - *
/ J9 B7 ^+ ~ l! ]3 p0 h& G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) V: U; z2 G" K- B, K P& u
- *
! J( I. k* L O7 m4 M - * This program is free software; you can redistribute it and/or2 v, L3 H) P; Y& `2 R1 z
- * modify it under the terms of the GNU General Public License as" V. i9 p6 o- Y6 V# L
- * published by the Free Software Foundation version 2.7 l' Q1 W4 O i/ d/ C4 l
- *
7 v9 F5 P( r# `5 w4 S4 a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ j/ {% D$ K {1 g& A% E - * kind, whether express or implied; without even the implied warranty9 [) b! D* K6 Q$ ]& _0 P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 H9 |0 Y) ?* y2 w6 w- A
- * GNU General Public License for more details.2 d* t# h$ ^0 Y8 {
- */7 `; ~# u+ z: I1 K# ]
# k u: d) A \7 Q; L0 h, ^. [! [- #include <linux/module.h>
% y* `8 x# z8 A - #include <linux/init.h>! ?/ y2 m5 R r. m& i6 Z: f' \
- #include <linux/errno.h>- N2 a [& @/ \
- #include <linux/types.h>; K# |, p7 m0 E) S3 ~
- #include <linux/interrupt.h>
, {; v5 H2 o" U3 | Z( p - #include <asm/io.h>
7 M) e! A0 }+ \% i0 Z2 H - #include <linux/moduleparam.h>
9 g, r( h5 A+ G - #include <linux/sysctl.h>
7 T0 ^) M# k8 \: s& y0 [ - #include <linux/mm.h>
! X2 y7 |3 M7 _ u - #include <linux/dma-mapping.h>4 N5 C# O: {" E" U
4 d5 b9 A# S# V$ D! A( m- #include <mach/memory.h>
# P& e$ j4 b- n% c, d5 K - #include <mach/hardware.h>
3 H2 D$ h6 y+ `5 U: H4 o - #include <mach/irqs.h>' a3 I6 K6 u: Y3 j4 W7 }
- #include <asm/hardware/edma.h>
% B5 ~+ f5 L5 Y: K: ~3 q( n
# V% c* Z+ V& U- #undef EDMA3_DEBUG! B0 D; x1 J! D
- /*#define EDMA3_DEBUG*/
% t0 w* M9 }) M: Q1 f# K
* ~9 l1 a8 r, }4 M3 X- #ifdef EDMA3_DEBUG
( L" [' D5 Q8 w' _; o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 u/ w% N+ `/ A4 j1 Y) o4 F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 Y2 s# \7 `3 I, N6 C1 ?% T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
Y) `% b6 U3 t/ H* Q$ k% m# G - #else& `( }! }) ]3 l
- #define DMA_PRINTK( x... )& e% p! q9 o& E6 v2 r2 F0 o9 `$ P9 H" \1 h
- #define DMA_FN_IN) N1 O8 O- W8 s. c
- #define DMA_FN_OUT
" M) Q9 Q& S9 _ - #endif
( G2 B) n' |, n) n1 g
& ^# S, b) B8 Z) C. D- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 B. I: q. ]' Q# D3 E - #define STATIC_SHIFT 3
4 e! F, L, W" I" R$ \8 o) m; S - #define TCINTEN_SHIFT 20
& O& j: p/ j a2 X" C' s5 `1 u - #define ITCINTEN_SHIFT 21
: I/ K8 f! B Y - #define TCCHEN_SHIFT 22
0 `+ L, V& |! @ - #define ITCCHEN_SHIFT 23
' v6 _/ E6 u- n1 O, L9 ]
. a' y7 @. H6 e& }/ }! }- static volatile int irqraised1 = 0;
/ v# s2 }4 e, q. ]. D - static volatile int irqraised2 = 0;
\$ Z+ M0 j. N6 N& V - 0 L1 J3 b, Q, H- V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 q: H1 e! y* {3 p D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 M# ^4 H2 h- ?3 B$ V& |( A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 x5 l e' L2 b! }% \ - : o% M2 o: R% r3 g# M
- dma_addr_t dmaphyssrc1 = 0;
+ l6 ^6 g- _9 G# @& S1 E - dma_addr_t dmaphyssrc2 = 0;
) a- H) A* h- H: ^4 U( L5 e - dma_addr_t dmaphysdest1 = 0;
. r4 [+ [! I9 ]. y - dma_addr_t dmaphysdest2 = 0;6 _# h9 I6 v" q7 ^: o9 z# U5 I# h
- ) A4 b% F+ k& r5 Q* ^5 N) }5 b
- char *dmabufsrc1 = NULL;: f# a4 i# _+ Y0 ~, _0 y2 I
- char *dmabufsrc2 = NULL; _8 e p+ F3 T3 }: c9 e
- char *dmabufdest1 = NULL;" k0 q" @& @& @6 D# U
- char *dmabufdest2 = NULL;
: K: a# z3 e) w- ]. J1 A# z" p
5 R" h5 f: r, O; l# ] I C- static int acnt = 512;7 @8 y! I, I$ i! K) |' T5 ]) @
- static int bcnt = 8;' }# n. `" u& _+ y& j
- static int ccnt = 8;
) [: S5 [* p6 }+ }& H/ k5 _ - " a/ E: H# J: {: C* }/ ]. s8 o
- module_param(acnt, int, S_IRUGO);: F; \% B" a! }4 E2 P1 Y: [7 R' w
- module_param(bcnt, int, S_IRUGO);1 F. G0 Z# M- _% {
- module_param(ccnt, int, S_IRUGO);
复制代码
5 W6 j" \ v4 b: f( @
% E$ R' N+ K! p d, r' A0 E0 ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 x; W1 ]) D- t$ b1 S$ q8 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 m1 |# j" V. \4 m2 g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 l" O2 M: \9 v" g# v4 X
& @0 r0 G0 @4 w0 r+ F( d( H$ `# b" c
+ j& D9 ~5 l- _7 W% D( D/ B8 S0 V |
|