|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 S$ I4 S2 K% _2 W c8 C+ \$ j+ t: Y
- [code]EDMA sample test application
2 u3 A6 x2 R) i( ?( J+ M - /*
0 Y# Y+ r5 r1 H! O$ F. G - * edma_test.c
[7 R$ c+ p! o6 M' x/ @ - *, b$ p$ {1 [! V" T4 G
- * brief EDMA3 Test Application" U( F4 j7 C$ d
- *
8 n. P% X% o% I1 s) e) \ - * This file contains EDMA3 Test code.' \; J6 E' p/ o h
- *
* s0 J$ s* \* M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, w) R" v6 X- S3 f2 Y$ M$ I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: G- x9 ^/ N1 M
- * TO CHANGE.
- u+ r$ @6 Y) f2 G8 _ - *. w/ Q5 T1 c* R8 d3 G4 u& p- V! ]: @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 V) g# _9 k5 H* \! c! ` - *
- |$ _ M' Z( h+ ? - * This program is free software; you can redistribute it and/or
2 W4 h: z1 }! q' l - * modify it under the terms of the GNU General Public License as: M3 N, A6 ]$ @ T. u5 q3 l
- * published by the Free Software Foundation version 2.( v _+ i2 _0 t1 h: S* g
- *4 F6 c8 u* X( ]3 c( _5 Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 e) g0 S5 [& D3 d - * kind, whether express or implied; without even the implied warranty
2 j6 g; f5 i+ v5 ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ v! T/ v5 b: n6 N' i
- * GNU General Public License for more details., B1 N! ?1 N" q
- */
4 N7 a! b9 t7 Q, m Y
/ x0 S7 [6 M S5 ~% g* @0 x. v- #include <linux/module.h>
3 `+ o3 f) B) i/ ^+ o: Y8 t q - #include <linux/init.h>, V9 F) o8 D- |- G( W
- #include <linux/errno.h>/ j& d+ w# a6 ?7 ?
- #include <linux/types.h>3 Z7 f* h+ | U8 y1 ~
- #include <linux/interrupt.h>3 i4 w0 O9 _# B' O8 P, K8 ^
- #include <asm/io.h>. w5 t; q( u8 D" [! W: ^
- #include <linux/moduleparam.h>
3 h7 ?3 J% T4 p& Q, @- ^ - #include <linux/sysctl.h>) |% `4 t. [; B7 [9 G, w
- #include <linux/mm.h>
- s9 R+ L/ O3 L( A" `( k6 \- @. _: J! d - #include <linux/dma-mapping.h>$ m$ z4 l+ Q( G7 t# ?* `
- c' V! b) ^# `+ g0 A- r- #include <mach/memory.h>7 r: c% D- I" M9 u+ `
- #include <mach/hardware.h>; ^$ F9 k$ h( F9 P$ g& V$ U
- #include <mach/irqs.h> o8 t& p/ I8 m" K
- #include <asm/hardware/edma.h>7 Q$ Y8 W* K" M9 a$ q# l5 u& r
+ b/ ~7 L+ ~+ U- #undef EDMA3_DEBUG6 u% w$ z/ r/ B2 M# k
- /*#define EDMA3_DEBUG*/! K' {4 e4 \ u6 a; n! L5 E
/ @4 `* _8 a# D( _% |2 s. K7 [, S; E; U' }- #ifdef EDMA3_DEBUG
% M$ d: K& {5 W- {' G6 o! z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 q1 M4 N9 l* L$ s0 d( j" O( b. U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), w' A; \0 R% o; t! T3 U( ^3 B, Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# B" n5 N6 t8 C3 K& p5 e
- #else
% O0 {6 B3 ~# D - #define DMA_PRINTK( x... ): S! J" I; p6 X6 S4 P/ Q" Y9 p+ h
- #define DMA_FN_IN
3 ~" {, y* [$ K) G/ p - #define DMA_FN_OUT
) s# N' Y" J5 h. L! t - #endif) j& G% X) r5 @2 D
- 9 ]- g+ f7 F2 W& q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# I# t$ ?2 m7 F4 p) n+ d$ C$ P
- #define STATIC_SHIFT 39 o* m4 S+ I. m3 T
- #define TCINTEN_SHIFT 20
- D7 z- j' `: b4 B& { - #define ITCINTEN_SHIFT 210 `1 r; x. O# x) k' F) }& R X
- #define TCCHEN_SHIFT 22
2 Y4 F5 w2 ~- k- E# F: v# j' B - #define ITCCHEN_SHIFT 23! N$ Z1 i$ m9 \1 F( _! h" f
. D7 g- Q" a% n$ B9 O$ c- static volatile int irqraised1 = 0;. r, K( U( _% e1 F# x
- static volatile int irqraised2 = 0;6 @; x) X: J, U; Y: B
% f) V9 ^# Q) b0 ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- ?* }) d2 W: } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 T3 s1 o5 S) K# F* t) `+ Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; I$ q$ J, | j3 J r
- 1 {7 t2 _' X/ Z+ I
- dma_addr_t dmaphyssrc1 = 0;6 ]0 P) c' Q' b
- dma_addr_t dmaphyssrc2 = 0;4 Q' P( `# r* @ S
- dma_addr_t dmaphysdest1 = 0;
& j! h& @4 F A1 E- E0 M - dma_addr_t dmaphysdest2 = 0;" \' l1 f0 R& g3 R" l% `' t
- ) {& |4 |1 x" _6 \
- char *dmabufsrc1 = NULL;; L) s$ ~% s4 K0 e3 P
- char *dmabufsrc2 = NULL;
: k7 _* r& D9 v* @; ^" C* |3 W - char *dmabufdest1 = NULL;
+ ]* K6 G! `. ^! P, J- S - char *dmabufdest2 = NULL;1 @% O9 B" `& V, |
- % j3 h) f7 k( K) W0 v% {
- static int acnt = 512;
T9 t. z- F2 [9 Q# h" B9 C - static int bcnt = 8;' @. |4 n; V, o- z+ E' w/ f
- static int ccnt = 8;
9 t* F+ l0 E4 x/ {% d% ~ - 9 j8 P5 }( I& |
- module_param(acnt, int, S_IRUGO);7 j* i# w2 N) @4 M4 }9 v
- module_param(bcnt, int, S_IRUGO);5 G! m4 b5 o$ L' S* F
- module_param(ccnt, int, S_IRUGO);
复制代码
( l, A% M: D$ W% O, h0 ~$ w! R# O& _% W- W4 }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 a" d k: ]* X' Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ X+ B, g# _ ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 r2 F9 |% Y. `* s7 Q( P: A$ L4 j& u2 N) [& e9 R( ]- Q& Z
; _- d q# X9 ~2 U) L( ?$ T
|
|