|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. ~' P! E1 D/ }1 ^. O' v2 w- [code]EDMA sample test application2 q; T: }# P! S% C0 z% D
- /*
5 @- p9 b. s% U, B6 w! Y - * edma_test.c
C5 p% ? y3 C+ `! c% z, ~8 E6 u1 b - *
7 D" o1 T; m# `: S - * brief EDMA3 Test Application4 B$ Z ~9 l/ J6 Z; n
- *# P+ \$ T8 e2 w. ~, {- l, m
- * This file contains EDMA3 Test code.
" U; a0 M8 a3 v: l7 M- a7 Y - *
* S u+ B9 t0 |6 X/ t6 L2 Q" A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! ]2 s m& D+ {7 V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- ?! n+ x7 a' |, _ - * TO CHANGE.
) E) I/ T; M/ U6 O4 b - *
' W! p$ u' o& C: d: m2 q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 b5 r* g8 J6 M4 u7 I - *
s" Q" B! f, Y - * This program is free software; you can redistribute it and/or
: `# W4 A/ K8 M$ c7 h6 C* R5 G - * modify it under the terms of the GNU General Public License as% ~5 L0 ~8 N; _7 _5 W
- * published by the Free Software Foundation version 2.0 t3 ~8 y7 }5 o3 n: i; b
- *
- H2 |2 v1 O, z! P! e. O: y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
L- D5 C8 x7 K0 ^ - * kind, whether express or implied; without even the implied warranty) j# Q9 k/ Q/ z4 B! e1 g7 J1 u4 C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: {" T9 {/ k; s; K/ z - * GNU General Public License for more details.. S7 }7 W! v# R
- */
% R9 v# i- G4 L" E/ X& V' ~ p% w - 2 V! |4 g& r7 ^0 T. s* h7 G, [
- #include <linux/module.h>
1 c- @7 ?# b" t) w' e3 }8 E+ T - #include <linux/init.h>
# h7 \& \. {% f4 Y& j1 T - #include <linux/errno.h>3 N7 o, c7 L3 e9 A6 L, H
- #include <linux/types.h>3 ?. Y* v7 Z' m& z% k& {8 q6 @
- #include <linux/interrupt.h>
& {' U8 p* g0 s* {/ t - #include <asm/io.h>( {8 ?$ l' m8 b3 N
- #include <linux/moduleparam.h>
$ w4 P g6 Y( `, t6 I( w( P0 a) K - #include <linux/sysctl.h>
$ T# N9 P" P5 h$ s6 t4 Z6 E" U# ? - #include <linux/mm.h>6 U( W0 L" W' S. k2 w1 G
- #include <linux/dma-mapping.h>. e4 Q8 b o7 @& A% f4 D
) S0 J: Y8 q$ F) x- O7 J: S- #include <mach/memory.h>
* \8 M1 w) a0 E/ T - #include <mach/hardware.h>
+ R- |) n( F6 @1 z( Y5 U - #include <mach/irqs.h>
) S4 c2 y8 E8 k, R; G" v" e2 r - #include <asm/hardware/edma.h>
: v @6 P/ i* I% A' Y - & g: I; _8 a& P5 g' Z! i) _; p1 A
- #undef EDMA3_DEBUG
. [. q% W, C; p r - /*#define EDMA3_DEBUG*/
* ~% ~+ a9 f |: L: G% ~- G
+ S* l$ {3 ~+ a/ ~3 h' y- #ifdef EDMA3_DEBUG/ h+ n2 ~" `# r. e2 I: R# T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' r' D2 e+ B) p4 I9 K u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ C# }5 a0 H8 \5 e) {, h) u3 `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 d$ z8 P6 _9 C% ~: N+ F - #else; F/ g4 r4 q* s0 z! M- D i. r! k; J3 J
- #define DMA_PRINTK( x... )8 c D) ^ \ R2 I
- #define DMA_FN_IN- o1 t8 t [" |) [* ` i
- #define DMA_FN_OUT
1 { D+ t# H2 h* S/ p - #endif9 S H6 ~5 D2 J0 n* x
0 T' g+ h) n5 O1 C$ j5 N' }9 m4 ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* Z, j% w9 `' B/ z: _ y
- #define STATIC_SHIFT 3+ Q$ T* j5 {* f+ e
- #define TCINTEN_SHIFT 20% I7 Y/ q6 F" ^
- #define ITCINTEN_SHIFT 21. b; |, S! I' l4 z0 p
- #define TCCHEN_SHIFT 22
# I; m K, H, _6 R$ x - #define ITCCHEN_SHIFT 23
9 Q7 z6 l& c9 w: I* z; q - 8 p" l. \) V) R) X3 P+ O @
- static volatile int irqraised1 = 0;! J, @& u$ V! W H* @& r3 o
- static volatile int irqraised2 = 0;2 X, C G; l* g, F
- 9 {# L# j5 v; O& \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 a8 W8 I G) z8 }2 D# T$ _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ? f0 V/ H- x( J0 E% M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 Q- ?2 Z/ @- Q) q% j0 H n
0 x1 j4 s2 H9 u- dma_addr_t dmaphyssrc1 = 0;8 B3 S: Q9 m% x; k9 N5 b' g
- dma_addr_t dmaphyssrc2 = 0;
W' k- U- v. Z$ c' k - dma_addr_t dmaphysdest1 = 0;
5 V* Y, B# h$ L$ q, z - dma_addr_t dmaphysdest2 = 0;) O* w" ]7 ]0 Q5 B# g( j h5 D! c
4 Z2 G8 e9 n2 M O- char *dmabufsrc1 = NULL;
. X+ u% m. J! t$ K: \" G - char *dmabufsrc2 = NULL;% K2 X4 g0 v+ o/ Z# l
- char *dmabufdest1 = NULL;
+ n+ P4 g! [/ ?0 S1 o - char *dmabufdest2 = NULL;" u0 C& h- D$ V) @5 d: Z
- - U; R) f( m/ D3 j1 J; [( U8 X& w; [
- static int acnt = 512;
6 {% z# B( |5 t8 e - static int bcnt = 8;+ N/ b/ Q# W* R9 }/ j3 W
- static int ccnt = 8;: K! [% U2 d# x9 `% z9 n+ ]- X
- ( P; R7 n5 w: g8 C5 k
- module_param(acnt, int, S_IRUGO);. l% A) U' a. [0 [# q% [% a+ B2 `2 Z
- module_param(bcnt, int, S_IRUGO);
" f# y3 O. E. `+ u ~* { N0 D - module_param(ccnt, int, S_IRUGO);
复制代码 " Y/ c% e2 g$ Z% z8 ^" l" {. X
) P3 a( ^) i3 I, a6 y# R 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 ~8 l5 r5 F, Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' f4 T5 M; O' f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* D2 [6 k& U1 W6 d s$ I, I4 }/ q( _
: o& t4 L3 y( @ _3 j) ? |
|