|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- m. b, O; B9 {0 T8 k6 ]5 q' v1 s- [code]EDMA sample test application
2 S6 `( Y3 g- K- \) G - /*
# T3 n; x7 G! M5 }) a8 z - * edma_test.c
( w9 g" g, C! z/ T - *' e- y2 e& ~( R) W& L. Q
- * brief EDMA3 Test Application$ Q5 _$ ]6 S. ^4 P& D0 C( k! P
- *
- I3 z) O: t6 I - * This file contains EDMA3 Test code.
1 Z T! q8 }6 @" }; n. d - *
4 y' `, n2 F y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 m* k1 Y; ]. c K" T* W# k; }6 Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, K: v6 h' r' M& G, h
- * TO CHANGE.
* O" @7 i2 ]5 [2 a4 l+ {& ?. Z - *: x( _) l3 ^' z# s: F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; m0 d" f" H! E! E1 I! l( f - *
, R0 v+ p% j. v& E" \2 { - * This program is free software; you can redistribute it and/or
3 U* f9 I& N- j% q! y - * modify it under the terms of the GNU General Public License as3 M" K+ H- p; j' M* w$ o
- * published by the Free Software Foundation version 2.
( h7 g( v. Q; l+ H z) X - *9 G3 E4 c$ y" `1 C2 w% B% p3 d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 G1 ^0 N( T. y) `& S* W# ~' @- A h - * kind, whether express or implied; without even the implied warranty
$ k6 S. M9 N" {, E. M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* G9 K- Q: @6 L- Y! _/ ? - * GNU General Public License for more details.8 X' p+ Q& }: n' c" m) t+ y, K
- */
! ^+ P* V4 U9 O4 w$ k
1 R# S1 w4 p& b8 L/ w1 J2 `) U- #include <linux/module.h>
) m. L% f% P/ m& V) N% |* ] - #include <linux/init.h>( y$ }0 t+ V( j8 W
- #include <linux/errno.h>' W7 U- L* \ R; I0 u
- #include <linux/types.h>9 J( _7 V* p9 U5 `' s0 p- G
- #include <linux/interrupt.h>
' e$ U$ Y# \; \$ q, Y - #include <asm/io.h>
, y4 z' c, ^* k v6 x2 {) e6 _ - #include <linux/moduleparam.h>
3 I4 s9 ]; m+ ~ - #include <linux/sysctl.h># I. a: g- X! f' D/ @+ J c- S
- #include <linux/mm.h>
6 k" p5 j" ?% V" C% r0 L - #include <linux/dma-mapping.h>
, S, u2 v) g; N) R0 o1 o2 I+ E! u) T7 F1 ` - ( g9 R1 G1 G6 I
- #include <mach/memory.h>+ D9 j5 Y8 K" w7 S6 A1 S4 G- U& M
- #include <mach/hardware.h>
2 ^" m5 q) g+ ~- L - #include <mach/irqs.h>2 z8 f9 U0 W' H
- #include <asm/hardware/edma.h># ?, V4 a; A/ r5 d5 ?
/ [+ X. p, T9 _' [/ K- #undef EDMA3_DEBUG
4 j& c5 l; f2 H5 s - /*#define EDMA3_DEBUG*/$ U5 M' E: }7 k" c, f1 T8 {8 A
- 4 T, X1 q3 t1 ]* q
- #ifdef EDMA3_DEBUG1 F w6 {4 i+ @) H) P$ E. E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 L/ g" f% D& Z( W/ r6 b* B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 d1 g. q. i! R4 I% _6 n* p3 O" [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: j' T' i2 E4 S2 l - #else& ^4 a( Q) f4 @$ l, c- R
- #define DMA_PRINTK( x... )
# s( S7 s4 `7 x( s. x, m - #define DMA_FN_IN. q/ ~4 U: u; d6 a1 C; O
- #define DMA_FN_OUT
$ S" f" y5 A3 g8 b: {" P - #endif& D( W" ^1 Y% \2 o1 I/ K }/ ], S9 ^
- ; }1 l. ]& T/ O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 V* _3 ^( t: M8 n0 O! \
- #define STATIC_SHIFT 35 Z" P* E- S: E) T+ S
- #define TCINTEN_SHIFT 204 p9 G2 Q. l5 Q0 q4 j" O( `) [5 \8 R
- #define ITCINTEN_SHIFT 21# h9 v/ ^; _& N4 Y( B/ O! M
- #define TCCHEN_SHIFT 22* S3 u$ k& [ _
- #define ITCCHEN_SHIFT 23
3 O% I' W. U% `6 o+ I% f; |+ w - . }$ S+ g7 h3 ?( S; ]! H. h: b$ d
- static volatile int irqraised1 = 0;" d( f9 L' Q; m
- static volatile int irqraised2 = 0;
& y- K i& y: Z6 m6 M
1 J" r/ e% p3 f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ x& x" o: n; a8 Z9 J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ }& @( M0 q' a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" d% H9 B3 t o* z0 x7 K
- 5 x8 O* Q* y/ I: W% ]
- dma_addr_t dmaphyssrc1 = 0;5 p4 i4 V6 r0 ^8 H$ w+ n
- dma_addr_t dmaphyssrc2 = 0;
0 \; Y f. _# |( }! g - dma_addr_t dmaphysdest1 = 0;
$ b7 `& N# J0 [: s: H8 L# H - dma_addr_t dmaphysdest2 = 0;
/ B; S: c' j& ~$ T" ?. D
+ a( ]" E/ x0 o- char *dmabufsrc1 = NULL;
# B. ?6 E. f* C9 F& } - char *dmabufsrc2 = NULL;
' z- V7 U/ P8 p+ P( ^% x8 \. Q - char *dmabufdest1 = NULL;' w- |/ ^' ]1 R$ R/ D* s
- char *dmabufdest2 = NULL;
5 u' E' m$ L) ]+ r1 F# s% v - 9 l' Z# v+ m& e; N" L C
- static int acnt = 512;
# Y. U9 B( a" M9 N2 `5 A - static int bcnt = 8;/ o4 Q+ C- m1 U9 }9 x, T
- static int ccnt = 8;
1 P& V( G# q8 B" c9 _: P* v - 1 O, z9 R {0 s/ @
- module_param(acnt, int, S_IRUGO);6 }; h3 Y" Y4 @ c$ ?9 {* C/ N
- module_param(bcnt, int, S_IRUGO);
8 R% g/ g4 q) a" ?; } - module_param(ccnt, int, S_IRUGO);
复制代码 + i T' J7 w1 }- p+ ^( s
, {# F- K4 ?6 Z% O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 I6 T$ U8 _) `; Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! H& B3 I* W1 V) y8 x5 _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ i+ i4 ?0 w( n A4 o- t, S8 Q; m; Z$ ]4 W& A* H0 G
4 M# `, F; u ^6 K |
|