|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 h# f% X# @! S
- [code]EDMA sample test application9 T1 B. J) E$ x* L: p# v! r! `
- /*& X, z. X$ m' t4 p( C
- * edma_test.c$ o: i$ Y S0 J4 H: A, @
- *
6 a# ~ d7 e/ }! w b6 V - * brief EDMA3 Test Application
. W6 @8 ^; X9 c: M' v2 R - *2 ~- A9 P' M, k" h
- * This file contains EDMA3 Test code.3 a$ [3 q: y' ^! q4 X7 Q
- *' o; F2 B7 E, | y9 t$ w# ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ H v2 k9 S- c8 k+ r" v' H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& S/ x6 c3 H/ d; [2 { - * TO CHANGE.
5 a' P$ z8 p3 x% H8 ~2 T+ i" ] - *4 f. Y' \: D, h. Y! q, Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ g6 ~+ F* c4 C h
- *
% g$ T- ]( o3 `5 W+ F - * This program is free software; you can redistribute it and/or$ S1 i- N* I0 I h
- * modify it under the terms of the GNU General Public License as
2 R, z! f, d) H4 C9 y$ ?7 g3 | - * published by the Free Software Foundation version 2.
0 Z% m- ^+ Q H) Y& M( L: Z - *- \. N- }# L5 _5 C/ {5 B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! R7 c3 y/ V) n& S/ S
- * kind, whether express or implied; without even the implied warranty
( r, S& i6 _% [" K$ _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! `3 F7 A! y: Q! B, n - * GNU General Public License for more details.6 W3 G2 r, X9 x% f3 [" B
- */! y8 _( h" b J' Z" h! \9 p/ D- H
- . h6 m. r6 b6 U) B/ e
- #include <linux/module.h>1 }: k% X4 |9 M9 M2 {( k" {5 x) C
- #include <linux/init.h>
+ u/ F! ?: W, `2 @+ A7 X: o9 l' Q - #include <linux/errno.h>
7 D a- B* U. g x - #include <linux/types.h>* L- U; ~% } }2 L. g( q
- #include <linux/interrupt.h>
* N1 N. |7 E2 N' ?8 S- M; d - #include <asm/io.h>1 m3 e. d1 [6 a4 Z+ D. p: G
- #include <linux/moduleparam.h>
3 a: d: i' q) U$ v; g - #include <linux/sysctl.h>
/ {$ G! b" Q& g4 \8 ?% e - #include <linux/mm.h>
( P& M6 Y* z5 G - #include <linux/dma-mapping.h>% o$ o# g; q- |4 Z( Z
% q9 j4 C3 \! L: k+ W0 t1 j5 A- #include <mach/memory.h>3 }. W j, S+ C+ {% r/ g( K
- #include <mach/hardware.h>
% v. m8 X' r9 D2 Q+ D1 V - #include <mach/irqs.h>
( }- P, m6 C( E$ ] k7 R - #include <asm/hardware/edma.h>; S3 d& [6 H7 D# S a5 U! w7 ?
- 3 U* s9 e+ D& l) K7 o( O
- #undef EDMA3_DEBUG4 O5 q: l i N. V! u0 S" i+ U
- /*#define EDMA3_DEBUG*/
/ q% @7 ~/ H* m9 y - - c- B0 {- T& ~8 m. B
- #ifdef EDMA3_DEBUG
0 J9 _% _4 Q" m1 I6 M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# a% I4 S2 P" E4 E9 U: Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 L( C& O( L4 [2 v6 b. p/ y O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 O3 K3 N- Z4 t% u7 \ - #else( w$ g3 T" B2 i
- #define DMA_PRINTK( x... )
2 q% I2 D( u3 j' d - #define DMA_FN_IN
, `5 ]7 u9 B g9 M - #define DMA_FN_OUT8 e; z/ W2 J) ]" w0 k6 q" C
- #endif% `- Q: Z; \& ?5 ~2 f& W
( {) M- J6 U3 M) \ A7 _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* a+ b5 e. y! z) o" F3 v. _( p
- #define STATIC_SHIFT 3 w9 ?& u. L7 a6 y
- #define TCINTEN_SHIFT 20
9 W" f/ V/ t6 F - #define ITCINTEN_SHIFT 215 A8 t3 l, F- v* t+ P
- #define TCCHEN_SHIFT 22
( L( L3 ?* I4 A8 _* t4 }* V; ^8 f - #define ITCCHEN_SHIFT 23! K3 u" z4 k% _% l `- y! z: u
- R4 {. D9 I- F9 W0 v i' a
- static volatile int irqraised1 = 0;
; K7 k h/ Y2 R# m9 @( Q - static volatile int irqraised2 = 0;
7 m0 Y, C) A% p9 a Y - ' }0 p2 M# r$ h1 l' [/ M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' C8 ^/ S6 c) D( ?) D6 ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: p6 F! z9 [2 ~. N; }5 C* u5 c5 k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ I) a( J0 l8 j4 Y
. Z2 u) \- b1 k+ F% o1 @- dma_addr_t dmaphyssrc1 = 0;& X+ _7 [4 M' R( G3 W
- dma_addr_t dmaphyssrc2 = 0;/ t* b( ?# y5 Y
- dma_addr_t dmaphysdest1 = 0;8 [* J# u$ \" J
- dma_addr_t dmaphysdest2 = 0;
) `, D0 R7 ~! ~+ ?- p4 P: @7 f- V
; Q8 v0 ^ S! _: z8 {* W' W5 E- char *dmabufsrc1 = NULL;, Z' A( o; r2 S# L
- char *dmabufsrc2 = NULL;3 `, _+ D& A9 r+ C
- char *dmabufdest1 = NULL;
1 A6 ~0 p$ g: L7 u" x, z% a; R. ^& B2 A - char *dmabufdest2 = NULL;
* }; `4 Z* ~- O0 c4 k
8 x2 E' [; Q8 ]2 `/ I- static int acnt = 512;
$ ^6 F$ Y9 y4 d& m - static int bcnt = 8;
5 s) u* B* H6 [9 Z$ `% _) t - static int ccnt = 8;% E+ m8 Q c) |, |+ }) i
1 k3 \% f B# ]- module_param(acnt, int, S_IRUGO);& `5 w8 @7 O" |5 N# m( i
- module_param(bcnt, int, S_IRUGO);9 I2 S$ z9 e0 V- T( m
- module_param(ccnt, int, S_IRUGO);
复制代码
1 B/ ~( Z5 a) \* H; o0 v4 O- X9 Q. c6 h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 D1 l# ^- r/ L/ j/ L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( y! [% ?9 D$ v/ G- M# g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 k) E: l. F+ d# o/ q- G) _" n
4 u5 X3 Y" l/ y: o1 ~
3 P6 h; Z! W: l9 T4 f4 y# h |
|