⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xtemac_intr_sgdma.c

📁 xilinx trimode mac driver for linux
💻 C
📖 第 1 页 / 共 2 页
字号:
/* $Id: *//********************************************************************************       XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"*       AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND*       SOLUTIONS FOR XILINX DEVICES.  BY PROVIDING THIS DESIGN, CODE,*       OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE,*       APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION*       THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,*       AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE*       FOR YOUR IMPLEMENTATION.  XILINX EXPRESSLY DISCLAIMS ANY*       WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE*       IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR*       REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF*       INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS*       FOR A PARTICULAR PURPOSE.**       (c) Copyright 2005-2006 Xilinx Inc.*       All rights reserved.* This program is free software; you can redistribute it and/or modify it* under the terms of the GNU General Public License as published by the* Free Software Foundation; either version 2 of the License, or (at your* option) any later version.** You should have received a copy of the GNU General Public License* along with this program; if not, write to the Free Software* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA*******************************************************************************//*****************************************************************************//**** @file xtemac_intr_sgdma.c** Functions in this file implement interrupt related operations for* scatter gather DMA packet transfer mode. See xtemac.h for a detailed* description of the driver.** <pre>* MODIFICATION HISTORY:** Ver   Who  Date     Changes* ----- ---- -------- -------------------------------------------------------* 1.00a rmm  06/01/05 First release* 2.00a rmm  11/21/05 Switched to local link DMA driver* </pre>******************************************************************************//***************************** Include Files *********************************/#include "xtemac.h"#include "xtemac_i.h"/************************** Constant Definitions *****************************//**************************** Type Definitions *******************************//***************** Macros (Inline Functions) Definitions *********************//* shortcut macros */#define ERR_HANDLER(Class, Word1, Word2)  \    InstancePtr->ErrorHandler(InstancePtr->ErrorRef, Class, Word1, Word2)#define SGSEND_HANDLER() \    InstancePtr->SgSendHandler(InstancePtr->SgSendRef)#define SGRECV_HANDLER() \    InstancePtr->SgRecvHandler(InstancePtr->SgRecvRef)#define ANEG_HANDLER() \    InstancePtr->AnegHandler(InstancePtr->AnegRef)/************************** Function Prototypes ******************************//************************** Variable Definitions *****************************//*****************************************************************************//**** Enable DMA related interrupts for SG DMA frame transfer mode.** @param InstancePtr is a pointer to the instance to be worked on.* @param Direction specifies whether the transmit related (XTE_SEND) or*        receive related (XTE_RECV) interrupts should be affected, or*        both (XTE_SEND | XTE_RECV).** @note* The state of the transmitter and receiver are not modified by this function.*******************************************************************************/void XTemac_IntrSgEnable(XTemac *InstancePtr, u32 Direction){    u32 RegIPIER;    XASSERT_VOID(InstancePtr != NULL);    XASSERT_VOID(InstancePtr->IsReady == XCOMPONENT_IS_READY);    XASSERT_VOID(!(Direction & ~(XTE_SEND | XTE_RECV)));    /* Get current contents of core's IER. Depending on direction(s)     * specified, status/length FIFO error interrupt enables will be enabled     */    RegIPIER = XTemac_mGetIpifReg(XTE_IPIER_OFFSET);    /* Set interrupts for transmit DMA channel */    if (Direction & XTE_SEND)    {        /* DMA interrupt enable */        InstancePtr->Flags |= XTE_FLAGS_SEND_SGDMA_INT_ENABLE;        /* Mask in core's transmit interrupt enables */        RegIPIER |= (XTE_IPXR_XMIT_DMA_MASK | XTE_IPXR_XMIT_ERROR_MASK);    }    /* Set interrupts for receive DMA channel */    if (Direction & XTE_RECV)    {        /* DMA interrupt enable */        InstancePtr->Flags |= XTE_FLAGS_RECV_SGDMA_INT_ENABLE;        /* Mask in core's receive interrupt enables */        RegIPIER |= (XTE_IPXR_RECV_DMA_MASK | XTE_IPXR_RECV_ERROR_MASK);        /* Don't enable recv reject errors if option is cleared */        if (!(InstancePtr->Options & XTE_REPORT_RXERR_OPTION))        {            RegIPIER &= ~XTE_IPXR_RECV_DROPPED_MASK;        }    }    /* Update core interrupt enables */    XTemac_mSetIpifReg(XTE_IPIER_OFFSET, RegIPIER);}/*****************************************************************************//**** Disable DMA related interrupts for SG DMA frame transfer mode.** @param InstancePtr is a pointer to the instance to be worked on.* @param Direction specifies whether the transmit related (XTE_SEND) or*        receive related (XTE_RECV) interrupts should be affected, or*        both (XTE_SEND | XTE_RECV).** @note* The state of the transmitter and receiver are not modified by this function.*******************************************************************************/void XTemac_IntrSgDisable(XTemac *InstancePtr, u32 Direction){    u32 RegIPIER;    XASSERT_VOID(InstancePtr != NULL);    XASSERT_VOID(InstancePtr->IsReady == XCOMPONENT_IS_READY);    XASSERT_VOID(!(Direction & ~(XTE_SEND | XTE_RECV)));    /* Get contents of IPIER register */    RegIPIER = XTemac_mGetIpifReg(XTE_IPIER_OFFSET);    if (Direction & XTE_SEND)    {        /* Disable DMA channel interrupt */        InstancePtr->Flags &= ~XTE_FLAGS_SEND_SGDMA_INT_ENABLE;        /* Mask out core's transmit interrupt enables */        RegIPIER &= ~(XTE_IPXR_XMIT_DMA_MASK | XTE_IPXR_XMIT_ERROR_MASK);    }    if (Direction & XTE_RECV)    {        /* Disable DMA channel interrupt */        InstancePtr->Flags &= ~XTE_FLAGS_RECV_SGDMA_INT_ENABLE;        /* Mask out core's receive interrupt enables */        RegIPIER &= ~(XTE_IPXR_RECV_DMA_MASK | XTE_IPXR_RECV_ERROR_MASK);    }    /* Update IPIER with new setting */    XTemac_mSetIpifReg(XTE_IPIER_OFFSET, RegIPIER);}/*****************************************************************************//**** Set the SGDMA interrupt coalescing parameters. The device must be stopped* before setting these parameters. See xtemac.h for a complete discussion of* the interrupt coalescing features of this device.** @param InstancePtr is a pointer to the instance to be worked on.* @param Direction indicates the channel, XTE_SEND or XTE_RECV, to set.* @param Threshold is the value of the packet threshold count used during*        interrupt coalescing. Valid range is 0 - 1023. A value of 0 disables*        the use of packet threshold by the hardware.* @param Timer is the waitbound timer value in units of approximately*        milliseconds. Valid range is 0 - 1023. A value of 0 disables the use*        of the waitbound timer by the hardware.** @return* - XST_SUCCESS if the threshold was successfully set* - XST_NO_FEATURE if the MAC is not configured for scatter-gather DMA* - XST_DEVICE_IS_STARTED if the device has not been stopped* - XST_INVALID_PARAM if Direction does not indicate a valid channel*******************************************************************************/XStatus XTemac_IntrSgCoalSet(XTemac *InstancePtr, u32 Direction,                                u16 Threshold, u16 Timer){    XASSERT_NONVOID(InstancePtr != NULL);    XASSERT_NONVOID(InstancePtr->IsReady == XCOMPONENT_IS_READY);    /* Must be SGDMA */    if (!XTemac_mIsSgDma(InstancePtr))    {        return(XST_NO_FEATURE);    }    /* Device must be stopped before changing these settings */    if (InstancePtr->IsStarted == XCOMPONENT_IS_STARTED)    {        return(XST_DEVICE_IS_STARTED);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -