|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 k, J+ _6 d7 j' W3 a( [. K- [code]EDMA sample test application5 ]! X# f5 l; z9 G: N
- /*
, \9 V; f7 U! \8 L' u# [; s3 _. H - * edma_test.c
9 I! b }* ?* S' Q+ d - *
- @; T6 D/ U' V. ~, s. {/ N* G3 E - * brief EDMA3 Test Application
9 P \8 z( A' @; @! N# P2 a - * w& y% A1 J: I# ?; r! _9 K- @
- * This file contains EDMA3 Test code.
/ V6 C) Q6 h+ Y - *
3 F& q- e) y7 Z: E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; W7 G N' @7 l& x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# P# |' b) B* Z$ e9 j. G1 R h
- * TO CHANGE." { u! {( {, W2 |+ |; k+ }* T% r/ g" V u
- *
/ m5 v) \& W, M3 ~. H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. `+ f# Y; n/ k
- *$ E- A, T$ `8 b, j6 g, J
- * This program is free software; you can redistribute it and/or1 V) ^) {/ o* I
- * modify it under the terms of the GNU General Public License as' R) N; d4 }; L: \+ P
- * published by the Free Software Foundation version 2.
9 S, |1 Y/ L6 r- w! z - *
9 w3 Y, i7 V! a" m8 t5 q5 J9 j( S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ J( I9 E" A7 \& w$ I; U2 F
- * kind, whether express or implied; without even the implied warranty
|7 x$ _! H' N e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: L* ]% E5 U8 D6 Z r9 `) Y - * GNU General Public License for more details.
7 J- D' N6 c% p2 r3 g, ~ - */# d. A* L9 o8 j4 \
- $ O; F- U! Y% q$ K$ r* X5 Z1 v
- #include <linux/module.h>! y# Z( P% K6 q
- #include <linux/init.h>
. `: O, a O7 D0 ] - #include <linux/errno.h>
- i: U8 a$ d' u) h1 b - #include <linux/types.h>
- F/ g. ?4 U5 y3 C; W0 V - #include <linux/interrupt.h>
, ?, \% g& X( D" t6 M. L) D: `# O - #include <asm/io.h>. l' P% z! f; n" e, k
- #include <linux/moduleparam.h>
: Z- R s/ s9 l/ U - #include <linux/sysctl.h>' n, R% S, u" q# ]- z
- #include <linux/mm.h>
1 h1 W+ m! ]- k* A$ d" D - #include <linux/dma-mapping.h>4 l9 w# p$ w! Q
- 6 D2 f# n$ b) Y7 N
- #include <mach/memory.h>
- Z1 x- p3 H K. z" { - #include <mach/hardware.h>
( p3 M* _' E3 }5 q- b; g - #include <mach/irqs.h>" K/ ?- T* n* H e$ a' ^9 h! M* O1 }2 Z
- #include <asm/hardware/edma.h>5 D% h( ]- }2 I' s8 J7 Q/ n1 e
- . F0 N4 N5 k: m% P8 ]
- #undef EDMA3_DEBUG/ T! N! {& \6 M; [. p/ O6 U
- /*#define EDMA3_DEBUG*/2 |0 H6 B0 }2 x8 y1 ~
- 2 @- Y' y" l& |% Z
- #ifdef EDMA3_DEBUG6 U7 r6 c3 Q- J7 \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) y, M/ c1 P' w: D- {9 ^6 t- E/ O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 ^% D: A$ z2 z% B* Y$ u+ s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ q/ C* A8 p" P
- #else
5 {3 h! L6 _1 O - #define DMA_PRINTK( x... ); g7 b# x( L5 I; t: I P
- #define DMA_FN_IN+ {; j' G, D6 }7 H8 Y$ F1 M5 l
- #define DMA_FN_OUT
. j, V( T+ T. E - #endif
^! ^1 H8 r2 S" t - ' f0 |$ o/ p y% ~% ~* ]0 U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 x: e9 ?3 M6 {
- #define STATIC_SHIFT 3! @# t. @: R$ Z. U; a
- #define TCINTEN_SHIFT 20# X+ ^! p' V0 s0 D1 a
- #define ITCINTEN_SHIFT 21! v" y2 Q. p# h: y3 M
- #define TCCHEN_SHIFT 22
2 \- ?7 Z# c1 H6 s* d - #define ITCCHEN_SHIFT 23
6 P' u: Q- x8 V% L$ r1 p7 ` - L6 ]( w; X4 D1 x( l& P1 q! \0 W& m
- static volatile int irqraised1 = 0;
2 U* w& O* _: F8 o% @/ ` - static volatile int irqraised2 = 0;, c1 C# }' l' k5 c( K( c1 Q
- 2 ?$ [3 i. L0 l+ D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* {" w5 _; c9 J N$ K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 {" m7 \# B8 o( {7 c- w7 f0 b; q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# q" U* Z# R0 J _
- o" h4 T `4 k$ j) g$ @* Q- dma_addr_t dmaphyssrc1 = 0;
7 P# J$ W3 f* y. y$ a' E" N - dma_addr_t dmaphyssrc2 = 0;9 U9 D7 ?! L5 s9 z& c" u
- dma_addr_t dmaphysdest1 = 0;) Q/ R+ }. _! i, i0 {9 R
- dma_addr_t dmaphysdest2 = 0;# O, I, Q0 @; t# V6 A W. M
- , T6 \6 [' [/ O% a* x9 f/ d/ m" a
- char *dmabufsrc1 = NULL;1 y! ?* ]1 z4 f& ?9 I
- char *dmabufsrc2 = NULL;
W# y7 `+ @. I: Q - char *dmabufdest1 = NULL;
4 S7 K2 ^; B* G) M# } - char *dmabufdest2 = NULL;6 o7 y) L: h+ o, k
- 3 d" T& ?/ ^- V
- static int acnt = 512;
, F) |+ y o+ N - static int bcnt = 8;
' t3 J) W/ ~3 X1 h3 s7 j - static int ccnt = 8;
~+ u5 A$ d( p) S9 {
+ z) g) c+ i4 ]* O# Y- module_param(acnt, int, S_IRUGO);' Q G( D4 p1 d9 K
- module_param(bcnt, int, S_IRUGO);+ |. @' X* r7 r7 R
- module_param(ccnt, int, S_IRUGO);
复制代码
# ?" }' s! |: r4 t$ S6 O5 C3 x0 K. f! u, X- H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 M5 G/ G8 i0 x! V( S& k5 [. V2 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
p0 B% E/ e: _ |6 v3 p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ i; J3 H6 T- G5 g* J
. Z: q9 R3 {' L# m
X5 Q) M1 t2 K( | |
|