|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! e! F( a( h! O" n4 W# L
- [code]EDMA sample test application
* k6 Z4 o% R7 O$ E6 @. c. | - /*- l$ ]0 q8 J, C8 ~1 s4 L8 O
- * edma_test.c% K' |' _1 V! i/ j5 B7 J+ q
- *9 w% M' C2 u+ S& b/ {
- * brief EDMA3 Test Application
. P3 Y9 Q6 C$ ]2 u$ p/ r - *
; Y! L5 P1 U6 k% s5 o+ w3 ? - * This file contains EDMA3 Test code.
]5 o N( [1 s) K* ]2 ] - *% n$ L+ k) {! c6 D0 Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 k& K+ M# O' } f8 E' k- h. f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, f6 X$ E0 g& N# H g/ H" A
- * TO CHANGE.* h# H4 L$ o! L
- *- n6 r% G7 g5 A3 q1 l1 c8 f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 h) [3 T9 E: D7 Y8 L/ C0 z6 D7 D) W - *3 K! Q% X$ d! i* w; ]* }8 d
- * This program is free software; you can redistribute it and/or
$ Q# m" g, V$ s - * modify it under the terms of the GNU General Public License as
+ T5 r% V1 x& c6 u4 m, ^ - * published by the Free Software Foundation version 2.
! z% Q5 G$ e2 N# R2 ^ - *8 [' g1 H5 {" h" L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 k( K1 J# \! K( ?9 C6 ~ - * kind, whether express or implied; without even the implied warranty
0 V1 u6 |# [& @1 Z* h# a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. _ p, a5 J, g# ^" P2 | J - * GNU General Public License for more details.
2 ]" a9 g% L; b1 k" C( A% M - */
& C7 Z0 x( {/ S% h9 D+ f( n
2 A2 b& E" V, ?! P5 g4 j. m% ?, b- #include <linux/module.h>
1 L0 P7 i1 E3 c% M - #include <linux/init.h>
( O. R4 q4 \3 y, D. b. } - #include <linux/errno.h>: M3 G. h: n( `8 g3 j$ F
- #include <linux/types.h>
4 W" O4 Q3 k. b& }. |* ? - #include <linux/interrupt.h>/ f+ o, T& r- x( K6 c
- #include <asm/io.h>9 t; W$ d6 v) j
- #include <linux/moduleparam.h>
]* j( \" l4 V - #include <linux/sysctl.h>
) Z: _6 L5 l! A8 k! @: @ - #include <linux/mm.h>
/ _4 Y+ D0 }' k; X6 Y3 Q# p - #include <linux/dma-mapping.h>
- d$ I+ W0 o/ a' x
4 R* z3 P( T' r8 c# Y- #include <mach/memory.h>) s0 Q: H* x6 ]% R" u
- #include <mach/hardware.h>
9 e) z& k% i) P( ]- b9 U - #include <mach/irqs.h>1 s0 _& E a( f9 p% Y# _& y
- #include <asm/hardware/edma.h>
( E; f2 V( K- c4 @: u0 h - . ^5 I3 z1 p$ _, P
- #undef EDMA3_DEBUG
# I: L2 f1 @% E- p& v3 [ - /*#define EDMA3_DEBUG*/
; a" n6 u+ U# V - % t l5 P, B0 u) Z3 G F# d
- #ifdef EDMA3_DEBUG6 q; d, |0 r3 Q3 u' p8 q6 L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! E# T6 [- D, f6 R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). y! a# c% _( [& w/ H5 x4 ^; |& T1 U' S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) A. H/ V4 k: ]$ M
- #else1 b, d4 C& {- s- E1 z g1 J* t
- #define DMA_PRINTK( x... )
8 _. N" E' t' ?6 m4 G' E - #define DMA_FN_IN
0 K2 n+ k% N) m7 {! y8 z g - #define DMA_FN_OUT# y5 a5 w e: d' s; Z% b1 c6 ^
- #endif) P: [/ L, C/ ~; T2 m+ \
( k0 g9 ?2 i5 H1 ?: ^4 }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 ? n: a6 V8 A
- #define STATIC_SHIFT 3, _& C. C7 u! p v+ K* Q
- #define TCINTEN_SHIFT 20
( I! \2 l; q* ?9 ~6 O' y/ U, {( a: v# }& } - #define ITCINTEN_SHIFT 21# y- {: C R" t* B4 M# w
- #define TCCHEN_SHIFT 22
( l0 |! X3 N2 z5 I6 O - #define ITCCHEN_SHIFT 23! W a8 r) {0 e8 P7 P- R2 ]! X
4 \3 j* F* V- I; g9 w# R" n9 w- static volatile int irqraised1 = 0;
, S- ^* U7 r9 @- b J - static volatile int irqraised2 = 0;
: Z& b0 H% ^3 z4 F4 x2 x - ) H4 a4 ~% [ B) A# l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; |4 H+ }+ x6 ]' d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& A" m9 M0 [2 G1 L( _. G3 z! z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; V1 l+ @; d6 f8 [* R1 ~* Y
% N6 ~' G* \! a- dma_addr_t dmaphyssrc1 = 0;
! l( W$ h1 V f2 r" h - dma_addr_t dmaphyssrc2 = 0;
+ s; `" q& G, B - dma_addr_t dmaphysdest1 = 0;, g# u$ H3 m& [; g% ~
- dma_addr_t dmaphysdest2 = 0; g: m7 ?- f/ K" E" X1 S
- # {; o; [+ H+ e) }8 H3 X" y
- char *dmabufsrc1 = NULL;
# C0 t# T- |) l4 h4 }7 I - char *dmabufsrc2 = NULL;
) n8 P2 _/ U! o8 S; J/ Y7 Z$ E - char *dmabufdest1 = NULL;
" Y: N( Q6 b% i# s& G - char *dmabufdest2 = NULL;
8 a2 y$ V/ w" E! y3 d$ t% D4 b# S% V - ( o9 z# A) m- c
- static int acnt = 512;
8 O+ o( [* `* O/ K" h - static int bcnt = 8;# C# {0 J+ r+ d$ E8 t: @, S* g
- static int ccnt = 8;
3 u g+ C0 T$ [: c: i - 8 e4 e: B& P- [) L
- module_param(acnt, int, S_IRUGO);1 t' J( X/ P/ Z. `
- module_param(bcnt, int, S_IRUGO);
3 j. t/ U* f# ~: y8 N9 e" ]& M7 a, F& H - module_param(ccnt, int, S_IRUGO);
复制代码 4 G$ ~/ `$ T& v" {# J) j
) F5 p" B1 Y; K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) B3 |; R5 S" S9 f- ~$ qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 z5 u9 N2 _# n- ~. R& v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 [+ M' J" i3 l
2 p# `$ J$ M( F
2 H+ z+ Y9 P7 |. ]# N( j
|
|