|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . D4 A7 f' s/ j5 a+ r
- [code]EDMA sample test application* p& e6 H1 Y p" R
- /*: d' s" Q8 ~2 K$ q" d7 R' g
- * edma_test.c5 T2 D' E' w/ n$ L2 B
- *
: @8 e3 R; ^. \5 u( q - * brief EDMA3 Test Application, ~5 u, n3 C1 N; K# {
- *7 z3 g. r1 k$ n/ @# h: O }& b" a3 i
- * This file contains EDMA3 Test code.
9 ` H! c' L. i: G9 D) |1 v: E0 M" C - *
$ t/ l3 ~ h5 P, J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 t' W) _. l* s2 Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. E; `* p3 `" @, d# ?1 r. F! u& _
- * TO CHANGE.
. d* d$ y6 s0 Z5 @8 _0 n6 @ - *8 S& z! E. W( n5 S/ o# C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* I7 ^/ [$ d: X. V) a: ~6 z; i - *
" }* T( i5 l v - * This program is free software; you can redistribute it and/or
4 [2 Y6 S; E: |$ k+ `6 t8 W - * modify it under the terms of the GNU General Public License as
2 [" W- k' A; D" c, m& R5 l0 u - * published by the Free Software Foundation version 2.
& Q6 L' ]- Q# |0 S$ W( } - */ i) @% p. r1 V! E0 z2 C4 D) A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ X% }0 O1 a8 \5 O0 A8 v# k
- * kind, whether express or implied; without even the implied warranty7 R/ ]! b9 N& y. V& {: J; ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 I& l4 w4 O3 r$ i( V) |# W - * GNU General Public License for more details.6 d4 U: d4 ^1 h/ g9 P6 e' A
- */& U8 E2 Q/ H. \4 S
}7 B) v7 K3 r" m0 O; B- #include <linux/module.h>% X c k9 _, u8 B3 w: q6 |
- #include <linux/init.h>( c: ]' @! E; n# J' S; a. l0 B' m
- #include <linux/errno.h>
3 z% w( w$ g' @) d: X' A! I \ - #include <linux/types.h>
a( Z0 z: q- {& z6 c - #include <linux/interrupt.h>. N6 ^* S( [" D$ ~$ v7 U
- #include <asm/io.h>
0 T6 | O7 g) ?& h, x. A - #include <linux/moduleparam.h>* z* {2 T: ~ `; ?( h! c& g
- #include <linux/sysctl.h>
" h$ e& z9 t- Z, M9 T1 h e8 d5 V5 J - #include <linux/mm.h>
5 u% W7 E) n/ @% Z3 _6 o0 Q - #include <linux/dma-mapping.h>
* L5 U( {: F. T/ a- j
/ s) Z" `! U0 b) ?/ l4 V- #include <mach/memory.h>
9 j+ C" s( n# O. M: | }) y8 y - #include <mach/hardware.h>' X, f' a) f$ a$ o I d3 e6 {
- #include <mach/irqs.h>) M' l& O7 k) C% ^; r+ I% t
- #include <asm/hardware/edma.h>' O$ Q) j+ o2 D4 w0 m/ S( O& ~
1 x2 `7 D+ r1 f+ D& |- #undef EDMA3_DEBUG; Y$ P8 O8 d1 S, _- u
- /*#define EDMA3_DEBUG*/: }. I P$ a3 \ P
8 |% u" }/ U* g8 N. I H+ \- #ifdef EDMA3_DEBUG" y* k. d! h1 @. U! M1 ]# V8 v" `3 c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
S# Q0 F* p7 Z O7 ^9 L7 | - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' y2 q7 N% |+ X% m& f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ `6 y2 P* s2 L: W6 p, w/ d f- T" j - #else
; h: i% b# O9 y" z, k8 n, j - #define DMA_PRINTK( x... )
; Q+ A% ?) n. T0 ~; P - #define DMA_FN_IN
5 Z, n+ V$ C5 c! b" L C$ g - #define DMA_FN_OUT5 g/ u! d8 t1 k9 y' k9 K
- #endif3 W |( r. F+ [) N8 b
+ J* d9 N1 ]+ d* ~% ?" b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! i1 U, r; a+ Q9 l& X - #define STATIC_SHIFT 3
& h( `+ p( |) j7 M. Z - #define TCINTEN_SHIFT 20
- O; L8 k; w- X* K* v3 m: S - #define ITCINTEN_SHIFT 21
( o1 ^/ Y- C7 u, f% \. u8 L6 ^ - #define TCCHEN_SHIFT 221 V9 K: e; ~8 S& m# o7 p- n
- #define ITCCHEN_SHIFT 23: L$ I4 N. e/ ^1 J, T D5 ?
- $ U6 B1 B# y; {7 A2 ~* s
- static volatile int irqraised1 = 0;, [+ q: l* \. T* F6 K' M$ j# g
- static volatile int irqraised2 = 0;
% x+ W( u5 t; f6 w: M1 v2 C% J4 k1 U - , c% R s# c" p1 k" q6 X/ e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" e2 q5 D" |6 K8 \' w/ P, G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% ~/ Q8 d2 T' Z9 ^; l8 D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- a1 c+ M- }; p$ }
- u* i. O! T* {$ F j- dma_addr_t dmaphyssrc1 = 0;
3 z8 ^! z! ? O. z; E - dma_addr_t dmaphyssrc2 = 0;% m `4 U* i: H( [4 o
- dma_addr_t dmaphysdest1 = 0;
2 P. K2 n+ n% _ C" T9 O( h' P - dma_addr_t dmaphysdest2 = 0;
/ k3 N5 J. X& \9 x( X - - y3 F2 @, T; G3 ~
- char *dmabufsrc1 = NULL;+ |; t$ D- P5 r
- char *dmabufsrc2 = NULL;
7 f! B% c$ O) ]- X - char *dmabufdest1 = NULL;
; R8 z5 }3 M% ]) }, l - char *dmabufdest2 = NULL;
) }4 L* @& s( j; D6 P, ]4 G
4 J+ Q$ ~6 u4 z- j4 W- static int acnt = 512;
' K" ]! W/ I7 _ - static int bcnt = 8;
, \( {9 r6 H) s) o% N' N0 Q" ^ - static int ccnt = 8;5 U) j( |. d D; G; {# ^
- r5 f# |( b* s, Y! O
- module_param(acnt, int, S_IRUGO);
, h- h9 y2 ~# T5 g - module_param(bcnt, int, S_IRUGO);# Y, @+ V+ O4 O0 S9 ~3 \
- module_param(ccnt, int, S_IRUGO);
复制代码
9 z& |" Y j0 k5 R
) ?9 q8 L1 ?4 B4 ~% \2 r" g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* G0 c: G7 p3 Y' Z! a3 ~3 u T! H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 I7 W B8 D% s- n, {+ ~: v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 V4 D7 I% U( k# [
0 h, g: d( y7 n, |
7 r9 g7 g6 e! S" g6 \ |
|