|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / |& E- C- y: G% v: N- [; U( R' l$ W
- [code]EDMA sample test application }, N2 \: g0 ~
- /*% n5 z+ H9 V6 [ q9 f. z8 _" W7 ^
- * edma_test.c
4 r0 }' V( D% d8 s2 z - *
, C H7 O* Y: l( o; ]( B+ [ - * brief EDMA3 Test Application
- D6 D' Q; V. H" z7 n' U# U - *
& v6 m( v2 l1 R: N4 X - * This file contains EDMA3 Test code.
2 j, h# y/ \; l8 e" ` - *7 J3 b6 h( E' @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 h, l A: G* B5 u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 V$ [, i1 ?: J( p
- * TO CHANGE.
$ X( K, X! g0 p' m+ ^ - *& R/ f/ R& N5 ?# y6 ^' }* j$ }, C, [3 M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
U5 ~ E& e8 y6 n; j8 c# ^ - *( B/ Y" I6 e' z" H+ m0 s* O2 }
- * This program is free software; you can redistribute it and/or) D/ C U0 R3 o
- * modify it under the terms of the GNU General Public License as
: Q, Q& E7 j/ R0 }2 T" u7 D) T, C - * published by the Free Software Foundation version 2.) k* ], a8 e4 C J0 a B
- *
; t1 Q& L5 O; Q) t+ [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' j# V. }5 A' I6 l2 r$ v
- * kind, whether express or implied; without even the implied warranty
( N9 K! n5 ?6 S" ]3 E& J3 H0 w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* f5 T( E: `4 x( V
- * GNU General Public License for more details.8 e* U' b" C) j& U. s( u
- */& b! q/ `, d; n' R. i9 |
- * Y- l, q! O2 y0 J
- #include <linux/module.h>
}& P! a! S$ W* C1 V4 |/ l - #include <linux/init.h>- [5 M$ y) Y9 k3 G8 \( _4 s5 [; b
- #include <linux/errno.h>
4 Y% y9 L' F( A$ l$ n - #include <linux/types.h>
9 `5 Z( D; n5 Q+ h" \. J: Y: K - #include <linux/interrupt.h># b, D5 U) H6 i+ \! E# o
- #include <asm/io.h>
~3 U0 ] q$ I% d - #include <linux/moduleparam.h>6 h; r5 z/ H1 Q7 ^' c
- #include <linux/sysctl.h>, C. _) p& c! o
- #include <linux/mm.h>
! ?& `' i2 G. m/ X( Y7 B - #include <linux/dma-mapping.h>- T% _6 I h: M6 o6 A- |7 s( T# V7 S1 I
. E# M" C7 a; e7 S3 f" e, }/ |- #include <mach/memory.h>
/ z% `, r9 r9 A5 D- W/ U - #include <mach/hardware.h>
; M( y5 ~7 N- B) g( C( C - #include <mach/irqs.h>
, c3 V. l) c8 B: H3 p- F - #include <asm/hardware/edma.h>, D9 }9 r, s! E
1 }5 N3 ~! i+ o8 w- #undef EDMA3_DEBUG
- H' U9 }2 s: ?9 O( N# C - /*#define EDMA3_DEBUG*/* i/ B! D6 o) M* x
- ( q! A5 L3 g/ b; E& c! a( R
- #ifdef EDMA3_DEBUG0 a( y. O! ]* l) q- s5 F- m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( ~+ [& v8 z8 \: J( @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( h# |: U$ g+ M0 @4 o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% e4 d' F" _9 h/ {! Q- ]% J0 ~( n# ~ - #else
& |& S0 [- X3 y' Z - #define DMA_PRINTK( x... )) n: Y/ S; a- _$ [7 {" r% U
- #define DMA_FN_IN
3 z+ ]! s" u! y, G. ~ e9 x - #define DMA_FN_OUT
5 U1 v0 h( `% c& i - #endif o$ i V7 Z+ ?0 l! K* Z
- / X0 z' [) y+ N( ~) H: W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 e) j* t' Y1 R V$ s6 a+ M
- #define STATIC_SHIFT 3
' v0 k; S0 c! ~3 ~9 a# v - #define TCINTEN_SHIFT 20# Z. z! n) r& a) @
- #define ITCINTEN_SHIFT 217 C: R/ n1 T c
- #define TCCHEN_SHIFT 22+ |5 d: a4 D7 Y+ Z" i; F. M
- #define ITCCHEN_SHIFT 23$ E2 ^, o. H M, A1 f1 R. R5 T
- % J3 R! M. L5 O
- static volatile int irqraised1 = 0;/ m' E. f4 {/ ^' |* P$ N
- static volatile int irqraised2 = 0;
+ k# i2 ?' n6 j1 Y; [- P' R3 z - & L9 k/ c8 y$ v: b- O6 \. z2 J8 G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
J; L0 h# K$ k5 }+ l1 D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; \ z' \3 h% _% y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ w- i' T/ r U' d
8 Z" \6 h; Y! s3 s2 Z- dma_addr_t dmaphyssrc1 = 0;& m0 @, S$ ?+ ]$ r1 A
- dma_addr_t dmaphyssrc2 = 0;2 E( r: ]0 C9 V' ^3 k
- dma_addr_t dmaphysdest1 = 0;
" j( b' x+ z" r9 ]) q - dma_addr_t dmaphysdest2 = 0;7 G/ Z. ?) x& C6 {. y/ A* \
8 T2 x4 A; U$ p, \# G- char *dmabufsrc1 = NULL;# g# R. [. _7 T7 z- _% x
- char *dmabufsrc2 = NULL;
, p0 \+ J9 ~/ Q$ S, Z - char *dmabufdest1 = NULL;
3 A6 U8 V1 ^- w- t0 P - char *dmabufdest2 = NULL;; M& E+ q6 ?3 B0 }1 _# r
- 2 B J2 ^5 j# }- j
- static int acnt = 512;" Q# E- W% u. Z9 Q
- static int bcnt = 8;
" W; W; H: ]9 D5 Z' J! j. D - static int ccnt = 8;
$ B: x, X3 a: J
; G; f; a4 q; U" \$ N- module_param(acnt, int, S_IRUGO);; ]1 ]* O9 a1 s: _
- module_param(bcnt, int, S_IRUGO);
4 l, Z, V4 i" @ - module_param(ccnt, int, S_IRUGO);
复制代码 3 `0 J6 e6 r1 W9 [# t( f- I
4 y& s% b3 P( l- G5 I) y! g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& W4 m2 N6 ]5 n+ L$ Q/ c% harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; P2 J4 \/ i% {1 _. b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 T! z \( a3 {1 u3 M
3 R& A& H" Y+ {2 C7 p& d. X1 b" P4 ?$ i( L! T2 o
|
|