|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & W7 C& w0 M2 \$ U; {
- [code]EDMA sample test application
& V0 f0 b. Q m; @- [1 i5 Y! r - /*% i, j7 R, N# A! ?; W
- * edma_test.c2 O9 ^0 {1 r3 F: K/ k/ B
- *
. o! x! B" U& i$ Y) i# D - * brief EDMA3 Test Application
1 f5 _ n% n/ \7 | - *3 {- Z- p; U2 u5 i- t5 k& M
- * This file contains EDMA3 Test code.& b( O* s5 V- @/ K) ~, y
- *
& W" Q$ `9 u8 g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( Z) }1 {, u& {6 q: w7 v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, o! t9 A" `( a7 R& U$ _ P - * TO CHANGE.* s1 j* U! S0 ^, }
- *
; g! X9 S: m- k' E- a/ G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- b# L) p( C( O# F - *: t/ X6 F5 l( ]( y% O
- * This program is free software; you can redistribute it and/or, H0 t! @5 `' w8 V3 X5 v. r6 x
- * modify it under the terms of the GNU General Public License as
2 O. O- N9 K# M5 }+ x - * published by the Free Software Foundation version 2.
, p0 B, ?3 ^2 e - *
/ Q3 M8 n6 f5 W( L5 \: b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 o% Q8 ^9 D5 Z( o! f - * kind, whether express or implied; without even the implied warranty* H; Y- ?- Q6 d3 y) @+ T8 Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. N/ t3 r. z8 n& z! }) F9 F5 b - * GNU General Public License for more details.
6 k% q2 J, @& |" _. W6 v9 _! R - */# i, }4 R4 A9 A: j; P0 s$ ^
9 J. [1 |5 _- W8 r% y% W2 h- #include <linux/module.h>2 e/ \2 S o: Q7 `6 v
- #include <linux/init.h>! V6 F8 Z- I; v5 |$ q! p- J2 F
- #include <linux/errno.h>
6 o+ T+ s( G4 ^8 R# ]& N - #include <linux/types.h>$ s$ Z+ l" n$ `3 S( B {
- #include <linux/interrupt.h>
( {) K, W7 N! ~: q* P$ b; O' p4 N - #include <asm/io.h>
7 O: b. _9 M) A3 v - #include <linux/moduleparam.h>
5 r; O) D, z9 s# ?3 e3 L7 i* ~( J! m - #include <linux/sysctl.h>" O$ H1 c4 t( `
- #include <linux/mm.h>) n. w& \1 ^- |+ I5 u8 k3 ]
- #include <linux/dma-mapping.h>; f+ j/ s/ k, g
1 S% ?, S* m- \ P5 c8 J* s- #include <mach/memory.h>/ j5 o4 H8 `! R" c- G( a
- #include <mach/hardware.h>/ [, w1 G* D) z
- #include <mach/irqs.h>( }8 Q- m0 `" K1 D& ^7 a: U ?+ ^) _
- #include <asm/hardware/edma.h>4 ]5 ~0 Y8 I# L) G1 H
- , v- S- j$ T5 x- u1 v7 ]
- #undef EDMA3_DEBUG9 V/ ~4 B) a) w$ [* N
- /*#define EDMA3_DEBUG*/
, S3 r7 ]7 ]# x/ T9 Y& }* f - , \' U7 k0 S, x6 z
- #ifdef EDMA3_DEBUG
, y5 o4 ^. v8 G5 S% ]: } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 t! T0 |4 J( ]+ T) `# ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 u& I% W0 x* Z9 k5 s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); d; L. ? O; D( o) [
- #else8 q8 Z. j, _- d3 H0 Q$ J7 V
- #define DMA_PRINTK( x... )1 @: p a# A9 Z, h7 H
- #define DMA_FN_IN
& V, j. s4 L3 A# K - #define DMA_FN_OUT5 ]1 B% G% ]+ _& i
- #endif
4 I# \$ h; X- c5 C - 9 F* f6 u( } ^9 O$ r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* b! a& s8 C1 A: K7 c! U3 J* W; W - #define STATIC_SHIFT 3
( c$ S# t# N1 l) d- i - #define TCINTEN_SHIFT 203 [$ v0 O2 f* w( B7 y6 W
- #define ITCINTEN_SHIFT 218 m) p* A/ |6 Z+ w, e3 ~9 v6 x" w: l
- #define TCCHEN_SHIFT 22
0 w S) {& m3 ` - #define ITCCHEN_SHIFT 23) t8 V/ g) A% \
- 5 T1 ]* f% J& D4 P
- static volatile int irqraised1 = 0;, R3 V3 {1 X9 \+ }) r
- static volatile int irqraised2 = 0;
1 o- J+ W6 K3 p/ V - ; H1 C" D% E7 ` A( E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% J' `) s; }6 P- I u6 M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; K* g1 o8 E4 @. S- K: e% U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' ]0 j, |; M* ~
. ]. K0 _5 T' r. r6 `0 v& z) d- dma_addr_t dmaphyssrc1 = 0;( D- G; n1 s8 _7 U
- dma_addr_t dmaphyssrc2 = 0;
6 w% `8 t9 H; f, V1 _2 p% h - dma_addr_t dmaphysdest1 = 0;
+ y( ?5 r+ O6 n3 U7 q - dma_addr_t dmaphysdest2 = 0;7 v4 ~- o7 A( g, ^7 P- j$ b
5 |/ A/ A. c" }- char *dmabufsrc1 = NULL;+ s* S' e& t: @
- char *dmabufsrc2 = NULL;
! ^/ _ J; T# w e5 V- ` - char *dmabufdest1 = NULL;
* \" K- K! R1 J) {2 h - char *dmabufdest2 = NULL;
- [$ `/ j# q) b- I* I, I
5 T% E0 W' }" n/ ?0 I& t0 g; V- static int acnt = 512;
2 v0 d* G: F/ J% c; q1 d+ Z: W- j - static int bcnt = 8;
' k h. |; o% C P5 J - static int ccnt = 8;
0 u4 \% }) S2 V I3 m8 T) o4 S - 8 D) G+ l/ T5 c7 x5 I
- module_param(acnt, int, S_IRUGO);* K5 s. N; f% |- S
- module_param(bcnt, int, S_IRUGO);2 D- _, k, ^$ B; {. l( a
- module_param(ccnt, int, S_IRUGO);
复制代码 ! k. J; \: W9 W5 b0 Y
~7 x! w( P7 j9 ^! b, K9 m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: d" ?3 n; @$ Q. sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 \* ~6 Y; w* Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: z2 u' a* z4 z2 g# c: R! U9 J: j
1 {$ a$ k/ H- W( u+ Y# L( ]* J0 A2 l0 V: [
|
|