|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 ^; u- a' A6 B B' l
- [code]EDMA sample test application3 @. k3 f9 Y4 B: m* n
- /*
R& i! [, J2 Z' C - * edma_test.c
1 b$ d. M% J$ |) _ - *
! ^. D& g, J/ Z7 d - * brief EDMA3 Test Application
' L8 q3 M y# h+ D) h4 d6 h& U) ` - */ U7 r: K! `3 X2 b2 R
- * This file contains EDMA3 Test code., \$ }% j* ]6 A; n U$ H
- *
! }0 ?: f/ @0 u* @' D: B0 e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& _# _1 ^$ w5 u# ^/ E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. h' S2 O8 L0 Z: V* | - * TO CHANGE.
/ Q H) Y% v2 i. l; D - *0 [- z4 H. H1 A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' l. S9 v G8 w* S: e# C% `. {
- *3 w$ [5 T" f V
- * This program is free software; you can redistribute it and/or
( ^2 F9 m3 l; d) L) ? - * modify it under the terms of the GNU General Public License as9 `' G) Z; h- G) b
- * published by the Free Software Foundation version 2.+ T/ r* Q& J6 J$ N4 h
- *! t. k* v8 A' m+ I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 }* v) Z& b8 W8 W, z# r - * kind, whether express or implied; without even the implied warranty7 k; @8 u+ V0 m$ p. p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 z: d$ ], n0 A& B l3 E - * GNU General Public License for more details.
; u1 }& N2 F, s8 W - */- ~5 }. _5 C; r
+ O# h' J6 L1 d4 B T- #include <linux/module.h>2 _3 u$ b H. X- U0 J+ M' |
- #include <linux/init.h>+ s& B. j( Q& l1 ^1 r
- #include <linux/errno.h>( R6 d* c: {- T! t
- #include <linux/types.h>
; Z5 p, n/ C/ j - #include <linux/interrupt.h>8 p5 d& I$ |- h" {& l4 b1 {0 S
- #include <asm/io.h>
% c! L+ a6 h( g - #include <linux/moduleparam.h>0 `) |& K% H* s. l
- #include <linux/sysctl.h>* @+ M$ v7 Z/ m4 z, ?
- #include <linux/mm.h>* j" K* e9 M3 d1 G- n
- #include <linux/dma-mapping.h>6 T# d9 s0 V& @3 ?. F3 L; Z
- , K" l$ m y: X
- #include <mach/memory.h>7 x0 a$ F+ }6 c6 }9 L' G
- #include <mach/hardware.h>2 e+ X4 b7 ^3 n. K6 i4 v
- #include <mach/irqs.h>
+ k" Q9 m3 S: V - #include <asm/hardware/edma.h>; f% i+ Y2 G" p+ `3 ~1 @$ }, @4 O i
- , Y4 S3 A9 \1 k3 |. M( W4 R
- #undef EDMA3_DEBUG
- M& w; k3 {2 r( E3 V. [( y - /*#define EDMA3_DEBUG*/# @( I2 C- Y& E8 @
- # }$ q& O* R4 P- m- P& D
- #ifdef EDMA3_DEBUG
' I. a% l. e0 H8 l9 q& }) S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). c) C# _% {4 y3 ]- K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! N3 {* C1 q& B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 z% m+ l$ J! e2 m J9 e; |. l* k - #else
. x6 a2 K3 Z% S - #define DMA_PRINTK( x... )
5 C: a O# \7 P+ z* ^/ h - #define DMA_FN_IN, m( K. q. r: T5 i: n* O( u: a
- #define DMA_FN_OUT
5 @4 [* }$ Q! c( p* l @( V7 X - #endif, o" i3 y- e, o0 M- U
- 7 }, k/ x3 j& h3 h, Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' ]( N4 i) p: j [. {- o - #define STATIC_SHIFT 3
' Z) l+ e ^% q5 F - #define TCINTEN_SHIFT 20
' H! S9 j# [# i9 o! s; O - #define ITCINTEN_SHIFT 21
4 w$ q3 p, s, c) y - #define TCCHEN_SHIFT 22# [9 [# H! _* Q4 c2 ^- K" W
- #define ITCCHEN_SHIFT 23+ K% `# t' d% e/ }/ N
- 4 L) H. @' U7 R* z+ v" m( i) @
- static volatile int irqraised1 = 0;3 J/ k4 B8 u2 U% b$ Z* X
- static volatile int irqraised2 = 0;3 M& G. m# p7 h3 C! _- y
- * S h9 E5 w; i' D5 g% ~2 X" N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: Z4 g0 ~1 ] L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 l9 Y Y0 Y- `7 U4 f$ w) b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ Z- N0 p* Z0 ~8 J4 U! l0 f - $ m' x; X; w" \ V
- dma_addr_t dmaphyssrc1 = 0;
# y# E3 z* H3 B# B2 E+ X' } - dma_addr_t dmaphyssrc2 = 0;( _ M0 ]1 ?) o
- dma_addr_t dmaphysdest1 = 0;" ^9 y1 X3 p- Y' U+ l: U
- dma_addr_t dmaphysdest2 = 0;7 z8 x4 e- Z- Q; n* K& l2 \( S+ @
- / S9 w# }7 b6 j# {
- char *dmabufsrc1 = NULL;$ K( b, k! u' B2 d3 x3 E1 O: S
- char *dmabufsrc2 = NULL;
+ n$ r. }" M3 S7 m+ T - char *dmabufdest1 = NULL; y& W+ _, U8 t' z( ~$ M2 [8 u* k
- char *dmabufdest2 = NULL;. M# |2 P; ~+ \ D: `
7 y3 N1 b Q$ T- static int acnt = 512;4 B$ q7 t' j: o- Q' u6 n0 e
- static int bcnt = 8;
$ o3 J0 f6 ?3 l$ s b+ X% Q - static int ccnt = 8;
?1 W/ w( @/ F q/ k) C' ?
5 G1 P1 w/ f1 ]/ @6 q+ ?. e, ?5 \- module_param(acnt, int, S_IRUGO);
) U; W* x1 d$ B" ` - module_param(bcnt, int, S_IRUGO);
) ?* Q l# h) Q1 A8 R" ~# z9 o- ^ - module_param(ccnt, int, S_IRUGO);
复制代码 2 M; i8 |( j" `$ a& g7 N
2 Y+ B( z; ?8 t# y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ Q. G" ^2 G; I3 T* Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ i7 ]8 _0 X3 q# r+ ~3 t: w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% O8 Q( w. j' t& X% m
/ b A6 }1 @& J% L; B- I! o, Y- u
* {- E$ {& T; p2 _ |
|