|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! v2 P* m# B" Q/ c+ o
- [code]EDMA sample test application
" T6 f' Q" h% w" k - /*- Z T& y" L! L2 G, y' `
- * edma_test.c
' R) u' b, A, ]; \ p7 v - *
$ R) Y3 j" W% x3 K - * brief EDMA3 Test Application
% b! n1 b4 @2 y( A& H, e - *1 L, S6 U4 z! Q
- * This file contains EDMA3 Test code. d( L3 D, D# n" c; L
- *
( ~* {3 [8 k: r D' \7 E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 k5 p7 \0 E7 _& z" w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! Y) C* O/ y4 r1 ?5 p - * TO CHANGE.
8 E0 ?% H3 _7 r$ e. X0 u - *
% i0 k1 W0 P8 @+ U4 q! r$ d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 G; K& ~% I( a- S$ h9 D - *' {3 g7 P+ o+ _# e8 {# b
- * This program is free software; you can redistribute it and/or
9 n- l7 i7 K' D- g - * modify it under the terms of the GNU General Public License as' E5 q. [) k( `
- * published by the Free Software Foundation version 2.! n: B" ?) d3 O, b
- *) n* C! \! A) L3 n/ D$ L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- o! P( M# j8 N3 N$ u* a7 x
- * kind, whether express or implied; without even the implied warranty
( x& K9 ] V; B/ P; Y* A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% F) C$ l3 d* q9 j - * GNU General Public License for more details.' N N6 N" p5 S, }* A
- */
' s7 T( l) M# ?5 Q8 @. W4 e - , U8 m0 X+ Y4 p. ?. Q S z
- #include <linux/module.h># e5 H8 |2 M+ S' t
- #include <linux/init.h>
+ x- J/ [: b- E3 |8 a7 C. m' } - #include <linux/errno.h>
1 E1 T& G( ^! U! f* e - #include <linux/types.h>% J7 B% S0 v. I/ Z
- #include <linux/interrupt.h>. Z# N5 }6 e' w: K- @% @2 K# C7 ^
- #include <asm/io.h>
2 F) Z% Y0 w9 I* d- a8 ?! ^ - #include <linux/moduleparam.h>
2 U% Q* t4 y2 N. S$ k3 D/ ]% w - #include <linux/sysctl.h># [. ~/ X4 |& I2 l+ ?
- #include <linux/mm.h> G [; M& Q' t: E2 I% @, X
- #include <linux/dma-mapping.h>
: E8 _. `7 Y& n' B8 K% ~
- B3 e$ [& ~- K6 D) u: ] o- #include <mach/memory.h>- z0 [! H. F }$ w" o
- #include <mach/hardware.h>
0 n8 [2 {- r, ]* q$ r - #include <mach/irqs.h>
2 B4 F9 Q1 R" _0 ^' m; L - #include <asm/hardware/edma.h>
0 T, Z9 Y+ q( D i0 d5 k( j - ! R4 ~3 I4 n0 U" P. K
- #undef EDMA3_DEBUG
" n- U3 |% K3 e, M5 l' j - /*#define EDMA3_DEBUG*/
6 N% u: _+ I. P/ k7 ]5 b! I; J6 M. N
: Q' H P+ T- _5 m8 t! q0 T- #ifdef EDMA3_DEBUG' U1 Z, Y" W* n' R# e2 T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 p+ ^9 ]) t! p* _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, w- e/ b% G! A, V6 R/ H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 l* O! o& x2 h - #else( D. H* L3 \6 t, S. K
- #define DMA_PRINTK( x... )( V) R1 ~$ \2 l V
- #define DMA_FN_IN
w& H; \7 |* B4 u - #define DMA_FN_OUT
% N! h5 x; ~5 r - #endif
. J6 R* I) L6 R+ p. E& |
6 j6 h* A: e$ ~' N/ S6 ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( D$ u! b: N" m" f( }' d - #define STATIC_SHIFT 3
4 U, `" X& _: G. ~! h/ o) @ - #define TCINTEN_SHIFT 20
& V9 R9 |2 |6 x6 F4 y! {( u- B - #define ITCINTEN_SHIFT 21
; T# O/ L; I) `, U - #define TCCHEN_SHIFT 222 ]7 i1 I9 N* [
- #define ITCCHEN_SHIFT 23
f o5 k7 E8 s - , a' {8 R/ i3 P2 I. q: Z1 k
- static volatile int irqraised1 = 0;
7 v# z o* d k, x - static volatile int irqraised2 = 0;, Q2 j; N2 m) j7 S' F& Z
5 a* x, L I1 ^# a# k. \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ C' d9 A' a) r( g' o% n5 ^7 Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, F6 K- {) q. N e+ E1 {5 I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ G q2 P9 c7 C' X" J- _ - - m& c6 V- V, W: }9 h" `/ J
- dma_addr_t dmaphyssrc1 = 0;
1 i0 I- c' e" X# d - dma_addr_t dmaphyssrc2 = 0;
! ?& m. f' o5 z! p9 f$ K' @2 _ - dma_addr_t dmaphysdest1 = 0;; \$ ]1 l# Q0 U: ~$ J
- dma_addr_t dmaphysdest2 = 0;
& v* E3 k- Z$ e5 R$ `7 t - ! _; O& k0 ^8 J- D
- char *dmabufsrc1 = NULL;
9 J3 { _$ o, Y; U2 {/ z - char *dmabufsrc2 = NULL;
6 A5 m) B" d& _ - char *dmabufdest1 = NULL;
5 k5 H' ~& q. B/ x& Q( z - char *dmabufdest2 = NULL;
! n8 L3 Z+ C& M) L& U2 C g
6 H) R5 Y" q( L; f- B, n$ w2 j- static int acnt = 512;
+ L5 m0 Z7 H+ L - static int bcnt = 8;* p$ d- ~( G/ i9 r4 v
- static int ccnt = 8;+ w$ A, [6 @. A' D% f
- / \9 T/ |/ i2 K4 ?9 M6 S5 b
- module_param(acnt, int, S_IRUGO); U+ X1 t H# C, Q, _5 X/ q& t, D
- module_param(bcnt, int, S_IRUGO);4 T/ j2 n! W1 e0 x5 I# \, r
- module_param(ccnt, int, S_IRUGO);
复制代码 : Z/ W$ s) g, @% G& D, \
( t' H/ @" T% `- r p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: ~% ]) R7 e$ I: r7 f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( C( W( @/ _" `# ^8 f, a, v9 Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 f( g1 }9 N+ c* S* W4 t8 t4 W' A" h, H o6 E( n& P, \
. \+ w& ?: m$ m, [ |
|