|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 _6 Z+ z3 t) g
- [code]EDMA sample test application f9 V1 v7 {( D. v, I4 L" \6 [
- /*
& P) V/ v( I. m* ]9 P6 [ - * edma_test.c
) `7 y. I5 M1 V6 j1 W7 g$ y - *8 o A6 B3 W+ V5 i
- * brief EDMA3 Test Application& _; `' \* @! K' p* g5 ^& G, Z" B
- *
8 x' ?4 A7 A: X5 ~4 B. N5 ? - * This file contains EDMA3 Test code.1 f. P4 Z' a$ J# X- W) h7 E
- *1 t5 B D; K3 z( q( j# Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 R8 y6 f# M7 P4 k) A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 E0 O4 O; k% ^' {" y' A4 n - * TO CHANGE.
0 p8 m8 q) L8 O# G$ c( \8 n9 _ - *
& Z+ B3 m) N/ J: H5 }; T6 J7 n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" E+ e! C& ?6 V6 p - *
1 ~! o- y0 F- |: R7 \ - * This program is free software; you can redistribute it and/or: Z- M" e g0 c& l& u
- * modify it under the terms of the GNU General Public License as' q/ z1 U' V( I2 s: y* z. e
- * published by the Free Software Foundation version 2.( {4 x+ e# f8 ^6 v6 [
- *8 R* k2 M( u. H% S7 H0 W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* X% T, \! c. A( {1 U ^ - * kind, whether express or implied; without even the implied warranty* F5 g2 M2 \1 B* J8 ^! T7 d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# u( t( ` z% m7 K$ f& S - * GNU General Public License for more details.+ Z: ~+ |, u8 u" \$ m# [$ i4 _
- */8 \& h2 G+ q, p* P! J3 d
3 O4 M5 Y/ i* C! a; c- #include <linux/module.h>
( r1 |1 J, ]2 r% D" f! j: P. o - #include <linux/init.h>4 M, ]% F9 `6 P+ Y! f8 ^
- #include <linux/errno.h>" v7 w9 @2 Y; @6 X1 \
- #include <linux/types.h># [' E. N/ T! a% C9 t
- #include <linux/interrupt.h>
, T% E! R5 q2 E* B - #include <asm/io.h>' B! p: _' l2 H' h0 _
- #include <linux/moduleparam.h>2 D ]( [8 A# K2 i3 X
- #include <linux/sysctl.h>
3 {9 K1 F* }: P& ~. @% R - #include <linux/mm.h>
% n* @) W. U- p+ ^# J5 p+ a: p0 v - #include <linux/dma-mapping.h>. y1 |, Y/ }# j6 c
- / |: s+ D) W& |
- #include <mach/memory.h>$ J, q; Y, Q$ v+ R" \: I
- #include <mach/hardware.h>$ g+ m. k* F) [/ l1 U
- #include <mach/irqs.h>- Z# @5 \3 T" ~8 T/ J* q( x, L
- #include <asm/hardware/edma.h>
* ^6 y/ @6 r3 B* c9 K* z9 B2 s - - K0 a# t9 P7 z# Q
- #undef EDMA3_DEBUG
- j+ D5 u& G5 a9 f( A! R/ H7 d - /*#define EDMA3_DEBUG*/- q4 \4 {- n a( U8 E- w9 x0 r
. x6 T" h' i* [3 N- #ifdef EDMA3_DEBUG( O# j* v% I& B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: W- z5 N2 H. D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
O; K. ^, |" o! y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( r' R. v- v) E8 y
- #else) y' G; ]5 m5 g8 r6 Z
- #define DMA_PRINTK( x... )
* l- Z8 j/ |. b' u7 ?5 Y - #define DMA_FN_IN: O4 ~* F4 U/ B3 v* m6 z
- #define DMA_FN_OUT0 U+ d9 g1 ?. E
- #endif
4 x3 W/ `4 q# A1 ]9 ]; x - - o9 W- j5 {8 I" P, }1 j. Z j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 T. @2 B G6 C5 z
- #define STATIC_SHIFT 30 {5 H- k% |2 u2 m+ W+ \
- #define TCINTEN_SHIFT 20
1 H0 ]9 l1 a; L( x1 X' s - #define ITCINTEN_SHIFT 214 X% j1 S0 l- h5 u
- #define TCCHEN_SHIFT 224 l4 a9 K, R$ k, K9 C6 l0 i) w
- #define ITCCHEN_SHIFT 23
! v2 ]' S9 Q' L" b0 A: s, e4 l+ H - - z5 ?3 h' W4 ]1 T
- static volatile int irqraised1 = 0;2 Z; J) K/ Z n
- static volatile int irqraised2 = 0;2 u! b' v: G4 o$ w6 {! ], t" b
- - i/ E& c* e6 i% q# x$ @* ^: n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: S" P) T& R6 |8 [* u* @% z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* p- P6 V$ x0 X1 e& B' k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Z9 w+ U- [/ {/ A8 j8 x
/ G% w- u+ X2 _" r/ {4 O- dma_addr_t dmaphyssrc1 = 0;3 _8 _% }% [5 i- d+ T
- dma_addr_t dmaphyssrc2 = 0;2 t7 j8 v! @& T$ X4 C- b
- dma_addr_t dmaphysdest1 = 0;
" N+ b4 X$ H. L+ w7 }: A - dma_addr_t dmaphysdest2 = 0;+ E ]& K2 d- L6 I) K+ h6 C: M5 ^
0 p0 V/ E4 W3 |: `% s. `7 I, {- char *dmabufsrc1 = NULL;& s. D5 h% L, o! M
- char *dmabufsrc2 = NULL;; j2 F4 m: ?8 t
- char *dmabufdest1 = NULL;
~2 c; ]" M. N B a; J+ x - char *dmabufdest2 = NULL;) E! b" |0 @& k- k* C s
7 @+ R) g; W4 w- static int acnt = 512;, R5 n* v( j1 p8 @
- static int bcnt = 8;* L5 w9 y7 x1 w! O( ]# |" l
- static int ccnt = 8;. P5 O: F, d" P5 Z! |$ V
( _0 P7 d/ i. k$ y0 K- module_param(acnt, int, S_IRUGO);
* u$ U0 E# v( c/ {+ M0 } - module_param(bcnt, int, S_IRUGO);
7 L3 e- W9 U* z! S& w; G - module_param(ccnt, int, S_IRUGO);
复制代码 4 ^7 m. S2 h; A7 w( {3 `- i* R U
4 C& ~: s& t+ M1 o3 V" V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, ~0 _* @) ], X0 Y" ]5 h4 xarm-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) y) J) T& i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 I2 \6 F9 [. @+ {: i4 X$ W
2 v/ [+ k8 R" t
?* l. E& u/ W( X |
|