|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; L* S# x: M; B4 g8 U0 V- [code]EDMA sample test application5 b! n6 ~7 y2 `$ H# Q# P' p9 c* K
- /*
. I0 c! ]. z" R8 C% G - * edma_test.c3 V- K5 {2 g/ ]6 Q
- *
6 F, S3 ?. u: O - * brief EDMA3 Test Application
/ b2 ]8 m0 r+ a - *
6 w, t1 ]" i7 n! Q, H8 N8 p - * This file contains EDMA3 Test code./ Q" i: L2 y+ ?0 ?( w+ @+ e7 W
- *8 \( Z1 V# Y5 C3 w6 U: ]4 H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 L# s0 g+ ^, s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) @( n' Y# x/ s& N - * TO CHANGE.
5 `( h( M2 @* a - *% M4 X2 o( k, P7 [5 c% g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* E" d+ N8 L8 Z8 n( _* q! q
- *. |* i" x% P6 U+ U
- * This program is free software; you can redistribute it and/or; \0 J" k2 ]5 q7 E% v& ?# ]
- * modify it under the terms of the GNU General Public License as8 y& l. i# z2 b
- * published by the Free Software Foundation version 2.9 i) K6 t8 S/ l" @) N
- *9 Q3 V& o* T1 U2 N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" S+ r2 T2 P4 Q( }! ^& G9 D& ^, \
- * kind, whether express or implied; without even the implied warranty
0 m- s& k: W4 `2 a. Y3 w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ i% m$ k( Q8 f) q
- * GNU General Public License for more details.$ b* t/ w6 O% d7 W
- */
: K. g% o" T* u6 }3 ?
X0 Q, p* t+ Q& P+ @, d) l* g$ t- #include <linux/module.h>6 d6 z# D) p# [0 t. i, H
- #include <linux/init.h>
; N3 }6 ]0 n- ?! U" ? - #include <linux/errno.h>
% O! s6 }7 T& @. `* T- G - #include <linux/types.h>
& H1 Z& U4 `2 {: F* S9 f - #include <linux/interrupt.h>' C* m. `% o! ~ o
- #include <asm/io.h>3 n( u( J% e/ C; q# y
- #include <linux/moduleparam.h>
1 q$ z7 o5 ]/ |1 v+ V6 I8 o/ l - #include <linux/sysctl.h>
) x4 {7 J$ L3 Z# r' H( j: S - #include <linux/mm.h>- z, g- F9 v* W- a7 h
- #include <linux/dma-mapping.h>
' a# l! q0 Y# d- E8 \2 e - : }3 M& G* z- q1 ]7 ?# _
- #include <mach/memory.h>
9 b3 C) L6 o8 ?( r. w9 }* | - #include <mach/hardware.h>- j4 x( Q" E% `& }3 g
- #include <mach/irqs.h>' M( I( E! ] L H/ G3 q
- #include <asm/hardware/edma.h>. A( X1 K3 M- X# O( ^
) C ~7 ~. R# x+ B7 v/ r- #undef EDMA3_DEBUG- I( F) Q* ]% A" m7 {5 I6 w
- /*#define EDMA3_DEBUG*/
: s7 S4 Y* a( y1 M7 ]) X, Y - 8 F q2 S/ O' Z
- #ifdef EDMA3_DEBUG: h8 R7 o5 M& i, Q6 }/ t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). E5 l( Y$ E0 O: q: F& J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- S, G# C& R0 ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* \- b9 s! s8 d5 V" h - #else4 W# z% r! n4 [
- #define DMA_PRINTK( x... )
3 B0 w+ G& L4 W8 P# U - #define DMA_FN_IN
% @ |, v7 F3 b% W8 m% d - #define DMA_FN_OUT7 g D' ^$ E E. d
- #endif
2 F3 d; @! ^+ V9 p2 M - : v, u0 t4 X* O* \, M1 {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); p- a) s) ~1 s+ V# c, `- f
- #define STATIC_SHIFT 3
Y7 ` P' Z2 K. a1 d - #define TCINTEN_SHIFT 208 v" x1 o" g* a' }
- #define ITCINTEN_SHIFT 21
' m& H: N% O0 h; \7 L1 |9 q - #define TCCHEN_SHIFT 22
& v- W3 N- f/ C6 u - #define ITCCHEN_SHIFT 239 ]/ ?. U7 \8 k# D6 a
- ) E- s/ H0 F. V8 w- \
- static volatile int irqraised1 = 0;. N w6 J1 B# h# ~/ B' U
- static volatile int irqraised2 = 0;
/ w3 ^* n* y! g( I. @+ i: N
1 m1 }( ]( ^9 l- Q* Q" l# m4 n h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 L5 g6 ]" x; J/ h, a8 o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 a# o7 n; L' p" {# T3 W6 z' Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 b1 \1 \1 H1 ?( h+ i2 i
. H9 ^# m; M; ]3 b- dma_addr_t dmaphyssrc1 = 0;4 J! E- r7 f- V6 K5 Z4 J
- dma_addr_t dmaphyssrc2 = 0;( k( C+ R! X6 c5 Z1 {
- dma_addr_t dmaphysdest1 = 0;
: q% h1 { T) l- N8 C - dma_addr_t dmaphysdest2 = 0;
( p+ c3 d s% R: K( q - ) N; T V" U# V) y( T
- char *dmabufsrc1 = NULL;
1 W( B, a' b" V2 `! l+ t0 @$ R - char *dmabufsrc2 = NULL;) }0 D( f& b' a8 \9 f% F: v
- char *dmabufdest1 = NULL;" y6 p4 T+ X, u+ {% Z
- char *dmabufdest2 = NULL;8 W) @# @5 L7 _4 d; X5 k
. W5 e8 w. ^, [3 V m/ Y- static int acnt = 512;- i: } S) Z9 ^# F/ Z0 I! [
- static int bcnt = 8;! v3 g; l b1 w' d
- static int ccnt = 8;5 z( Y2 |$ }* l# a" ]- b
- " t- M. b# x. q4 M( h
- module_param(acnt, int, S_IRUGO);
0 E; }. r* g r" t P3 u - module_param(bcnt, int, S_IRUGO);* R! V" I: ~8 \0 ?' ^% ~
- module_param(ccnt, int, S_IRUGO);
复制代码 ) g4 h8 d) V- a9 C7 B
5 w: l% v7 o+ H! R 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 Q3 M- J4 R0 c/ g2 x2 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! x3 L/ v3 k% Q' T! Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 ?8 w T4 ]4 g( z9 Q, N
7 z+ ~: n7 I0 {% F# w' T% E8 ^# u5 X$ T3 H2 a
|
|