|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , G6 e- ` y9 j9 ?; _
- [code]EDMA sample test application
5 D! x2 O3 a3 Z- a4 m - /*
4 P. C6 F9 v' m# n - * edma_test.c" p* ~3 U* {$ V
- *
0 W+ c; ?4 z' @" k O2 A - * brief EDMA3 Test Application3 d7 X& [/ x- q9 _! \3 d
- *
. Y F+ f& Z9 E3 a: [9 Y) p - * This file contains EDMA3 Test code.
/ k5 G$ }$ N; L, c2 e# D/ \2 a - *
$ ]2 z7 }, k: z/ `2 g" o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) M$ F! A/ a3 s6 t6 C" m. e+ | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 a0 C* Q' b/ L+ P/ A! F
- * TO CHANGE.
7 `* M+ W% E# f5 `* L. z9 U - *+ E7 f& Z$ |% h4 O+ t: o( p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 b5 X: h# S5 E+ s
- *) A" }) v* B; i! }* ]
- * This program is free software; you can redistribute it and/or
9 x& P# X( E; m4 A; F( `; D - * modify it under the terms of the GNU General Public License as
/ }$ x H0 ^0 [& ~. b% { - * published by the Free Software Foundation version 2.
7 P Y2 p$ j$ N3 O% p$ f - *
4 D! M$ d0 b; ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 x2 C( g5 h! B* D9 L' U+ r. Q
- * kind, whether express or implied; without even the implied warranty( W+ r9 v! m3 n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 g$ `9 {0 k) o; K
- * GNU General Public License for more details.4 p% u' a$ [9 `0 f* X
- */
3 x+ U T( i; M9 S3 x - % [* S6 f+ ~4 z% I; ]" b6 l
- #include <linux/module.h>
+ _ r, _* G; U0 E8 t( H) d - #include <linux/init.h>( M! ~7 f7 g# p! {7 ?
- #include <linux/errno.h>
6 ~. Q) R2 d" { - #include <linux/types.h>! @4 E; h6 U( Q1 @) L
- #include <linux/interrupt.h>- b( Z ^, e& I9 d* `4 j) m
- #include <asm/io.h>' Y3 i% \# K$ r" V( k; Q6 ?9 y
- #include <linux/moduleparam.h># N5 i( s' }4 I) E: S9 ]. {
- #include <linux/sysctl.h>
/ Z* r7 Z, K' y. c - #include <linux/mm.h>) c3 y# T8 m" k a
- #include <linux/dma-mapping.h> j; J8 t! W' r' O; y* q+ D3 g
- 0 @3 k( P) O4 v s$ B7 ]. a
- #include <mach/memory.h>* i8 r& f5 M: j1 |8 A8 Z
- #include <mach/hardware.h>3 r( B/ c! g V$ P/ T. \) q* a
- #include <mach/irqs.h>
7 u- Y1 f2 F0 x2 u' V - #include <asm/hardware/edma.h>
. e' U: L$ W/ M ]* ~9 |
& l0 o$ N, I0 b r( S1 s& k5 V- #undef EDMA3_DEBUG5 n" T3 X" a$ W! `6 G
- /*#define EDMA3_DEBUG*/# W7 Z |/ V) O3 S( ]! l
- & b! W1 m0 S2 B' |$ m
- #ifdef EDMA3_DEBUG
+ u* H! g+ r7 D6 U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; z# q" H* q' c. `5 q6 }. @! Z- _4 q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 ?) L0 }6 W: E7 Z* `! I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 @) c2 m& z' a* v# ?! C( d - #else
& N/ G c) c+ ^) |/ J) C2 L8 X - #define DMA_PRINTK( x... )
/ j6 U; U1 ?! _, ? - #define DMA_FN_IN* n( v! C# n% _8 a! G6 v' j
- #define DMA_FN_OUT2 H# J3 r/ V4 `; B5 y% s
- #endif
$ O8 F' Z: i* \ f - 9 ~ Z, \$ J2 e A+ D7 L# {; R$ G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 {' l, a# l4 s: C- h
- #define STATIC_SHIFT 3
! m2 ^3 o" w$ y3 U - #define TCINTEN_SHIFT 20* b3 ?4 U- R8 \( H% [; X( G
- #define ITCINTEN_SHIFT 21
" A9 S5 f& `& Z. H5 h3 k - #define TCCHEN_SHIFT 22
& `; I2 g* N8 f* A - #define ITCCHEN_SHIFT 23. m: x8 J% h' s( r2 p- U$ j
- . a% }' E9 P. @% G
- static volatile int irqraised1 = 0;1 V" [. R3 p7 p2 x5 Z" c# }: i
- static volatile int irqraised2 = 0;/ b# z# z o( i& ^8 f! P9 Q
- 6 q- z. }% a3 H% d& ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ?2 e; n. V; f% M, M! |* P9 E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% M* x- Q1 @ i0 ~6 `+ b; b6 H! F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); H7 o1 T( z/ e* O# t, |
- ! D! V; Z. ?2 H' K; B. H5 s
- dma_addr_t dmaphyssrc1 = 0;
& I. J- W* p/ H, b' T - dma_addr_t dmaphyssrc2 = 0;
o, V0 @: c( J7 K# x - dma_addr_t dmaphysdest1 = 0;
; S9 a" G0 S3 P; ^: J) i0 @ - dma_addr_t dmaphysdest2 = 0;
" H* j* T! l0 D0 Y1 y/ B8 n
, p1 [, J7 J( }' @; i# ? p( f- char *dmabufsrc1 = NULL;
; j3 V' O% [* T$ _) X h3 N/ U4 ^ - char *dmabufsrc2 = NULL;( d" j N: P; ?: u5 t
- char *dmabufdest1 = NULL;
% S+ @1 i/ a1 [ - char *dmabufdest2 = NULL;
. t0 q- \3 D) e$ A6 X. P6 F2 @
( X4 D& @$ Z4 n$ m/ V' G. o- static int acnt = 512;
1 \ J) `* a( w! z - static int bcnt = 8;
9 W+ x' U8 K D/ g - static int ccnt = 8;
- O5 m" h( W& a" B8 q) i3 I
, F) D3 @+ c; c. y9 k5 }" `- module_param(acnt, int, S_IRUGO);
. W5 V3 x6 A3 K, N/ a, m* i - module_param(bcnt, int, S_IRUGO);
2 z. Z) @" W( m - module_param(ccnt, int, S_IRUGO);
复制代码
6 c( D' g N/ T
( z- a( N# Q1 u' U: j: d1 x& b' U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 e) H' [ r" ~2 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; n: X' e5 w% m- w) n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! s U1 i4 b. J8 V
4 K) J b1 K* u
6 ?/ o/ q9 n; n( h$ H- F. J7 \
|
|