|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - u/ p3 m6 h) l- A& Z
- [code]EDMA sample test application
$ R# k1 b! Z# g7 K- M8 K7 m6 O - /** }& I0 a( U7 \. F9 p" @* s
- * edma_test.c( f2 I0 `! v9 d
- *9 N$ y% y% A* P) S. o
- * brief EDMA3 Test Application+ w, F" p- ` n1 r" T# t1 ^, k4 }
- *0 ]/ o8 b: {% h5 a" o9 U
- * This file contains EDMA3 Test code.0 l3 S n' j9 r
- */ j% [; h+ |8 L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 Y) |! l0 |+ H$ G+ R! L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 }/ M- \1 M3 D9 i0 K0 o. W - * TO CHANGE./ m; B# u: [7 y9 z- n. V/ W
- *
6 \& k& c2 I A* ?2 b8 v. K: { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; f; K' _" h, d- q- `( c
- *
2 d2 a/ V2 h$ ^+ i( S( y" D - * This program is free software; you can redistribute it and/or% |9 E3 L/ V& c2 S0 k
- * modify it under the terms of the GNU General Public License as, n8 | Q$ X# j0 h
- * published by the Free Software Foundation version 2.
0 k) E/ [9 ~/ S) J. [ - *
: a2 k6 S! R- L( m' { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 P* V' m% |6 `7 c - * kind, whether express or implied; without even the implied warranty
" l5 L! Q3 C9 X& A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% l& @, b7 R3 s - * GNU General Public License for more details.
' C" _# G- v2 ?8 z - */
# u. W! v/ [% v* K- @) _& E - ) R- y) p1 c8 |1 p
- #include <linux/module.h>
" q! |! X) ]9 {+ c7 y. ]5 @9 r - #include <linux/init.h>
# U1 D9 [! O( q* C5 b - #include <linux/errno.h>
3 A# R5 P' X1 a; Z5 B& T - #include <linux/types.h>3 O5 ]5 D( g+ G7 }. x! y
- #include <linux/interrupt.h>) x1 u, f* P; c$ H# X$ x
- #include <asm/io.h> O3 N0 `2 L7 A+ k
- #include <linux/moduleparam.h>
* y. \( e3 w) ^+ @* g6 z0 P7 f8 z' ?. v - #include <linux/sysctl.h>
: A0 B7 `/ o$ F- ~ J( m" r - #include <linux/mm.h>
% g* d0 {, S. q* H' K0 N, c, w3 D - #include <linux/dma-mapping.h>
1 V p" s5 A/ N- A - 3 w- p9 Y! Y5 J: o
- #include <mach/memory.h>
# h! \. {- m- r" d; Y8 G6 Q - #include <mach/hardware.h>8 X( V6 C6 d1 q8 Z
- #include <mach/irqs.h>
5 C0 ]) }. A( K+ z# {2 b - #include <asm/hardware/edma.h>. G% S m' \ x6 a/ o
7 ]& N) r" x5 a, v- #undef EDMA3_DEBUG
+ @1 X! v, k, I+ u0 k0 s - /*#define EDMA3_DEBUG*/
& K) ]4 p9 h7 w, x1 c6 m6 H3 l - / D/ ~7 c& d y2 _5 J
- #ifdef EDMA3_DEBUG
6 f5 |: a, V* M7 ^( m/ O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% R8 U9 T% F- m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
`4 w8 \& i7 m7 B& Y( M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" M8 \2 I+ J$ w% ^; Y9 y* l - #else; j, F" ]+ m' y
- #define DMA_PRINTK( x... )" l7 p4 [( [; l' K$ ~
- #define DMA_FN_IN
. t* o3 f, `3 L! B3 J7 J% z - #define DMA_FN_OUT
! ? ~& h4 ^0 G: D - #endif6 G/ ~8 s! H! E$ x" ~
- * p$ D: x. v4 r0 P* E2 P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ e5 g! U: l% p1 ]$ r - #define STATIC_SHIFT 3( }% {9 }. [; z) [7 c. D
- #define TCINTEN_SHIFT 20/ [( W" i9 l2 t7 C# x* |: L0 K
- #define ITCINTEN_SHIFT 212 H/ J6 j3 z2 D; s3 [
- #define TCCHEN_SHIFT 22
: I8 n. J+ j- t0 L - #define ITCCHEN_SHIFT 23
0 }! N# @" \$ r& k - 2 s4 ]% h2 O1 q
- static volatile int irqraised1 = 0;
% N9 U+ @4 r9 K2 y5 s4 Z - static volatile int irqraised2 = 0;5 i# t* {' O. [1 H1 z" u; j, e
- 3 E# d" P( H' l5 D! P* m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( b- I/ K5 Q8 e/ l* N3 c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 u, {6 w7 z& P$ w* w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ U" M& j9 K9 F- ^7 ?; g! m
" `2 R. ^/ e" ~! h2 U- dma_addr_t dmaphyssrc1 = 0;
b9 x6 a) q4 a4 f; v9 {* O - dma_addr_t dmaphyssrc2 = 0;
: V5 ^3 u0 G) x3 M' T! E" h# ` - dma_addr_t dmaphysdest1 = 0;
- i. J5 E9 t+ e1 S( g - dma_addr_t dmaphysdest2 = 0;# W* V$ `. y& h2 A- X. S: h- Z! N
- ; B, |- t2 M" b7 l+ B( r: B
- char *dmabufsrc1 = NULL;
* @ T# [$ T" V - char *dmabufsrc2 = NULL;( z) W6 e. g7 e) U- p/ \- m0 K' L
- char *dmabufdest1 = NULL;+ m( g1 {; o5 Z
- char *dmabufdest2 = NULL;
& U) l: y) l: |; P! e8 t1 X- G - : {5 t9 f5 p# C: d7 h
- static int acnt = 512;
$ u1 g+ R7 w; e6 P - static int bcnt = 8;% n2 X9 N2 e7 H5 `: D! o
- static int ccnt = 8;! M f( U0 p8 e) m6 l! R
- 0 Y6 t, c q4 A3 ^9 F1 Z" y
- module_param(acnt, int, S_IRUGO);& U/ C! |! ?8 k; F4 {9 [7 ^7 B
- module_param(bcnt, int, S_IRUGO);% a# _. P9 S1 F! W7 \. Q
- module_param(ccnt, int, S_IRUGO);
复制代码
% `3 t: m1 Q3 J
6 [' V. Y) y! p# J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# d2 M' x1 f5 B/ a( F) }8 c) iarm-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! M: T- X5 U) c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; q0 q+ o& o; X* K' c3 C* r8 s" g4 {4 l6 L
* ?2 B5 x8 A/ s, J( Q |
|