|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 S4 O1 q+ C) O/ i0 ^
- [code]EDMA sample test application. G4 W* L X' y# [
- /*
5 d" y* M- [- w8 ~3 Z7 i - * edma_test.c
2 a7 o; C& ?1 } - *
^0 ~+ S4 k7 w% ^7 Y - * brief EDMA3 Test Application
! T1 V) K- X9 a0 \ e, d- W - *4 |/ d: J- N6 y) m# q. k
- * This file contains EDMA3 Test code.
7 _: z# o0 |( l6 v3 ? - *
L+ E: D( E7 C5 C" k, q: o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ [' q5 @- b& Y& `2 c0 T( M' n1 [( ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% J! ~, |" I5 r3 m1 a' Y1 J( [; b6 S - * TO CHANGE.8 L) [' G, O% P5 F+ R( `6 e$ ?, V
- *
. Z0 N6 X! X' l6 I4 t: |6 N! ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' C( d" E' |" L! e4 X+ ]# }0 Q, `
- *
+ [5 K7 n: V. a6 g - * This program is free software; you can redistribute it and/or: Q; ]* C4 W* e- i8 `
- * modify it under the terms of the GNU General Public License as; w& k% g6 T: G9 _7 O* b
- * published by the Free Software Foundation version 2./ T9 }7 A$ W3 M$ x& U
- *
) N4 Q% n) h! \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ J5 N/ l! L1 L% j. f - * kind, whether express or implied; without even the implied warranty
7 ^' @* u9 w7 N& Y; ` Y' f+ A# j s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* o- `; Y' S/ ]( v/ l0 R; s, {
- * GNU General Public License for more details.
7 s2 |3 S0 g- a* I - */
2 ^' W3 P) v- n# ^2 u
& h ]# r4 Y' W3 `6 U! B- #include <linux/module.h>( ^" |1 Z5 ] ^: l
- #include <linux/init.h>8 ^$ R3 s4 X4 \- \- ], r0 V
- #include <linux/errno.h>
- {4 Y. i$ {( E- U& q; b - #include <linux/types.h>
) U q P& |/ X3 h% } - #include <linux/interrupt.h>
. H- O3 F L- |+ Y* M* | - #include <asm/io.h>
y. u0 Z v. b- k) G$ n% u - #include <linux/moduleparam.h>) \- \7 r/ P- Q: _4 R7 M
- #include <linux/sysctl.h>" T- R2 t* ]* ~0 H6 ^5 N& n
- #include <linux/mm.h>; g+ m2 L4 N/ \; q! H
- #include <linux/dma-mapping.h>
6 {. w* D4 h' @% T/ o; \6 D8 e4 @, M6 l - # ~2 H8 Q1 w1 c+ D" G8 v
- #include <mach/memory.h>2 }3 p6 C _/ [7 F8 i
- #include <mach/hardware.h>
) A% K) b& v! I - #include <mach/irqs.h>
) |; P' D: k, x! M2 D+ U - #include <asm/hardware/edma.h>% e1 p. k- Z7 b
- 0 O& s8 \4 M1 S, a
- #undef EDMA3_DEBUG# y# V! R. ~ @# Z0 G
- /*#define EDMA3_DEBUG*/ n. s6 J J: M
- 5 I# O4 y8 _2 _! X: q$ D3 l3 ~
- #ifdef EDMA3_DEBUG a. a( Z$ |; e9 C6 B' A( ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- V: n, w8 j( P6 ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( d! _9 {3 S2 [4 K7 t; Q# Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# ^! S; Y- ^7 J' ]" j
- #else
4 ^* C8 S6 C7 i - #define DMA_PRINTK( x... )
: l- T! N+ T! t% i4 c, ^; }6 d8 O - #define DMA_FN_IN. [6 A. M- Y7 ^2 d7 m) E" e
- #define DMA_FN_OUT( a; u# I6 }! p4 h
- #endif* \ U* @6 r# D! w- |
7 C+ c' @. Y- n- S3 P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& ]' I' e) j& n( F& U
- #define STATIC_SHIFT 35 O6 D2 u8 J1 i- k: f
- #define TCINTEN_SHIFT 207 W( t1 k$ [ \ q* Q, M- j4 X, w y
- #define ITCINTEN_SHIFT 21
: H3 l# v( u7 F5 }9 A: [ - #define TCCHEN_SHIFT 22
6 H+ S% Y2 t( s( r0 ]) Q; U - #define ITCCHEN_SHIFT 23' N/ w2 b9 h/ _3 v* i. e
; {8 P. k& ^ }; h* v- static volatile int irqraised1 = 0;
# x6 r! a, m' ?/ Z7 G8 w - static volatile int irqraised2 = 0;
% h9 G4 b( I6 X* i
! i+ x' h; `" e/ Z2 M+ ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! Z* ^% v2 M- R9 J9 Q; P$ x, I! S, p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Y, L& r* c& @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; m0 y' f& T C. U p
2 P3 z6 T4 b- w! k2 M- dma_addr_t dmaphyssrc1 = 0;
1 Y# R) A* ^* F. S, s - dma_addr_t dmaphyssrc2 = 0;
6 Y) d) C; P" A E0 d - dma_addr_t dmaphysdest1 = 0;
% O) K* q8 i( h5 H1 G% _9 {& u - dma_addr_t dmaphysdest2 = 0;3 c% ~# [# A6 [) W, P# e6 H: m
- / o: c- c4 [4 Z2 @- [+ b
- char *dmabufsrc1 = NULL;
& ?, k* {3 ?" z* k3 U - char *dmabufsrc2 = NULL;
j! ]6 x8 b4 @) z! W9 [5 \+ j - char *dmabufdest1 = NULL;
# t3 [% C8 H3 R. v+ { - char *dmabufdest2 = NULL;
2 P& }; D+ O! p3 m
4 q0 b. s' F9 C' i$ Z- static int acnt = 512;6 B/ Y' y* t0 t0 C/ @" I7 M/ }
- static int bcnt = 8;
9 b7 u0 {. s9 G - static int ccnt = 8;/ v6 @ {7 J8 u
, X! \& T5 p/ i7 d1 f( U- module_param(acnt, int, S_IRUGO);5 ~5 m4 z- F# D2 c5 k- L, [
- module_param(bcnt, int, S_IRUGO);! k8 U- {; L5 Z! \! ~3 j
- module_param(ccnt, int, S_IRUGO);
复制代码
: C$ q" \& H! H# ?; l2 z
2 x% h' R. P7 v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 X& ?/ \8 D1 H) E$ L8 c) X1 |& Z0 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 M M+ {+ q0 u" U+ Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. P Q/ U! j( b6 j5 n4 k5 k
* Z" g+ F4 i1 x* f7 p5 D- C; p
4 x5 `7 u2 ^! F" V$ _* c2 f/ T8 d# y
|
|