|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # s6 I# x. M) p; A' B1 y! ^# s
- [code]EDMA sample test application
! J& ^( ]5 i# \! ]* }5 l f - /*0 S% k8 k9 f, R. g* b0 z
- * edma_test.c" R. V3 S& V4 Q
- *
2 d. L& f( `3 m; s* D - * brief EDMA3 Test Application
% \4 K8 n) k7 J) `7 ?$ {* ]3 X8 N9 }0 ^ - *
w; f8 I; X- k: m, m- G( s - * This file contains EDMA3 Test code. w' h$ w- Z6 J1 K
- *7 C5 ?7 {3 v) F/ J+ ?( j4 Y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# X2 q8 e# V# t" A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ A1 `& K6 ^# f9 i; v! T8 U+ J5 d
- * TO CHANGE.
. ?3 N' {8 |+ \/ P) b - *: R% n$ ]# o% X2 G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 g+ Z6 M) n* [' ~7 r
- *0 X! R5 Z0 u2 {, m7 x" ~& _" d
- * This program is free software; you can redistribute it and/or# B" a: y7 Q8 ~; i3 S, r' b/ O3 d
- * modify it under the terms of the GNU General Public License as0 r! g o' O! e7 L p2 n
- * published by the Free Software Foundation version 2.. A" x* |# Y1 m0 e# X, `/ p
- *4 q( D1 @/ @ A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 s5 i8 U" v/ ?
- * kind, whether express or implied; without even the implied warranty
- g7 y' r3 R3 q9 F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. Y8 P& h ], C( g: Z
- * GNU General Public License for more details.
c, g2 `5 |" l6 o# b F3 O - */3 W* I4 |, B! m$ u' N) J) A) h
, R8 U# m( \# z: A: J- #include <linux/module.h>
K% `7 |6 L7 s& ^ - #include <linux/init.h>3 r) K% e% e* W
- #include <linux/errno.h>& ]: I+ S" Y& N' v% C5 P$ M
- #include <linux/types.h>( x! Z# v& Z. N" {6 {+ M
- #include <linux/interrupt.h>
) {# C& n( t4 x$ [& w- T - #include <asm/io.h>
2 Q! ~: m4 N6 _; T - #include <linux/moduleparam.h>
0 z% _% \& l W2 M - #include <linux/sysctl.h># \! K6 ]. g7 o- S& j! B% ?3 ^! {8 r# w
- #include <linux/mm.h>% \$ x1 X( p" A/ R4 O" x- I ~
- #include <linux/dma-mapping.h> ?( ]! u1 y2 e0 e8 F5 ^& S
1 h- T1 }" N" M- M- #include <mach/memory.h>* ~% p; Y" z, M1 A0 t% Q
- #include <mach/hardware.h>
5 C0 y U0 O' E W' k - #include <mach/irqs.h>
! i$ V' X4 R+ S4 i - #include <asm/hardware/edma.h>+ ~8 O! @% `/ B$ _" E* l0 x
$ G5 z% O' z m) d, x- #undef EDMA3_DEBUG
! `& h+ u8 v: L - /*#define EDMA3_DEBUG*/
4 G& L, u5 o) x& |1 m# L0 g - " p2 w2 L4 b8 V) x5 c
- #ifdef EDMA3_DEBUG
5 }0 R' V' X9 W$ R! _/ x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 x' \+ _5 U" I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# m' P; C6 ~, e) d; h# K6 \+ M( U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ s1 S9 n. P* _4 y' Y3 [
- #else
G0 ]( J) T/ U0 L - #define DMA_PRINTK( x... )3 d- ~1 [% D) \1 C; h$ u
- #define DMA_FN_IN$ s2 k/ `: ]# I$ J) _2 S
- #define DMA_FN_OUT
! Z% i" Y7 h) u) _5 M3 R - #endif/ x5 _0 c2 D% ^
- F- M' W8 {( R: H8 M5 t! p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- o8 T9 F' x. |. ~# Z: J9 |5 O3 T
- #define STATIC_SHIFT 3
, b4 Z, }) }/ D; H9 J4 _5 } O - #define TCINTEN_SHIFT 202 p$ |* d5 H+ d
- #define ITCINTEN_SHIFT 21- \7 D5 _3 C8 d3 V `
- #define TCCHEN_SHIFT 22& e+ |% ]" a; @; y4 t8 w$ t9 t
- #define ITCCHEN_SHIFT 23# Y) V* g; H% r s+ x
- & B5 {0 `) ?( v9 A' W2 O. I
- static volatile int irqraised1 = 0;
1 y5 ^- w/ O# A* F* [ - static volatile int irqraised2 = 0;' }6 Y* n6 U; F! w% e! P2 h, z& w
- 2 G3 }: A4 `( T# x w X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- j( i; H) v% A% p: f& F( I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. y8 n4 `- ]5 Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# {$ k0 R2 J" h" k4 ~$ r2 h6 o
) j4 Q1 f' d: k3 F- dma_addr_t dmaphyssrc1 = 0;4 s. o, ~8 _# P4 R% D
- dma_addr_t dmaphyssrc2 = 0; w* }3 E t+ w; h( A
- dma_addr_t dmaphysdest1 = 0;
- m0 w8 q+ F7 D - dma_addr_t dmaphysdest2 = 0;
4 d# N+ n; Y( f9 o7 J- K8 @
& M; e$ J/ n7 E: z6 x. s- char *dmabufsrc1 = NULL;
2 }! I9 M1 f; `- G& h' o - char *dmabufsrc2 = NULL;9 u6 y$ N- M1 Q9 Q* O9 F
- char *dmabufdest1 = NULL;* ~3 ^. [: h, [1 }
- char *dmabufdest2 = NULL;
, R) m. b% t) q* j
2 q' V( _) w' g8 F- static int acnt = 512;
; G. y& w+ B# @% \! f+ d" n1 u# I - static int bcnt = 8;
3 d! X6 Q! g M5 R6 _ - static int ccnt = 8;* u* K* ?/ G# w- l5 z/ F# U* D/ N
- 7 B1 x; X/ z6 Z9 F
- module_param(acnt, int, S_IRUGO);
% |9 i. W) [* s" J, @: ~ - module_param(bcnt, int, S_IRUGO);* V' t u! }" i$ @% J
- module_param(ccnt, int, S_IRUGO);
复制代码 , ]3 l% `2 |# O# o- Y& p' T. P
" `- Y" L; D9 X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* A# o' }) u$ } W2 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ a3 h4 d6 u# p/ \% l" M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 V3 i" \$ J1 ~8 v' n
& p4 ? T3 L }9 B4 I
4 F3 u* N5 G) k |
|