|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! |4 ^- G3 [! k9 C
- [code]EDMA sample test application
, H9 H# |5 W% a# j - /*% Q$ f% D; G& ~# l
- * edma_test.c
8 r" d- b3 d) v: _$ ] - *, x4 m5 [' {8 E, R" p2 J K$ z5 G
- * brief EDMA3 Test Application) E' y& k" o1 a4 r. x0 b! ^. _
- *
3 n( |5 w( A( {9 w: k+ } - * This file contains EDMA3 Test code. W) |. U* D3 ~8 r, c- u9 A
- *
# h0 ~( p% V! Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ |% _$ l! w3 K! U9 A7 i1 m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 ?1 A( \- t; }
- * TO CHANGE.
; R2 n% |8 `* U% k - *( w/ r) V: Y1 V6 b7 O( q3 ?8 N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" _" h$ L; ^ \% M0 h0 G2 h% E - *
2 z5 a _" R" i - * This program is free software; you can redistribute it and/or
7 @0 p, n3 B- f+ n' V/ X8 g+ Z - * modify it under the terms of the GNU General Public License as3 O& [, N" I) \+ a7 Y9 m8 x
- * published by the Free Software Foundation version 2.* B+ _) s% {6 O4 o" n: m' h2 w& `7 _( C
- *1 f L$ S( B' P5 D+ [& @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 m& ]" U8 {' s" z2 P
- * kind, whether express or implied; without even the implied warranty7 ^- S+ c2 o) T% N3 y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) F- h/ u! b @ - * GNU General Public License for more details.
+ N& @, O% w! |0 \" U - */
" @) V: ~" e: |* P: `0 Z9 n L# T
) i3 x- f3 T6 ]9 L+ R, D) C- #include <linux/module.h>
0 p% l9 W6 c+ L- J - #include <linux/init.h>% A- V# V1 ~' a. t; E: h
- #include <linux/errno.h>. e% }) H" w8 c1 }( a
- #include <linux/types.h>! J9 d6 p9 `+ C/ L8 ^
- #include <linux/interrupt.h>
) L& W) w4 m( l" t8 c; q - #include <asm/io.h>' J5 Q6 N* W. a8 l* A2 K
- #include <linux/moduleparam.h>( p: o0 p4 ~; Y' \! a
- #include <linux/sysctl.h>
; `& r" e4 h) w; ~3 m - #include <linux/mm.h>/ O* F* G( t- N2 s) S
- #include <linux/dma-mapping.h>
! k' @, b2 p9 M8 u' y
$ Q( U6 q+ V9 D! G0 E- #include <mach/memory.h>
: y( K' R" p/ ]* m - #include <mach/hardware.h>1 J4 q; R: G4 f \
- #include <mach/irqs.h>$ C# X) f7 [* l+ }( C
- #include <asm/hardware/edma.h>
* d* W) z7 ^* p( n
, X( H1 n4 ]; L% M1 r- #undef EDMA3_DEBUG1 [6 {& N, v; [1 J3 ]
- /*#define EDMA3_DEBUG*/
' ^9 N7 }; q* N" {, B
# e+ g2 E7 _: r) _ |, Y- #ifdef EDMA3_DEBUG
( y+ s m7 b3 N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 F2 o0 y4 ?& @7 k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' t6 U6 U6 t p$ T: [+ U4 t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- E5 {2 O& p! L& z. I# i - #else
3 {1 t6 z7 c8 V9 L) }* c& ^ - #define DMA_PRINTK( x... )
' N$ K+ E' j- k" s - #define DMA_FN_IN0 o) p' m6 H) l0 N3 h% t
- #define DMA_FN_OUT3 k3 c8 Y1 u! }# g ~7 f! w
- #endif
! ?9 o7 k! w- ~+ R8 o; x2 {+ ~3 K
# k( f/ }9 }* r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 ?" {- `% m# R/ n* N# b
- #define STATIC_SHIFT 3- H2 M# x! X y8 L7 U( W/ `
- #define TCINTEN_SHIFT 20
: W4 Q6 j" P8 p9 ^ - #define ITCINTEN_SHIFT 210 I6 E+ T& `9 v& f, m
- #define TCCHEN_SHIFT 22
/ {% K6 x5 }* z: O6 V0 c: B5 I4 g - #define ITCCHEN_SHIFT 23
2 `3 a: m5 X/ b - - s& {7 i4 N; s. |: F
- static volatile int irqraised1 = 0;
6 ^0 k4 G& [, h1 ? - static volatile int irqraised2 = 0;9 q: ]5 @. Q4 y3 d- F. c
4 P5 [; z" @+ k( W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- i" l, `' m' s, e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ z7 H2 C3 M: y* V5 V: d0 { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); O5 X' q0 c! p0 }/ z% M1 i U
1 B7 Q, m4 [& F$ s5 r. o, M; N- dma_addr_t dmaphyssrc1 = 0;- |$ m& c1 ?# O, }' ]
- dma_addr_t dmaphyssrc2 = 0;: S" W! _# o2 {/ K
- dma_addr_t dmaphysdest1 = 0;8 Z. x& X8 x2 c6 e( M) h- b
- dma_addr_t dmaphysdest2 = 0;
$ A# D4 v4 D& X% P8 Z) P - 6 N; \1 I5 o3 F! s; K# x) W
- char *dmabufsrc1 = NULL;$ j+ l" ?0 N" {5 J
- char *dmabufsrc2 = NULL;& L4 I* A/ N) o, T- D/ K- S5 M3 M
- char *dmabufdest1 = NULL;: z; a f$ n: c; K
- char *dmabufdest2 = NULL;
' B' U4 N$ Q) x8 g. t9 q
2 X! t1 \+ G: ^. |( U- g' k- static int acnt = 512;' r8 Y$ V! K- ^
- static int bcnt = 8; f, D6 w+ X8 {9 p1 v) x. @
- static int ccnt = 8;7 Q3 X; j8 a- O- ?$ r, w
( A+ y" U* D+ J' ~6 w& X- module_param(acnt, int, S_IRUGO);
4 M. u8 p% B1 }1 I1 [1 l - module_param(bcnt, int, S_IRUGO);
' k* i0 O; f- M( w - module_param(ccnt, int, S_IRUGO);
复制代码
5 d& W3 Z6 y7 r# I3 H) v- Z/ j6 v) y' e% d* ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! p) j# ~6 V% A' p% X2 B/ H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" m- u- e( i0 W6 d+ e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( V% l* k5 |* r/ j' X. I, t) y/ n' r1 z! o) n
: W$ V g* U3 h1 R, x |
|