|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# @" F' R# ` L3 ^2 S- [code]EDMA sample test application3 Q0 Z+ j. D7 S0 ~8 P( F
- /*4 ~2 t5 Q# P& ~* g: l! d$ [
- * edma_test.c5 s/ L: Z3 T( e9 G
- *
C7 Y. l6 B1 r1 f - * brief EDMA3 Test Application j. I1 _; {9 @/ v$ H
- *# ^3 M) y/ C' p: E
- * This file contains EDMA3 Test code.8 v+ k* I$ `3 ?& ^; l! v
- *) U9 q: M$ J5 K" E! s; K; }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ ^: _6 V1 D0 F9 d$ Q6 T" _0 v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: x" J+ S( e- Q - * TO CHANGE.1 | j( D" H1 q$ M5 A6 e( Q. P
- *2 j6 F* ~! K. H" Y6 t4 R! \; I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) W/ g& i" Y* h; W" A, l - *1 B/ N* f( i4 Z
- * This program is free software; you can redistribute it and/or* o4 A# a/ w2 z5 }3 Z. `' R
- * modify it under the terms of the GNU General Public License as# V! W0 @2 \! ^$ O- U2 x; A. W
- * published by the Free Software Foundation version 2., q5 z, O9 {" _& Q* y% F( F4 ?+ m9 h+ h
- *4 T! a# _2 I8 t- C& r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. n* B3 ]: t2 A" D- \$ f - * kind, whether express or implied; without even the implied warranty0 N/ T; c! m2 {0 q5 ]$ E, l9 s: _* h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 w6 s5 j. M* `& |; \ U - * GNU General Public License for more details." r$ \: h, a) u$ @% d
- */
: D @/ B$ U/ C( T! q - 7 l% z# o& v" w6 i k) l
- #include <linux/module.h>* H: q$ s0 t- x: J ^
- #include <linux/init.h>5 j8 O) ], x9 }7 R7 ~" X
- #include <linux/errno.h>* L. h+ d7 e* a5 a% H, |
- #include <linux/types.h>; J5 X4 W1 |# B7 E
- #include <linux/interrupt.h>
, Q0 i$ F& g2 Z% u - #include <asm/io.h>
, C- y( |, Q- J1 Z0 c" q( s3 A - #include <linux/moduleparam.h>8 [0 u3 W; I5 r: q& i
- #include <linux/sysctl.h>& y8 f9 [: R0 q4 M% o J* K
- #include <linux/mm.h>
6 x' c" B1 x7 U4 O& S9 z, p# N# B - #include <linux/dma-mapping.h>. f% v+ n. v3 P9 D7 N: A
- & y4 H, Z$ I" J& m# I7 `# ?9 e
- #include <mach/memory.h>
8 ~1 w- t" w, q' b+ X - #include <mach/hardware.h>
9 M9 U' a D& e% I - #include <mach/irqs.h>+ m/ J. h3 |! ~$ G+ B/ C
- #include <asm/hardware/edma.h>) X( }. [, z6 K/ f
- / x B8 ?9 f# X, ~) Y
- #undef EDMA3_DEBUG
1 `7 o& W0 S; g - /*#define EDMA3_DEBUG*/. s. k4 x/ W/ F4 \
& E7 b0 O3 `, y: D3 R2 g- #ifdef EDMA3_DEBUG6 e9 p! B+ g" r& w) e+ v8 a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 F/ g2 h+ U1 R3 B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ h( ?# N& ~; M* D5 a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 N2 E$ a3 k3 p9 h/ V0 s7 Q8 O - #else
, J* i0 d% x5 V' z. Q; z - #define DMA_PRINTK( x... )* L; `* f" f2 h9 g! H. O- }% w& B2 v
- #define DMA_FN_IN
P- ~1 J2 P7 l' |9 L0 D. \6 k - #define DMA_FN_OUT" J& Z" ~- \6 h# v1 _4 v
- #endif
! r& E: T/ c, @" n7 Q
; T4 {! U: s6 ~" h0 }# r! Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ K# F. g0 e" W3 ~. D: C) E - #define STATIC_SHIFT 3
, r" w: U: o1 m% E; S- Y$ o - #define TCINTEN_SHIFT 20
" A/ i+ Y& R- P0 N - #define ITCINTEN_SHIFT 216 @1 o! x2 R$ ]$ }
- #define TCCHEN_SHIFT 222 L! Q6 W% ]- E+ d8 ^7 M/ B
- #define ITCCHEN_SHIFT 23
' V* \1 g0 p! q( T
6 ^) N4 \2 a7 T2 [5 T3 G/ `- static volatile int irqraised1 = 0;
! \ j% E7 ]! e3 M6 e* l; Y - static volatile int irqraised2 = 0;5 W, Q! h* k& I: j
* I# J. x8 e7 g/ J, c' l' @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, @( [( H# p( s9 Y" u. C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& C- V) |# S! \) N/ C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( W5 g6 Z3 f4 ?0 K7 `/ z _
0 H9 N3 G; f7 i- dma_addr_t dmaphyssrc1 = 0;+ B; [" k: M/ ^3 V& M6 W7 o
- dma_addr_t dmaphyssrc2 = 0;& w; G0 w& h- C, g; H6 T- ^
- dma_addr_t dmaphysdest1 = 0;
4 f0 c4 B6 i$ U - dma_addr_t dmaphysdest2 = 0;
, E* f; |$ l+ L$ z) x
, o! p5 Y3 I1 ]& f; j' Q- char *dmabufsrc1 = NULL;7 s- z, ^1 p2 J2 Q6 L+ u! K8 ]
- char *dmabufsrc2 = NULL; `# ?4 c8 R. M
- char *dmabufdest1 = NULL;
: T6 B. j4 r$ A8 k2 _( p3 f2 d& ` - char *dmabufdest2 = NULL;# F4 K3 s. G8 m) n/ c+ v9 o4 A
$ u) m8 v' m* G2 y. E- static int acnt = 512;
: s" ?( Z2 L4 d8 ?; @ - static int bcnt = 8;# c O2 r1 k0 l, Q
- static int ccnt = 8;# _# f+ |6 r8 V' D% h
- % Q: f2 u: M7 `1 m( R
- module_param(acnt, int, S_IRUGO);0 S A) \$ d D, j6 X# R/ Q
- module_param(bcnt, int, S_IRUGO);
$ B1 Q* R# c% g a. D- L - module_param(ccnt, int, S_IRUGO);
复制代码 6 e0 K+ f" v5 r ~
4 ]! u# L( x1 Q3 K- z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% ~4 Y5 C9 F$ [) Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# b+ I f# h% `, d: K: F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" }/ J e! v/ z+ G! b- @8 \
m+ L5 n. G7 y) A
; {/ M' J4 g& h |
|