|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 u8 h6 }) B9 y& S0 V9 T. G
- [code]EDMA sample test application
4 I f" Z7 w5 {% Q4 }& n6 x& z! Y - /*/ t s2 M, J" s6 i6 _
- * edma_test.c( W/ r4 g% J/ I4 k+ z% j
- *- Z0 N+ o# Q, _5 A5 z# @9 d
- * brief EDMA3 Test Application4 @2 s3 f$ p' O& q: I8 y3 q
- ** J: u$ K7 P0 T% l& V/ g: q+ b
- * This file contains EDMA3 Test code.
. L+ d5 z* r" W0 v* J - *0 P9 ]* b* @' Z- m6 B- X; |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 Q- c, m2 X; x( X; ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 L- u1 ~5 q( E: L - * TO CHANGE.
: D3 E9 @3 q4 e+ b - *
+ M" i9 |' T9 |4 |2 t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, k/ s) q; }6 y1 a9 K' g
- ** B) F% e6 ?$ P1 a: h
- * This program is free software; you can redistribute it and/or: g0 Q, d+ @) F
- * modify it under the terms of the GNU General Public License as
) E- F" p5 H( V2 E6 |6 _6 h - * published by the Free Software Foundation version 2.. v/ } O4 T! ~4 m
- *
+ ^' m+ q R1 P# {/ t5 K" _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" t7 |$ Y) }# V S0 c) R+ a- ~( i3 J
- * kind, whether express or implied; without even the implied warranty
) i+ ~) f' L9 x5 D! {6 S6 _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 }' E' c0 u- Q( g - * GNU General Public License for more details./ x+ e0 f) b4 G, h$ V
- */; W2 y# c3 a2 ?+ {
- 2 n6 b) d/ q. _" r/ V
- #include <linux/module.h>
2 z, Z0 j+ N( F4 {; Y6 c - #include <linux/init.h>& }; s' l \8 p( i- I8 u3 g0 M
- #include <linux/errno.h>: N2 Y* h3 c5 h
- #include <linux/types.h>
: H6 S L0 x V K0 L1 _* W - #include <linux/interrupt.h>7 _5 n2 _+ w3 n- ]' e. L
- #include <asm/io.h>
8 r8 s8 }. [& L; | - #include <linux/moduleparam.h>
F( R' q: Q# G/ B' D: G - #include <linux/sysctl.h>
8 K! x8 x1 j1 ` - #include <linux/mm.h>4 o3 P) f6 g' t/ B4 S$ s! j; {( L
- #include <linux/dma-mapping.h>
8 b _$ p% d4 E5 E5 Z- t
7 _) p# _8 H @. z- #include <mach/memory.h>; v3 y5 `4 x7 X$ n6 d9 N
- #include <mach/hardware.h>
! E3 y0 B0 k& A/ V7 x - #include <mach/irqs.h>' O. [! H" V, a$ [$ Q+ N* P
- #include <asm/hardware/edma.h>2 v6 C( Y2 s" Z) z
( K# ~ e- U5 ]. D$ J; Q- #undef EDMA3_DEBUG
: `. k! v; H0 @6 b0 O V* _ - /*#define EDMA3_DEBUG*/
( _% p. v2 t( b( k# B X
`! l/ y$ k% d, V/ I7 W9 _: Y- #ifdef EDMA3_DEBUG4 ?7 P, |) L3 m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* ^# W7 C# i. j- ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) l9 N% A* L. f# {- W" v9 w4 p9 Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 h& {, Q# a; F
- #else
) I+ B! u! Q$ q7 G6 I1 C8 e - #define DMA_PRINTK( x... )
$ M: U# B0 e. { - #define DMA_FN_IN
8 C" q- `8 Y8 D1 W! \* ~' m2 j - #define DMA_FN_OUT
* _6 q" a/ l2 { - #endif
$ T# c3 q% X5 H' S" C2 z) n9 |$ P4 D
+ g( o7 ~1 ^/ l. |$ |- y3 \; e$ }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 ~: ^1 }% A9 \( \ - #define STATIC_SHIFT 3
8 z9 g5 O8 b3 W% M! l+ G - #define TCINTEN_SHIFT 20
3 p9 D3 p5 D: h* m8 ` - #define ITCINTEN_SHIFT 218 F" V% g7 z% R. X# z6 [
- #define TCCHEN_SHIFT 22
% g3 v1 `" q& e' x+ \+ _! g - #define ITCCHEN_SHIFT 23& x% H3 ?# P% A+ X
- 4 H0 r( @2 P% \& H
- static volatile int irqraised1 = 0;7 F# M1 K' O( A5 f k5 Y
- static volatile int irqraised2 = 0;+ y1 a. Q& ?& @& I A* o
- * [, |. w. i* N s% r( y! [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( E# C, t$ }/ }, d) U1 S" @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
H2 }! d- s3 M* W' V/ g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" [, C. B6 |& z4 l5 z4 X
- ( F8 D; B& b6 n \" ~: y" u% E
- dma_addr_t dmaphyssrc1 = 0;
7 T% Q0 e/ K: N - dma_addr_t dmaphyssrc2 = 0;
: X. A# N8 Y; J V3 {- { - dma_addr_t dmaphysdest1 = 0;9 x% l d' ~1 k3 ]- |
- dma_addr_t dmaphysdest2 = 0;
0 _% w& \/ U$ O. a' z/ l- g7 ]1 v - f4 R3 f. [9 u7 C
- char *dmabufsrc1 = NULL;
6 [5 T1 _6 t7 q( q" T6 E - char *dmabufsrc2 = NULL;
/ e9 \! W1 q" l4 [ - char *dmabufdest1 = NULL;* ^6 m- J% V4 A: s9 m! \( E
- char *dmabufdest2 = NULL;. @: b3 v7 G7 Z8 C5 d! h! q# l/ y
- : h# t( L$ C* O
- static int acnt = 512;1 y3 d9 I) o7 v; v- B( `& l
- static int bcnt = 8;
$ @8 G c; |! u) @3 G) ] - static int ccnt = 8;
- _7 I8 [0 L4 |% @
$ S- |/ m$ i) Y3 H) \% |, ?, o- module_param(acnt, int, S_IRUGO);9 K* f4 R+ X" T
- module_param(bcnt, int, S_IRUGO);; l. X0 q. ^( f, x& O& e
- module_param(ccnt, int, S_IRUGO);
复制代码 5 ^- x5 P3 s; Y( r; n" G+ b$ c
- R$ Y2 Y9 y) _0 Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 o9 z) ]- E' D# w" [# Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: l$ W/ N: i( s5 P" e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- p* V5 V) W/ b* N
, x' b! q+ C% T" P5 }- n7 \4 C& E& y3 i) V4 k+ V
|
|