📄 gtdma.c
字号:
/*******************************************************************************
* Copyright 2002, GALILEO TECHNOLOGY, LTD. *
* THIS CODE CONTAINS CONFIDENTIAL INFORMATION OF MARVELL. *
* NO RIGHTS ARE GRANTED HEREIN UNDER ANY PATENT, MASK WORK RIGHT OR COPYRIGHT *
* OF MARVELL OR ANY THIRD PARTY. MARVELL RESERVES THE RIGHT AT ITS SOLE *
* DISCRETION TO REQUEST THAT THIS CODE BE IMMEDIATELY RETURNED TO MARVELL. *
* THIS CODE IS PROVIDED "AS IS". MARVELL MAKES NO WARRANTIES, EXPRESSED, *
* IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, COMPLETENESS OR PERFORMANCE. *
* *
* MARVELL COMPRISES MARVELL TECHNOLOGY GROUP LTD. (MTGL) AND ITS SUBSIDIARIES, *
* MARVELL INTERNATIONAL LTD. (MIL), MARVELL TECHNOLOGY, INC. (MTI), MARVELL *
* SEMICONDUCTOR, INC. (MSI), MARVELL ASIA PTE LTD. (MAPL), MARVELL JAPAN K.K. *
* (MJKK), GALILEO TECHNOLOGY LTD. (GTL) AND GALILEO TECHNOLOGY, INC. (GTI). *
********************************************************************************
* gtDma.c - DMA functions and definitions
*
* DESCRIPTION:
* This file gives the user a complete interface to the powerful DMA engines,
* including functions for controling the priority mechanism.
* To fully understand the capabilities of the DMA engines please spare some
* time to go trough the spec.
*
* DEPENDENCIES:
* None.
*
*******************************************************************************/
/* includes */
#include "drv/gtDma/gtDma.h"
#include <vxWorks.h>
#include "wrSbc7410.h"
#define NONE_CACHEABLE(address) (address)
#define GT_REG_WRITE(offset, data) GT64260_REG_WR(offset, data)
#define GT_REG_READ(offset,data) GT64260_REG_RD(offset,data)
#define GT_WRITE_WORD(address, data) \
((*((volatile unsigned int *)NONE_CACHEABLE((address)))) = \
((unsigned int)(data)))
#ifndef UINT32
#define UINT32 unsigned int
#endif
#ifndef EIEIO
#define EIEIO WRS_ASM (" eieio")
#endif
#define GT_WORD_SWAP(x) LONGSWAP(x)
#define VIRTUAL_TO_PHY(address) ((unsigned int)address)
#define PHY_TO_VIRTUAL(address) ((unsigned int)address)
#define GT_SET_REG_BITS(regOffset,bits) \
((*((volatile unsigned int*)(NONE_CACHEABLE(GT64260_BASE_ADRS) | \
(regOffset)))) |= ((unsigned int)GT_WORD_SWAP(bits)))
/*******************************************************************************
* gtDmaCommand - Writes a command to a DMA engine.
*
* DESCRIPTION:
* This function writes a command to a specific DMA engine.
* The command defines the mode in which the engine will work in.
* There are several commands and thay are all defind in gtDma.h.
* It is possible to combine several commands using the or ( | ) operation.
* NOTE:
* This function will not enable the DMA transfer unless the
* CHANNEL_ENABLE command is combined within the command parameter.
*
* INPUT:
* engine - One of the possible engines as defind in gtDma.h
* command - The command to be written to the given engine number .
* All possible Values are defined in gtDma.h and can be for
* example (for more details please refer to the GT data sheet at
* the IDMA section):
*
* - DMA_HOLD_SOURCE_ADDR.
* - DMA_HOLD_DEST_ADDR.
* - DMA_DTL_8BYTES
* - DMA_DTL_16BYTES.
* etc.
* OUTPUT:
* None.
*
* RETURN:
* true on success, false on erroneous parameter..
*
*******************************************************************************/
bool gtDmaCommand(DMA_ENGINE engine,unsigned int command)
{
unsigned int offset=0;
if(IS_INVALID_ENGINE(engine))
return false;
if (engine > DMA_ENG_3 )
offset = 0x100; /* Access to the four additional gtDma engine. */
GT_REG_WRITE(DMA_CH0_CTRL_L + (engine % 4)*4 + offset,command);
return true;
}
/*******************************************************************************
* gtDmaTransfer - Transfer data from sourceAddr to destAddr by a DMA engine.
*
* DESCRIPTION:
* This function simplifies the usage of the powerful DMA engines. It
* transfers the desired amount of data (憂umOfBytes
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -