|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # O3 v8 @' _) J0 c: P0 {' `
- [code]EDMA sample test application8 [/ ~9 a) ~1 \ ]. P6 }8 W( _
- /** o. b, i7 U, B2 ~$ X5 o F/ H
- * edma_test.c3 }' V3 A5 u* K4 w+ _5 }; R" W
- *( Y, W2 p6 n6 v3 @( f; S
- * brief EDMA3 Test Application! u, c D0 h& o" ?$ D& X* I
- *1 d: }! J( ~- J) T
- * This file contains EDMA3 Test code.3 r. U7 ?& _0 M3 H
- *
( w$ k% j1 F, x; E. z0 ]' Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 d6 d8 e- o3 t- i, G5 J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ z- m+ N" L6 p7 T3 ]
- * TO CHANGE.8 s+ d+ N9 L8 J$ |# }
- *8 d, k$ e& V/ C) E! j4 i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" Z* J9 X f( B- `- W - *2 d1 {! @' V9 R1 `5 ?
- * This program is free software; you can redistribute it and/or
7 F% f4 ^$ I B2 I - * modify it under the terms of the GNU General Public License as; Q: H+ b0 [: L& @1 F" S9 A
- * published by the Free Software Foundation version 2.
; o. F( v$ R2 W5 @! y! q - *4 k& ?+ ]6 _2 C* P1 p- B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, C! h% J/ F4 `: Q5 q" I
- * kind, whether express or implied; without even the implied warranty
' A& ^" |& C% D" @* A p$ | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' A8 n) y6 F: m8 q8 e \7 ^, i
- * GNU General Public License for more details.
9 F, O( q/ M) k. @/ _- x( R, ? - */0 @( F+ @" Z4 d: a" J0 F* @% M! A
# y" q; A8 l$ D( A( n& V' O/ x- #include <linux/module.h>5 X6 P% Q" ~8 O# |( U
- #include <linux/init.h>
4 c+ P5 d% p; D' } - #include <linux/errno.h>
+ g" @$ N3 j* X9 l5 f - #include <linux/types.h>( @4 D; q. I( A9 q8 h6 Q$ S+ Y2 i
- #include <linux/interrupt.h>
9 d' V- T0 X2 A: \% C1 U! g& R - #include <asm/io.h>
+ Y" \6 H# k7 X4 ` - #include <linux/moduleparam.h>! n6 G( y5 S( M& N! y* y2 y, m
- #include <linux/sysctl.h> Z, Z: g/ O7 o4 b
- #include <linux/mm.h>' x0 U0 U1 I, y
- #include <linux/dma-mapping.h>6 B. D, f9 A7 j, c: U" _- G; U
- 2 ^, G" T/ @# @& Q3 z3 ~0 @% p1 j
- #include <mach/memory.h>* {) v! Z5 T V4 v$ e. n
- #include <mach/hardware.h>
" d, c, x9 f6 G) m+ U$ M: x' f. W - #include <mach/irqs.h>1 w; n: {# {9 W* r
- #include <asm/hardware/edma.h>
8 M8 j( X$ _: u9 t v m
* ?7 A/ L7 r: }+ z1 d \- #undef EDMA3_DEBUG. O1 Y9 T- r0 U: c- n
- /*#define EDMA3_DEBUG*/
' c2 _& v- [! E0 `' Q5 _
7 n+ j3 }4 `) c1 U- #ifdef EDMA3_DEBUG* b+ A6 P/ Y% ?% Y' v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 S- x% Z2 P4 g* s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): q7 O+ z H, T1 d; G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 X) T. T0 Z# h# `% i% c4 H2 f - #else- b9 e1 a) p; b$ y9 \
- #define DMA_PRINTK( x... )
$ M# k+ Q+ ^2 I; ]$ X3 o; L - #define DMA_FN_IN
' `8 N6 \7 F0 I$ | - #define DMA_FN_OUT
; `' }% g0 m# u - #endif- J i% \) H, @4 v
2 h3 v( |. D6 J2 k6 A& _4 B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 |+ ^" U' f( @. C3 r- r3 c
- #define STATIC_SHIFT 3 \. H) @1 O: h8 Y$ q( j3 j
- #define TCINTEN_SHIFT 20
' |7 R. J: s3 T4 W6 L+ ~+ x - #define ITCINTEN_SHIFT 21+ \: p R4 d1 U Q& }3 ]
- #define TCCHEN_SHIFT 22, U5 B p$ c: j0 ~: |+ i9 c
- #define ITCCHEN_SHIFT 23
& r! {5 Q3 x% K - " @6 N$ D1 X) \) K B f
- static volatile int irqraised1 = 0;3 T) i# B$ f* `9 X
- static volatile int irqraised2 = 0;6 n( D2 E( m. } G4 m
- 9 K3 Q, L4 n D+ u9 S2 ^+ y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: P& M% X4 M1 o' Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! U! u( [" ?. \ _. u* }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- M, }$ t3 C& u2 Y
* p% }! P q. y5 r. ?! n- dma_addr_t dmaphyssrc1 = 0;
, i2 h1 a/ {2 }4 _& G$ X/ a - dma_addr_t dmaphyssrc2 = 0;
$ G3 R! H L8 L5 C& F- X/ o - dma_addr_t dmaphysdest1 = 0;
2 s% l) T/ ^2 M( @( q7 M - dma_addr_t dmaphysdest2 = 0;' y2 G1 ~7 \# V, E* _8 [9 n
- # z% C, F2 w2 E1 @' V
- char *dmabufsrc1 = NULL;
Q1 `- S& M: \# z9 u$ Y - char *dmabufsrc2 = NULL;7 c |; K" ]8 |9 r# ~/ ~
- char *dmabufdest1 = NULL;! [, X6 b* b2 S+ T2 Z( u q% S" L
- char *dmabufdest2 = NULL;) n" x: X" X0 z) M7 o+ ?
& B3 J. M$ z- Z- }8 w- static int acnt = 512;
" ~; S% U$ G9 j - static int bcnt = 8;5 i! q4 j, c9 A9 M, n) A
- static int ccnt = 8;0 Y7 d. |; P8 G5 g
- ) }2 m. L- E$ i2 g8 O* F
- module_param(acnt, int, S_IRUGO);
2 V2 u" ~% y- a4 z) |* m# g5 p$ e - module_param(bcnt, int, S_IRUGO);) I- d# T% L& Z$ _% o! M" |. K
- module_param(ccnt, int, S_IRUGO);
复制代码
. c; K' Y( g1 S! T" h/ }
8 P9 K \- n1 f6 Y6 f2 W* a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 N* d& S/ d/ n" x6 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ P9 p4 K5 C0 ^8 r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& T+ z3 k! w2 B4 Z" P
5 ?; r; |/ j4 |. y: P: ?5 e' L+ U& a- N& | `
|
|