|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , |" p: h2 S, x& Z: p
- [code]EDMA sample test application
+ G" ~- W8 I$ ?6 f/ ?/ {% t# L - /*
0 P6 ?4 a' z& ^9 W1 ~- o( }( H" |3 A4 D - * edma_test.c* p7 y8 U$ R2 L: t+ [
- *
3 z2 _6 V4 ~8 k* F4 Y - * brief EDMA3 Test Application
9 N6 Z! x. s1 X9 F6 V1 _+ M - */ T" L% A( g6 ~
- * This file contains EDMA3 Test code.
, }; [8 n! `3 H) }. {" I - *! ?0 K/ T. H. V: ^" K! o0 S! @$ a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 K" E$ M' h, M6 n7 \: u R) M: A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" o- A/ n: t2 u; s1 M3 y - * TO CHANGE.2 \5 d2 F; D: F" D# u5 W
- *0 I2 o- u- u" ?1 u" t9 B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; j% ~, g& @2 T5 c5 M( @& t- B - *
$ V+ f( F5 T% V5 |4 K" U+ N - * This program is free software; you can redistribute it and/or
" E( ]( g2 t) r8 Y7 H7 G - * modify it under the terms of the GNU General Public License as
# N; c; x; _. B - * published by the Free Software Foundation version 2.* q _( r5 h$ Z6 a
- *
: G) D# h V+ D# {. H# d' ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* @! O/ D! ~) [+ u, [
- * kind, whether express or implied; without even the implied warranty
3 j2 A1 i) |! s: w+ p# w1 C/ T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% [ Y j0 e4 Z9 b. s' y
- * GNU General Public License for more details.8 F2 m0 {1 f; O. _& |
- */
4 L3 e! f5 Z& [ b1 K2 D7 f - * T/ Q& u& O! X' a
- #include <linux/module.h>
, W0 q0 @8 ~ p, m' |. A+ _ - #include <linux/init.h>0 W2 j* h) [; Q* I9 ^3 G$ M& ^5 X/ _
- #include <linux/errno.h>
; v5 e, S4 N: g/ D1 y - #include <linux/types.h>: S. b8 e p5 w3 T0 l
- #include <linux/interrupt.h>/ o \) |5 ^# G# Q$ C7 \4 H; t% y
- #include <asm/io.h>- f' B* k# }" Z M
- #include <linux/moduleparam.h>- _) L9 z7 |( x# C" Z
- #include <linux/sysctl.h>/ }- _% Q1 f5 c" P0 `
- #include <linux/mm.h>3 b/ y* l( W6 Y% ]
- #include <linux/dma-mapping.h>
5 A) ~ ^( |" D8 T: ^
+ z2 W4 T; [" G" W, C- #include <mach/memory.h>3 O- p% t8 j0 J0 \ V
- #include <mach/hardware.h>
0 H, @6 F& W. u* F4 d2 y - #include <mach/irqs.h>3 U8 t- g5 X+ B" U2 m2 {, y0 a/ Z9 `
- #include <asm/hardware/edma.h>+ L4 H6 D7 ~; s) [2 B i
- / v4 I- Q4 w& M! W5 l1 b. @
- #undef EDMA3_DEBUG/ P% v! H2 k5 W" J
- /*#define EDMA3_DEBUG*/: K+ Z3 ^5 {, {. P& b1 o% g- Q
- & Z6 s/ v3 Z+ j7 B1 u" Z2 B
- #ifdef EDMA3_DEBUG
" O: P2 z3 e1 B! n0 v3 G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# e" a/ `3 }7 s) d8 p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& i0 t( k4 V$ q( S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
G; D- a2 A( K1 N1 {8 a - #else8 h/ L0 E: e# s N+ P
- #define DMA_PRINTK( x... ), _+ c0 v4 Q9 r; Q z) V. U
- #define DMA_FN_IN
1 R2 v2 h0 Z, F2 Q! a( D - #define DMA_FN_OUT$ G2 M `7 E9 B( ?$ M) b
- #endif
% ^: k! }9 C8 k( F
; }- M* ^5 l3 m# I5 I% c2 ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- @2 z& @4 E3 @) K$ ?; [8 V) I9 h - #define STATIC_SHIFT 34 t0 ?2 B& {' M6 _9 Q f
- #define TCINTEN_SHIFT 200 X, r$ _+ y4 o% U$ l$ ^. |0 J
- #define ITCINTEN_SHIFT 21- V: @1 I: A( y$ a. {% g
- #define TCCHEN_SHIFT 22
4 l4 i6 C$ g( Y V$ Z9 k - #define ITCCHEN_SHIFT 23+ c6 \; i7 }* G) v
- 2 B# V" K6 k+ A; G+ Q
- static volatile int irqraised1 = 0;" W1 g$ Y7 L6 N$ N( X3 c& @% w
- static volatile int irqraised2 = 0;. J [% }+ ~9 P- a+ E
2 k* i4 e4 z- M* ~# ]' N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ q& o1 Q& p0 f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ q* v3 g- N' {0 e: t% q4 o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# H t8 A# d8 p8 u
, e8 E K7 @- C4 Q5 @- dma_addr_t dmaphyssrc1 = 0;
0 ?+ e+ t$ I. t+ e9 j - dma_addr_t dmaphyssrc2 = 0;: Z! D. A7 |# p: Z
- dma_addr_t dmaphysdest1 = 0;9 p( ]9 s. c" K) a+ }
- dma_addr_t dmaphysdest2 = 0;
+ A6 r/ `; x3 _ - $ w# |- o6 O. m3 Q" y$ G
- char *dmabufsrc1 = NULL;
0 W# ^) |* L4 p# `+ b$ T8 f - char *dmabufsrc2 = NULL;* k6 |! {# m, b) s
- char *dmabufdest1 = NULL;. S2 \7 c4 ~" G' t! ^
- char *dmabufdest2 = NULL;
8 C8 V T2 ], S$ J+ ]& M0 k - 0 [( i! k. {- F1 a: Z2 R
- static int acnt = 512;$ u+ ?" |/ u7 A- z. G/ t' H
- static int bcnt = 8;: a4 c Q/ h3 |3 O# `1 e
- static int ccnt = 8;! [* b6 \/ w6 i; J
/ x$ H- q! S! f6 n* e W9 M- module_param(acnt, int, S_IRUGO);- [! z0 u( Q" M3 r
- module_param(bcnt, int, S_IRUGO);; l1 P0 G, @- J; r
- module_param(ccnt, int, S_IRUGO);
复制代码
7 c) a; z- s$ K# |/ c# I" m
% I6 B. R/ z, i! Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 p- p& I1 b7 u* H8 l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% f/ x8 x' g4 y E5 Y# }# T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ J& w! Y; Z! Q- l7 j3 D- U" Q. R" _' i
! ?! I9 m2 \) s$ f* _ |
|