|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! d1 b9 v, f7 z1 G, U
- [code]EDMA sample test application% d- E9 f8 y3 o* D
- /*. {( O$ d% }+ w/ U9 Y& U2 Y5 N
- * edma_test.c7 ^0 V. y$ h, \
- *
* r0 ?* W3 c0 L - * brief EDMA3 Test Application5 v' @' w$ d+ x8 `, e! T
- *! l! o- z/ f* ? V
- * This file contains EDMA3 Test code.$ S: R$ G; K! }0 r# _: \2 ?
- *5 f% r. v" j% x" s% y. f' z: E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( F& V4 P' T- y7 R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 U- J# |6 e% z; u' s
- * TO CHANGE.
9 H, b4 Y( `1 @& m - *
9 S8 X" q2 U$ f3 I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; y. i, x% T. f& Q5 U7 s' d - *
& L f+ }9 D4 E0 w7 r - * This program is free software; you can redistribute it and/or7 J: y) c; G* I0 O. H
- * modify it under the terms of the GNU General Public License as
( |! \1 o: ^1 k$ }% w. ~/ I5 n - * published by the Free Software Foundation version 2.* u+ d+ v6 X& B- _; Y1 a% h
- ** C6 Z1 V# R5 ?* r/ |8 [7 Z& _8 O" m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- j2 z' Q8 k& H8 k) a: V, F1 c - * kind, whether express or implied; without even the implied warranty7 ~- H, I) j0 d. d% O/ K1 p7 m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 p6 {* r" p! i6 k - * GNU General Public License for more details.5 R& [$ F1 d: I" F) b# p
- */; \7 _' u, n, s" P8 P D
- o# C5 a7 H/ G; _6 k3 c4 h3 R% s4 k% E- #include <linux/module.h>) K0 x" c% }' r% q
- #include <linux/init.h>: y w' @5 }- r* Q; M4 c
- #include <linux/errno.h>1 i2 b1 y! V. x6 a4 o: c
- #include <linux/types.h>
3 K$ K1 d7 f" B - #include <linux/interrupt.h>
/ b% Y' T# u+ g - #include <asm/io.h>
6 o1 t. ]$ x' f( W( C& n4 E - #include <linux/moduleparam.h>
8 d8 y( c7 t+ e" o% J: k - #include <linux/sysctl.h>, D; c5 i& L% Y; h# s8 f* v- x
- #include <linux/mm.h>
" j1 g/ N' T$ d* k! `7 R+ ? - #include <linux/dma-mapping.h>1 F! M% R1 N! @2 Y' n7 r
; {% k$ f4 }' B- #include <mach/memory.h>$ n) l2 p! B' x: H) r9 w
- #include <mach/hardware.h>$ d0 t7 p2 p; S7 q9 B# A' X( d
- #include <mach/irqs.h>
i) K$ m' g) e7 H1 g9 t - #include <asm/hardware/edma.h>2 l# X, E3 m+ S
3 s, s. K- ?; j" \( K" S& B* N- #undef EDMA3_DEBUG" x3 A1 K( c7 g( N% Z. N- B
- /*#define EDMA3_DEBUG*/
, f9 v r3 c z& t7 a3 s - 0 L6 Y; Z( G% G$ d. c% j
- #ifdef EDMA3_DEBUG
0 g5 J, [/ X" M/ Y/ l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 K0 ~. o0 u8 n5 O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 Y4 M Y* Y8 Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 J7 @+ o v' S0 D; _' R) b# f
- #else
: L2 N' f- `- @ - #define DMA_PRINTK( x... )# m! O5 ]" T7 ]2 |* |- f0 t1 r" g
- #define DMA_FN_IN
; P3 X& `& c z8 V - #define DMA_FN_OUT
0 @4 g5 z2 C) a - #endif1 I4 Q% p: d9 `: s2 _/ D! c
- ) E$ r# \2 {! `9 u( k$ q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 o+ d" L/ R# X9 S4 m% U' y - #define STATIC_SHIFT 3, J6 n. M- t1 J+ C
- #define TCINTEN_SHIFT 20
; q2 Q# j$ s( K0 t4 h N - #define ITCINTEN_SHIFT 21
" b4 y% z n- f( A$ S- i& U/ r - #define TCCHEN_SHIFT 22( _' L' S! H- \5 m
- #define ITCCHEN_SHIFT 23
8 }; ]3 u1 k' K, O+ o/ C - 4 r' X: F c) k$ h/ T
- static volatile int irqraised1 = 0;# |3 _+ D! `( @# r1 C
- static volatile int irqraised2 = 0;
0 g8 J! I4 |' l( R- c: g O
6 W4 B Q; t' x9 s5 {/ B: v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 { L* w7 Z$ E. P0 ]- Q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! o. ]6 x) m% S" o. W" U* Y- k4 y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* a0 A' W; o: ?; {8 B
- $ t6 E: R! j+ G
- dma_addr_t dmaphyssrc1 = 0;) q' O4 K. [; r9 [- x2 M/ @
- dma_addr_t dmaphyssrc2 = 0;5 N1 P0 `. h0 w" Z
- dma_addr_t dmaphysdest1 = 0;
- H! }" {0 E2 U, ] - dma_addr_t dmaphysdest2 = 0;
1 |8 J! T4 Q Q6 i- T
V( V4 o9 o# _! }- char *dmabufsrc1 = NULL;
) w2 V3 n. M, g" F" ? - char *dmabufsrc2 = NULL;/ u. f3 n! \8 Y* a& c; P1 {
- char *dmabufdest1 = NULL;
* ], L1 V, z- M1 f P - char *dmabufdest2 = NULL;7 F, v- [; m3 n6 x, U" n/ V
- . _6 p+ g' @+ Z4 T3 I6 c
- static int acnt = 512;
8 d! V x. @, S2 q - static int bcnt = 8;
" z1 t y: \1 y$ l! o0 L/ W - static int ccnt = 8;$ m) d, e# {1 L ~* D
- c: r" I' H% P) x: ^, \% ?- module_param(acnt, int, S_IRUGO);
/ y4 P) x' a# O3 S - module_param(bcnt, int, S_IRUGO);
$ S. L4 q% \" t# A, i" ?1 G" Y - module_param(ccnt, int, S_IRUGO);
复制代码
G2 h8 D1 q# c
0 R3 U% O& _8 m; x3 ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ _6 w7 ]& @. J8 Z9 m. G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( S8 ] S- d6 C9 q" e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. U1 G. h7 h& h0 c! _$ N* J9 [, r$ x
?& d, k2 \4 a: S
- l; f6 P4 s& L2 _) R3 t% h6 J: @3 [/ O Q
|
|