|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 ~: g8 N9 d# J9 @4 f) W
- [code]EDMA sample test application
$ j3 B7 v! \- t - /*( e! n$ l" W# S7 M& g% K
- * edma_test.c
3 T) B$ A) v8 U4 [& \1 T+ A - *
0 P. p) w) K4 G$ [4 f$ p+ Z - * brief EDMA3 Test Application
1 ~; ^- L5 q0 q7 Y- } - *
- [& l1 j9 I- u - * This file contains EDMA3 Test code.
4 o% O: x; }0 w; C5 H0 c - *7 y- P8 f2 h1 d2 h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 s, j8 R4 [; P7 b( _; S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' R- a5 b3 M$ `1 i
- * TO CHANGE.. h) P, Q( S1 {4 n
- *% {5 c0 c: A# O3 ?8 F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 x, P& p* }# o$ _$ o2 D# t1 H
- *
9 V4 _" b# j# ~ - * This program is free software; you can redistribute it and/or! C* ^' v/ P& X% q0 X+ S# N3 X2 |
- * modify it under the terms of the GNU General Public License as
% L% e2 r1 A& t# Q# q: x; X6 w( Y - * published by the Free Software Foundation version 2.
" t5 j" C0 X2 b, l1 F* F+ Q - *
: Z3 W+ B& A& v9 {5 L7 i% q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. Q: L( w3 Q1 ]! w
- * kind, whether express or implied; without even the implied warranty+ b. n1 q( f6 f! ~' @6 N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 ]* F5 q' v, k, {( X# D8 s
- * GNU General Public License for more details.
& D( ]' ^* t# t% @# D9 G& P5 h2 V - */, g$ f- q* O# ], Y
# I i3 a( P) g; s- #include <linux/module.h>0 T1 I& e$ m, w' X/ g' ]5 G
- #include <linux/init.h>
. ^2 m+ y2 a3 L3 F a8 i; q; _4 g - #include <linux/errno.h>
! ^. A8 Q+ b$ j) R) \# _& T - #include <linux/types.h>2 s5 e6 p" i; D- D8 l3 @5 g' t0 ^
- #include <linux/interrupt.h>
: k) W3 D) i8 b% U - #include <asm/io.h># [- t, g9 d& ~' Q$ y
- #include <linux/moduleparam.h>8 S; P: T0 W8 X& o! y
- #include <linux/sysctl.h>
& F9 ]4 G# N6 c8 K; r. A' c, n& c - #include <linux/mm.h>
3 ^- f' x0 L& B- U' M - #include <linux/dma-mapping.h>
2 [; }' D$ V0 e% R5 k - ! |! r' K) s* _$ V
- #include <mach/memory.h>" h4 `( p0 Y% }# u$ H) N9 F
- #include <mach/hardware.h>
$ K0 A, c7 B5 D$ W$ F& T - #include <mach/irqs.h>( g% }( [6 r3 d: M: r# L8 y
- #include <asm/hardware/edma.h>+ U: s7 i0 `" S- m9 Y
- 1 A }" N( |$ k) i8 v# L- B/ d' ^
- #undef EDMA3_DEBUG
, u4 n8 m0 K d2 m - /*#define EDMA3_DEBUG*/
' q( d9 p0 y2 X( l
1 K/ S8 n2 g+ u7 C8 _" G$ G# N/ [: W- #ifdef EDMA3_DEBUG
3 [5 l: ?& U. D% W+ f m6 ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# O, J) ~) j! d5 q: h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 L* v$ Z$ h ]4 \$ [2 n; K2 B$ g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* O9 m/ g2 U. q2 j9 a
- #else, ~2 w( `( r2 C7 d
- #define DMA_PRINTK( x... )
) f0 f$ O4 ^2 J+ b: L& h/ b7 v2 \ - #define DMA_FN_IN0 W% f( [& y" @' Y% O/ x
- #define DMA_FN_OUT
" L' a/ H8 f+ V - #endif
) T& U J) P7 Z2 _4 X5 F% s' t% f - 5 x6 Q8 p+ V8 j6 g2 i+ p8 O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
W) F) K/ k5 J - #define STATIC_SHIFT 3# a* Q$ V9 j+ `0 P2 j: @5 c6 d9 p/ m: o2 G
- #define TCINTEN_SHIFT 20$ P0 ^2 {" B' F7 V" T- V
- #define ITCINTEN_SHIFT 21* `5 h: @* O/ i7 A' S1 n
- #define TCCHEN_SHIFT 22
9 r) P& i7 s- ?. E; ] - #define ITCCHEN_SHIFT 23
6 o N: c; {2 K4 N2 u - 3 y" a# Z! p& l. K, o2 s) k# g
- static volatile int irqraised1 = 0;, ~ t+ n. O& m/ w1 f6 ?4 _& J
- static volatile int irqraised2 = 0;5 P' _# u/ D; ~7 I
- % x, X0 W- ]) C* N: w% k5 R+ h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ y, I" {. N2 }& _" E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! V. c9 b2 h1 r( W; G" h- m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( w& \1 C% y/ P/ `# c2 a
- 7 ]2 J- R5 ^- i
- dma_addr_t dmaphyssrc1 = 0;
$ d) h! Z% h+ `* w+ P- O' t - dma_addr_t dmaphyssrc2 = 0;
/ n" |5 {: H' ~! N' x; l - dma_addr_t dmaphysdest1 = 0;
q% F8 r" h0 a% r* k; o - dma_addr_t dmaphysdest2 = 0;7 a c6 D, ~: X4 p
- J( }/ N- c1 P2 x% L- char *dmabufsrc1 = NULL;
. }* F+ ~7 M, f - char *dmabufsrc2 = NULL;# Y( O4 x- x3 v$ }7 r$ z
- char *dmabufdest1 = NULL;6 e% N, o7 _7 d; R- x! T( m8 @3 Y
- char *dmabufdest2 = NULL;6 ]1 @8 p C$ P( {' Q
- . V: ]6 _% V9 \, ?8 Y9 ~
- static int acnt = 512;1 T5 M0 r; n7 L9 l# a
- static int bcnt = 8;
- H W' a- I2 @( O( [( J: Q; k7 P% Q - static int ccnt = 8;$ E$ ?% E+ J( U
$ p2 l; b5 m5 f8 u0 |- module_param(acnt, int, S_IRUGO);
3 U/ q7 t" b1 s9 l - module_param(bcnt, int, S_IRUGO);
9 \2 L. s2 @* h, d - module_param(ccnt, int, S_IRUGO);
复制代码
- |6 D3 W& ^* j3 P& J- Q+ U. s: V2 {6 p; w# t J# {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 X% m4 v+ A0 |3 A% ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# O, i5 E8 Y" Y$ V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ g0 Z, U6 w8 J$ B' q3 Q' G J
- _ {' V, l. }3 q
1 D' S, l- |/ N" J% u$ r1 p2 M |
|