|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 O. C8 _/ l [4 t1 w# x- _- [code]EDMA sample test application
7 v2 H" v- N: o/ L - /*
M3 \8 m8 Q& J+ C - * edma_test.c7 H! V I. ?1 H2 y3 y" G- P/ o# f
- *
, ~: O; c( S9 j; a - * brief EDMA3 Test Application
3 N7 a! e; L: a+ H# ]+ J% ^" x3 P - *7 T" ]4 S: s& w) M1 q/ L
- * This file contains EDMA3 Test code.4 s* b* ^( M7 h1 I% \8 d. ^7 \
- *
' G5 Z) ?/ U1 @' W9 k0 S7 X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' ~0 u) l* o1 a' a2 C. e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 S: ~0 e- l2 Z$ g
- * TO CHANGE.
5 F% h4 ~8 H' x) n/ A" v* E - *4 a! x4 w x) z$ @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; f4 r1 `; E& J! C Q4 }( R( ` - *1 b, c; T5 ]1 R8 X$ k; G
- * This program is free software; you can redistribute it and/or) j' S# m' M q' n1 ]: o* I4 {5 ~: e6 f
- * modify it under the terms of the GNU General Public License as
: b9 |- Y9 z+ Z9 G8 g8 C7 R$ V - * published by the Free Software Foundation version 2.
2 f1 H! A3 a* i - *
9 I8 ~0 n! x# u: z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; @+ ~1 Y U' J G; R - * kind, whether express or implied; without even the implied warranty, V7 _- f/ }9 e0 v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 O& w+ G3 Y- t# H/ L - * GNU General Public License for more details.# a+ b' O6 x, d$ y
- */
4 Q; \9 e6 ]9 E( l2 |! m+ B
7 D# ?; Q& p# t0 k2 t0 G2 c1 e- #include <linux/module.h>
9 @$ f: J* y8 ^9 } - #include <linux/init.h>
: x0 h* L+ b+ o* x0 c G - #include <linux/errno.h>
& B/ O( j$ s8 q/ Y8 _$ `7 l# F+ `- G - #include <linux/types.h>
: j' I H+ R! _7 [! `( y - #include <linux/interrupt.h>) [& }8 \6 e3 |1 Q. q5 X
- #include <asm/io.h>5 O# Y& ] C5 h( f* z( ~! o: |7 k
- #include <linux/moduleparam.h>
4 Q! I! {4 v2 o3 c5 E$ V7 f - #include <linux/sysctl.h>
5 z2 B. Y2 F8 X$ g - #include <linux/mm.h>
$ b9 l$ q* j" t, D' q6 }# z - #include <linux/dma-mapping.h>
' R- T$ T1 `/ ^9 v3 [' i
6 X; \$ a2 Y S1 Q7 a- #include <mach/memory.h>
3 I/ d3 G& |8 O: l9 N - #include <mach/hardware.h>' R' v" W5 }) W$ q, |6 f
- #include <mach/irqs.h>
. J4 t2 k9 m5 o8 t J, e. _5 o( H - #include <asm/hardware/edma.h>% o# t, i' `) D4 T6 \
- 3 P5 u: ^( O" C& M' d r. v! a2 c
- #undef EDMA3_DEBUG3 C9 \$ g3 g4 e" r
- /*#define EDMA3_DEBUG*/
* m6 s- o' z+ s! r' N- G- l
, r R5 @+ r1 a" b- #ifdef EDMA3_DEBUG' n- o' f" H+ z F- {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ |7 w7 s) H$ T* r+ A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 Q5 B( x8 J( [$ Q4 W& p& [! @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' ]# C! D! {$ I2 N9 |
- #else$ C- i; }' o0 ?% }
- #define DMA_PRINTK( x... ): u- ^; {) N/ v5 E1 p' B4 C. S
- #define DMA_FN_IN
6 T+ z5 Z: `3 a @' d0 v7 W - #define DMA_FN_OUT
$ t& ?9 G/ \3 k6 x/ V* a - #endif
- P; T6 t/ S8 c2 R: g' J( ` - + G( z. i, n ?1 W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& E8 u5 ?+ b; y L) _2 [ - #define STATIC_SHIFT 3& t$ P6 U& {; m! b) F
- #define TCINTEN_SHIFT 204 o. F3 a5 t, N# N
- #define ITCINTEN_SHIFT 21; o% x/ r' A$ a
- #define TCCHEN_SHIFT 22; V8 S( @+ i* ^0 V4 U9 d; W
- #define ITCCHEN_SHIFT 231 `# W( M# T3 S- p7 S! q
- $ R4 c+ J! x) z8 \% J' A
- static volatile int irqraised1 = 0;
! X' V2 N! `% l; i - static volatile int irqraised2 = 0;0 C4 K. m$ [+ Z _1 u6 _+ i1 B: p
- % D/ I: O/ r% m3 O& A7 A" O+ z. Z# ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 p) E3 V; H' M2 z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ V3 l* {7 v7 U) w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- W6 f7 \5 L9 I8 a: a! u- m
- 0 U! F# @* u. s- }
- dma_addr_t dmaphyssrc1 = 0;
1 X. @ t) T, Y, l2 b \4 y - dma_addr_t dmaphyssrc2 = 0;+ l2 F" R ]' c0 ]9 a' q1 p
- dma_addr_t dmaphysdest1 = 0;0 w' |/ \ b% E1 F
- dma_addr_t dmaphysdest2 = 0;+ k, @0 b% q% s0 V8 }
: Q) f: I9 }9 S, H. c- char *dmabufsrc1 = NULL;- X3 `4 m2 p% d
- char *dmabufsrc2 = NULL;
0 G5 e& V5 p8 ^1 y9 R+ t - char *dmabufdest1 = NULL;5 p- }6 y$ O+ |* g2 n- F# I
- char *dmabufdest2 = NULL;
8 N* R5 ~. b% q% C2 i - # r, k# C. z0 W2 \3 K' I2 @! p4 R
- static int acnt = 512;! c- E) b/ }0 Q
- static int bcnt = 8;8 B2 P/ y4 M+ {: g; {
- static int ccnt = 8;
5 b. ~! Z" o7 l! ]1 Y0 d0 d
8 V8 _& H; f+ i) b0 X1 f- module_param(acnt, int, S_IRUGO);
. A7 v, ]4 p, m# P - module_param(bcnt, int, S_IRUGO);$ j O4 g7 F( G
- module_param(ccnt, int, S_IRUGO);
复制代码 / N7 w( i- {8 T2 }
}# L% J! Q6 P8 Q4 P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' E9 u$ B' F( { `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 d' }8 A6 l4 n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; | C7 u& E9 ]/ m& U8 P1 W/ f
w+ _5 l, p5 U0 f8 |; b3 ~" A
8 R( _# r+ \- K2 a0 s: r! w |
|