|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 Z- E0 ^) M7 H5 i/ Q9 D. x e
- [code]EDMA sample test application
* ]! s- I0 L$ b1 L, Y3 v/ Z( b5 { - /*5 X# ~9 N# P) u; r& X8 c
- * edma_test.c
. l* G* z' R. G% y5 W' A4 D7 [ - *
\* R# k. |* a% O! t - * brief EDMA3 Test Application: o" s- w+ H) y
- *1 ~. _; A3 Y; Q! [; ]
- * This file contains EDMA3 Test code.
6 _ ^6 G1 }7 C - *
% A; H5 N( |5 t3 z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 B# Y* U( u% k; `5 N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' X2 r W {( n3 S) U- T
- * TO CHANGE.: v8 r& C# i+ y
- *2 e! r- V; `6 e) }1 B) z3 U' O( P' q. U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; R' |1 t( I, c+ S: a - *
( G5 x+ g: z* L2 O# ^) y - * This program is free software; you can redistribute it and/or
) W$ n' [1 P- {. U: a; n% p3 Z - * modify it under the terms of the GNU General Public License as9 ]6 S Z) l! V& V6 c4 _$ e
- * published by the Free Software Foundation version 2.
3 h8 ~3 E6 Q. @, q s3 ?! ]9 T, N - *
) s3 S% ~3 m. @3 L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" i; U8 N" r! P$ P D
- * kind, whether express or implied; without even the implied warranty; `4 W; j. O2 e9 m1 V9 c* u
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 ^, j5 c$ f4 s O. m+ }; \0 l
- * GNU General Public License for more details.4 z2 T( }1 j- _ J: v4 |
- */9 B. F/ k( p, D" g! W
( r8 X5 B- @; R: E' e- #include <linux/module.h>2 F4 u6 W' E" s. r4 L3 Z
- #include <linux/init.h>* |! ^' x* y2 y# Z6 f. B( M6 M
- #include <linux/errno.h>4 x7 u0 C" k7 g! ^5 {
- #include <linux/types.h>
/ r+ y$ T+ |2 a/ Z - #include <linux/interrupt.h>- @+ \8 {2 j& ?1 T1 | O V
- #include <asm/io.h>0 T; ?, c' p9 U8 N
- #include <linux/moduleparam.h>4 T) s! J1 Q1 ~; B
- #include <linux/sysctl.h># P; w; `% c: _5 m
- #include <linux/mm.h>
) \+ @/ U/ B$ P+ C) F+ ^ G - #include <linux/dma-mapping.h>9 |/ ?8 i) f% ~: [4 M1 v
: i. O' F0 A% y- {7 m- #include <mach/memory.h>
% e3 d' k7 \; |; Q9 v - #include <mach/hardware.h> w, i2 }& \ j$ |8 Q4 h y0 m3 @
- #include <mach/irqs.h>
, s, D" I" l0 ] t3 T$ b - #include <asm/hardware/edma.h>
: T# b E: b6 y* I
7 M) I) y1 b, J B- #undef EDMA3_DEBUG1 R/ y3 j5 @4 S' A
- /*#define EDMA3_DEBUG*/
( s/ a, T; k) f - , E* w! q4 _( ~
- #ifdef EDMA3_DEBUG
% n' Y, g' O2 g! n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) J% c5 R2 C# |- p( u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 d. ~; V% X% `: g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. g- ^$ x# M9 {3 z0 ` - #else
1 Q/ M" K8 i4 ^7 y) k9 G - #define DMA_PRINTK( x... )
) h1 u4 E3 b' N - #define DMA_FN_IN0 |, l) [0 \! b; f( R4 y5 y( v4 I R
- #define DMA_FN_OUT
9 R) b \" K, ?1 w3 ` - #endif/ Z) k/ H! v- l8 n9 l7 S
5 @7 L2 N$ P, g3 j# R! ~7 N- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' S& J) W* W& U% r3 x) [" U- A
- #define STATIC_SHIFT 3
) `$ v9 G8 r- G# q; g9 I - #define TCINTEN_SHIFT 205 G, {* l. a* t/ j3 B# s/ p( p
- #define ITCINTEN_SHIFT 21
' h. ]6 C' [2 ~" b6 r; r1 A. q( b - #define TCCHEN_SHIFT 22* K* E$ e* u) a( R) o
- #define ITCCHEN_SHIFT 232 T, H% C2 e0 }7 I6 H1 ` _+ V* M
8 K; m" u( t& K3 a' N- static volatile int irqraised1 = 0;
6 Y5 q0 o8 N# X# q - static volatile int irqraised2 = 0;
1 m& N) F0 w6 }6 k" b1 Z! D+ ]
7 j4 o! ~, ~5 d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, ]3 t$ z* g3 u, ]( V% _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 P6 b7 G2 f8 {& ^0 \1 Z1 w' \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! k9 T- w% H5 R+ X& L - & i, K5 r. S! ]
- dma_addr_t dmaphyssrc1 = 0;% m5 l* D* e9 R3 e+ v6 ~
- dma_addr_t dmaphyssrc2 = 0;
2 x5 I* S v- d - dma_addr_t dmaphysdest1 = 0;0 E# d) C+ m6 @. h( n! i
- dma_addr_t dmaphysdest2 = 0;* C7 S; v! g% O- Z9 A) h3 N2 \) C
- 9 R+ |- w! E6 V6 x2 t0 Q4 O/ G2 g. ]
- char *dmabufsrc1 = NULL;9 E6 O) l% g! }0 O
- char *dmabufsrc2 = NULL;/ l! s0 ?+ w! ~3 d
- char *dmabufdest1 = NULL;
+ I' S) f$ R2 ?; [6 T- D. k4 N - char *dmabufdest2 = NULL;
. ~) c4 z1 ]* A$ }6 M+ Z9 H# j - + i. u s) P1 H% \' C7 c
- static int acnt = 512;
3 b9 o8 ]. c4 c/ P- b - static int bcnt = 8;
( @$ I+ O+ [* u! p$ ^4 ` - static int ccnt = 8;. ^+ i) ^# p7 r& x G# C- H$ V! n5 e
- & o' t& r" Y! L8 t( K6 k& N' q
- module_param(acnt, int, S_IRUGO);/ ?4 S9 i' X; l/ ]$ g
- module_param(bcnt, int, S_IRUGO);
7 _4 k5 ^% `5 L0 J2 q5 U, }' k - module_param(ccnt, int, S_IRUGO);
复制代码
9 i1 ]3 }9 i2 ~. h* R
- Y( w; t! k+ t7 ~: @% R) f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ ?$ A# y/ j; F B+ Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: L: E. W. h! u9 Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, l/ `3 G/ d( a9 ~- T7 F+ P! g7 s; C. Y
% `3 m" K) v# |( a. q" c
/ s* Y/ c7 Y! s |
|