|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! t" P X F- t# p
- [code]EDMA sample test application
5 s& {" ]6 P& ~$ v - /*) d z7 `5 E7 ]5 u3 x3 }
- * edma_test.c7 c5 l8 C `+ n8 z0 o. [
- *
5 G% B A" X, u' @ - * brief EDMA3 Test Application. d! v6 o6 ?! w% Z% N; O& b+ c
- *, p) S! R' Q" W9 j, u9 Z: X* a1 q
- * This file contains EDMA3 Test code.1 Y5 o) E# s' f1 p0 J" d7 {4 f7 O
- *
" @+ z1 u' Y# n3 i" k: G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 e* _3 Z0 W% Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 T4 d Z7 C: |( K
- * TO CHANGE.; i- A! e$ w) y9 f
- *
! K5 S0 u8 v5 z# O6 s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 U t2 H: m3 J3 {
- *6 T; E; n/ N6 t# \4 V
- * This program is free software; you can redistribute it and/or, M; e8 r. I+ D5 C- z" s$ x. l
- * modify it under the terms of the GNU General Public License as( i1 o# j* b% m, p$ W; b2 R
- * published by the Free Software Foundation version 2.. w+ I. F0 t4 f& o5 p
- *
; A2 S: B4 N& [) d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 S9 ~" E: a$ N
- * kind, whether express or implied; without even the implied warranty) L# c; ?2 q! I9 q6 X' K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 G% e& r [9 \. y `' o( ^8 o% T* F
- * GNU General Public License for more details.
: o6 N7 C# @' ?* R! P0 r - */2 J* I* I& E+ U6 d' J
# ?7 |7 Z. K. x6 K- #include <linux/module.h>7 H D" L: `0 p e5 ~) C
- #include <linux/init.h>
, b2 A8 Z/ h1 ~ - #include <linux/errno.h>
/ e5 Z6 m6 B4 K) f - #include <linux/types.h>
4 x' w y& t2 a9 C - #include <linux/interrupt.h>
, ?3 c h2 A0 Z1 f7 P( l - #include <asm/io.h>3 p( |% c5 N; O/ @
- #include <linux/moduleparam.h>4 r) w) H1 N1 p: W8 _7 P
- #include <linux/sysctl.h>& n- a! Y0 b; E
- #include <linux/mm.h>% a. f, n8 \7 e; a( W9 z& m
- #include <linux/dma-mapping.h>
& g$ W7 `! X/ ?, ~0 ^$ W& N P+ \9 }& Z - $ e# P# L& n/ Z% {
- #include <mach/memory.h>
. S1 \* w$ L! d) J: q: U - #include <mach/hardware.h>0 W% s) i! l" b# L# N1 A w
- #include <mach/irqs.h>8 ^( E! @$ [, f; Y9 ]$ M; B9 _/ U6 H
- #include <asm/hardware/edma.h>
; m) c, x) x5 P* g% w2 h: |9 B - ' W" T2 M0 }, m& @
- #undef EDMA3_DEBUG
4 m2 o2 d3 R3 ? - /*#define EDMA3_DEBUG*/+ W% y$ v, d5 g0 j8 ~& ~
- - y& R3 V5 r1 o2 [9 ?" T# b
- #ifdef EDMA3_DEBUG
: U* P/ `9 l( t! j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 c' L% Q) M0 ^% P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 S, P {6 A" ~1 M3 U4 N9 |+ W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- T! z; B; ?" h/ u+ S; v7 {; B - #else0 b. K* ?0 d" E4 t' t& [0 b
- #define DMA_PRINTK( x... )
# _/ E, ]3 L: I- W - #define DMA_FN_IN2 b! | u$ a; w6 O7 |6 N
- #define DMA_FN_OUT; {2 P' x/ D Z# [( o* W* X; _6 C
- #endif+ I0 f' r% {) C' k7 I4 A
- + {3 o$ m+ S, c/ v, E+ f) d% @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 F, b% Q8 V4 | - #define STATIC_SHIFT 3
( Y; G0 u" q: i8 X - #define TCINTEN_SHIFT 20% _* c$ y, E/ f* A) M7 ^3 g& J; H
- #define ITCINTEN_SHIFT 214 k, v5 T3 v$ x' ~ @) B! j
- #define TCCHEN_SHIFT 223 \, B4 n" Y* O$ a
- #define ITCCHEN_SHIFT 235 ~/ [$ h2 W! Y* N+ \% L
; \3 A4 S0 Z# i- static volatile int irqraised1 = 0;* J' L5 ~5 y4 E1 J- z
- static volatile int irqraised2 = 0;
u+ t8 ~0 K/ A$ A. A
% o+ ~, y! W# j4 \5 A8 L6 ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 e% [. m: I0 a9 M$ ] c. v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. R9 n7 A' G% u
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 k) n( O/ r+ t. b
- d3 F0 |# }, w4 D3 T' v! h1 V- dma_addr_t dmaphyssrc1 = 0;
8 v0 _; R& a3 k) u, i - dma_addr_t dmaphyssrc2 = 0;( U5 t' L! M. V- J/ @0 U
- dma_addr_t dmaphysdest1 = 0;
- |: v! U: [' R& c* y* a - dma_addr_t dmaphysdest2 = 0;$ ^* _# }, G/ N+ j
& ]( ~6 V& K! y5 ~ O8 |- char *dmabufsrc1 = NULL;% ~) f: @% \8 W& A
- char *dmabufsrc2 = NULL;; [/ L* W1 O4 u% w- |
- char *dmabufdest1 = NULL;
, w& A% M6 m5 L, U& }. x1 s8 S. ?4 M - char *dmabufdest2 = NULL;* M& f. j2 ~' S/ m
- + W& q5 _4 B& c* \2 w0 h; @, V" D
- static int acnt = 512;
' T% O* r' L/ B, t9 } - static int bcnt = 8;& l0 R3 K) O; y4 I4 o1 K1 N
- static int ccnt = 8;
1 i# i C$ p/ ^7 }* N - . J5 p2 O/ g0 I' M1 u7 [% u
- module_param(acnt, int, S_IRUGO);
- |/ I7 c! W+ R' i - module_param(bcnt, int, S_IRUGO);
. Z4 D. b9 P3 G* I s- Q - module_param(ccnt, int, S_IRUGO);
复制代码
! n) s/ L8 Z [9 F1 `. J! Y* `7 ~1 I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. w6 l( V: A$ x9 n1 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 X0 s. v8 U& U5 p( _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 N* T. T8 m& d1 V; [
3 w$ s, A" `8 o9 S. P6 F$ V% U( f! z. r' U* `' q/ ~
|
|