|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 X$ r/ a$ O. e; e) H/ T8 N9 a+ K
- [code]EDMA sample test application' F0 a' k- w# ?
- /*0 c1 H: ~1 x6 ~8 \: r
- * edma_test.c
0 M" f. ]9 @0 z9 G. J8 E1 {" y - *5 S6 _ A; a6 x7 i" n$ G K- g
- * brief EDMA3 Test Application
% h! c! l! G/ c& w7 F0 q: u - *) k; P8 a5 H" n: z% p8 I) f/ g2 f
- * This file contains EDMA3 Test code.
, ^. N2 \) }4 a+ p6 w+ Z! m( h; J - *
* k% p, h, M3 v) ]9 V& j; g; R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, r$ P4 K" m/ q: Q' j/ V& q3 [4 e8 @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 ~0 E/ d0 L9 F7 K
- * TO CHANGE.
. `( A6 x. z; l) N - *- D8 E# [ P! _* D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 i- T5 f$ \ Y/ J: n5 K F4 b - *- N8 Y+ K2 b) a* `, a
- * This program is free software; you can redistribute it and/or7 A% u3 \3 c" w$ t, ~5 v
- * modify it under the terms of the GNU General Public License as
* T# F8 k7 }8 j* i1 w - * published by the Free Software Foundation version 2.
; ^: |& L0 y- P- E$ F - *7 O/ m1 M( Y L) C; z; u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ Q8 R! C1 q* T9 [: a - * kind, whether express or implied; without even the implied warranty/ A" B2 n# Y# o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& {4 d, e1 e1 u+ b) m# m - * GNU General Public License for more details.
5 e* f1 A) M0 ? - */ [5 d& D% g; r6 y- S
1 v: A& n/ Q, e% {+ T- #include <linux/module.h>
& r9 g5 j" y1 I3 o& d; Q$ u - #include <linux/init.h>
5 I6 U3 r" R2 i" N - #include <linux/errno.h>
- s# q/ l7 E* J2 }$ H5 ]" ? - #include <linux/types.h>9 n& s$ }* d1 u" s; v# I- A" P
- #include <linux/interrupt.h>4 A2 O9 |7 j i8 A j/ H
- #include <asm/io.h>8 }. L1 d/ [* l% x. A
- #include <linux/moduleparam.h>. k0 C' o" d5 w* b* Y" n; M
- #include <linux/sysctl.h>) M& R7 a7 l* \5 q) b
- #include <linux/mm.h>* \3 y( `1 {4 e$ D
- #include <linux/dma-mapping.h>
, u9 r* q" j3 [, K% H- L
2 m" F6 D! B# s' Z6 ?+ ~1 J8 s. d- #include <mach/memory.h>1 K! a* l% h# h, K
- #include <mach/hardware.h>
# T" T0 h. R" a8 b - #include <mach/irqs.h>
( u* S' z& K! A" n+ j - #include <asm/hardware/edma.h>
: t" r8 U$ a' w1 ?
7 C; G+ }5 j: q! r* o- #undef EDMA3_DEBUG
" f1 r1 l+ Q- e$ J$ m, A- ^1 s/ G - /*#define EDMA3_DEBUG*/8 i' T+ m0 }1 F/ W; u
4 P( |- G7 R' n4 D. o* U, B. O- #ifdef EDMA3_DEBUG# U1 h8 H" g7 r% r6 i# t1 q& H/ k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' K6 k3 W* O& C1 ]( b/ G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: s( N: h9 [ m) { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ d4 T$ J* S4 V$ c! K2 ?( j
- #else* j+ Y* {7 d( @; I( n# j9 W
- #define DMA_PRINTK( x... )
) j v8 l0 l1 A - #define DMA_FN_IN
2 @1 S z9 `. w, O% z, x) ` - #define DMA_FN_OUT. k3 h+ p& G% B# V1 ^8 L1 V
- #endif
! Z9 j( l* t" f; I9 H: { - 5 W3 U! ]% H; q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. c& \) c. ^! {% W+ V( ?6 ~7 j - #define STATIC_SHIFT 3
( C/ d/ W8 i1 `3 k, V' j' q - #define TCINTEN_SHIFT 20
& n1 q; B& {# U% ^1 b& F2 H - #define ITCINTEN_SHIFT 21/ G; p% J5 ^* K& l3 f& F! k
- #define TCCHEN_SHIFT 22
- O% O0 A. W0 b$ V2 o - #define ITCCHEN_SHIFT 237 M- E, @9 ?( i" z& t
6 d6 O j: m! X2 I8 }% M- S5 @- static volatile int irqraised1 = 0;
9 T9 D* _. M5 |& \! A% w7 a3 G - static volatile int irqraised2 = 0;
1 E1 p+ r& ?+ P# I3 O2 ?& j - 0 U% P8 K- J5 K& R" `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 Q" e2 v9 O) r' t, k! r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- `" D( Z! ]$ j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) g) s& M8 U1 B7 Q$ R8 f
8 p* D. U- C4 \% S+ K( G, l- dma_addr_t dmaphyssrc1 = 0;! y4 L7 V% F2 l& ~; {5 T- ]5 A5 @
- dma_addr_t dmaphyssrc2 = 0;; u. w4 h) E* P% e
- dma_addr_t dmaphysdest1 = 0;
0 `% u ~, o& t2 o - dma_addr_t dmaphysdest2 = 0;: V3 u ?/ l9 ], L" U d9 A
" d% R! l5 J7 v. d9 ]) C- char *dmabufsrc1 = NULL;/ J9 B- E4 p& M2 U* u+ l
- char *dmabufsrc2 = NULL;' c0 E3 ]6 ] q( r# ?. ^
- char *dmabufdest1 = NULL;
- i C1 _$ ]5 w5 K - char *dmabufdest2 = NULL;
/ O: S- C& G" p9 N% |; t+ W5 y! y& V - $ d( @( v4 l- P* A$ w
- static int acnt = 512;
1 o: }: ?5 g# A7 E2 S - static int bcnt = 8;: W+ `3 w. ~8 q
- static int ccnt = 8;
/ [0 c5 c; x; R+ D j g+ e
% n& p% u1 u7 A9 y- module_param(acnt, int, S_IRUGO);& @/ j& l3 O- `- f1 v% T+ k4 I: a
- module_param(bcnt, int, S_IRUGO);
, s9 ^% M x/ m" l/ R - module_param(ccnt, int, S_IRUGO);
复制代码 . Q; a/ a, @ A
: I d2 N3 u t1 `8 Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; H) Q4 E( o5 q
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! ]- X3 F! |7 e0 V; f8 d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' i r2 X% c3 ?' ~2 w
1 F, e Z! E( | }7 u# b
! | I5 F9 q' b2 }+ \) j2 v |
|