|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 g- u0 F# x" Q6 b% n+ q
- [code]EDMA sample test application
3 x/ R z7 f; D, k" \ - /*, h9 g9 ~2 D3 |, b5 F0 [0 J& O
- * edma_test.c
b1 Y$ l( M9 R6 l9 U5 |+ _ - *6 t5 w9 T- E. P `
- * brief EDMA3 Test Application) M/ n- i! {6 p0 b1 I; y
- *
* h/ ?' c: H+ ` - * This file contains EDMA3 Test code.
3 ^2 }' d9 t: W& t - *2 L5 s, P7 h/ ~! `6 }7 j% x7 y \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: E9 N3 |3 y4 a& ? w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; E+ O) o; t0 p! F3 e# ? - * TO CHANGE.
3 S( Y9 K9 Q6 v - *0 @" c" a3 d2 x0 S& ?# U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) `: H" p' f2 ~/ ~$ r
- ** d5 @+ l ^* i: F# i
- * This program is free software; you can redistribute it and/or- s6 I2 m1 E8 }5 s- K) A5 k
- * modify it under the terms of the GNU General Public License as
5 V9 s/ U! `. g8 z. J+ M2 C! z5 K9 O - * published by the Free Software Foundation version 2.! W6 G) [5 [8 k$ a8 _1 |
- *
7 A W" f/ n; `5 F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 f, D5 O: x: A2 F k
- * kind, whether express or implied; without even the implied warranty$ l2 \4 E% x- t2 x% U/ J
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ m9 y/ u2 }6 @6 _- e - * GNU General Public License for more details.: A. [- w1 [6 ~
- */, |7 V( C/ V5 y' i- Z) n* ?: u
R- a9 U( Z" s- #include <linux/module.h>
3 {# q. r) Q B - #include <linux/init.h>
# w3 l+ o# D4 Z) }& ?+ X, h6 g1 X - #include <linux/errno.h>* j& g: ^7 E- ?' \: a7 F- F* G
- #include <linux/types.h>
& z5 j, W* I* c( O0 V - #include <linux/interrupt.h>
& J( @2 K/ q- Y, I7 S' Z @ - #include <asm/io.h>. X. w( J" A: h& b
- #include <linux/moduleparam.h># S9 i x* l; ?5 m3 A
- #include <linux/sysctl.h>
$ |! X; u; @/ `; C& [% C! T5 R3 W - #include <linux/mm.h>, {/ h1 P/ h4 U, }/ N. L
- #include <linux/dma-mapping.h>$ M! U3 K, _' ]3 J& I
U: o3 C: r7 |$ a% v8 V1 o- #include <mach/memory.h>
) ~( _ q# S2 _. B$ R8 @ - #include <mach/hardware.h>8 q; O/ F2 h; e- B6 H2 D
- #include <mach/irqs.h>
* V4 E0 Q( o, D - #include <asm/hardware/edma.h>( q+ F& C1 ?: h
- / i- z/ g9 ?+ ^8 Y+ [! }5 S: t8 T
- #undef EDMA3_DEBUG
1 j. A& s+ h- I; F3 B& x' o3 a - /*#define EDMA3_DEBUG*/2 t. G# g, N' K8 p* U& m
$ T& Z) ?1 p, ]1 X/ x/ H- #ifdef EDMA3_DEBUG
6 L: d- G S' A& O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' @8 i O) F1 V6 U2 z) H9 N Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 o- X; | T0 z, [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): w9 b8 P+ G _& X* S2 O
- #else
7 u9 I; |2 h+ b0 U1 c; N9 V% f* s - #define DMA_PRINTK( x... ) F3 L# V! J5 s
- #define DMA_FN_IN# O1 b3 ?" P" A: `9 Y
- #define DMA_FN_OUT! J6 @! u2 N# K, C) ^3 N
- #endif
3 D: M. c( E5 r
- Q+ J6 v z' \ _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" V- P$ r8 M( h3 P8 D7 K* ? - #define STATIC_SHIFT 39 I: X, {1 e, K3 F8 m# ~ o1 ~ G
- #define TCINTEN_SHIFT 20" t* s/ `1 L5 D/ }* n" o
- #define ITCINTEN_SHIFT 213 u1 {: z; q- |- ^
- #define TCCHEN_SHIFT 22
/ c) x- T. M3 F% ]9 M - #define ITCCHEN_SHIFT 23! N: p+ z, M- V1 Z, O. c8 q
- & ]; @# S4 G: r# t; C- v7 ^: ~+ m
- static volatile int irqraised1 = 0;
B- G# r! T" I2 ~ H1 ]) W - static volatile int irqraised2 = 0;
. Q, z3 P! B- D3 d- o8 K+ G* S z - 9 E: G& i( M3 X! n0 v6 c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* R) O/ I8 o& E) _$ |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) h- e: B4 d% o- { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( T6 w' H8 [1 B5 s; _9 C3 @
- & u. N# r$ k8 ]8 c. V- E
- dma_addr_t dmaphyssrc1 = 0;( q, c ?! _4 N
- dma_addr_t dmaphyssrc2 = 0;
) g+ f4 O: c. X - dma_addr_t dmaphysdest1 = 0;
7 W; ^& z% q. ~* d - dma_addr_t dmaphysdest2 = 0;# }- K! |& r: ^ }3 ]6 @
3 J7 V9 o0 I& h5 T! ?, u m- char *dmabufsrc1 = NULL;
4 h8 H/ I* n$ M9 R& g6 C9 w - char *dmabufsrc2 = NULL;0 v7 ?" T: g( q6 v" A3 w, ]& t
- char *dmabufdest1 = NULL;
6 E; Q" a5 z3 y9 N - char *dmabufdest2 = NULL;$ `4 s% Z5 e; P+ ?% D
- 9 p0 Z* V G8 i M
- static int acnt = 512;
' K& p+ r) J+ B! m9 d - static int bcnt = 8;8 F4 |) B. n- S$ K' m# Y$ a
- static int ccnt = 8;
& [9 g7 A& d- x3 W; t2 C# W$ F! |2 b W
+ J+ n2 {- o* H4 x; x* K4 a- module_param(acnt, int, S_IRUGO);
8 W( c+ K: q3 R - module_param(bcnt, int, S_IRUGO);, h" T, Z6 b0 Z) r3 w
- module_param(ccnt, int, S_IRUGO);
复制代码 0 O4 U$ ]9 b4 d' ?6 v; i
2 w" F9 Y1 q$ t: K' _; D3 d. W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" Q( T0 [/ E2 v) i! @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ V( i9 l- W" X- t9 m+ d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 J' `: {4 A2 k5 M1 T [ C/ {$ h. P
, S9 ]$ ]1 `5 B; f9 k
|
|