|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( _" P1 t9 F2 a+ X8 O* F- [code]EDMA sample test application( y! \( k" O3 J4 e' T& u
- /*
! c9 E b4 P2 U$ L, c - * edma_test.c
1 A# \6 R* `0 [4 c3 \+ x- M3 w - *
1 d9 a" ?, j* f9 H - * brief EDMA3 Test Application
0 P- j8 Q: u/ ?8 M- i) Y - *
0 M4 Q. C# J! ^* Q& e- r - * This file contains EDMA3 Test code.) ^. Y; D$ m% m/ I4 j9 T" Y! u
- *
8 h, J5 g) L: B. D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* T5 q- D+ n }% L3 t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 l! o4 b% A. Z1 X+ \& R# k - * TO CHANGE.
|! H: [& [9 H( [8 J. w" K3 j$ d4 N4 j - *) l! C1 i6 H4 Y# W7 i: L9 h5 p+ r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 I) T' S6 d- o# P) e& l
- *$ r0 b, u0 T, V6 \2 V2 y
- * This program is free software; you can redistribute it and/or
5 s- [6 S' Z ^/ S9 d( Z$ H - * modify it under the terms of the GNU General Public License as
4 \: u. H# g* _- A3 N - * published by the Free Software Foundation version 2.+ V% c1 ] \, [2 s
- *! J; T- e. N7 _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# x# z1 J9 J. C1 B! Q4 p" M - * kind, whether express or implied; without even the implied warranty
2 r( B. b& Y4 { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' V% u9 j+ `2 f( V `! {7 S - * GNU General Public License for more details.
( [. P5 y; u2 p' i3 h. N9 ]* G/ y - */, s1 y; U1 v& |3 c2 E# a
7 f2 x6 j$ J8 e8 D0 W7 h% F5 I- #include <linux/module.h>% s, t5 q* _2 I8 D0 h
- #include <linux/init.h>! M( G3 N: a S- G1 c0 s' g
- #include <linux/errno.h>: @! u: Q3 p5 {- m( Q
- #include <linux/types.h>: P1 w( }1 z5 A
- #include <linux/interrupt.h>
) h" N I7 C3 ?' @9 h0 P - #include <asm/io.h>1 W, y, ~/ ]/ c) {; l; q
- #include <linux/moduleparam.h># s" L; T4 B% e& x) ^5 T
- #include <linux/sysctl.h>9 d t* F2 J. X& `
- #include <linux/mm.h>4 g+ X/ K9 |% m6 @* ~% Z# |
- #include <linux/dma-mapping.h>$ G5 I6 |2 [3 C6 S, d. c
# N/ \% X6 J- U7 G" u! R- #include <mach/memory.h>
( i- `) ?+ I7 T+ K( c - #include <mach/hardware.h>
) U: s+ M, @# L- r; e+ N1 c - #include <mach/irqs.h>2 e9 b' K- p y/ x
- #include <asm/hardware/edma.h>
3 F9 Y/ n Q. Q4 b$ ~% x. u# c! P - ' E( T8 M' P2 F
- #undef EDMA3_DEBUG) g Q$ V4 T% l3 \1 u5 e* j
- /*#define EDMA3_DEBUG*/
- n" H9 I, c8 q; N2 i - + V- Z. i0 O9 g, `6 s$ `/ o, o, F
- #ifdef EDMA3_DEBUG
# Y. g) v6 O# u" c8 Z4 H3 a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) U# F+ {2 N8 C" K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 l7 a$ A- T8 j. O$ G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' J: H5 Z' i7 {; T& a* K
- #else
9 ]* |% n5 t9 M7 K - #define DMA_PRINTK( x... )
0 z: @1 s4 } v$ F4 X8 A - #define DMA_FN_IN
7 J1 B6 G- h: x8 E! B$ a7 h - #define DMA_FN_OUT
+ E8 M3 _6 U$ A( [/ u0 X% _ - #endif
8 ?& A' r' k( ?0 P
. Q# o c$ z8 J. b' F6 Q& Y. V1 y% z# B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( O( q( A! ]4 u& ~- Q - #define STATIC_SHIFT 3; p% ?0 _6 [! f& n! A8 ?3 M- m
- #define TCINTEN_SHIFT 20 z R( U( j: a8 p+ Z9 a' a
- #define ITCINTEN_SHIFT 21
' `# D& n% D* i/ S; x - #define TCCHEN_SHIFT 22
% R" c8 r- }& e n! K( s - #define ITCCHEN_SHIFT 23
% q4 V: H4 |) F- f- z: } - 1 P6 V( z, v0 i: Y
- static volatile int irqraised1 = 0;5 p, N' y6 r$ Z; s! v' V% {# p
- static volatile int irqraised2 = 0;6 ?, \- g& P/ S$ c: _& P3 o9 X
+ i" }- ]/ p, P3 @: ^+ j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# E+ ^: V7 y1 U. L0 I, q& G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- d' C9 j+ I$ k; P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 @3 O8 C% u0 q+ n \* O* ` - ' b# G2 x. r+ A. g: ]" m, @
- dma_addr_t dmaphyssrc1 = 0;; f( e. U1 Q! {5 V! H1 h
- dma_addr_t dmaphyssrc2 = 0;
. Y% B6 U& v7 A7 u l - dma_addr_t dmaphysdest1 = 0;
; j G" W# x" a" z; d9 o8 H% { - dma_addr_t dmaphysdest2 = 0;
) i8 k* q" k% e y8 p' R - I, K7 ^6 y' X: \0 e. U7 T# `0 ]
- char *dmabufsrc1 = NULL;
$ b w6 @) f- ?3 |6 v, A2 m - char *dmabufsrc2 = NULL;5 o# `: p. K% p/ }( Y
- char *dmabufdest1 = NULL;
" i1 u6 t. G8 X$ L3 ~& B - char *dmabufdest2 = NULL;
`3 ]6 B+ ]' R8 X; m* o& q4 Q
" a! j1 Z1 u( w' x- static int acnt = 512;
$ w# S# a3 }9 [, S0 r+ b - static int bcnt = 8;3 i, a$ T; X4 j
- static int ccnt = 8;# m6 C/ G: O4 u' \
: k8 @3 y$ G) B4 j& O- H0 Z3 G- module_param(acnt, int, S_IRUGO);. d2 _0 U1 d6 S$ U. T
- module_param(bcnt, int, S_IRUGO);4 `* ]& f/ u; e% `
- module_param(ccnt, int, S_IRUGO);
复制代码
; Q' ?" u. i) h9 [2 \4 m/ A" @* T# Q# b1 v: q8 i7 n/ N: p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* O1 H, M( i4 S Y* B7 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# x5 d( m2 p" j; C# K- T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 ?5 a# }; v) v/ z: d0 l
# v3 x) k+ w0 G; y% Y r, f- w
* x$ R, v1 {* |' M
|
|