|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 S' d: f2 X% U1 E1 l- [code]EDMA sample test application0 L& {* j) U3 _+ d. s
- /*2 i, l s6 J' Z r9 |
- * edma_test.c* S. m! @0 E: v; I! j0 W
- *+ S6 F; r% w% N4 S, s! l
- * brief EDMA3 Test Application9 J- X( k9 l6 i3 S$ F4 ]6 V8 F
- *! c9 o. x: j0 _: J8 q
- * This file contains EDMA3 Test code.
+ b. ^' i/ p6 T% g, _ W8 p. N7 s - *
& K- O: R2 _2 ?; }0 } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 p0 r' V9 N% Y* r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. X, l" t/ b8 r/ b2 Y
- * TO CHANGE.
& N& c0 r& p% Q/ e1 Z - *
! k0 C$ B. T' V& I0 d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ \0 B) B4 X5 _2 W
- *
# p h g; x2 j% }3 B - * This program is free software; you can redistribute it and/or J; B: g' s9 ?9 y7 K: ]
- * modify it under the terms of the GNU General Public License as: S4 e- w9 `7 z, [5 K
- * published by the Free Software Foundation version 2.2 Y M8 K' ?0 K7 U* R- _
- *
f o8 X$ t9 i# i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 G! b! A; P' \( C - * kind, whether express or implied; without even the implied warranty; L3 ]1 L) K+ k* l* t( B( n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ A) [8 T, ^* | N) Z
- * GNU General Public License for more details.4 x e! W, _6 B: @$ O& U
- */
8 K; e0 G% \2 J
/ A. O G, m/ S$ n" M( A$ u- m- #include <linux/module.h>7 p' x; N" q& U, g; d l
- #include <linux/init.h>
9 k) _; q5 b' Y - #include <linux/errno.h>
+ S2 W) J; B2 D8 u; f - #include <linux/types.h>
8 |$ m0 r7 o9 Q" m; t5 m - #include <linux/interrupt.h>
6 ]/ l' W" d/ f6 e6 B - #include <asm/io.h>
! Y+ i% ? c/ B$ Z - #include <linux/moduleparam.h>
( i* m* M: t. j1 o' \7 H8 h - #include <linux/sysctl.h>
6 z+ B" W+ V. g8 ?" Z, P - #include <linux/mm.h>6 j4 a3 g( s! ?* a1 W
- #include <linux/dma-mapping.h>2 X+ g4 L1 J8 R; |7 p
; i7 m, J" s3 ?6 A+ b2 Z- #include <mach/memory.h>" V0 K" ]1 T, \" q2 x& P3 u
- #include <mach/hardware.h>" ^2 J @4 k$ o
- #include <mach/irqs.h>
2 f# o% \) V; ?; j% S2 r - #include <asm/hardware/edma.h>
W9 P' J) U$ j' @3 `5 f# x2 P - & M5 G9 J4 z9 Y/ ^4 k# j
- #undef EDMA3_DEBUG
# G. n4 @/ M; g1 {% d, I - /*#define EDMA3_DEBUG*/
0 i/ A6 G( M, A' t
+ t# Y9 A% a1 b* E9 p0 T3 ]- #ifdef EDMA3_DEBUG
1 f$ u. ^' C9 p5 J# k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! m" q: ~; u9 Z6 H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- S I% O) _4 y1 k5 Y4 Q! | ^. b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), }6 P* j" g B) d; H( e
- #else
9 Z; L7 }; `- z5 q; S1 p - #define DMA_PRINTK( x... )2 I8 }1 x6 T+ G' f
- #define DMA_FN_IN }5 }6 N U2 Q, D- ]0 S8 M8 W1 H' A {
- #define DMA_FN_OUT
2 q4 a- Z! x" k' h5 g - #endif+ @- Y" {9 w* ~* b }9 e5 \- }% j
- ' Q3 y4 c$ a6 e8 F$ C0 h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 E' e2 \- W' w - #define STATIC_SHIFT 3/ i9 |# V1 X/ ~. v, |7 S
- #define TCINTEN_SHIFT 20
* @2 {! k. y) _: z; m - #define ITCINTEN_SHIFT 21
+ s* a* y' P0 O1 p8 T/ Q! b - #define TCCHEN_SHIFT 22
7 E) ~* ~( R5 D3 {6 ?2 ` - #define ITCCHEN_SHIFT 23
( X, f5 f' d1 z9 W - . I. _3 k2 }4 Z9 [- H
- static volatile int irqraised1 = 0;8 v, g7 L# l& |9 X
- static volatile int irqraised2 = 0;
$ B5 z; e4 [( {' m+ c - % \0 L& x3 r$ T( Q" s$ M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) i# Y+ i/ U3 u) x& [: [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 V* k& l g: B" M' `) `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Y. L9 v) t+ h/ M* v5 Y( _4 j) `- h
- 2 h( h7 r9 j0 b, S8 S, D
- dma_addr_t dmaphyssrc1 = 0;, R* k _6 Y: R4 Z
- dma_addr_t dmaphyssrc2 = 0;
) }6 b$ ], Z% G3 h# Q5 B/ C - dma_addr_t dmaphysdest1 = 0;
. _1 ]' I: a* v7 C+ L F% u - dma_addr_t dmaphysdest2 = 0;8 V- a4 g4 ^' w
3 U0 O# i* f' z' `. b$ D6 w- char *dmabufsrc1 = NULL;7 D! w R8 M `
- char *dmabufsrc2 = NULL; ^* H& D( f' W- d! Y9 _
- char *dmabufdest1 = NULL;
8 n" S- Z2 L; W1 f8 d( Z - char *dmabufdest2 = NULL;
8 ?' j8 C$ b% C0 f; y
7 c& N; D" ~4 v0 X, p4 m7 k- static int acnt = 512;
! ?5 r- |$ d8 U! t! P - static int bcnt = 8;6 G3 t+ f3 O5 Z5 [3 q
- static int ccnt = 8;& x% G$ G& d5 t/ b$ x) q
- $ G5 I: n1 b. z. r% `
- module_param(acnt, int, S_IRUGO);# g; }9 A1 c4 a) b# M! F
- module_param(bcnt, int, S_IRUGO);& H+ _6 @* {$ W+ A
- module_param(ccnt, int, S_IRUGO);
复制代码 L" G+ N' k' k4 ^7 @$ |& C
/ r9 r# g g" X t6 \/ w0 J Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% g6 b' z/ {5 d/ N% q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 P; `2 i }! y2 a! J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 p1 Z9 P5 y$ D# X
7 G- Q1 J2 a0 A1 F# b' Z* B8 L9 y4 ~: ]* c/ G- Y2 ~
|
|