|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! r6 \" h+ e x' ^# }# V7 \- [code]EDMA sample test application
3 N" ]; l$ w) D+ Y2 K/ J - /*5 x& t4 D* U K1 Y
- * edma_test.c
' O" T1 @7 s" j' O# \ - *
; M3 z+ L4 q2 R( Q - * brief EDMA3 Test Application$ D7 C( \" h1 @. W& ~0 Q9 H
- *; t# o! h3 Z) A$ L& e" T* T
- * This file contains EDMA3 Test code.
8 P& `! G. f6 z# [0 d4 e6 c) d - *6 F* z9 D$ J# g* O0 W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 s: [6 h/ i4 g# t/ U9 m8 v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' K) P" `0 h9 [8 h, F - * TO CHANGE.& v4 F+ v! y; z% o' C; t# Y( {
- *: o! q4 J7 B: ]( [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" g; S7 |4 P& Y9 X$ C7 I0 } - *
9 Y0 T7 ]4 l9 m6 Y9 S5 m7 @ - * This program is free software; you can redistribute it and/or
; e4 E. `+ T8 x& X- }. s. w: P - * modify it under the terms of the GNU General Public License as
* d* L0 h7 E9 d. i! n9 i/ \ - * published by the Free Software Foundation version 2.
3 F; G! E% K3 Q8 P - *
7 B- S( X" D$ ]& ?& N8 ^8 @* O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 ~0 i& I3 W& s
- * kind, whether express or implied; without even the implied warranty
7 @; X, v. e. C1 ^$ T8 v2 ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& f5 Q* f& B1 a. S( S' ?! ^
- * GNU General Public License for more details.' k! \2 ?3 Q# t( L
- */
6 J. M- h! @" m6 K9 _- N - 4 y2 P Y2 y5 I3 u5 @
- #include <linux/module.h>3 U" }% h8 j0 U. Y! u5 x: A( I( e
- #include <linux/init.h>' r/ |* W3 ?' H$ u W+ {, t
- #include <linux/errno.h>
' p0 {/ Z. m& n - #include <linux/types.h>
% ~% h& B, G$ [7 O5 e, v e - #include <linux/interrupt.h>
. _4 J7 _ a; |6 x W |0 K: l - #include <asm/io.h>, T( n6 h; E$ g; t0 J8 K
- #include <linux/moduleparam.h>3 H5 H6 O+ X1 x" Z/ a3 L: b( @
- #include <linux/sysctl.h>/ r# |( d0 `1 |5 i* w3 A
- #include <linux/mm.h>; r! e' R) N l2 I/ `
- #include <linux/dma-mapping.h># m6 a1 X" }# j8 {' W
& `( M8 }; z: X1 I2 E" P- #include <mach/memory.h>3 ~ C+ Q$ j/ E2 z* {
- #include <mach/hardware.h>& Q- w; L9 y/ A! l
- #include <mach/irqs.h>2 q1 l8 [6 E9 u; \
- #include <asm/hardware/edma.h>
% ^0 K) D! Z/ S$ [' ~ - : L4 O4 n7 j! W9 j" h
- #undef EDMA3_DEBUG* d$ `/ T2 T5 O/ t+ Y! ~! ~+ E0 Q
- /*#define EDMA3_DEBUG*/
' K* R5 U( Z$ f& ]- k% C0 [ - # D7 E% Q5 b" Z/ B
- #ifdef EDMA3_DEBUG6 ^( b9 M4 ] L# O- m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ a+ J# l2 W2 D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ S# N* s) y! v1 |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( A. @# F0 ~$ i% @( D$ `3 ?* X' z3 W
- #else4 U' O- d: r; t: ~+ x8 d
- #define DMA_PRINTK( x... )
) T4 t# ~3 s. I% p: y - #define DMA_FN_IN+ \9 J) D% N# v1 b
- #define DMA_FN_OUT% C- _0 o4 U7 z/ u
- #endif
* o8 @& s7 L6 e
9 ^9 Z3 U- `4 T, l3 h) k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" K7 @8 @5 E; O
- #define STATIC_SHIFT 3
# l* p% N4 [% }3 ` - #define TCINTEN_SHIFT 20
+ T. w9 m. w, K" ^5 |# \ - #define ITCINTEN_SHIFT 21
" V& l! M l+ O* G - #define TCCHEN_SHIFT 22
! b- A) T5 L: d5 Y# K - #define ITCCHEN_SHIFT 232 w6 |: B% M3 S+ a' Y5 a9 J
, b$ k% s* I+ q; s3 u( c- static volatile int irqraised1 = 0;
2 J" K7 ?6 H: i - static volatile int irqraised2 = 0;
: D" E' G) K+ G" s - 8 w" r: a0 w- d5 q5 j# @6 @* }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ X/ q% p, V) c3 B2 D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) C' M% T9 M* S8 h$ @' x) V& q& `5 L) y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. g, B/ g2 C3 s* X6 S7 Y - 0 m! L" X# W) q- q) e
- dma_addr_t dmaphyssrc1 = 0;/ Y4 W2 {$ [3 k' A
- dma_addr_t dmaphyssrc2 = 0;
% J5 M5 K! x3 t. e# o9 v! T9 Z) B - dma_addr_t dmaphysdest1 = 0;3 i+ e$ k7 n2 f, k. i( q- E2 b
- dma_addr_t dmaphysdest2 = 0;* b1 k# L* |! p# ?
- 1 G2 a5 ]$ x9 }" J0 O9 A
- char *dmabufsrc1 = NULL;
* w# [# ~: w0 _+ W. s9 N - char *dmabufsrc2 = NULL;
1 ]/ F3 @2 t; M$ a5 y- h - char *dmabufdest1 = NULL;
# x- [; ~5 A4 `9 v8 @ - char *dmabufdest2 = NULL;6 ? i# p% w/ O; Y2 A3 U& @3 ?
- 3 c& M. S6 ]- K" [$ n# K
- static int acnt = 512;
% o* o, G! T2 y) |; E - static int bcnt = 8;
' [' g- ~* e; B5 T' B# \) k$ ~ - static int ccnt = 8;( H6 l. P" P2 _7 V
( D6 G( @( z+ ^9 [6 e0 B- module_param(acnt, int, S_IRUGO);& r0 Q8 d. W- [7 Q6 f5 F
- module_param(bcnt, int, S_IRUGO);
$ m" c8 M, L; j; R - module_param(ccnt, int, S_IRUGO);
复制代码 2 |9 ]+ v8 k6 q, e m0 q: W8 Q5 _% T
( k) a y1 [3 ^% G8 q/ D9 G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 ]( I# R) T0 L% p: H( j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 y" ~3 P4 g( ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, @1 A. z+ J2 w
8 Z, x' b9 g$ I% b/ L
8 L% v/ B. T$ V. I |
|