|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( \0 _* h* r* y7 x- t- [code]EDMA sample test application1 q8 f; J; w. s- |
- /*
4 R. V% l8 G% k* s" e4 S5 j' R - * edma_test.c$ a2 o: o) @6 B; K- [$ Z. M* M# Q
- *
+ v K6 b/ `; H0 X: S7 S: ?6 Q - * brief EDMA3 Test Application
1 c J! x, N) j7 F$ p6 ~) I- D+ I - *
+ f8 P7 b2 C0 Q - * This file contains EDMA3 Test code.
6 U. ]4 w! m8 Q, @# ^ - *0 o. U7 n- E5 Q3 M! \9 _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! S9 ]5 v5 I: Z8 L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 k7 m6 l' u n& q, q
- * TO CHANGE.
8 p! h8 S$ h" I- G: W$ } - *
# x* [' L# {( `5 u u! m: v8 e7 h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- C2 D- T, y+ ^/ h" X - *
( L/ l* E) G+ S6 n4 @ - * This program is free software; you can redistribute it and/or, ~3 T1 K5 Y- k2 y5 B' u
- * modify it under the terms of the GNU General Public License as3 B2 I6 A% r& E; {8 [" C. }5 S
- * published by the Free Software Foundation version 2.
* ^) f# E O# [" ]9 @7 ^, d5 t7 F3 o @ - *
6 n) s) L: A. G3 N2 h+ H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 x: {! T2 K/ U: a
- * kind, whether express or implied; without even the implied warranty
2 A% m: V. G6 G4 n A V9 ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) U6 D; y6 |0 w) l5 l2 \* \ - * GNU General Public License for more details.4 ~9 x( ~3 q; W" K; v
- */
1 ]5 A) F$ N" \' {; ~/ ~
$ f, d4 B; }4 d3 |0 s' O/ w- #include <linux/module.h>& _( {# T& D1 T# ^. y5 I- h5 t
- #include <linux/init.h>
8 j* f& W. X, ` - #include <linux/errno.h>
, g1 s9 s9 b2 Y3 q - #include <linux/types.h>
+ K W9 h' P/ W. R, g - #include <linux/interrupt.h>
- ~' j5 V* S) l y" _6 C0 H - #include <asm/io.h>
: a, J- E4 o6 D1 S* K9 F( a - #include <linux/moduleparam.h>
! a5 F: O2 R. }8 a - #include <linux/sysctl.h>
. q8 g+ {' K& ^) B - #include <linux/mm.h>
5 V1 E7 K; o5 m - #include <linux/dma-mapping.h>
, ~! U; S) [# E# j# _- e9 `+ I - 9 e5 z& S) P1 e, }& E
- #include <mach/memory.h>; e4 \# K3 ]+ u" N$ |
- #include <mach/hardware.h>3 b9 q* E: D( _0 k4 C
- #include <mach/irqs.h>, D0 o* }/ [' i4 m2 G5 @% g! @1 x
- #include <asm/hardware/edma.h>
) j; {2 K5 u( N3 b
' }4 D3 f1 S \- #undef EDMA3_DEBUG% ]5 r4 h: A( a5 }8 }
- /*#define EDMA3_DEBUG*/
$ O# p# ^: I/ H7 C+ C
$ J7 x0 @& X! L- #ifdef EDMA3_DEBUG& z0 `7 X. _; I* U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* S& }1 |4 r8 q0 n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 w0 d7 ?& w7 r; |* n1 z* n/ u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), X% ?# I4 m* ?8 ^0 }' ^% y# V p
- #else
: c/ \% o+ M1 Y8 z - #define DMA_PRINTK( x... )2 U" g7 y# V- s* e+ Z q
- #define DMA_FN_IN
" s, T+ `" ?8 x - #define DMA_FN_OUT7 i5 ]" D- F. s9 p9 @* T3 e/ I) r
- #endif
7 x& ?: u3 K2 l0 B n - & {: n/ [9 i" X: @0 r) Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) P$ w1 Y* ^. ~! s( A' g- c0 s
- #define STATIC_SHIFT 3' L5 v; ^& T! {9 [
- #define TCINTEN_SHIFT 200 ~, x, d! m$ A# H* {: I6 | r
- #define ITCINTEN_SHIFT 212 Q$ J1 x9 l/ @! o! |
- #define TCCHEN_SHIFT 221 _9 K$ M2 D# R3 H
- #define ITCCHEN_SHIFT 23- o8 D" X+ x* S
- 8 @6 _/ ^& o y1 h+ g
- static volatile int irqraised1 = 0;
/ ]: x, s5 @. N0 r - static volatile int irqraised2 = 0;
- j5 c$ L( f% Z0 k t - / {. D5 v- X7 j+ ?5 d% ^; c m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 {( D& _4 x- d/ u) q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 Y7 f( E: {0 h$ l9 \; z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& L& Q$ Y. q: g$ k& c( e7 W0 z6 t
7 R: D d0 F' w7 c+ L- dma_addr_t dmaphyssrc1 = 0;
; f Y# J1 B! q" D% u5 P2 b- E - dma_addr_t dmaphyssrc2 = 0;. [4 M( O3 x& L) W" M
- dma_addr_t dmaphysdest1 = 0;0 f9 s$ M7 m) R! m
- dma_addr_t dmaphysdest2 = 0;; f. @1 L0 c- A; q# L' _. d: _& f
, c# i% x, a7 p+ G* q# y9 C6 g/ `- char *dmabufsrc1 = NULL;
2 f* u7 A. z6 T' f" } - char *dmabufsrc2 = NULL;
7 z- t% E0 g. j/ u3 W0 X3 }4 u0 f& Q - char *dmabufdest1 = NULL;
0 y( n; }; C; |; u5 O - char *dmabufdest2 = NULL;/ @$ k2 Q" u6 {4 {. v: ]/ S
8 A( Q% |5 X. I2 z+ m {. T [- static int acnt = 512;
, c( C7 Y( i, I* _& `+ }& `/ ~, y - static int bcnt = 8;1 K, K, \1 ]( e3 i( @
- static int ccnt = 8;% b; e+ h& Z1 \2 Y/ E. H; P0 }4 g
- 9 T% ?! _/ F" V' P. U1 h+ Z
- module_param(acnt, int, S_IRUGO);
1 C0 Z& g! W. j- z3 ^ - module_param(bcnt, int, S_IRUGO);3 R9 t6 N& h' J" a, L
- module_param(ccnt, int, S_IRUGO);
复制代码
8 M8 d: H3 q1 O. z' h* S8 N
! }3 s6 u. V1 r0 F2 N/ a0 |+ R6 x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' K- d! O- |% _! w) a' Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 F; k2 E; t. V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 S4 A+ u. |; g, y4 w
& `7 }5 W+ p, s0 j9 d' a, T+ F6 P. ^5 U+ g
|
|