|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ \4 o& x" V- \
- [code]EDMA sample test application$ d4 h9 j+ @. L3 h) }$ y) t
- /*! o, g: U, L% k: C8 \
- * edma_test.c
7 F' B8 l1 n& O. h - *
( G/ l3 x+ \" B$ ~, d - * brief EDMA3 Test Application/ V! F, ?( X f$ j( k8 r
- *
2 c8 @1 W b% z2 D - * This file contains EDMA3 Test code.& H l: p+ r- T5 e6 m0 B5 ~8 B( z
- */ _+ a. ^# ]# c+ l R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 v/ x- w7 \# Y0 t% R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 k+ m( r0 K$ X. L1 J3 i) X8 X, t* ? - * TO CHANGE.
7 O7 b$ ^3 k. l# { - *
, c" ~ A) M2 D) C( ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: l. N$ Q: X! b: D# J - *
+ r/ L% b/ y- Z8 w, e; D$ C) g: K - * This program is free software; you can redistribute it and/or
! |" [1 z) E; Z2 P: r& P: { - * modify it under the terms of the GNU General Public License as
4 Y u- U$ X( b8 k - * published by the Free Software Foundation version 2.; L' V# z; r t7 j: e" A9 L
- *
. `- C+ S* @ V; x/ _ {2 k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, e" [% d8 I X: s/ Y3 d* s) G
- * kind, whether express or implied; without even the implied warranty. R) X! @- N0 e4 U: v) X! A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( r0 F* N" F9 x/ D, }" {6 u, K5 C - * GNU General Public License for more details./ X' X8 O1 \6 O, g% [) A b
- */0 U* `) y. F- f- p
- . l/ u, U P' p
- #include <linux/module.h>" X* J# u5 l$ u6 \2 G
- #include <linux/init.h>
, Z7 K6 |* h+ |, h/ e - #include <linux/errno.h>
- o$ e9 u; W# p8 s8 P' K* o) D - #include <linux/types.h>4 c# X- Q* N! x2 \+ P1 c
- #include <linux/interrupt.h>
2 _. Z0 A" ] i - #include <asm/io.h>& e) {$ \8 [" t& W @
- #include <linux/moduleparam.h>
9 C: M$ j; y4 ~" A% m$ \( z; d - #include <linux/sysctl.h>! ]# {4 k$ ]* ]; n5 p! t. u
- #include <linux/mm.h>
: Q# P' C/ e7 e! X7 A1 ]: S9 G+ b - #include <linux/dma-mapping.h>
$ S3 U# L5 i3 v8 c2 ~% H
: C2 e' }: ^, ~# M& v/ Y; n- #include <mach/memory.h>
$ i2 D' V) k4 `+ E6 _/ O3 {) w, } - #include <mach/hardware.h>
+ G0 d8 ~$ C5 a$ r' { - #include <mach/irqs.h>" F5 M( {, Y* W t P
- #include <asm/hardware/edma.h>
) C, l6 w+ a; h8 l0 B3 a - # ^; P/ u* N+ T" _) O; v
- #undef EDMA3_DEBUG# L# }3 k5 S: o- R5 p; d
- /*#define EDMA3_DEBUG*/! U+ R7 Z! N3 K O' I
- : j" R8 X) N) f; ^
- #ifdef EDMA3_DEBUG; V8 G/ l S/ b. r* I1 q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ t- h" c: j4 T" N# B4 K+ ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ x. f' Q6 s# r3 |( f8 e* O/ {' e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) z; v; [; B/ P5 j( g( X
- #else1 ]- B; e \7 T. N6 d' a
- #define DMA_PRINTK( x... )+ ]2 j( w4 I# w# D
- #define DMA_FN_IN' l$ }1 R0 ~3 u* m- D% E* {
- #define DMA_FN_OUT' K$ g# F( c7 V( I: b- p5 F
- #endif
: @) Q3 ^8 {( m
7 a/ h4 A8 I- m$ [* B' m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. t! Z' `4 Z$ H6 R7 r' W, I4 O! w8 v - #define STATIC_SHIFT 3+ q" B' w& s7 _& \
- #define TCINTEN_SHIFT 202 b- \1 X: r r0 I" W8 A
- #define ITCINTEN_SHIFT 21
1 T2 G) S5 B. _4 }8 E. X7 r, ^ - #define TCCHEN_SHIFT 228 ` v# P! \% F8 m/ a3 x% @ H
- #define ITCCHEN_SHIFT 23$ Q, M& @& V8 t* @5 U, a
0 r9 x' ~- N( D- static volatile int irqraised1 = 0;
. P @# j- N2 M/ G+ h& M - static volatile int irqraised2 = 0;- O; R/ {+ k: a
- , m) f }4 R' [3 n& n t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Z/ v( U! _# O% r) \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) n7 K4 ]8 p* S) P+ V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, @. E$ }5 O1 V' J- U! B
+ ?0 d' g4 y! N O& D/ {- dma_addr_t dmaphyssrc1 = 0;" M: V0 T8 V3 s" O G" }0 j
- dma_addr_t dmaphyssrc2 = 0;
! n9 q3 R/ I8 Y& B! \& K - dma_addr_t dmaphysdest1 = 0;
6 I+ _$ i; ], l( X - dma_addr_t dmaphysdest2 = 0;. c9 G- x$ X* M4 v
+ Z1 l( w* @) E3 b& x4 x% J- char *dmabufsrc1 = NULL;
# z# ]4 T4 S) W9 |0 C - char *dmabufsrc2 = NULL;. |) b, `* m, K0 [; G1 U
- char *dmabufdest1 = NULL;1 @( Z0 l4 y, p/ p9 J
- char *dmabufdest2 = NULL;
! Z$ Q, \$ o; V N8 V2 @' M
/ J1 h q" A! }- static int acnt = 512;, }/ p* I3 d% G6 a8 q
- static int bcnt = 8;8 V! \+ X2 k0 o3 c! f8 E! L
- static int ccnt = 8;( m7 {+ M: Y ^
- 7 r% W$ d6 F! h5 s4 X
- module_param(acnt, int, S_IRUGO);
, `, R$ X# g% ]& q6 k - module_param(bcnt, int, S_IRUGO);
& a9 B" l9 b; N4 x, G - module_param(ccnt, int, S_IRUGO);
复制代码 ! U! o6 _8 H# d! x3 @
+ ]; P- Q% Z4 ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 \& }. W z+ n( x+ P7 W7 N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, ], L" v$ x5 a: ]3 O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
J( ~: D9 U) R) N4 F% ?
1 _" N M" C4 x" @3 c7 Y4 Y. ^! A: i8 z0 |! q/ L8 p- X
|
|