|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: [1 U6 `* K R) u, {. q- [code]EDMA sample test application8 m1 ]+ _1 D/ `4 ]2 x4 H
- /*
9 B2 R6 O J, h7 J) ` - * edma_test.c6 P3 ]! @, _3 P( |
- *
0 C% c7 e& U9 }6 v3 @ - * brief EDMA3 Test Application" p5 v/ i7 z T* S3 Z3 ^; A2 a* z
- *# j2 |5 X6 e; Y- i# Y7 C
- * This file contains EDMA3 Test code.0 J3 B6 D7 g. M9 m- g% u! Z6 ^
- *
* _$ e' @/ b) I! N; ~* L. J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE e& m+ {4 g4 @7 X* e' H6 ^3 r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) Q0 U2 T- [" g& T' N* p( N) i6 { - * TO CHANGE.
! c. \& I8 D) o6 X M - *- l. E7 B1 p+ R5 S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* p. @2 ?7 B8 W" Q
- *
( J d: i) z( y6 j - * This program is free software; you can redistribute it and/or+ k" u& f( M# I% C* M
- * modify it under the terms of the GNU General Public License as
/ m2 B' I8 Q& Y* I - * published by the Free Software Foundation version 2.- h& G) k4 Q7 ^2 |5 }) c9 b
- *
1 z" j7 i U- E& w& t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& s( X) j) t0 n0 E4 x
- * kind, whether express or implied; without even the implied warranty( U" r$ ]. P- @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 R- x, _( @" ]" U - * GNU General Public License for more details.
) w* i* d, l- C3 {# y" p' u2 E/ c - */7 i' O$ E% y+ ~
& k. D" W+ m; c& }: W- #include <linux/module.h>
! c9 t& k' V- P/ G - #include <linux/init.h>
' R: n* ~4 _# V0 T2 [1 X( M - #include <linux/errno.h>
- T+ f# F5 r0 p6 L' a3 c c1 a; Z& j$ t - #include <linux/types.h>
/ X3 W% ?, L+ M/ v" ^- G6 b - #include <linux/interrupt.h>9 ?7 ], Q8 z: m* y3 p' b
- #include <asm/io.h>8 O% s" D. H" w$ W" @: d; A5 p5 y
- #include <linux/moduleparam.h>
; f4 W7 j. o5 o& `& i - #include <linux/sysctl.h>% A! q) d3 q r8 a
- #include <linux/mm.h>
& W. R; ]# t9 a# n9 @" u5 I - #include <linux/dma-mapping.h> F" a/ ^$ G4 d; U/ ^
- M9 m: v/ Y1 V8 u' v( n- B- g- #include <mach/memory.h>
' A$ F' D/ Y* n% v; _9 z" a7 n- T - #include <mach/hardware.h>
5 e. b o. F% _4 X% @# N9 r2 B - #include <mach/irqs.h>
) f+ t* V( X, W. P8 P7 T( A! U - #include <asm/hardware/edma.h>
, j: c6 W b: ]. c |) F - / h6 K% E1 b7 r0 a* f* w
- #undef EDMA3_DEBUG
/ i0 M* ^% u# T$ p3 n2 D" o - /*#define EDMA3_DEBUG*/
, s, ?6 ^) k3 } N4 ^6 `$ c
) I( Q" ^; ~0 `; |5 D+ w6 U5 g- #ifdef EDMA3_DEBUG2 b0 V- H- \4 f# P) ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# [6 x+ D0 P. v, g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ B8 |% c- y, c; b; w* k; w. v$ o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 u; Q9 m6 _, n. B - #else
; u9 r9 w) [, [( o4 T - #define DMA_PRINTK( x... )
, T0 ~5 h( _' |4 i3 t8 `5 r - #define DMA_FN_IN
/ O% {9 ]$ p% i+ a - #define DMA_FN_OUT
- ]4 h: K+ r7 j9 T* s3 t - #endif
! Q3 B- \) |1 @1 W2 g8 G3 o - : K- [/ y6 q x" h: V- K9 T( n r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" {; l9 y" [8 Y" R- _; d: U2 i
- #define STATIC_SHIFT 32 S* s2 f2 S$ ?, u$ @
- #define TCINTEN_SHIFT 20
* p4 m7 {/ T4 ?9 b; i - #define ITCINTEN_SHIFT 21( G8 L3 s5 E) d6 H. A+ L+ ?$ f
- #define TCCHEN_SHIFT 22
& I& h4 }7 T' D% ^ - #define ITCCHEN_SHIFT 23
) P$ O e) [+ E; R+ k) R9 Z o1 |$ q
' Z g; n9 L# p D- static volatile int irqraised1 = 0;
1 W% y) ~/ {8 N# k( A2 a5 E - static volatile int irqraised2 = 0;0 K6 [5 x7 P( M! D: g
- 3 [. J ^! l2 X) h" M3 M& j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ r. q5 Y0 ^8 W/ d% y4 V2 a; c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; |2 h6 H# G3 v( Y- F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 M: Z# Z, O4 h8 ?5 H) X! s
- + O% v) j" C6 R% A+ R
- dma_addr_t dmaphyssrc1 = 0;7 E$ B7 e" r5 g; o' S% { D x
- dma_addr_t dmaphyssrc2 = 0;& T0 H3 n& \# e5 |5 u
- dma_addr_t dmaphysdest1 = 0;# B0 y+ W. x- `" b, J; b% B
- dma_addr_t dmaphysdest2 = 0;# y, I( {" j! n+ I C7 p' U
" ~6 v1 Q; B& o7 m) T% d) l- char *dmabufsrc1 = NULL;
& R2 l7 A" p8 P: N3 T - char *dmabufsrc2 = NULL;
/ [/ K$ w }$ r% L - char *dmabufdest1 = NULL;
1 r. S; ^4 ^1 I7 S# ] - char *dmabufdest2 = NULL;
8 ?. m, x& H; ]* g5 t7 e+ D' w - ) q9 g( u8 a D6 p! \& Y
- static int acnt = 512;
' x) s1 g3 W& V - static int bcnt = 8;, p, [' a3 j/ _. a$ r5 `; E! [& v/ H8 m
- static int ccnt = 8;
! @) ^* l* V) i, `8 L4 H - " `9 i3 e9 k- ~! [( z* E
- module_param(acnt, int, S_IRUGO);
; ]) ^ W9 T: i9 s, Z- D4 @ - module_param(bcnt, int, S_IRUGO);
% t' n6 x* t, f& \& e - module_param(ccnt, int, S_IRUGO);
复制代码
7 P K, o7 B$ Z. ~) Z3 b. m+ f* t+ ]! |+ [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ j( e- z$ g6 g; y0 Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. ]' `/ i6 w3 d' J+ t. I& O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 A7 [" O$ S1 w0 m8 s, Q3 P
" |$ T, n w/ C: ^. p9 f, U# r- U6 f' ~, l
|
|