|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 [4 F0 N/ f1 b! N4 i. Z' ^
- [code]EDMA sample test application4 g; ?" R& J. ]
- /*
0 J$ Y8 a% k7 b1 _; s- h5 C% w' M - * edma_test.c |/ w$ c2 d5 x' v
- *& x( ?5 k4 s+ r; l$ C
- * brief EDMA3 Test Application1 Y4 _6 r( O4 V8 W: s
- *
. C; h( h8 ?' G0 [; {) K - * This file contains EDMA3 Test code.
" h9 C5 H0 R2 j" P - *
6 \5 R! L( U' F) W" S0 M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: P4 L3 D7 d8 D; [0 O8 g/ b" f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: q h5 o9 O" i- | Y) C
- * TO CHANGE.
) _4 B, V X' q1 Z) z9 a1 u - *
6 y: P: K& h1 ? c4 M. R" }0 { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! j/ k# b" T; `" c6 V0 \
- *# c( F& L" s. M& E4 Q: n' l' B
- * This program is free software; you can redistribute it and/or
( q, C7 O- Z6 U, ]# ]0 @9 q - * modify it under the terms of the GNU General Public License as
) p" o. L# `* Q9 H9 ^0 s - * published by the Free Software Foundation version 2.
+ O& M9 H" f/ g7 a& }2 T - *
( t9 a7 ^4 v6 ~' U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ `$ M7 J* {- G! v) w
- * kind, whether express or implied; without even the implied warranty
. Q6 G5 V) Z9 K, n" _7 J3 F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ K' ^: {% x* u1 q! }3 c - * GNU General Public License for more details.1 J, P/ A, Q. z+ R* G9 G
- */
' P" V$ P9 |/ g( s0 a4 ^
; H5 ^& L. L x; W- S2 [- #include <linux/module.h>
9 ]0 J$ ^# }, M - #include <linux/init.h>! _6 W1 V! g& @, ?# q
- #include <linux/errno.h>
; ~3 |9 x( g6 a9 h8 R+ J. w - #include <linux/types.h>
9 Z! O# R# R4 M" B- z' c- y - #include <linux/interrupt.h> a3 L! O) G, M
- #include <asm/io.h>' k* Q6 h% \. G; e. \
- #include <linux/moduleparam.h>
2 H+ @& |) w9 v# A8 U7 b! f, k - #include <linux/sysctl.h>; E$ G3 u* ~+ J; A1 Z: Z
- #include <linux/mm.h>
( H5 D: U' H9 n7 a& z0 W) e - #include <linux/dma-mapping.h># m& q) H3 L& g. r
- 9 c! r: k0 u: m9 q y+ f9 ~# K
- #include <mach/memory.h>: A; ]0 ]" F4 J6 f. S. y
- #include <mach/hardware.h>
6 Q: V2 R% _. x4 t - #include <mach/irqs.h>) M% W7 d S9 g9 I$ f
- #include <asm/hardware/edma.h>6 S+ g; B( e% s! L& ~5 `' G9 h
- 3 [3 T4 t3 @0 t N( ?# g
- #undef EDMA3_DEBUG4 u. y! L, {0 q( D# W: m* N* {
- /*#define EDMA3_DEBUG*/. H) n8 ^9 s; Q* v
- 9 Z- C3 g2 C" d! ^: C7 y
- #ifdef EDMA3_DEBUG
' ~- D4 ~: O4 |, i' R J9 K& a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 @7 s& Q3 N- _( B; Q: k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
i/ F R* m8 [. s7 w" W' I9 X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* ~! u, D, u: G6 {, b
- #else I2 d# w# |+ A3 l
- #define DMA_PRINTK( x... )
9 |1 q3 t" x7 G: t2 _' O8 l - #define DMA_FN_IN
4 ^6 Q) V7 b) O# P+ t; J8 d. k - #define DMA_FN_OUT2 v4 D1 ^: B+ i+ \; [7 H% T
- #endif
, y6 c2 t5 h8 H* n
v# @4 b$ I2 p8 h0 w' N- #define MAX_DMA_TRANSFER_IN_BYTES (32768) ~5 _& `+ t. n4 @7 l# m
- #define STATIC_SHIFT 3
0 B( C& g7 a6 C- b1 c) f - #define TCINTEN_SHIFT 20
/ O6 t/ T, S4 l9 U - #define ITCINTEN_SHIFT 21
$ j* i9 X! J* P" u! b - #define TCCHEN_SHIFT 22! ?: ?8 H+ n N- c) `# h# F
- #define ITCCHEN_SHIFT 235 l6 } ]- z! X) M
0 V4 n+ G0 j# x4 O- static volatile int irqraised1 = 0;) u4 ~: P) L1 Q) C) O
- static volatile int irqraised2 = 0;; a# E- m& U5 c+ T! m; i
- ) ~/ t+ ]' h! @3 p z: M( d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) s! ^3 m+ r; g' g6 ?' }; `) H8 k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' A) _; j8 u8 f0 Y: f3 P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: Y5 `# k# ?1 P& s N
% I1 }0 d0 ~) O) ~! c* Q; y0 F- dma_addr_t dmaphyssrc1 = 0;
4 Z u# K, ^7 v' O8 S - dma_addr_t dmaphyssrc2 = 0;+ o+ c. ^" f4 n$ J# z
- dma_addr_t dmaphysdest1 = 0;% S7 o# s- Y1 E' n- v# b/ ]
- dma_addr_t dmaphysdest2 = 0;/ X) e9 G# K+ W1 K# C% _+ x: e
- + y K/ l, F) |9 V
- char *dmabufsrc1 = NULL;. b- s+ L D9 |0 r7 ~9 G3 B
- char *dmabufsrc2 = NULL;8 p+ o+ {( x5 H" D, Y( V
- char *dmabufdest1 = NULL;7 x9 ?1 g; l+ Z+ O; S H$ A1 k
- char *dmabufdest2 = NULL;
2 C1 H# x7 A4 j8 D5 D( x; T; S - 1 F g( W1 N* l! r# e
- static int acnt = 512;
1 s" f4 L" x( u6 J2 i( o9 P3 J+ X - static int bcnt = 8;
2 @% w( }4 |$ B, B. R - static int ccnt = 8;9 e% o; M. W6 d. V+ v; Q
: H) _0 C* V$ q3 c2 H, ^! g/ k1 ^- module_param(acnt, int, S_IRUGO);4 O& v/ @$ q9 t, o4 Q4 ~
- module_param(bcnt, int, S_IRUGO);
; ~3 h2 g5 J% ~# V) u - module_param(ccnt, int, S_IRUGO);
复制代码 4 G7 r9 t3 t/ d/ c
+ P' D0 q7 c2 O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ u0 c0 }3 K0 o( T+ `. n5 }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 `) f4 P* |1 i1 A. Z* G1 _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ I+ c U6 @% r z0 X* j6 W. c
3 t7 G/ a' R7 w9 r* K) a6 r* Y+ ]6 L1 V& o' Q& K0 M" a* D4 p
|
|