|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, P- p7 X% y1 n G; x1 Y/ K8 B- [code]EDMA sample test application
+ n+ a# c, U, I; _ - /*) z( [' B# i7 |2 Z
- * edma_test.c
( |4 ^2 ~: a$ A* ~! f2 R - *' b3 ?2 Q! b/ _! H1 j* U3 _
- * brief EDMA3 Test Application
0 \3 N# q1 D4 g0 ]. c& |9 n% x - *6 y4 p( T2 B' a$ r7 Y9 n
- * This file contains EDMA3 Test code.0 w& B# y7 G% v9 O7 M( E% L
- *4 y/ u8 O& \; M0 T" k0 Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! _5 x/ Z: C4 g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ W) T, Q8 V4 t
- * TO CHANGE.9 s& H% Q5 T8 R+ J
- *
, X- [1 z& Q7 R& e0 E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 e6 |7 @& Z. \0 Q- m; J - *
8 E! F8 K% b1 W6 R6 r) ? - * This program is free software; you can redistribute it and/or0 g+ E3 d+ W$ D
- * modify it under the terms of the GNU General Public License as
6 t% Q( L: x6 X( c& G" ]+ E - * published by the Free Software Foundation version 2.
: X7 @' ~+ I; [3 n6 B4 |9 @. V - *2 j% D7 Z5 g0 U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 q' ~/ l8 z. r/ y" C0 U) I0 i
- * kind, whether express or implied; without even the implied warranty
2 Y$ s$ _" w2 t0 n: Z' l8 Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: J* o" x6 ]8 E+ ?2 U
- * GNU General Public License for more details.
: z0 b& U/ L& t" T' Q) A6 p; Z* C - */
" G* z( t- L. ?* A
2 }& V! h9 f- [: A" N$ K/ u8 h- #include <linux/module.h>. W* c* M7 W. `+ G2 P5 h1 x2 K
- #include <linux/init.h>6 F8 p% x9 P) |5 P- `
- #include <linux/errno.h>" m. A1 E( p' g
- #include <linux/types.h>6 d' y2 }9 L7 Y$ r$ C
- #include <linux/interrupt.h>5 O3 P5 s- ^ F+ Z9 u
- #include <asm/io.h>9 p! K) I3 n/ q9 }) `
- #include <linux/moduleparam.h>* i) `, C. X, @( v& \
- #include <linux/sysctl.h>
) R5 q& Q% ` u" g1 M6 R - #include <linux/mm.h>2 J- G* S2 x/ w2 _
- #include <linux/dma-mapping.h>
" b5 {, e. ^' F) j( |! l9 L3 X - 6 C$ R( F8 F2 j$ D: H9 N# q. f+ }5 r3 p
- #include <mach/memory.h>; A& ^6 o; x! ~- y! @
- #include <mach/hardware.h>
7 N+ D& O, u+ J: l - #include <mach/irqs.h>: ^3 U! W5 ~# P. C E. t+ P
- #include <asm/hardware/edma.h>
# A1 J) g/ t7 C: I, L+ x
: C+ q- Y6 l/ l: g- #undef EDMA3_DEBUG
3 e U7 Y- Z1 x/ B# ? - /*#define EDMA3_DEBUG*/
) m; Y" O. ~0 l& R" b" y+ b - * h5 C5 d# e6 a
- #ifdef EDMA3_DEBUG
- P3 H# f5 \7 I- v" ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- z! Y9 o/ `9 y# l0 g3 L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; @0 {, H2 h6 v/ e. o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% u( n6 D& j1 k2 g5 X; R - #else' P1 s+ P: K# G6 P, f, @( V2 j' L
- #define DMA_PRINTK( x... )! J: ~ V; b o9 r1 C! n7 g: x$ R
- #define DMA_FN_IN, S i/ F0 h" W
- #define DMA_FN_OUT# @' w2 r9 b$ ?! ]4 c8 F+ _
- #endif
7 F7 u8 |% S$ L
+ n4 Q9 o7 S( r7 U) A3 F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% B, P, b) L! C0 j1 n& E. i8 E' C - #define STATIC_SHIFT 3
+ Z8 x0 R+ Y' V# } - #define TCINTEN_SHIFT 20
/ R6 P$ \* W4 m" h, V. E5 R - #define ITCINTEN_SHIFT 21
, Z# u. U* r: @2 X# A - #define TCCHEN_SHIFT 22
: E; X( F7 }3 @% u& @ - #define ITCCHEN_SHIFT 23
- S+ H- q3 W# r& _ | - 8 c* [' C2 ^# ~: i
- static volatile int irqraised1 = 0;( o- W- g; d6 g# W1 a
- static volatile int irqraised2 = 0;
/ T' w; R6 R7 l
2 D1 h3 E9 V8 ?0 k2 j. P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! F* d( o3 \* J4 J4 P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) R9 P# a! q& G4 v, a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, d% E9 A* V0 P; t
# z/ K: r O5 z/ j/ d0 E- dma_addr_t dmaphyssrc1 = 0;; I( G& {0 c& n, h" I" }
- dma_addr_t dmaphyssrc2 = 0;. w, j/ n9 p; N2 L0 `+ _
- dma_addr_t dmaphysdest1 = 0;& R& T6 E; ]5 u5 ^& i
- dma_addr_t dmaphysdest2 = 0;2 _) O% W9 Q$ ]4 g- M
, v' }0 V" S4 v; X- char *dmabufsrc1 = NULL;
5 g) g0 ~1 ~! Y' U5 N - char *dmabufsrc2 = NULL;0 w% B* Z/ X. Q
- char *dmabufdest1 = NULL;
5 u3 Z ^. o% V/ z6 G+ A - char *dmabufdest2 = NULL;
3 U" z% l! X0 w. m& _
4 b4 w: j' a2 |" X- static int acnt = 512;4 e8 K# C5 h" p( C- E. v1 z1 G
- static int bcnt = 8; R! F3 W8 Q) Z. f' f% a4 p4 x6 u
- static int ccnt = 8;% s0 _+ D, G" N6 n5 ]1 F% d2 {( _
- ' {* ~% V) \! p/ G; w
- module_param(acnt, int, S_IRUGO);- q" i2 j. e7 T4 r0 t
- module_param(bcnt, int, S_IRUGO);
X( S. t G# Y - module_param(ccnt, int, S_IRUGO);
复制代码
( d2 g& _7 t* L3 I- P% o: r3 i% t; a- u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# F" o9 k5 q u' c& e# a
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 Q: z) _, n. l2 }/ b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' ?/ k6 {% z6 E" @$ s% b2 W& X$ T. ?# N
* s/ X9 U* z' E" r0 V$ P
|
|