|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 X! R$ D7 n* _" D
- [code]EDMA sample test application e4 N T$ Z# Y# u P. B5 [
- /*, B$ r9 S( d- x; N/ e4 B: @! z
- * edma_test.c' K+ Q; v8 f2 r, x- ~
- *
( R! E4 E _8 q# f. L - * brief EDMA3 Test Application1 T$ d% L4 `3 x" k+ X
- *9 \8 B' T: f. \+ a! B
- * This file contains EDMA3 Test code.
4 l; J1 [1 D+ m+ b) p! x- C! s' ~" j - *) C; p# C* j6 Q3 V2 ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 M L) Q; ?0 E% i: v* k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ R1 Q; F3 \: b+ s2 Z! U9 \
- * TO CHANGE.( z- Y( h" u8 h) l8 z/ e, Z
- *' ~/ G+ e) d5 t1 Y Z4 A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. [4 p# A/ E1 n p9 ` - *
1 C9 G% l* B5 Q - * This program is free software; you can redistribute it and/or# S5 b' Z8 a; F) O8 z! e
- * modify it under the terms of the GNU General Public License as* O& }' n: R6 y
- * published by the Free Software Foundation version 2.2 u6 ?- n* K" r3 R8 T$ [9 }
- *
; W' I1 a! B E# Y- V0 f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* e' [ Q# o1 j/ W - * kind, whether express or implied; without even the implied warranty, c7 u! D" N4 Y' v6 V# C. n5 w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, E2 H0 V% E3 g; f6 z
- * GNU General Public License for more details.! S5 f7 g4 a. g7 _1 j
- */$ o% C+ E4 D- B6 @ K/ k1 m
- , d' T0 R8 Z( G
- #include <linux/module.h>
: G3 [+ {) m0 y - #include <linux/init.h>' X6 ^0 P( A) X! k) ]
- #include <linux/errno.h>" G$ s1 a' T; E
- #include <linux/types.h>. g; j. G$ Q0 L& z! j- `
- #include <linux/interrupt.h>3 x7 k4 d! I1 _! }6 J
- #include <asm/io.h>
1 D2 Z7 M6 D. t' N+ N, @- r0 v7 a5 _; | - #include <linux/moduleparam.h>% F6 M8 G8 E( l
- #include <linux/sysctl.h>
* z7 h7 I m2 I% ]. T' Q# P) l - #include <linux/mm.h>
- M) w7 j5 D" i+ y/ M, Q! x - #include <linux/dma-mapping.h>. n5 I# w$ Q1 f# g& ?2 z
% ~' N; _! k" I9 n8 D9 }7 U+ m- #include <mach/memory.h>3 R/ z% s# T* K
- #include <mach/hardware.h>( c* ]5 c2 t* W/ c6 W- f
- #include <mach/irqs.h>/ j7 J& o% `6 }1 w) d3 o, U
- #include <asm/hardware/edma.h>% h9 O( {1 N7 d
- 2 v/ D* p2 J7 C; w- o5 @" o! b
- #undef EDMA3_DEBUG& s8 z9 W; T0 X- }
- /*#define EDMA3_DEBUG*/3 u+ i9 S E4 E& w
; i" _2 I- e8 r2 ~: h' m0 p- #ifdef EDMA3_DEBUG7 ?/ G6 B) @& a, }% z: |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' f F3 @$ x4 `' d) W+ D- O3 U6 t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. E: O& H: R; x+ W! Y$ A F1 G" ]4 } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 r& h) l4 X8 z/ i" o - #else
& M4 R7 g. f! n9 L, I6 }3 c3 x - #define DMA_PRINTK( x... ). ]' d0 ~% o" S5 Y
- #define DMA_FN_IN
' O: {4 Q* c* ~; | - #define DMA_FN_OUT
7 Z# F8 ?( a c& h( K# J( W* D - #endif
5 T/ w+ J k0 Z2 }* x; n( o H
" K/ U$ ?! b2 x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 V3 b6 a7 p5 q8 a. n" F3 w
- #define STATIC_SHIFT 3$ d( |: g' P* U8 x
- #define TCINTEN_SHIFT 20
$ \2 R9 z( f+ g+ S+ A; P - #define ITCINTEN_SHIFT 21! z& a5 w/ c2 }# R! J! p
- #define TCCHEN_SHIFT 22% z" O( ]4 Q+ b
- #define ITCCHEN_SHIFT 23
6 d: \2 J* T+ O0 u* y6 e) r - ' Y7 \5 o2 \7 D
- static volatile int irqraised1 = 0;, }/ q! K4 b5 `4 X! t( P8 h
- static volatile int irqraised2 = 0;! P% Z% c( l, P. {
- 7 J; c7 L6 l4 N8 Q% N- H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& Y3 J+ T0 a+ E: k; o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; f8 [# u1 N" u2 f- u; t- L1 G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" R! O( o' l1 C5 a3 K! ~ - - n" Y/ S3 H6 b! G# ]( E
- dma_addr_t dmaphyssrc1 = 0;
9 W4 ]) C( W) ^( Y/ N- @ - dma_addr_t dmaphyssrc2 = 0;* P' f( M/ e; b: L1 o6 p
- dma_addr_t dmaphysdest1 = 0;- f3 \* J' T5 a8 [
- dma_addr_t dmaphysdest2 = 0;& A" T4 A Z- B( h1 x; n3 H2 o: e
/ J; x; p; A3 Y, e- char *dmabufsrc1 = NULL;
+ L- K% L9 G# g3 \: I- i - char *dmabufsrc2 = NULL;
. r) J/ I( }0 w) B4 D - char *dmabufdest1 = NULL;
6 p* b6 Z c7 L - char *dmabufdest2 = NULL;, B4 l' z; |( u) S
% R5 ^5 Z0 H7 B; X' Z- static int acnt = 512;
: ?6 b- M# B$ u2 l2 b c' C - static int bcnt = 8;3 q$ j O5 f1 ?- j e
- static int ccnt = 8;* N( D+ L8 e( |* j N' U9 m2 m" L
- , _; J, o2 G# V" R: Y* @/ g) x
- module_param(acnt, int, S_IRUGO);+ e1 e$ h8 m0 G) x+ S
- module_param(bcnt, int, S_IRUGO);+ e+ J, T4 _( @+ p( |7 p1 X+ d% h
- module_param(ccnt, int, S_IRUGO);
复制代码
( g3 y) @: U8 a; G c
7 C* z. g3 w% G5 K" t) U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; Z5 B* q4 C# U rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( u3 ~$ F7 W/ q8 @; L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: ~' j0 T( F, P) F1 N$ z
" Q% E O3 o$ ^. Y- r
7 u0 U9 z6 p. R1 y; i% N |
|