|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# W- C* e6 |: \. P0 \3 g; \& o- [code]EDMA sample test application
" K2 F) o( E/ C( ] X - /*
! A# e" R* a( W" K4 M3 x - * edma_test.c
4 ]3 s+ O: l7 }5 X5 J5 P7 P - *
0 @2 K3 n' D& q8 g - * brief EDMA3 Test Application) Z& R" J$ y3 c9 @( v
- *% ~ q& C6 C/ _+ `+ L% w
- * This file contains EDMA3 Test code.
6 T$ d, y/ A, u$ E& U/ h" { - *
( P( c: d3 f# F5 x O" U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 L( r6 {, _8 `0 t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 U+ m. S$ w# S
- * TO CHANGE.
" O \/ v5 H5 l) ^6 ? - *
, N& V! }8 }$ t& E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% `9 H' n0 R0 [ - *
3 G6 E$ c3 l5 p - * This program is free software; you can redistribute it and/or2 u2 C7 b* `. l9 D- g, z* H: q
- * modify it under the terms of the GNU General Public License as$ q8 [! m6 V. N; d( s) K0 q
- * published by the Free Software Foundation version 2.
* t) m2 C8 i# V6 e* i) Q - *" O. g$ {8 }5 f Z B! O, t( j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 w* O- r4 s2 h: I - * kind, whether express or implied; without even the implied warranty! a0 [( w/ z+ s; @) a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( Q+ m$ x- H/ \4 ^6 H l/ ^3 q - * GNU General Public License for more details.
/ B4 v2 a! P# U( R) I - */
/ O7 d0 R. i* P( z l
$ ~ G* V# V+ T6 j! Z5 m- #include <linux/module.h>5 o( I' a2 j; s& u+ d; i
- #include <linux/init.h>
$ l m* k4 d8 m7 y9 G - #include <linux/errno.h>& e$ P+ P2 P# q4 C6 @' g. Y" y8 i5 p* g
- #include <linux/types.h>, f5 l/ U+ j0 E/ ]. R
- #include <linux/interrupt.h> C' }; @7 ~& M* B Y- {* f
- #include <asm/io.h>7 w1 D" a8 l7 k, J! `
- #include <linux/moduleparam.h>
" H0 L$ t# S- h4 C" e - #include <linux/sysctl.h>
% ~( v" `+ @ I# \% p - #include <linux/mm.h>
( r8 E' V o2 {0 y1 {& R - #include <linux/dma-mapping.h>
. h+ V! H% M8 K8 T; Y - % Z" F7 F' B5 e5 n9 t( Z
- #include <mach/memory.h>
) C: q) h2 ^+ H3 E - #include <mach/hardware.h>
% ]6 |6 o7 ]4 j- f, ~/ k - #include <mach/irqs.h>8 y. e: Z: O v0 l2 s
- #include <asm/hardware/edma.h>
; K" ]0 k( N$ c: Q. B+ v3 ?
5 B" J A' x( U. U- #undef EDMA3_DEBUG; p; E0 T/ i' M* m
- /*#define EDMA3_DEBUG*/' k2 m& y/ Y! m5 `
5 @0 H8 w4 W- A1 C3 X2 w- #ifdef EDMA3_DEBUG
7 J C6 @) ?; B( M+ p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& R- Q4 {& N1 M! n' j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 |% J, m, g9 }8 [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 }; p8 v5 |+ b \# G - #else8 j$ [) @2 Q- X! h" f! P
- #define DMA_PRINTK( x... ), v$ I; Y3 A4 c$ W/ x* l8 X
- #define DMA_FN_IN7 P0 G7 M% o9 w+ b9 G2 E
- #define DMA_FN_OUT) m! l2 e2 r8 Y7 W$ H" w( z
- #endif
" h* ]" S: x9 x5 r1 g( g - % @! h$ W4 O# x5 p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" e) `5 p3 j2 I9 j+ u6 d* {2 e
- #define STATIC_SHIFT 3
' P' d% F9 z* J/ Y! U9 u& V0 d - #define TCINTEN_SHIFT 20# a+ _. R$ V: y0 v( ~1 a
- #define ITCINTEN_SHIFT 21
: s# @) D$ s- O# {. S - #define TCCHEN_SHIFT 22
4 m# F$ B( B6 i2 n - #define ITCCHEN_SHIFT 234 k5 A) a9 f5 [5 K: E
- $ @6 i2 }/ h4 u% g; t. c& W3 ^
- static volatile int irqraised1 = 0;( M( g$ Q! S% i9 q' W% h
- static volatile int irqraised2 = 0;* j) j7 _* _% }" u) K0 C# w
4 o- Q2 ?) V1 s. L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' n( F" H5 P" E6 n3 } Y/ Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; @) \9 F6 b# O) m2 n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& P% S$ h. O4 w
5 P8 O" `) g4 A9 v9 b" @! B- dma_addr_t dmaphyssrc1 = 0;* h* F' p. i) o Z) e; N' c
- dma_addr_t dmaphyssrc2 = 0;# L, G: p3 b6 O* _
- dma_addr_t dmaphysdest1 = 0;
6 C! G% N4 j3 H- g - dma_addr_t dmaphysdest2 = 0;
+ _4 A1 {2 B7 D% [7 i
: { ?& s ^5 w- char *dmabufsrc1 = NULL;
, @/ d& v4 ^( B1 Y - char *dmabufsrc2 = NULL;
. V) z" p+ M3 |$ e - char *dmabufdest1 = NULL;0 w3 W; Q" n$ J. G
- char *dmabufdest2 = NULL;! A9 }9 Z8 l i! ?2 h* \. h. n
5 P1 {5 ^, [# ~1 B# d- static int acnt = 512;* U2 u0 c! a( Z! ^- z6 U2 c5 r
- static int bcnt = 8;2 k, v8 u1 ], r/ J3 n0 S
- static int ccnt = 8;2 B7 Q9 L) c5 F0 Q3 J2 X% |
- ! t% Y: ?; |3 Y4 a
- module_param(acnt, int, S_IRUGO);& T: Z0 N/ i/ O0 J$ `
- module_param(bcnt, int, S_IRUGO);
1 o% y$ N% ~0 ~, a8 I1 I - module_param(ccnt, int, S_IRUGO);
复制代码
5 m2 Y6 \& U4 O: A2 n- p5 J
8 R$ O: w( p1 m1 ~9 S. s8 d% s" A( @8 N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 E( H, q' }0 V* v: @! A* J9 r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* ~: ?7 u9 Z6 V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 O B" ?( r7 s8 J
3 n( M. Z5 U6 M# G) ]/ U$ L/ T) ]( r. @) G3 B, S
|
|