|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 W5 z" a7 i1 T6 y& m# t5 M9 ?
- [code]EDMA sample test application: ~$ W% }% {2 N
- /*0 R8 l0 }9 l8 V: W# I
- * edma_test.c
: S+ f3 T/ F' _ - *% ~2 b3 H b* E' X8 G
- * brief EDMA3 Test Application1 m4 n) C+ Q$ u8 H5 W
- *& e- N# i @2 S: j) R
- * This file contains EDMA3 Test code.
5 l- L- H; \" } - *" w& w8 b3 Z: h+ ~2 J {( ~# A( o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 k: r/ f" j+ {8 ~$ S, f' W( B# z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- H4 l- j* n. T% N f
- * TO CHANGE. [& K S+ Y3 o
- *
- E, j: ?) ~: Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' Q5 V! o7 {# a
- *
! h5 e% Z6 Y1 {: K: n4 J* N - * This program is free software; you can redistribute it and/or0 `# {( q$ m: J+ C7 l# s; y
- * modify it under the terms of the GNU General Public License as
Q. j# r! M- c) I, k0 \0 e - * published by the Free Software Foundation version 2.
& o- M% c1 Q" p0 G: o) r - *
: |/ j# j/ ^( f/ L" V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 \: M! O: S3 S
- * kind, whether express or implied; without even the implied warranty
0 |% \' G; ?- D, e6 [% H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; ^+ |9 u1 D5 B( H1 J0 k) A; R
- * GNU General Public License for more details.# O/ h: p Q: Y4 e: g
- */! K3 [% b' x$ w2 Y" [" u
- @- S9 Y- R' {1 P/ J1 Q
- #include <linux/module.h>
( e5 v: t" [# j% h$ m, ?) S7 G - #include <linux/init.h>& @ Q7 W* _7 ~! k) W
- #include <linux/errno.h>
7 h. R8 b. x: z: r - #include <linux/types.h>3 u& |+ d, a9 x9 i# S
- #include <linux/interrupt.h>3 m& ]) s( m/ D) @# l Y$ e& i
- #include <asm/io.h>
% a( p8 g, Q, b - #include <linux/moduleparam.h>' F% g3 w3 m/ W
- #include <linux/sysctl.h>
" ]; H. o o5 d - #include <linux/mm.h>
9 c& i% G. x q; K0 y- A2 m - #include <linux/dma-mapping.h>7 X5 o' s9 z! U* J
6 N$ o( [. Y) W. B( b- #include <mach/memory.h>) H7 v+ @& ]" _( X1 h" L1 h% j
- #include <mach/hardware.h>
: d$ f& m1 x$ b& C. Z% \ - #include <mach/irqs.h>
c: z; G% p9 Z7 D% a8 o - #include <asm/hardware/edma.h>! f& D# W1 o6 Y
( K0 t, i9 K! U. G! W- #undef EDMA3_DEBUG
" i0 X8 _+ L( p) j2 ` - /*#define EDMA3_DEBUG*/0 c% J/ h4 G- i8 Q+ V; ?
- ! |, I7 X" P. ^+ L7 I y H
- #ifdef EDMA3_DEBUG
9 ?1 @) p' X! c1 X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), [7 ?! ]0 J" i5 Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: J% `5 b4 M5 n( ~: s1 p& ^$ q5 b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 U* K2 L/ k# u/ `) i ]8 H7 `" G" _' ~
- #else
; f( h8 X5 ~# E8 K+ q8 S - #define DMA_PRINTK( x... )
D# k( F0 P- K+ t& l - #define DMA_FN_IN- ?& X6 A: P) e2 ]2 e
- #define DMA_FN_OUT
* U b% ~ k1 q o( w - #endif
' U# G7 _2 G7 v, i- l
& e. k4 n6 k3 J+ }" l7 }5 w: {- #define MAX_DMA_TRANSFER_IN_BYTES (32768), @7 P U1 i! \9 ?/ Y/ {
- #define STATIC_SHIFT 3
( |: n' u9 ^$ x Y# i9 g - #define TCINTEN_SHIFT 20
" Q, p6 w ^# b - #define ITCINTEN_SHIFT 21
: U7 o& a4 p% r8 ?4 z; u - #define TCCHEN_SHIFT 22# |& r: b' j. A! n) \1 F3 @( T
- #define ITCCHEN_SHIFT 239 g) l& f1 J) M0 \5 a
- ( J' I$ U c. d) o3 B+ t5 I/ m8 b, ?
- static volatile int irqraised1 = 0;* I+ n# I7 y* _, f
- static volatile int irqraised2 = 0;
* S9 `& W' E( d# }3 e6 g8 i6 ]
* p- A j# Z! f/ z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ [3 ~- |6 B& u1 s7 p; Q0 _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- M' k! o, c& N6 j- X* Q+ z0 S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. |* A: Z: ]- @" t* c - 9 |; _3 V% Z$ M5 v3 d) r* X/ o
- dma_addr_t dmaphyssrc1 = 0;/ d8 q2 f9 A0 H8 v" b% ^
- dma_addr_t dmaphyssrc2 = 0;# ~# I4 C' _' Z0 o" _/ F
- dma_addr_t dmaphysdest1 = 0;
2 m. u5 M' i% L - dma_addr_t dmaphysdest2 = 0; }& \' E0 L+ F& m
- - _4 C+ e1 W! k8 O& l/ F, I, m
- char *dmabufsrc1 = NULL;4 Y% x2 i( a; g3 `0 f
- char *dmabufsrc2 = NULL;
' M. Q& P n) P - char *dmabufdest1 = NULL;
, g: o, S0 c* N8 F - char *dmabufdest2 = NULL;" D6 o, J( \0 n: u1 C% \7 k
- 8 O6 R; K% T2 Z% c% V1 {
- static int acnt = 512;
2 W! _$ i" g1 F4 ]' m( u1 S - static int bcnt = 8;
! {; q2 z1 Q7 y - static int ccnt = 8;- K* y. l; k1 s0 r5 d# W
$ L2 i" t8 ^# J+ Q- j# K- module_param(acnt, int, S_IRUGO);
, \/ V! D, P/ K# z$ @ - module_param(bcnt, int, S_IRUGO);+ O- Y2 |- d/ O, ~5 p# t
- module_param(ccnt, int, S_IRUGO);
复制代码 9 F; Y5 B# q( t& [
7 w# _1 T+ K+ K. N& g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 T; m' ] [% parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- ]. J7 Z5 F' j) q/ W+ r. u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 r1 h2 [% W+ T* w; W+ D- a; V( q+ ^5 C) W$ C9 Y4 s
# |% B6 F% C9 @; B2 ~ |
|