|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ `/ U0 }0 V8 m
- [code]EDMA sample test application
; b5 X) g; P9 L" A3 |* N - /*$ L7 Z! |' @3 u* T, F3 V6 w
- * edma_test.c- p# x. p) _: v6 h
- *
, i# b' W* [5 n) |$ i0 Z - * brief EDMA3 Test Application
! f. V: ]. Y# c0 s - *7 f3 o% e s6 o% M, v+ h
- * This file contains EDMA3 Test code.* H; j! a0 J" l# Z8 o
- *
$ O: l9 K1 G* d b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* H* e* ~* u* c8 [ `4 p9 V# x( H1 \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 C4 M4 x: A; ]# f
- * TO CHANGE.' ^+ m: w; z0 I" ^9 d& B8 E
- */ ?5 \" Z4 B( B8 ?3 Y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" d! I5 w5 H8 G- E; B I4 o - *' Y& R7 i% I9 a4 h1 j
- * This program is free software; you can redistribute it and/or
6 R) y8 V% M1 f6 A7 H& G - * modify it under the terms of the GNU General Public License as
, A# |% ^4 V/ f, @ - * published by the Free Software Foundation version 2.
) o1 L& _' a% x' I9 i" E7 N7 j - */ e& T# [, E" b8 z V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% d0 {# a1 A: m" A, t) r - * kind, whether express or implied; without even the implied warranty
$ d) J4 b/ Q. @0 u1 \( q+ ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# t# B) p' N; X" ~; w. H - * GNU General Public License for more details.: t5 i* ~! r0 d6 Q3 N* Z
- */+ N4 ~5 P( T% E, R) Q
- " W8 e" ]3 A: ~0 `+ g
- #include <linux/module.h>
o# _/ y1 Q3 i& l2 M& J - #include <linux/init.h>
" j; f. H5 i, b3 ?- O1 i - #include <linux/errno.h>
, J [# Q* x$ ?" f6 C - #include <linux/types.h>" ~3 @8 a* s+ n) X* v% [! ]9 S
- #include <linux/interrupt.h># G+ Q6 N1 @0 g' m
- #include <asm/io.h>1 e y j/ n# b3 D
- #include <linux/moduleparam.h>" x/ c0 K7 C3 a5 C
- #include <linux/sysctl.h>, v3 A: I& M* d5 E
- #include <linux/mm.h>
7 ~! |) l5 U; C. x& o% q+ v - #include <linux/dma-mapping.h>4 ]9 |) W I2 |. X% b
# m/ \- J: }2 U9 E- #include <mach/memory.h>( g& ?. Y; g2 J& L7 w# t
- #include <mach/hardware.h>
8 M# E' m/ `2 f r1 J: V - #include <mach/irqs.h>1 L2 j6 s6 C3 h
- #include <asm/hardware/edma.h>% B) A' S5 L! D. u; K( s q
- % N. D8 E p( b- `- t' X/ K W
- #undef EDMA3_DEBUG1 R1 {3 K; ?+ Z) q0 l1 \
- /*#define EDMA3_DEBUG*/
" H2 Y9 X* C m$ K - 2 t' l6 w4 `+ ~4 J- C$ c: k
- #ifdef EDMA3_DEBUG
* x+ o; i% W% s/ B+ A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& o4 L8 o2 y# G# m1 ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 y& G) [# ?9 Y, m4 u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 F5 x3 U) g: n- h. v$ k8 V - #else- i3 O7 p9 q: {3 D! b
- #define DMA_PRINTK( x... )
) \% n: \$ d9 |$ X1 Y0 H3 G" x( X1 T+ f - #define DMA_FN_IN7 X, R9 h d7 B. ~; i% H
- #define DMA_FN_OUT
, G/ V; C& [. [ - #endif3 }" p# _8 _/ M0 g( T
- " ~ J9 \1 K$ ?0 @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' H H) D* @8 [! s$ e! z9 \
- #define STATIC_SHIFT 3
' r( J& C$ m* H- S, B7 R - #define TCINTEN_SHIFT 20
' l+ S. a |+ e; e* K4 b# w; z/ K. w - #define ITCINTEN_SHIFT 21
5 _. l7 t3 H3 C7 @% b - #define TCCHEN_SHIFT 22
- [9 K4 e: B, U- P, P1 O \ - #define ITCCHEN_SHIFT 23
@7 p! @4 X/ U' E - ! p. b* R" o& g
- static volatile int irqraised1 = 0;3 ~4 r ]) s I3 O W2 y
- static volatile int irqraised2 = 0;
' m! q2 q% v/ f% l1 _
) F; W1 X2 @7 c8 [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 v& F# }7 ~: v, @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 w6 E* @7 ]- _' U' ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, b$ e0 A5 u& K6 r2 y# z3 y
) [% \3 U" _& ]) }0 A+ X- dma_addr_t dmaphyssrc1 = 0;
. i N g, W( N, G0 o - dma_addr_t dmaphyssrc2 = 0;
1 Y2 ` z( N; m) d" K, t0 Z - dma_addr_t dmaphysdest1 = 0;
7 B5 J, ?! ?4 E- F! I - dma_addr_t dmaphysdest2 = 0;
1 ?3 }6 K/ B& {. `" ~4 Q& x7 B& [ - ! ~# Q# Y0 E; B$ N0 N3 Z
- char *dmabufsrc1 = NULL;
& i$ B6 Q, r V/ O& g5 z - char *dmabufsrc2 = NULL;9 w& v$ g5 S6 f# L" C5 U) G
- char *dmabufdest1 = NULL;9 O% Q! V c+ p% d5 o K
- char *dmabufdest2 = NULL;6 F7 I/ e! k; o3 u
- - s+ Z, v v) e3 C7 e/ X# o
- static int acnt = 512;5 v& q/ X' G9 h! F( L& ?- \4 g* g- [
- static int bcnt = 8;
! g& H/ w1 Q& | - static int ccnt = 8;
9 g; ~- S7 y/ I* A# |
+ t: G' E* k' k) Z5 q' O- module_param(acnt, int, S_IRUGO);6 Q$ n, G5 }" q6 U/ M* w1 c
- module_param(bcnt, int, S_IRUGO);
- |/ Q/ ^* Z1 @ - module_param(ccnt, int, S_IRUGO);
复制代码 6 j, Y4 R0 \5 h6 {% p. e4 a* x
0 L. C$ n8 I, ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- u- e9 i9 G0 F g( }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 e- H0 o, `; S3 k/ Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 b; u7 ~9 a+ a1 i. n* J0 G
9 C$ e% M! O6 z+ d5 `3 u6 e& R, z% R) L9 Q. e# I* b
|
|