|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! R! p6 l9 K. i6 V5 m) s8 |) [. D$ Z3 Q+ r
- [code]EDMA sample test application( [8 ~5 H, }. j6 v- u. Z+ r
- /*
, F# H1 M0 {$ f/ l# V }: f g - * edma_test.c
! q9 D( L5 |% R7 W* G - *5 M- e' J+ {6 k9 k, z
- * brief EDMA3 Test Application5 K: h) t; `5 ~- F3 i) _/ |
- *
1 @+ }9 ?# E3 f7 Q7 X) O9 ~. ~: t - * This file contains EDMA3 Test code.( f m2 R- p/ I& ~& k2 M
- *
! d- I3 v- p% K1 V# Q) w8 J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, \/ t) M: e( g6 F3 p; v, g/ k! z! u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. m$ D. [, F# x! v" x B& n
- * TO CHANGE.
( e( H. u V1 n; C1 I1 t2 \$ Z' N - *
; O5 }* w( V, ?) ?$ @4 G9 i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 l* v6 h7 Y! ~) G( N- X3 S5 y. p
- *" z8 |& ~$ K9 R* R
- * This program is free software; you can redistribute it and/or5 a$ @3 j$ I* _7 X* V4 N/ H
- * modify it under the terms of the GNU General Public License as" @" i- g* D5 { R
- * published by the Free Software Foundation version 2.
7 c1 X0 d2 i8 V9 c3 ^0 V - *
O5 M) \# S" g! k3 S' w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 g8 j) K2 h3 e3 G9 v& [* ?
- * kind, whether express or implied; without even the implied warranty
$ X4 m1 n" ?4 ^7 ^9 S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 h8 ~6 t2 ?# j9 `3 [& `, U7 r
- * GNU General Public License for more details.. |0 M! ^2 V) |3 P0 Y- P
- */
: E0 W% d4 l1 x
$ P0 Y: q) I* F0 k- #include <linux/module.h>6 f3 j F+ L$ f$ Z! T5 a
- #include <linux/init.h>, Q1 N# W7 [) b! M3 I! l
- #include <linux/errno.h>+ k& L0 W% |+ c) M" z! r( N
- #include <linux/types.h>
# a: x2 }; ?, e d& \; b3 G9 Y - #include <linux/interrupt.h>9 W) X' f, r. D/ d* w
- #include <asm/io.h>
( F! f, P; ^7 G4 [5 E/ o - #include <linux/moduleparam.h>
# K2 K1 c0 j% z$ {" ~' x& a' g H - #include <linux/sysctl.h>
3 f( i% G# a) |4 Z* i/ v5 |5 t - #include <linux/mm.h>+ v& O" F9 H* Q2 a) E& k
- #include <linux/dma-mapping.h>/ r0 k; f1 O$ ? J5 i
' J9 M0 G9 A$ p4 }4 y7 J: P- #include <mach/memory.h>
1 s/ I- K/ L$ p% l1 S# s - #include <mach/hardware.h>+ u9 v) ^! \1 |) P
- #include <mach/irqs.h>
: w X p6 a& B* { - #include <asm/hardware/edma.h>, D/ V0 k: m: }& v. A! ^ T* C
- - V8 M# A. Y6 l( \
- #undef EDMA3_DEBUG
( y S' i7 a* E; B- l1 P8 ^& ?6 @ - /*#define EDMA3_DEBUG*/
( O+ Y' R; p* \' n
* o" ?5 s5 p( G. l5 P- #ifdef EDMA3_DEBUG a- |2 v; \* J/ G: K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
q) a3 e- {8 ^" h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' q/ y% V- J" D9 J, k6 l5 [# ~( | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 s- B9 h% E5 v2 @& @
- #else
; q( C1 e7 z4 J4 W# b. w - #define DMA_PRINTK( x... )
/ ^6 c/ n7 k: | - #define DMA_FN_IN! a# r5 G; [/ A+ p0 b: Q
- #define DMA_FN_OUT
3 v" P/ F3 [0 g6 { - #endif, B/ z0 d( |. X: u- E5 B1 n
- 0 v/ C! f% g" B9 j( r4 g8 g7 L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 P) m$ G9 o) i, g7 @: c
- #define STATIC_SHIFT 3
( |9 _" n0 h- r6 b4 S+ ^ - #define TCINTEN_SHIFT 20& x' ?& o! b" f# N& c m0 n
- #define ITCINTEN_SHIFT 21
2 \# R7 D# u! E" |2 B - #define TCCHEN_SHIFT 22
/ X; F- p: }& o q - #define ITCCHEN_SHIFT 23, D* G: X& c- v# \$ B% U! k
- ) M# _$ J: X) t7 E4 _2 r
- static volatile int irqraised1 = 0;; u6 ^ ?- }" r0 _9 p
- static volatile int irqraised2 = 0;& _, g1 ~+ q" \/ O! v
- : J/ x; z. K7 Q3 e, V0 [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Z4 _( v D" j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( x% l3 u3 M& U0 {3 s1 U$ q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 I* Z! t, ^' h7 E* _ - # a5 r4 Y4 X# {3 o0 h
- dma_addr_t dmaphyssrc1 = 0;
1 j' O1 G) Z4 I - dma_addr_t dmaphyssrc2 = 0;
' ~5 X( N; k- N - dma_addr_t dmaphysdest1 = 0;
* n6 i. @" e9 R: ~3 A - dma_addr_t dmaphysdest2 = 0;( U) q' w- z1 H9 g5 m
- . w- J0 h0 z y4 d( @1 M' O* _
- char *dmabufsrc1 = NULL;3 p3 ]1 v. F: ^. F- a
- char *dmabufsrc2 = NULL;9 c% {. r) ?; w( S. l
- char *dmabufdest1 = NULL;' Q0 O0 i" E! ~( d2 w
- char *dmabufdest2 = NULL;" b7 D4 L5 Z0 Y! s' g4 e- J
- , x- E0 G2 K5 Y
- static int acnt = 512;
/ y# [( x8 G/ ^# H* } - static int bcnt = 8;
4 X& ~# ^! J N9 t& ` - static int ccnt = 8;8 [' g1 C' k1 j
/ ]- u ?$ U+ `- module_param(acnt, int, S_IRUGO);2 {+ j' V% T( W% c
- module_param(bcnt, int, S_IRUGO);
2 U, h1 k6 n6 c0 G - module_param(ccnt, int, S_IRUGO);
复制代码 3 L. ?( [+ E8 J7 ]
t! i# W& x4 S0 C/ t& {) J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. ?; F. u+ ~2 J( T- d4 `3 harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) K9 O& f. _# z3 R a- D1 o7 ~. f7 E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 b# j6 l/ n1 S, R$ ]6 e
5 V! d7 r& g* Z, h Q: n& `" U2 B) k9 h
) e; O$ ]/ I: B$ y* l: A6 w |
|