|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 s% Q k u3 V! ^+ U- [code]EDMA sample test application
1 ~& f% U( h' [/ o8 V - /*$ p7 t" J4 n& D
- * edma_test.c; ]/ G. Y3 B; l9 b2 g
- *
; E( I" |, ?$ ~# r( ?4 T. ` - * brief EDMA3 Test Application
" o# G; |& i( {% T% u2 \' z9 A - *
: L8 D% q. n, ^; w2 P - * This file contains EDMA3 Test code.
. `$ v" }* ]3 J# j - *( ]0 f& [, u2 G% p3 l% L; q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 b0 t4 A$ K: [! b/ e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ z1 k; s* O4 Z' F h" p4 d
- * TO CHANGE.
4 S$ r& b4 _# `( Y4 }5 h) e - *
1 ^2 Q! X8 d$ t | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 `- m* R, F# M; `* o2 b
- *1 t Z: ~2 M' }7 ?1 ?& @4 r
- * This program is free software; you can redistribute it and/or
7 n0 D2 R5 l) `2 [, Y6 ` - * modify it under the terms of the GNU General Public License as0 Z. g4 E1 Z1 i
- * published by the Free Software Foundation version 2.4 J) ]2 z; H- o2 r9 W
- *
% F: _# v8 S! E; j3 ]/ c+ J. s2 I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 t6 _+ r5 j) P! g# O - * kind, whether express or implied; without even the implied warranty
6 o# Q) e1 j; A% m" j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, }2 b( w( k7 b& `* t - * GNU General Public License for more details.
+ g: w! A' C3 Y - */( j: M) G* W1 Y
$ i" l: D: c: y4 {- #include <linux/module.h>
& g2 G5 E x$ N3 b$ `; W* { - #include <linux/init.h>/ J1 Z% f; J2 s8 N( \& t: B
- #include <linux/errno.h>
) h2 \7 _/ O& P5 x" L - #include <linux/types.h>5 Q1 t; J5 F3 S1 K
- #include <linux/interrupt.h>
( w) B4 G z* K6 L+ D" G; D - #include <asm/io.h>, p* r9 i. }$ r7 i% v ]2 i8 S5 ^' K- ~
- #include <linux/moduleparam.h>
* a; H7 i0 l$ Q - #include <linux/sysctl.h>5 b, g: F; m' M+ j
- #include <linux/mm.h>
2 g% b% I9 N2 L5 E M8 m - #include <linux/dma-mapping.h>9 p9 F; P6 L9 ^. [# I
- $ ]5 l! W" D: D/ f* [7 k3 n! g& [
- #include <mach/memory.h> T/ V8 u+ W9 @' f7 `
- #include <mach/hardware.h>
3 k& n, n: j" J$ f* p2 G - #include <mach/irqs.h>- G7 r& N3 }( c E5 C$ A
- #include <asm/hardware/edma.h>
3 w% {0 p9 i8 a4 ^* J - e+ @0 |) N4 x- X O
- #undef EDMA3_DEBUG
: z. O$ |: b: v; E - /*#define EDMA3_DEBUG*/
" ^5 Z2 \7 p. `$ P' J3 q - 3 c- o+ Q6 ^% A3 `" F' U
- #ifdef EDMA3_DEBUG) E# W# }& O: O1 c3 g3 S5 _* s$ J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 H, o. p+ L$ s* |; @* } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" G2 N, z# D" W, c7 \0 a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# X! l2 N0 c6 u - #else g2 a$ B( r: `, ]
- #define DMA_PRINTK( x... )/ n# D$ y- w8 Y! c3 p: K
- #define DMA_FN_IN
+ E( F0 K7 v' a& P* C0 } - #define DMA_FN_OUT
: d4 O$ L5 O. t2 U$ B6 z- @4 ^/ { - #endif
3 [, s' n$ m9 B2 Z# G/ e$ S5 h
- W; S. q5 ^+ d. Z- C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* B. L7 o i6 X
- #define STATIC_SHIFT 3, |1 ~# W6 N5 f3 w0 ]( d
- #define TCINTEN_SHIFT 20- @2 L- O$ W3 c- l) @ m7 K
- #define ITCINTEN_SHIFT 212 B6 K" t# A6 y7 W4 X8 F
- #define TCCHEN_SHIFT 22
4 X9 v3 B' X/ R' m; [1 s - #define ITCCHEN_SHIFT 23
4 @8 U3 G: U+ G( f# X$ n - ! _. C* Y% I! C Z
- static volatile int irqraised1 = 0;& i7 o, Z7 e4 P5 b
- static volatile int irqraised2 = 0;
" p9 N i$ o8 A8 X; K - ' ~( G" K0 S v# c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- d) V0 c5 A# @ a0 y" _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 a3 {# V7 q% ]1 H8 I" t5 M2 | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 h( x9 ~+ @0 h. T
- ; J7 \1 {& [ E# ]% _" ~7 H
- dma_addr_t dmaphyssrc1 = 0;" \) M, t/ Y* }0 T5 P
- dma_addr_t dmaphyssrc2 = 0;; \; h7 Z) f2 R
- dma_addr_t dmaphysdest1 = 0;. v# u# F. {! C! q* E# W
- dma_addr_t dmaphysdest2 = 0;9 }9 U& \6 q" e! s
- ) A2 G. D9 [. A; X2 @+ ]: a' @
- char *dmabufsrc1 = NULL;- N0 s( A- [0 |6 x* X; L
- char *dmabufsrc2 = NULL;' I2 p5 h' i9 S. ~/ E
- char *dmabufdest1 = NULL;
5 z: j4 W8 o! d8 j3 l' u3 e0 I4 ` - char *dmabufdest2 = NULL;0 R) m# J" q4 X; ~9 \" U2 v: b
- 8 I9 E u" t4 Y% ^: {# i6 Q
- static int acnt = 512;1 v p C: I7 j
- static int bcnt = 8;" h; i- o2 {/ U% o- m
- static int ccnt = 8;
$ u* u* U% {4 L# c - : r9 Z; A9 R; U" O
- module_param(acnt, int, S_IRUGO);
; n( `0 h) d1 E9 D5 b - module_param(bcnt, int, S_IRUGO);& ~! l8 Z% U0 H! ^3 e. F6 V
- module_param(ccnt, int, S_IRUGO);
复制代码
: ^3 P. k, T9 ~9 {: E: R: V& l/ x( S
/ W7 v0 @) u4 r8 P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 O& n7 j+ E4 D7 K( O8 A* d1 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 g$ Q6 h7 W' E# u2 b5 W+ W! ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 w. _/ p" C3 B5 o: O
: }. Y6 X1 J. K/ j6 I0 S9 H
2 m9 Y6 v6 X ~- p |
|