|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( N; X# O! x& E* b3 p$ o
- [code]EDMA sample test application! N) N2 c' p$ v3 o! j
- /*
! ^: Z# i A, J" S, \ - * edma_test.c
4 \. ^5 }4 o8 Q8 x4 _ - *( |' l! u4 h1 V N& \3 E& }6 M7 c8 }
- * brief EDMA3 Test Application1 t( Y% I' i( s2 x2 {0 r+ j
- *
5 v1 I) W) o1 S9 E) l+ L' _ - * This file contains EDMA3 Test code.
. P8 c" X1 ~- c$ n6 B. Y! Z4 L - *
4 `8 [, L6 ~! n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 M O- s: W4 e( Z8 @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; z7 f& F2 i9 o6 W& U - * TO CHANGE." |% q( i& X K) S) _2 z
- *
5 Y+ n! t* E5 J+ Z5 ^5 E3 Q7 ~ B+ k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, Y* Z+ Q7 M7 S4 ]
- *5 j3 T) n3 I: B8 V) z% k6 C0 w
- * This program is free software; you can redistribute it and/or# X/ a2 I L& ~1 u0 D7 i# Z' L9 A0 Z0 z
- * modify it under the terms of the GNU General Public License as
; ~- {( W# |) R; Z. p - * published by the Free Software Foundation version 2.
4 e2 z7 u0 N# B1 s6 d7 X7 F# O' r - *
" d. e! f. p; e a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ c9 v1 A) n B8 ]2 J1 I/ R' T - * kind, whether express or implied; without even the implied warranty1 B- j/ d5 u" J8 @: k! s! V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 k2 Z f! }2 C* k! m I) x
- * GNU General Public License for more details.
! L* p' I1 y2 }' r - */
9 a" H, i0 a5 n# q- V8 u
w2 P: E" x' K% ]; J- #include <linux/module.h>: I$ [ P8 } w$ }
- #include <linux/init.h>+ j0 w/ a5 X" }0 S: V" p4 B
- #include <linux/errno.h>$ w4 o6 K2 w7 Z; i2 ^# Y* q$ w; T
- #include <linux/types.h>
0 r- O% S5 j Q3 @, P. P - #include <linux/interrupt.h>
9 K" C, A5 ]6 p4 k5 e6 N5 `4 `. G - #include <asm/io.h>
! p' U/ t' F. ^5 X - #include <linux/moduleparam.h>
# \; M3 x6 I. { {0 b/ D: g - #include <linux/sysctl.h>2 H8 B1 a x+ |6 R" s1 c: B
- #include <linux/mm.h>
6 [9 O3 K, g, i* n - #include <linux/dma-mapping.h>
) n) x1 D/ [0 n' y7 o* u% W - - B% _' r( o+ j
- #include <mach/memory.h>/ T: s' v. J7 @4 L$ b5 n
- #include <mach/hardware.h>
# D. l( s% L* C# w( ? - #include <mach/irqs.h>
+ k0 h. E2 D' `8 x! Z - #include <asm/hardware/edma.h>9 }8 w0 Z- a O2 D: k p( o6 M
- 7 ^" x+ r: B6 t
- #undef EDMA3_DEBUG
) Y1 E: d6 O* N4 r+ \1 c - /*#define EDMA3_DEBUG*/
6 [' u2 I: V! |
: X- ~( _- D3 c5 u, `# K6 f5 ~- #ifdef EDMA3_DEBUG
1 Y) Q2 }' |% ~1 v! h& V% D+ L9 \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ ]7 |3 i* `- F+ J3 z3 k/ l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* }+ q' x: a+ e O' C' ? F4 q6 N. Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ Y7 Q* K1 H% A( m% E b" W' b9 X - #else
" r0 Z+ d5 g& \ - #define DMA_PRINTK( x... )
X! ?- }, ]7 e - #define DMA_FN_IN* ^" L6 h( j, e% ]
- #define DMA_FN_OUT5 l3 `. |8 C7 f, ?
- #endif
' S3 u8 X: n& ~5 s - : r( V. W% |0 U) r6 V( l* e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# m! W/ c! _( b. \6 l* r! ^; M
- #define STATIC_SHIFT 3
2 n& q E; |- j b! y% S4 W3 p. r - #define TCINTEN_SHIFT 20
6 u2 X7 Q" A3 Z& ]- k r - #define ITCINTEN_SHIFT 21
7 T; ?$ R+ P0 ~+ r/ X' [7 O - #define TCCHEN_SHIFT 22
, w, x' Q+ j( s - #define ITCCHEN_SHIFT 23# d' p1 q. g4 k4 p) _! s7 T
- 2 g0 [3 f2 ]. t) k
- static volatile int irqraised1 = 0;1 z E. F; f; B i4 w
- static volatile int irqraised2 = 0;8 A7 j8 i' k% P) V% b
2 L1 Z7 `: N( o; V! b8 D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& |& i! S& z2 T1 d# D2 v+ c; A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* V/ p/ c$ Y! t& M6 p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" r$ {3 t" D3 |! C# q6 Q5 x
- $ T. Y& f* J1 c- x5 v# D/ A4 w
- dma_addr_t dmaphyssrc1 = 0;+ y w( Y( j' @* i v: q/ x
- dma_addr_t dmaphyssrc2 = 0;! o5 P$ S( L* t' P
- dma_addr_t dmaphysdest1 = 0;
! l5 V2 H$ ~+ v1 z% H - dma_addr_t dmaphysdest2 = 0;3 n: X- b2 u0 @& B8 g3 @
- ) `0 j+ B# C% [ D
- char *dmabufsrc1 = NULL;% a7 h {/ P9 x; {! G
- char *dmabufsrc2 = NULL;) A, H( m8 q k5 c: a( ]$ u7 `& W
- char *dmabufdest1 = NULL;$ U, P& K% J3 K+ m
- char *dmabufdest2 = NULL;! I/ ^* t2 q! b4 p" ^+ g
X5 h& c" H2 f- w) Y. ]- static int acnt = 512;
4 y4 H$ |6 G2 d! j) e3 l: K - static int bcnt = 8;& \1 G4 D/ m0 N3 L* w0 N
- static int ccnt = 8;
' ]1 _1 |' F9 W* N' M/ \, Z2 t- w - j5 `, h" T; G* Y2 _& R
- module_param(acnt, int, S_IRUGO);3 F* f y; S; R- l. M
- module_param(bcnt, int, S_IRUGO);0 q6 ?9 m# L0 P9 n
- module_param(ccnt, int, S_IRUGO);
复制代码 1 A; a0 b& t) t8 ^
7 A# k( l* i2 R2 f( s) J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 x# Y) h. j" G( s6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# |$ Y |/ E& h ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
{1 _0 c* h+ h! A
) y) {4 W6 u% f b) m9 I7 T6 E
9 O( }6 D, x% s0 |$ o% b0 l |
|