|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 D0 `2 P7 C3 w; t- r6 U' p: h" F
- [code]EDMA sample test application/ s; F! i B8 P9 x9 B2 e3 V
- /*
2 ]; ]3 o; V3 B" Z7 _- Z2 \ - * edma_test.c' M0 x; Q- Z* L2 m( `6 z
- *
7 j- O1 H7 m Q. ?2 [+ [ - * brief EDMA3 Test Application
1 M( q/ H/ I5 `6 M - *4 n% ]9 m/ H5 z
- * This file contains EDMA3 Test code.. e6 ~8 }1 u5 T* O
- *& i9 p; j5 ^: _* D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 J* f3 X3 k/ y R$ }! f9 n" h: L, x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& e2 P* ^- R! ]5 V# H5 ] - * TO CHANGE.; H! y6 }$ v" X8 u
- *. p9 U- M1 |/ d7 }, L: K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 I5 O4 i) x8 S7 c& u O B2 F - *7 h2 c- a& s6 e' | {+ p
- * This program is free software; you can redistribute it and/or
$ g4 g6 B# J$ f, k# |( l - * modify it under the terms of the GNU General Public License as
# D g4 r/ W2 S& G( @4 v - * published by the Free Software Foundation version 2.
* u; {! ^7 m. W7 E3 a - ** q, R6 B6 D" x% c3 B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& q; F" }; i0 f7 k
- * kind, whether express or implied; without even the implied warranty5 P# |+ f. j/ W' a' ^% t" L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ z$ ?# {! G, ?: f- y - * GNU General Public License for more details.) q# \& n2 @' q+ o' f6 z
- */
' w/ q7 Q J; }/ |+ Z - ) d# s' a. f" [; F
- #include <linux/module.h>
; F1 E% {- P' k P - #include <linux/init.h>) u% |) W0 d2 i$ X! @: I9 c9 |7 }
- #include <linux/errno.h>
: \! y. ?0 d: o0 {7 p- c9 j - #include <linux/types.h>
4 p4 p8 h. i- D- n% F - #include <linux/interrupt.h>
* h+ a3 r- d/ O" ~9 l6 w - #include <asm/io.h>
3 e. M4 \8 O) l - #include <linux/moduleparam.h>" o0 A" f B. |% C
- #include <linux/sysctl.h>3 v2 a5 n! q3 K# s% }
- #include <linux/mm.h>
. P. A% U9 d* P" c K - #include <linux/dma-mapping.h>' ]4 o5 ~# N, ^. M+ l
- * E- @7 k( y7 V; D& z4 ?
- #include <mach/memory.h>6 P: k' ^7 x. r$ G$ f
- #include <mach/hardware.h>
# r0 V5 {& G) Q+ H6 s" q8 j e$ ?! a - #include <mach/irqs.h>9 P2 I, }' }. A+ f7 A4 X2 H
- #include <asm/hardware/edma.h>
; h( k6 K1 m1 v; }0 U" i0 T2 n - , Y0 E0 m9 Q7 g* g' W
- #undef EDMA3_DEBUG
6 v {8 n5 S! [& f9 ^ - /*#define EDMA3_DEBUG*/
3 R0 ~7 x7 d$ I$ D. |2 \$ i* C4 [
5 }7 Q, S# X( Y# z' Z% [5 M3 t- #ifdef EDMA3_DEBUG
6 h) V& m( h7 O/ o5 A! q+ {5 ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 T @; M& x A: m3 r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: h0 P# U' @5 g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 a6 j3 _* U/ Q" k3 n: l {
- #else! M) m8 e! a) B* V+ H0 P# F
- #define DMA_PRINTK( x... ): ~. c* ^( u9 K* r( O& B4 z
- #define DMA_FN_IN
. k# A2 C3 W# ?, |# {; h - #define DMA_FN_OUT' f& f7 f: e: }0 Z- S7 L( q
- #endif2 D' S8 `4 F1 Z% i9 M9 z
, {; F9 }/ C8 {* k" Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
m. f n$ _; S1 Z - #define STATIC_SHIFT 3
; f5 L* D7 f0 A ~" u - #define TCINTEN_SHIFT 20" K# ^4 T: F) W0 m: @% G
- #define ITCINTEN_SHIFT 21
6 g) G. r& D8 }: M5 y - #define TCCHEN_SHIFT 22* T m# ? T9 _, u
- #define ITCCHEN_SHIFT 239 H7 H1 ]: `" |* {) i
- 5 a5 p. M: M) S2 @0 R
- static volatile int irqraised1 = 0;
6 p g7 N$ p- P s# S - static volatile int irqraised2 = 0;
2 [% a3 }; S# V0 E( |. O - 5 N# F! Y3 t4 h+ a+ }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& ]: j" z+ Q, O$ U: y1 _# U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 k/ b7 B0 k9 q( U% r, X! g, n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ q) [3 e: H2 a; y
+ f; x' @1 o& K" G5 `- dma_addr_t dmaphyssrc1 = 0;; @5 R! D9 r7 s7 }
- dma_addr_t dmaphyssrc2 = 0;
7 M( w$ ^) c1 w! K - dma_addr_t dmaphysdest1 = 0; U3 q- l) @; H% Z
- dma_addr_t dmaphysdest2 = 0;' u" j0 j, D% B- n
- 0 W$ ^4 h% I" U( a
- char *dmabufsrc1 = NULL;
+ v D, W. U2 E7 P& M) Z4 z' C- K% K, G+ b - char *dmabufsrc2 = NULL;
' m8 R# T4 q3 M) X" [, x - char *dmabufdest1 = NULL;0 |4 H2 a, k& ^1 o9 w( i+ B
- char *dmabufdest2 = NULL;. H0 l, ^5 J8 u
2 ?% n% }; L2 D2 E- static int acnt = 512;
6 V+ O; }5 ~6 h - static int bcnt = 8;
' n' {# P% U" L0 d7 e: @3 c. m( J) k - static int ccnt = 8;$ a% \" H* l6 f& w5 N
- - a" b2 g" w: o! Z# L7 j
- module_param(acnt, int, S_IRUGO);
8 u- l. I; B K% ] C - module_param(bcnt, int, S_IRUGO);# V6 i. T5 M |4 t4 V' k8 F5 ^
- module_param(ccnt, int, S_IRUGO);
复制代码
! N; o8 E% l% M; Z' i2 i4 ?" O6 L9 N# z5 n g/ @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; o0 {9 M9 K0 larm-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: l' D# ~$ H! t% I1 Y$ k5 @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. n W& D2 D7 A2 C/ F
}2 f# T1 \7 i' G* ?2 I
5 j' T( f# L/ l: p5 D3 O3 A |
|