|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / D" `9 i* }0 ]8 Y1 o; L# V
- [code]EDMA sample test application( _! I, Z9 T, H" z
- /*
: j' O. N$ S, |$ s* } - * edma_test.c
% O. G3 A) B { @; Q. i - *
7 ~( u3 s, t2 y* j8 { - * brief EDMA3 Test Application! ]" S/ b7 D- J! S, ?1 j0 s4 P
- *1 I% R( X& r( b5 n1 H9 t; E
- * This file contains EDMA3 Test code.: q" T2 i, Z7 `9 q' F1 B9 z
- *! c6 e% q# A; H+ o; H+ P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ n5 P# |- L" V8 y6 h! U2 `6 ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 v: s$ F' t7 y - * TO CHANGE.+ R$ x& ~3 ]% Q; [) A) w
- *. [1 x" j% Z) M9 R* `, {- h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; @1 ~" n5 I; l0 l. U) p3 \ - *
6 ^. R, Z( i, X p9 C% d - * This program is free software; you can redistribute it and/or* \8 F1 ~) F: s+ g" ]
- * modify it under the terms of the GNU General Public License as
' R+ |) X9 ]" g+ v! m$ S' R - * published by the Free Software Foundation version 2.' v. N$ C4 j; k& Y8 d9 x! |8 {
- *
) O: p$ N; t+ `. q/ p/ f$ f$ g6 d - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( P4 h9 s' T! W& `: m5 C4 l0 L' T0 k - * kind, whether express or implied; without even the implied warranty6 t5 w8 l( ?" K A# @! h* o' \
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 h. c& ~ U5 {# }1 P
- * GNU General Public License for more details.6 q5 n/ d6 S; @6 p+ _! T$ b5 V
- */
) C& z4 L+ M1 Z. K) A4 | l
. [ r" O0 |: v$ f5 a& U* f- #include <linux/module.h>
; P2 q8 R# `: _ - #include <linux/init.h>
2 @, V: n4 C9 o% K) Z; n - #include <linux/errno.h>
# W3 K0 g: _5 ` - #include <linux/types.h>- \+ t+ P; B# j Y( H5 e- g
- #include <linux/interrupt.h> @6 k* h' J; }- W+ K9 G7 D
- #include <asm/io.h>/ R q; q! X) u: {4 U
- #include <linux/moduleparam.h>2 b7 F# X" g& J8 e# ~
- #include <linux/sysctl.h>
, p. [, h; q4 ~# R - #include <linux/mm.h>5 K* X1 [* g+ ~
- #include <linux/dma-mapping.h>
" o T2 e9 [* Y1 ` - * `/ M, i; |& O: l
- #include <mach/memory.h>
( F4 K/ w! q: H/ g' h( D - #include <mach/hardware.h>* A' m) ]4 ~$ X- P# ]1 }
- #include <mach/irqs.h>
$ [0 z" ^' e) i& w7 g3 @: v - #include <asm/hardware/edma.h>
4 q G, S9 y d0 M& T- p- X0 n - ; N9 P+ I1 N& L9 d4 H5 O* L6 i$ b
- #undef EDMA3_DEBUG( B& o$ ?4 L1 S7 h" \- z) M r
- /*#define EDMA3_DEBUG*/( b3 ~: d/ {# V4 |
7 u+ Z' Y; b- Y0 E+ F+ L- #ifdef EDMA3_DEBUG9 E5 w' B# N- z" `2 E* m: p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 H; g6 r; w: p8 |& r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" I% E u) }0 p9 n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, A3 W/ e3 h7 n% ? I. y' z4 F - #else5 [$ D! t. w$ F
- #define DMA_PRINTK( x... )
* L: v1 J% Y- b* `: e5 A u7 A - #define DMA_FN_IN+ p8 u U; n+ D; E- r. w" `( T
- #define DMA_FN_OUT( S8 \/ s; V9 y4 S! N' H& `
- #endif
+ h% @$ |- A$ j) ]1 A - % o; |- Y/ o# Z% l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 N \+ r, y. Z- T- s
- #define STATIC_SHIFT 3
% z Z5 j! Q. [; N - #define TCINTEN_SHIFT 205 Z% X' h- i2 ^- D2 E6 ?
- #define ITCINTEN_SHIFT 21/ \8 W& X9 \! g9 m! f- a: G, a& S
- #define TCCHEN_SHIFT 22
$ Q" b2 [& S( d1 B - #define ITCCHEN_SHIFT 23) |0 L. p! [$ x% e7 G* \+ U
. f! b' y: F& S5 i* A1 n- H# w. ?( C- static volatile int irqraised1 = 0;7 o9 k/ B3 X5 ?* ]# L* w; A0 x
- static volatile int irqraised2 = 0;
4 L, ~: q& Y! y: F
4 V T i5 w/ r( f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* K6 d. \; _/ Q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. `) ~ I9 O" a# C3 C! ^! n% U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 `- f$ V) S! [) V" K9 i
- 3 c( K+ c0 _, f0 ]
- dma_addr_t dmaphyssrc1 = 0;
+ g) T6 B- j: L8 l i0 o! b9 |9 y - dma_addr_t dmaphyssrc2 = 0;1 G4 m0 m3 D4 s q
- dma_addr_t dmaphysdest1 = 0;; b W3 n: G7 j& h5 m
- dma_addr_t dmaphysdest2 = 0;0 T9 ^9 N9 K) N) D2 G j
- ; ]. W4 c' o' i+ T0 V3 a" A
- char *dmabufsrc1 = NULL;
7 F: l" |9 q& u6 p& b - char *dmabufsrc2 = NULL;* ]- X' x5 i1 v7 `$ w" X9 V# A
- char *dmabufdest1 = NULL;! O: M8 G; V/ h5 M* _0 g+ _
- char *dmabufdest2 = NULL;
+ ^% ~: M9 y' r, m; _- u8 u- A- a - * \. {( w% z3 c; H+ u
- static int acnt = 512;
; p0 h5 h/ n% e7 v$ v! { - static int bcnt = 8;, g8 \* U+ h3 l, B. } N( |3 d: @
- static int ccnt = 8;6 z% R, b! b3 k" @
( E: K- g& u- h% N$ o- module_param(acnt, int, S_IRUGO);7 M5 E9 k. M# r# g4 N% y4 t3 v0 L
- module_param(bcnt, int, S_IRUGO);* p1 C L% s! U! B/ j9 h) {
- module_param(ccnt, int, S_IRUGO);
复制代码 % ~. ?7 {! P* v
5 T. F$ A0 a! V# ~$ t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. V* ?7 a2 u3 C. W6 `& n, iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ k T/ j5 \- |; y" Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: N. m4 t z/ O8 D
) A2 }% d" m; k- S# i% p: v, @3 D3 b3 d& r- B( P
|
|