|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 x# f( n( s& l# ]9 T" r+ O5 g* W
- [code]EDMA sample test application
# X. a2 I6 x7 Y* K7 Q4 T- z - /*" X3 O: [3 e, ? R5 k# h
- * edma_test.c
3 k( G2 p; {& D# } - *
( v5 k7 d1 [; P' i9 ^ - * brief EDMA3 Test Application
4 G7 S( b( C( }0 d - *3 Y. B5 l% e4 s: u) B3 e5 q
- * This file contains EDMA3 Test code. E# }5 Y- |2 [" f5 f" Q$ t
- *
! ^6 O; C( ?: R! o0 I4 Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; e% p5 O, g( t5 V, O/ E1 j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 X3 }' u! w( `, Q. F3 I - * TO CHANGE., F' i7 @( C( P. ?+ X
- *
& d. f7 P! ^( n. B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* \# l0 Y- e1 b" F" t. x( e - *% [6 [* U# L8 l! Z7 k
- * This program is free software; you can redistribute it and/or
; Q4 R& W2 P- S( S3 [2 K. I - * modify it under the terms of the GNU General Public License as
1 y# R x Z1 a# C5 M% | - * published by the Free Software Foundation version 2.
( A3 D8 D" } X% G5 O) n' u$ N8 k - *7 Z, I$ S( o9 h9 u' p9 a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 A0 U# ?" X: s
- * kind, whether express or implied; without even the implied warranty
5 j2 h9 q& D' H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% I% ?# G" B/ K2 i5 y - * GNU General Public License for more details.
6 s2 q8 @" b7 P! ~ [) M - */: J# d/ U- n6 r. ]; a6 h" `9 |
- 8 w6 n( D I& J G
- #include <linux/module.h>
5 G2 d$ o3 M2 C$ I - #include <linux/init.h>
W5 E& S* d' B3 h1 |9 B6 n - #include <linux/errno.h>
- w. x4 a3 G0 ]: i - #include <linux/types.h>4 N0 j/ l% U M0 m/ c: \8 S" ~$ Y
- #include <linux/interrupt.h> v& R0 |; s: L4 K( ?; W" L
- #include <asm/io.h>8 j# p( V8 r8 f( S+ I8 c; C; A# V
- #include <linux/moduleparam.h>
5 W+ B3 ~& v9 _# F - #include <linux/sysctl.h># G5 P4 E- ^/ x3 _
- #include <linux/mm.h>
g( |& g( Q J$ j' i - #include <linux/dma-mapping.h>
' u( a' P$ h# E- S - 1 J; x P0 L/ u5 N$ m# Z$ e; O$ h
- #include <mach/memory.h>
4 J2 E: `! R4 {" [5 n4 F- I/ b7 @ - #include <mach/hardware.h>9 ~+ U2 n5 S5 k; T
- #include <mach/irqs.h>
5 Q* z) V3 x/ A3 o7 J- [7 |. j - #include <asm/hardware/edma.h>; {- }# B$ }& j0 N0 k
3 f5 F7 c& A! ?0 i" j) u0 @& [- #undef EDMA3_DEBUG/ A$ S8 t* M7 ^, s2 P: Y& V6 U
- /*#define EDMA3_DEBUG*/- h. i9 @( z0 v; g' j! I
- 1 N( Q a' ~# ^% ]5 `
- #ifdef EDMA3_DEBUG
# E+ f3 s& d. M8 o- T: c: \% P% s$ X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" ~ l7 c3 Z0 H$ y. A! Y& n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! p) |% R+ [' C# C% ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! ]1 n; J' @) A; W/ o - #else. {+ s5 q8 J9 k8 f" [5 J. o
- #define DMA_PRINTK( x... )
, N9 L6 f5 m5 \# l1 f - #define DMA_FN_IN a2 o' f6 }) w: E- D( h R
- #define DMA_FN_OUT
& ]9 X9 ]3 `& r) w - #endif- v) I" t* f( y
# { U7 w: y) S8 Z: V* g& ~* X' s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 m! o4 {0 f( \% a7 o8 l2 ]2 h - #define STATIC_SHIFT 3
% Y2 ~* _0 S2 Q, a( |- r( W - #define TCINTEN_SHIFT 20
- ^" M6 a" {- v9 c! V - #define ITCINTEN_SHIFT 21
^& U0 J+ N9 `# B0 y6 n4 _ - #define TCCHEN_SHIFT 22# E/ S( k/ D9 G9 P: S
- #define ITCCHEN_SHIFT 23
' @4 D7 A& f4 ] - , ]/ n) z8 @. N5 T; M
- static volatile int irqraised1 = 0;
& |! m4 G; T `4 @# q - static volatile int irqraised2 = 0;; O) E0 t) n, x3 H. z2 d% F2 X
- C' o9 Y( V6 V, o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 S1 c+ c1 e& s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 z7 S! {! u8 I) m: T" V1 Y* v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ U0 d/ j& n5 J' U v. e, t
- + W" H: ~4 A: L t; X3 k2 E z9 V
- dma_addr_t dmaphyssrc1 = 0; D7 Q; B/ Z8 F$ g
- dma_addr_t dmaphyssrc2 = 0;* n: V6 n( W' p Y; X
- dma_addr_t dmaphysdest1 = 0;, S; J+ |& g7 {) O8 B j( Y: l/ ~
- dma_addr_t dmaphysdest2 = 0;
( ]1 t0 H! m# n4 U. l - " c: I x: ]5 t8 I
- char *dmabufsrc1 = NULL;
1 R: s0 P0 o: ] - char *dmabufsrc2 = NULL;% g. W8 j; ?- K% v4 Z) `
- char *dmabufdest1 = NULL;/ j4 D4 o4 z* V. B
- char *dmabufdest2 = NULL;
3 S( Y( E* L" ? - " r/ V$ L X/ T! k4 {5 c5 q
- static int acnt = 512;2 N+ q0 ^' c0 X5 S/ ~- i1 i- E
- static int bcnt = 8;
) s) |" v, j2 a - static int ccnt = 8;
0 {2 a, { F! W3 g- h8 F! J3 u
2 @/ }7 H1 J0 b# ~% p( c- module_param(acnt, int, S_IRUGO);
4 m6 P) y. [6 K3 y" z - module_param(bcnt, int, S_IRUGO);' f& p% }0 C* M+ C' S' K8 P) v
- module_param(ccnt, int, S_IRUGO);
复制代码 1 q! D4 L) L" f
- s% k2 B, S& K6 { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 D! C( z2 x5 M/ V8 v. c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' q# d1 w& ~. i! E+ |1 Y4 _; d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 S' G0 D6 N) {0 S5 X* N! V& c0 D1 ?% X
w0 q; R; ?! w |
|