|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 ]5 V+ d) x8 z5 ~, G. t5 |. ]
- [code]EDMA sample test application
7 n- [( Z A! |# `9 w0 a - /*5 s- C6 O9 Q( } X1 q \
- * edma_test.c$ {0 _2 ^/ s: N8 B
- *, U M- p r4 X" r' y5 {
- * brief EDMA3 Test Application
i& S. w- L# b, v - *
5 p. ]+ d" C& b# v2 N - * This file contains EDMA3 Test code.! F% k r$ i9 ]3 q8 E
- *
8 N$ h& l3 z2 g9 j! v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: y4 _2 I: l4 B1 [2 p7 P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! _. _9 F% A2 W - * TO CHANGE.
. u8 \9 ]5 i) R/ P9 t) a2 `% ` - *
7 Z; F4 O0 K! x2 x# ^, ]% A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 j2 v2 t* _, [/ q - *
2 A* W# B& `1 u - * This program is free software; you can redistribute it and/or7 @) ? y5 l1 ~3 c% D, R7 u
- * modify it under the terms of the GNU General Public License as
1 a; V& P& W; n. y9 W% P - * published by the Free Software Foundation version 2.
- n! |5 n7 G- ]1 Z" Y/ p6 B - *) H2 ~3 {+ J i/ f2 M. V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 }3 t3 d, `' h e& M1 Y; I! p* h
- * kind, whether express or implied; without even the implied warranty7 Q5 ]+ B# v$ J. x/ X- {+ k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; j5 c/ J* b J6 y& v - * GNU General Public License for more details.
+ O( M9 h( O% q" I/ }9 s# {- L - */- N# e' J4 X+ W4 G- [# _
- 1 r$ j8 V. a4 n2 x. L m
- #include <linux/module.h>
M0 K9 w9 x, a - #include <linux/init.h>- r% h% y0 ]; Z% J. r, }
- #include <linux/errno.h>
+ j. X% {) P9 B' z [ - #include <linux/types.h>3 N& E% O3 Q# s6 C
- #include <linux/interrupt.h>
' \! `2 c0 D$ z+ O - #include <asm/io.h>6 s/ O7 w9 \! e) J/ L) h
- #include <linux/moduleparam.h>
7 m% F8 Y# F, E1 W* H9 @ - #include <linux/sysctl.h>
]4 W& i% E( M% @) K% { - #include <linux/mm.h>
0 U+ i8 C+ f6 K) X/ P; ^: ^ - #include <linux/dma-mapping.h>
3 S, Q, B5 z1 B3 ^1 k5 G* F - 3 C! W: _! l+ V. ?$ j; S
- #include <mach/memory.h>, k7 Y' w( [! K. j2 H6 ?
- #include <mach/hardware.h>) `: l5 P: ~3 Q! J5 c3 X
- #include <mach/irqs.h>
$ {- C: i' C3 h+ c) N7 ?# l - #include <asm/hardware/edma.h>7 u; m- w0 Y P/ M! e) ?
6 C9 b5 _5 z3 w8 s6 y* [4 s$ R; t- J, ]- #undef EDMA3_DEBUG1 ] n) ]+ X" M5 E& S3 e
- /*#define EDMA3_DEBUG*/, ?6 z: A2 y8 x" w T7 z; B
n0 h1 V% f! l G- #ifdef EDMA3_DEBUG
/ o( _& A1 Q& Q7 e7 C. G1 h# @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 t, S9 I, P# x: r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! W# V8 W% T- z2 n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) {. }; y" S& z: d+ ]& \% Q/ H! Z - #else
" K" p, {& \* Q" w& _; F - #define DMA_PRINTK( x... )! y1 [3 r" ^5 P0 B4 f
- #define DMA_FN_IN
" E6 E! M4 Y. o8 g# o# | - #define DMA_FN_OUT
4 K# R j; g$ s6 h- l( u - #endif
# K! W/ ~/ L7 t4 E% A8 X& X
6 R+ r1 ~' L. \1 u: `3 h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- {$ z2 |, a' z' h4 p' S( P5 G- l
- #define STATIC_SHIFT 33 M& O# D6 i: ^! ~5 g
- #define TCINTEN_SHIFT 20) I: U" Q$ M$ k7 T9 H! \. V
- #define ITCINTEN_SHIFT 21
3 h1 G( C8 b8 Q5 `" l: k - #define TCCHEN_SHIFT 22" f- \/ H8 F' \, S6 @9 G1 @, Z
- #define ITCCHEN_SHIFT 23
3 ^7 f/ a9 h* _ - , u( p" e2 d2 I4 p" `
- static volatile int irqraised1 = 0;- w5 \2 x/ W5 p# Y/ V
- static volatile int irqraised2 = 0;
7 n5 }& B8 ~" z+ z) v5 R' b - ' g+ h" d% U: k6 z# J9 y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! j- X; @5 j" \# V9 T/ L1 L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! k3 h' P4 A& i5 S6 G! m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
j1 w3 N3 V2 Z/ Y. V - . H& c- i6 ?6 |8 \( d
- dma_addr_t dmaphyssrc1 = 0;
' ^ F+ W7 e" I6 n - dma_addr_t dmaphyssrc2 = 0;
0 Y% M1 j( S7 A9 v" D - dma_addr_t dmaphysdest1 = 0;
- u Q8 q8 ?9 V7 I - dma_addr_t dmaphysdest2 = 0;) e3 s0 f5 V3 o1 F0 ~8 p% A
- 1 N' S- q" J ?/ T
- char *dmabufsrc1 = NULL;9 n/ P; j$ Z, z/ s
- char *dmabufsrc2 = NULL;
, g; ]+ r6 E# I# b& |. ] - char *dmabufdest1 = NULL;
Z0 V$ e2 x5 P. y - char *dmabufdest2 = NULL;1 q. v. H% R# R
- . z$ |! Y" X$ [
- static int acnt = 512;
1 K2 Y+ g# n2 m6 c7 `5 U - static int bcnt = 8;
+ r) Y5 ]) K( N/ A, X - static int ccnt = 8;
. P2 E; \. I. c, h6 t
2 ] e: q9 D* q& u; s- module_param(acnt, int, S_IRUGO);
( r6 v# x V9 W; v: C" U& S - module_param(bcnt, int, S_IRUGO);
8 }: |0 }3 v5 j: _! o - module_param(ccnt, int, S_IRUGO);
复制代码
5 B3 S6 z" ^2 K) J+ a. T/ t& x. H% d8 Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 W: `' c6 O3 Q" S9 Q9 `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! Q1 w' B8 }, _) b5 L' s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; m: B; ?) w. d) W5 g7 t( r( l. K: X- l$ c: f& V
+ c% A+ M% D* O" W) i4 _' @
|
|