|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 |/ l" j( t3 c2 {/ S( o
- [code]EDMA sample test application0 k0 e2 \3 j9 J4 C- M
- /*
" f2 _. E0 a& v3 V& f - * edma_test.c6 W+ F" e! A7 r
- *5 ~% C1 O9 `; Z2 _3 L* t) O
- * brief EDMA3 Test Application; I8 W2 ^: E( i1 P6 [$ v
- *
/ z2 A/ E8 j; x" [ - * This file contains EDMA3 Test code.* o$ q: C8 `3 ^' [
- *
V5 R: t, d. P s( ^- }8 | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 v9 `% ~- ~: Q6 b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! z I% N3 \( ^) T! d) O. \
- * TO CHANGE.9 s$ m( y3 S3 k2 e
- *
% v. z+ V: S4 v K* ~/ \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# H! C [! x# Q2 j0 B5 U - *
0 R& E! {8 p2 Q7 D% ~0 x% [ - * This program is free software; you can redistribute it and/or
) L2 u) t6 n: [( a" s - * modify it under the terms of the GNU General Public License as4 ^( F$ {3 J+ @! y0 R) y# e9 v
- * published by the Free Software Foundation version 2.
* K8 m6 n; Z7 @: V - *( V( Y3 J4 M! w* W4 [7 |3 z- k& X* f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" a% L; i% Q6 j - * kind, whether express or implied; without even the implied warranty
^/ {% i1 u+ j2 J# ~$ j5 Z# k9 r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" v! |5 i& ^5 [' W& ^ - * GNU General Public License for more details.' j0 U( N# F! a2 E4 @ D
- */. |) H+ U; p `0 n6 q: V! o2 j
- - G( V$ a) I1 o2 H8 }& q
- #include <linux/module.h>
+ C8 k/ E$ y5 g - #include <linux/init.h>
' O( u) n$ I- o" [$ T - #include <linux/errno.h>
5 S) ^9 Z9 B4 u. a' b) F - #include <linux/types.h>% h& b1 q& v- Z. `6 w7 n
- #include <linux/interrupt.h>
# J) q$ K9 N- [% r0 F- k3 \ - #include <asm/io.h>
% d6 `" O+ g$ u" y) _8 r - #include <linux/moduleparam.h>3 l# G# J: p+ \7 p8 |/ ~) \4 O: P
- #include <linux/sysctl.h>* l3 {8 |1 P; C a9 u
- #include <linux/mm.h>
" @2 j7 Q, T9 w4 C+ B - #include <linux/dma-mapping.h>2 U% I+ r S9 H; ^9 j( i
- 2 }) ]5 F5 B2 z! T8 Q
- #include <mach/memory.h>% p2 H+ q9 T: R8 p
- #include <mach/hardware.h>
4 R: Q: }9 W% H/ n - #include <mach/irqs.h>
) a! t, A7 h/ Y' B: l8 s; z - #include <asm/hardware/edma.h>, s' ]1 [3 y) s4 Z+ e+ H
0 ` |- f: y; M ^ H7 U- #undef EDMA3_DEBUG
$ V& P1 H+ F9 c$ a - /*#define EDMA3_DEBUG*/) P2 ~8 a6 D; G, D$ ?* H! D' Z
) }2 a$ v1 L$ r- @- #ifdef EDMA3_DEBUG/ v. b- E2 ]) R4 c+ i) ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ P$ _* b& b. d! @, u% ~+ t- w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 t$ _" Q8 Y0 e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). w1 [- J6 P1 e. c3 U3 s, \
- #else" d0 Z- x/ Z4 m% r* I, [, e
- #define DMA_PRINTK( x... )8 D4 F9 ~& V# q6 Q3 O( J
- #define DMA_FN_IN
; Z% i" z) T5 G, T3 u ~- q - #define DMA_FN_OUT2 t( F g! A- [6 ~! D
- #endif
" L) E1 H7 r3 b& N( ]; S - ; k+ a7 O& D4 D% a, \; Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& u7 s2 A8 W6 e - #define STATIC_SHIFT 3
& j: H7 |! ~% }4 I, [, E1 O4 Y - #define TCINTEN_SHIFT 20
4 q0 _7 }( B/ J/ X# |) V - #define ITCINTEN_SHIFT 21( S) ~8 s% f% M k" q+ f6 ?# d
- #define TCCHEN_SHIFT 22
9 k, F) E& e% W2 J - #define ITCCHEN_SHIFT 23
9 W' W" n9 } @; [" I3 l - $ I- Y \) |, }& I
- static volatile int irqraised1 = 0;; o% g7 {/ s) M$ }
- static volatile int irqraised2 = 0;) v9 b/ `. d" o& ^1 a; V7 D0 X
- : U- p; u% K4 l: S6 z% [' N/ Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 a# L7 Y; G- k/ u' S5 W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' T6 C) W \! A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) r5 K/ O- V0 I0 _- E- O# x - 8 {' L1 |& S& `7 |
- dma_addr_t dmaphyssrc1 = 0;
; x5 R/ M% Z+ N9 B1 ?# d( R; Y - dma_addr_t dmaphyssrc2 = 0;
3 M9 {: J$ Q- M7 f( o' V. p - dma_addr_t dmaphysdest1 = 0;7 g! {8 Y! u5 @5 m
- dma_addr_t dmaphysdest2 = 0;, N! B' Y/ t- A% Z% k4 ^! t- e
- - V3 C& {) X; x1 ]# t
- char *dmabufsrc1 = NULL;
9 o. h0 M" { M& x7 k" H$ K - char *dmabufsrc2 = NULL;( W3 ]" x* q. M
- char *dmabufdest1 = NULL;% h8 [; E7 U6 }! M
- char *dmabufdest2 = NULL;- H% K& _. `* j$ J- ^4 O
- * x, `6 S' Q* \- ]
- static int acnt = 512;; W, W8 x5 h h
- static int bcnt = 8;* i% J8 \4 z# d& H# l1 l$ i) m, Q
- static int ccnt = 8;' F6 k2 B1 m& L* U; N' A! J. M
- . N8 R* g% T! s3 C7 L
- module_param(acnt, int, S_IRUGO);
# v! b1 h, m% ] - module_param(bcnt, int, S_IRUGO);
7 p3 `1 D8 \. @* m$ ~$ A$ C% [& `1 k - module_param(ccnt, int, S_IRUGO);
复制代码
p. m; ]6 a! A# W8 A: @+ d$ m9 d) i: ~$ |" n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, F2 r* Q+ O3 S6 u: h: q: larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. n8 G1 C, m) T' H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" b: O) p. N) O" [3 |$ `) I# W
$ B& M* }8 b3 R$ Z @
+ t( M9 S" C3 ~, ~8 r |
|