|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, x6 _2 h, q8 ?7 R( w8 X! K( ^- [code]EDMA sample test application
% M0 a R% K% [1 }' P - /*
1 K6 i- S" n( R/ s - * edma_test.c
- ]" E* H1 E2 P! y/ M; } - *7 t0 F2 h# l& y F
- * brief EDMA3 Test Application
+ \# z% G% Q7 L% q7 T- c - *; u, G/ L: g z( V( ~- ?
- * This file contains EDMA3 Test code.
. R Y% U* C8 ^8 o9 N3 A4 P - *
( l$ F' Q4 R' k- } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" Q3 l' Q( A+ E1 J F1 P0 V% ^3 j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( }' ~( u C9 D' J9 u5 |
- * TO CHANGE.; _: m5 W$ _6 L7 O: S# l. i
- *: o; C- a- T5 E1 g: @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- f# [: m3 B! u2 z6 O# P. T
- *- `6 f4 `. x0 _! m2 _
- * This program is free software; you can redistribute it and/or% J4 ~) f2 x$ l8 B W [% i: b. k/ _
- * modify it under the terms of the GNU General Public License as
2 T$ y8 G0 d" O/ X+ e4 ?) Y - * published by the Free Software Foundation version 2.
( W! i+ m8 x/ q/ T/ u/ v; L9 Q+ v - *0 w5 L8 I6 C' R+ E$ h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' b1 o' |. b( T
- * kind, whether express or implied; without even the implied warranty
1 R3 R- ]1 ]5 a+ V) G! _& A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 y5 g8 r# L1 z9 q% G4 w9 x - * GNU General Public License for more details.8 ?! P) ^2 [8 Z2 A1 s+ Q
- */6 L* W4 `! Q, v5 O0 p* o3 \% }
- 5 z, m' Z& h4 W+ a+ y& r
- #include <linux/module.h>& K6 m( U5 C7 ?7 V
- #include <linux/init.h>/ A/ s( E0 o3 a1 N$ D8 r+ b# L X& x
- #include <linux/errno.h>8 B; _( T( s! r) i- L
- #include <linux/types.h>
% h% J3 z% g% q3 O+ E* C - #include <linux/interrupt.h>, W; t6 U& _( g r
- #include <asm/io.h>9 w# H. a9 U/ R( n# @7 k
- #include <linux/moduleparam.h>
' S* q/ j, v, a1 O5 w - #include <linux/sysctl.h>
& m/ {( R/ f" n' D- f - #include <linux/mm.h>
2 q8 F. ~0 i/ ^/ | X9 j$ i1 ` - #include <linux/dma-mapping.h>. o- u' o8 G, g' W* _- a" e0 P
$ ?) k' w1 I4 C; q% B$ H4 j6 A1 m- #include <mach/memory.h>1 Z. P/ T: F( `+ ]
- #include <mach/hardware.h>
! j$ ]3 v7 N+ h* u& ~/ G4 s8 K - #include <mach/irqs.h>" E* [- G4 Q9 n2 [$ ]
- #include <asm/hardware/edma.h>: W8 w' O. M. ?# U, f
- * K/ w( D5 X/ y8 [' {# k s: U
- #undef EDMA3_DEBUG
$ @$ u) b9 N5 O9 w+ K# \+ [6 ^ - /*#define EDMA3_DEBUG*/3 D4 D o+ q t3 _& ~! o6 T
: Q2 O9 T8 v1 E6 W* S) ~ N1 S3 o- #ifdef EDMA3_DEBUG, E* \2 b3 B. U; G' z, n( ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( h; z2 N! l; [; [$ n1 D; ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' i$ _' x s0 `% } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 e* U/ T& }' c& O5 S$ U# V - #else
* U7 |# I# M8 d9 a6 Q) H - #define DMA_PRINTK( x... )
- Y. [) D9 Z. \) @% f5 u6 O5 n - #define DMA_FN_IN
8 S' g) r8 d z3 |! @3 ~) `, a - #define DMA_FN_OUT
: ^2 |) h. [! Q - #endif
2 q3 r+ E/ M, J* r" \1 _0 H - . o! ~% E* @; E+ R4 T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 C) S r0 Y1 a: X. q" w) s# K. z
- #define STATIC_SHIFT 3" g+ w, t0 M. {0 r# c+ I
- #define TCINTEN_SHIFT 20* Y( o! l/ B- W# e
- #define ITCINTEN_SHIFT 219 X6 F% |3 ?% a5 _4 O7 s
- #define TCCHEN_SHIFT 22
, L) s( Z6 p) ^& D5 Z0 ~) b - #define ITCCHEN_SHIFT 230 P6 ]( Z A3 R1 W3 V3 z, F) Q
- : L0 K: o" C2 Z; h& v: p0 Y
- static volatile int irqraised1 = 0;; t6 \) \5 V3 j2 N! L& F
- static volatile int irqraised2 = 0;* \* ?/ m) N* {* C# c% f
5 q6 q$ L* w- ^. p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 g% y" V7 p. a7 O" V' P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% s4 t3 @' ]7 _& _1 u
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 a; D* [ |- `! L6 r( y4 O
# l+ K& z) w; k! w: b) z- dma_addr_t dmaphyssrc1 = 0; h$ j" P4 K) e- G
- dma_addr_t dmaphyssrc2 = 0;
$ I7 V! A: O5 z9 C# e - dma_addr_t dmaphysdest1 = 0;5 E& J. h2 T5 v9 X6 [/ H. p
- dma_addr_t dmaphysdest2 = 0;
# k* m1 k' d! I9 m - ) S! w6 ?: s5 j ]/ K
- char *dmabufsrc1 = NULL;" y8 `( t8 \: g* R2 w, Y
- char *dmabufsrc2 = NULL;: P( a0 ^5 r& w8 F
- char *dmabufdest1 = NULL;
$ _- u$ o8 g! c; i+ s - char *dmabufdest2 = NULL;8 j% ?9 k% v, [% ~/ M
& t7 u) a/ K% ?/ U1 b% z- static int acnt = 512;
7 X2 O- v3 y4 Y! |: c1 V - static int bcnt = 8;
\0 x8 q* {; W - static int ccnt = 8;
1 F8 ^# e! z" Q$ m7 x) g
2 ~3 j% L) O/ Q9 W- module_param(acnt, int, S_IRUGO);, X. \- o" p$ @
- module_param(bcnt, int, S_IRUGO);% N1 N- J; D8 @" i
- module_param(ccnt, int, S_IRUGO);
复制代码
+ J4 T3 L: N; z, V
7 K- o! B+ z1 D" w/ N8 L0 f5 G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 t( f% q+ U/ A; N: i5 u' B& |2 Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 S1 M9 w0 i+ g0 b: y/ T6 d: v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 N, k' g Y; v/ s3 V n) @6 y& y" q" w# U2 v5 ] \) u. \7 U
6 w# U5 J: a; U3 P
|
|