|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 K, _- w A0 x0 }6 H- Z
- [code]EDMA sample test application
8 Q8 ]0 {- R* q) c9 b3 G/ l- ^ - /*3 m! W J8 _9 _
- * edma_test.c4 _8 K& Q/ \1 b* W& j6 e
- *
! V- D. z0 s# t6 r) Q - * brief EDMA3 Test Application/ t; x% K3 x% y- N6 J
- *2 Y6 a: M8 [" ^. s
- * This file contains EDMA3 Test code.5 ~9 _- v/ R. n2 l8 g
- *
" A( y& e& r$ m/ r8 M# C+ P% L+ w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# [, x1 b& t6 @) j/ V: Y- v. a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 f/ G* [) M2 Z' r - * TO CHANGE.
+ P5 K& W9 P; `, n1 e - * Y6 R. [: n# k l) X: v' }* C, r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 G0 K& C. J/ E& ^9 g( ] - *
$ F( Z) b1 ~ ~# _7 t) I I - * This program is free software; you can redistribute it and/or
- S' Q9 D7 L. V* e, d - * modify it under the terms of the GNU General Public License as' x) C& |9 m8 ?1 j
- * published by the Free Software Foundation version 2.
2 e- ~" a3 H9 S- u5 }$ n& R - *
# `# C+ P N( U& b4 O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" D5 N+ T2 G/ \3 Y7 [$ g$ s
- * kind, whether express or implied; without even the implied warranty5 L7 \8 O6 ]/ [( K4 z1 B% T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 T* n& a7 W6 a. w) t9 T - * GNU General Public License for more details." S! ?& j" t3 ^/ L3 k6 F n/ o* |! y
- */8 f& G. r+ V. |* ^
. _6 H. b: p; w; a7 U9 k% ^4 J% a- #include <linux/module.h>
4 J, u3 I/ T9 Q5 m; [* e - #include <linux/init.h>0 I/ K! h. O( A: b' b2 g
- #include <linux/errno.h>( O- o8 Q+ c8 F, p0 x1 ~7 G
- #include <linux/types.h>& U/ W3 l: T" D. s* B
- #include <linux/interrupt.h>
/ J' s4 m. V' A( K. j: r. m4 s - #include <asm/io.h>3 l- j. X, ]0 ~5 g3 R
- #include <linux/moduleparam.h>7 G; C. G0 R/ u& |
- #include <linux/sysctl.h># U. M+ ~, z7 Q8 Z; T
- #include <linux/mm.h>
' w; h. B6 u5 _2 j! G - #include <linux/dma-mapping.h>0 T3 d+ p$ I. D' K
- $ C1 H) z" c) M5 J# Y
- #include <mach/memory.h>
- }+ O- k& {6 R `( Y2 D9 c - #include <mach/hardware.h>
8 E6 t- Y9 J) F5 Z - #include <mach/irqs.h>: ]! N G4 P$ [! P
- #include <asm/hardware/edma.h>8 x) B) [+ [9 a# A! m
- : ] k4 v5 S" [/ R! \
- #undef EDMA3_DEBUG, L8 f W+ m3 @
- /*#define EDMA3_DEBUG*/! H# \1 o, o& g
- 0 c {) m: w' ?: `0 A
- #ifdef EDMA3_DEBUG
8 l5 U, j1 b0 e: j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 C5 X5 p/ W0 P+ E6 H, l: W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), ~* l/ @" m5 F3 m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" `6 e( S8 m0 \( ~ - #else
, V; [" Z3 b' ?0 ` - #define DMA_PRINTK( x... )
* n5 z. o2 \' X5 P6 k& J! w( H - #define DMA_FN_IN6 v$ G+ A& _) o% |; k
- #define DMA_FN_OUT3 E# H8 [ U3 B+ M- R
- #endif4 Y) t4 r. i8 u+ N$ s/ H, V
- ; U2 k t4 g. ]! i/ u- T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! Z% T0 O' M, C5 I2 N8 X
- #define STATIC_SHIFT 3/ K6 |6 L" V: c7 y9 Q
- #define TCINTEN_SHIFT 209 u+ s" N4 u: P
- #define ITCINTEN_SHIFT 21
# C) W' @! y( V( J - #define TCCHEN_SHIFT 22. @6 A( M6 S3 l6 v4 ^+ P- T) f4 f
- #define ITCCHEN_SHIFT 23 S( a) }% F! k
- 6 N# h, R o& Q; `; J0 \2 D" K
- static volatile int irqraised1 = 0;
2 x* ^2 D3 X7 ^8 d - static volatile int irqraised2 = 0;
4 _4 ^5 h) @, n7 ?- A
1 J Q0 @2 ~% g4 b! H0 M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 E; [" _+ m. W* o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 x$ @" t: [" y% i r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 B/ J0 X! O! z Y' M5 J# H
- 1 n) `: T: {, i+ z
- dma_addr_t dmaphyssrc1 = 0;9 j: A1 S1 @. h
- dma_addr_t dmaphyssrc2 = 0;3 ?3 w& k- ]# u) g {. `9 H1 _
- dma_addr_t dmaphysdest1 = 0;' q" B( P$ m. J5 @* Q
- dma_addr_t dmaphysdest2 = 0;; r- x# f) E- @) t6 s* X$ g
, F" t) U7 U8 F# t; h0 I- char *dmabufsrc1 = NULL;
5 I' M1 n; q7 Y+ C1 L - char *dmabufsrc2 = NULL;
/ T. F: m" G. i) Z0 R8 s - char *dmabufdest1 = NULL;
( j" d. p) @; G! @# w) x0 X9 Y - char *dmabufdest2 = NULL;
$ N9 d3 c0 r! @9 ~! V; }
$ \7 u$ e. H! e' y- static int acnt = 512;
1 D3 n( w- x. W) v- ]' C - static int bcnt = 8;
: L, ?6 k! ~0 b - static int ccnt = 8;
1 B0 Q# }! c, k6 _0 X5 l7 c+ V
0 [1 l+ K; R1 `: x! G- module_param(acnt, int, S_IRUGO);/ k+ ~2 [$ d$ B7 F) K; x# F* e1 D
- module_param(bcnt, int, S_IRUGO);% A1 w& T; C) u; h- @3 D
- module_param(ccnt, int, S_IRUGO);
复制代码
" |6 H+ B! k5 W& y* O! E; }
& u, F2 `! c- m. [5 t! L( ~- e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 U6 f+ [/ x1 }2 F Y" w1 C# Z# Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 L+ \0 m+ {2 g! a7 s& I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ \- {3 C% b9 I! J/ M, [7 M: u! S+ H& w4 m
8 F E. q8 B8 w- O) S8 E |
|