|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# f, j& l" Y; S- [code]EDMA sample test application
1 ]$ f9 |8 L0 Q v; A" N8 p' K - /*
" X! q" Q2 p/ u - * edma_test.c
$ G3 P0 l; f! c" U r+ K7 c - *
* n/ o$ l: Y1 \ k+ @ - * brief EDMA3 Test Application
: S: M! C0 {: P# X9 S) b - *
4 g% Q* c9 [0 k" R1 h0 z, p - * This file contains EDMA3 Test code.
$ J+ o( E$ Z! h4 {# g, ]! I0 R - *
2 U) Y2 y/ d- H* ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. @5 x# w! N- B, v' \$ q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 @% T8 O! R1 E) b5 d/ u5 o - * TO CHANGE.+ q6 i, `5 d* o0 C* S3 l
- *9 B8 O& [6 p" ~5 c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 j- s6 y( x3 y% o+ b( C, n
- *
0 J* n) w c* s2 [; f - * This program is free software; you can redistribute it and/or
- k% {4 L0 z0 K' Y$ b7 h - * modify it under the terms of the GNU General Public License as
( K2 r. d3 z9 C0 B - * published by the Free Software Foundation version 2.3 s) g! M+ r! \( h; Y
- *
+ \/ S5 ]7 H8 @" w! p# j( E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 {- q/ a) n( |! u+ t
- * kind, whether express or implied; without even the implied warranty
' Z% u7 J T- W" l' J6 t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. Z8 x3 f$ ^8 @( j3 u C: C' X# J, l7 N
- * GNU General Public License for more details.! @; n+ }2 g- K& m+ K
- */
8 B, v9 Y+ h2 J: n$ D# P. i+ @
, a2 x b5 C6 b- #include <linux/module.h>
( }: d6 p6 C9 c; c$ \6 v - #include <linux/init.h>1 V9 E7 L& x, D7 M5 @ {2 S3 H6 c
- #include <linux/errno.h># L% z0 p+ a/ @" C% q1 A9 G+ H* c$ w
- #include <linux/types.h>
7 u5 ~8 c; O" e1 G) I, } - #include <linux/interrupt.h>4 ^* q8 ]- v( P- l, c
- #include <asm/io.h>
9 a) r6 `; S+ C - #include <linux/moduleparam.h>
9 R$ ?0 I4 t& D2 Q3 a8 D9 a( k/ @; v. Y - #include <linux/sysctl.h>2 u. _+ }- P+ X B" K' ^
- #include <linux/mm.h>, d7 t7 F4 G9 z% ]
- #include <linux/dma-mapping.h>
8 N( r( }$ y) @
% s7 E( i: p) v" @7 M- #include <mach/memory.h>0 n3 O9 _% x1 i0 D! h# o
- #include <mach/hardware.h>
7 @6 U7 B, A/ Z5 V3 T6 s6 @ - #include <mach/irqs.h>2 ?" D; @8 p" `0 e* s' g
- #include <asm/hardware/edma.h>
3 E8 \8 Q7 }1 t2 B- h
. }' `3 n6 M+ q# ]; \6 N2 P; @1 M# h- #undef EDMA3_DEBUG9 h$ e& F( R( V9 O- ^# v
- /*#define EDMA3_DEBUG*/
, k7 F- |! q2 R. e0 b" z+ {6 D - * g6 _% \+ C( |6 I1 `; C
- #ifdef EDMA3_DEBUG6 D0 A6 d- | ~& B, t3 @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 h* D3 S H" p& C' G; i$ |6 n; `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( q! l) {$ N' v% F9 [1 S" g% c* E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) c# x2 \+ P7 r+ G
- #else+ ^. @1 O$ p8 T( z
- #define DMA_PRINTK( x... )
6 {, t( C4 {1 V! W - #define DMA_FN_IN) K( t0 `6 o( [( ^# d6 W
- #define DMA_FN_OUT
9 J3 J, ^$ E7 \4 x" D1 ~ - #endif5 r1 k. L( t" r% I9 P$ T7 R
" I R6 w0 q! \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! ^% X6 ^- N$ [! \4 B% o
- #define STATIC_SHIFT 3! @ d. e( s" ?1 S3 n U
- #define TCINTEN_SHIFT 203 k" Q$ q$ E9 {0 U0 ]
- #define ITCINTEN_SHIFT 21. O% j4 v$ K) s( _: |/ R
- #define TCCHEN_SHIFT 22
$ R, o) W o0 b6 G! ]! z - #define ITCCHEN_SHIFT 23, t W/ T* a$ t/ X% L# X) v
- i1 `, ~# F5 G' N' l8 N$ H$ {3 e
- static volatile int irqraised1 = 0;; _" Q4 Q5 K' X( |2 B( A& \
- static volatile int irqraised2 = 0;
: F8 g Z% f- U
7 h( P- H3 k4 T$ d, \4 c2 K( {+ d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 _9 f( h' x" ]1 L( G' e5 U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: G; Q' d5 U" b0 t- g! n2 _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 D' x/ R8 n" i
+ V: P7 T( D) d7 W$ _' F u/ ?- dma_addr_t dmaphyssrc1 = 0;
+ o% B, c3 G9 B A, P - dma_addr_t dmaphyssrc2 = 0;
; O* X* g1 t# A* S7 T7 _9 L' T6 u: b - dma_addr_t dmaphysdest1 = 0;
' ` N# X7 v; F( B - dma_addr_t dmaphysdest2 = 0;
% B0 F* O9 d6 c# c4 {0 `7 g
7 n4 d d' o' I/ M+ Y7 j& E# W- char *dmabufsrc1 = NULL;
! ^! f' b( a% z2 a$ n- S8 L - char *dmabufsrc2 = NULL; K0 |; A. V, ?
- char *dmabufdest1 = NULL;
! g+ j; R. c& O& o' ^: r6 B - char *dmabufdest2 = NULL;% q+ G9 } y# M* m
" V' v# ~+ S7 T, Q! y: ~, Z* k- static int acnt = 512;. @3 T+ @; z. {' t* ?% |) R* F
- static int bcnt = 8;
7 D* x4 o- B' ~4 J5 U; c - static int ccnt = 8;
* i3 l4 i" k" d) ]
& v; b' ]( G" i3 ~- module_param(acnt, int, S_IRUGO);
- E g6 v! s; ^+ q3 q1 u - module_param(bcnt, int, S_IRUGO);9 R5 M; q' B" w. W1 ~ S1 u! \
- module_param(ccnt, int, S_IRUGO);
复制代码 7 f, [. Y: J0 o! k* ^, p
- j* W3 q) V1 X9 A6 C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ A" ~: p8 \4 K% E1 u3 S& L; [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 [% {, Y* }7 u2 @7 d- s! W: a+ v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 {5 j, r5 j0 q5 J
# Q- d, U: C# L) E5 j# u6 j9 m% I* c: ?0 J/ E. @/ ~" g3 ^
|
|