|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 x: q; ~; q- a! t) U
- [code]EDMA sample test application8 S; p3 o4 @$ g
- /*1 L! h2 {6 L; Q# i' \1 H: y
- * edma_test.c
, H1 z H7 c6 F7 |% R5 g1 U7 C - *# P+ q' x9 F& U, R4 U
- * brief EDMA3 Test Application
( K6 o5 w+ ]: v5 X9 B - *
* [* u# w4 T8 t0 W - * This file contains EDMA3 Test code.) M8 a- C9 k d Q9 N
- *
0 a$ L/ {2 K* r6 ?$ y' R9 w* d) F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ `% D2 V) w8 m) |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ x; f$ q& }8 G+ B J
- * TO CHANGE.* }+ u* q& P- B- \# p" P$ A! \
- *
' D! f! I5 K5 ^" O& W2 X5 f7 v+ t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% |( j2 }. v) z# I - *
( _' ~$ V+ C4 e `6 `5 b& Z$ z7 \ - * This program is free software; you can redistribute it and/or
& ]* `- E+ M3 U( L( q( G: @- T - * modify it under the terms of the GNU General Public License as
' E. Q7 b% O7 C G" M' p# b8 V - * published by the Free Software Foundation version 2.
& x( C2 @% [7 \, X d - *( N% u6 ?0 O* L5 V1 R' i: x9 B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ J" r8 g7 o. ?% [+ a
- * kind, whether express or implied; without even the implied warranty
! y* S& I0 D5 V. w: D+ Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. Q, A5 _8 o& O. u- W. o, @ - * GNU General Public License for more details.- h8 f! l: s1 L0 S6 |9 w9 z
- */
8 V, ]# X% j/ r* V3 ]; t2 o& @
- y$ X7 A, W+ x4 b, `- #include <linux/module.h>
6 |9 X4 D6 B& @% }9 Y: ` - #include <linux/init.h>
6 H: |0 Y& T( l; z& B: L) a6 k2 Y) x - #include <linux/errno.h>
; f7 Y/ V, s/ g3 @: U" t9 v+ V - #include <linux/types.h>8 o$ }! Y- Y1 `4 |' z& {
- #include <linux/interrupt.h>
1 l8 j& C8 A: @0 _* H% t) o- r - #include <asm/io.h>
0 L% J7 d( l! O3 J - #include <linux/moduleparam.h>. r. M( M+ P a" z% L( V# _
- #include <linux/sysctl.h>& d& i( U6 v+ |& S+ v4 N; [
- #include <linux/mm.h>1 D5 P# N0 x; u. d2 C9 {( a# {
- #include <linux/dma-mapping.h>
1 ~8 [9 {9 z* T- j5 o - : T* N4 @7 J9 X2 |. Y1 i
- #include <mach/memory.h># Z% i* X& _/ [: Q# Z
- #include <mach/hardware.h>8 C" m) T. g1 @
- #include <mach/irqs.h>
2 w( \+ G5 r9 x1 Q3 j9 H9 ]+ P - #include <asm/hardware/edma.h>
- D$ I6 @/ U9 D5 E
4 f! k6 ? h: P% y/ F4 S, ~- #undef EDMA3_DEBUG5 @* J& G7 N8 L4 g
- /*#define EDMA3_DEBUG*/$ [$ a. \9 G$ v1 j6 l) N) e" j
/ t9 P5 g' R; G7 f+ \- #ifdef EDMA3_DEBUG4 }: y8 i6 f. X. M" p) g0 f
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 s. B9 @: d1 j0 V. R( j4 e* y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), h2 o7 X. c# E3 `" J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( N& \3 x" {/ {. ^: L4 h# x - #else
$ q+ `3 R* I J L9 G# x$ h; L - #define DMA_PRINTK( x... ): Z" I$ V L4 j8 m: p$ d
- #define DMA_FN_IN
8 e5 X( R+ c, ]) t! Z* l+ Y H - #define DMA_FN_OUT ~3 o, k- t A
- #endif4 P) a+ t8 I; h# e$ H) h( t% S( ~4 M
- " C! E$ f# F6 Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ p7 u4 D' P5 z: o0 G - #define STATIC_SHIFT 3
; ?+ z" g( Q4 n, P( U - #define TCINTEN_SHIFT 20; K4 k4 n9 D( j8 Z0 I' j
- #define ITCINTEN_SHIFT 21
" m- C: D* B5 ?8 q+ f0 W6 s - #define TCCHEN_SHIFT 22! G; R" s+ ]+ o
- #define ITCCHEN_SHIFT 23+ n y" J+ y" H& V
- 9 A; r# e6 P, s) e# Z
- static volatile int irqraised1 = 0;
7 Q( m, {2 `% G% N - static volatile int irqraised2 = 0;1 t; O7 h) X# A- F
* w$ y) X# M/ N' L2 ^2 C4 z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' Q/ S+ ]; A4 A) R/ P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- [* t- B8 C2 o' `+ D4 [: c i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. J1 I* ?" K+ ^1 P" L
; P1 v0 x5 u' Y1 ~+ X- m+ S, m- dma_addr_t dmaphyssrc1 = 0;
% k Y+ ~& A. |; |5 K$ \( C - dma_addr_t dmaphyssrc2 = 0;9 e. `. B! u [0 M' S
- dma_addr_t dmaphysdest1 = 0;, ]% ~" L7 W* `
- dma_addr_t dmaphysdest2 = 0;, o( E+ }) ?) z; d" o0 v4 `: a( O
- _9 S+ }' L5 l2 A: X
- char *dmabufsrc1 = NULL;
& o1 D% G" c5 h% `/ T. z7 d: a6 C - char *dmabufsrc2 = NULL;
( J5 ~: m! {' @3 h/ e, U - char *dmabufdest1 = NULL;- ^8 K- ?$ p" u
- char *dmabufdest2 = NULL;# ?4 B2 w5 ~, _ F
$ b ^5 r, U. G1 |5 u- static int acnt = 512;
7 g5 u2 I2 C% h4 ], i( W- g, O - static int bcnt = 8;
7 W& R; z- D- V& Q- y5 d f4 y9 Z - static int ccnt = 8;
5 N* r: o$ {3 P. |0 q( C" [
. ^/ ]8 c" T1 s3 [ {- module_param(acnt, int, S_IRUGO);
! g+ e" q5 N' u9 c' E0 _ - module_param(bcnt, int, S_IRUGO);
: S2 T. n+ X9 P. E+ i. a - module_param(ccnt, int, S_IRUGO);
复制代码 ' ]7 p' |' i/ b+ b7 r4 V
7 ]) `- w* f' ^; E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 V5 ~6 u0 j) S! ~- ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! L: a5 |: q( D1 B9 I* `& K& G6 @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 B# `- f; t" {! Q1 u
* u1 d6 x; W) x7 e9 ^9 ?" g9 G+ ?8 k' V6 T1 }% L
|
|