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

📄 xtemac_sinit.c

📁 xilinx trimode mac driver for linux
💻 C
字号:
/* $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_sinit.c** This file contains legacy initialization methods.** <pre>* MODIFICATION HISTORY:** Ver   Who  Date     Changes* ----- ---- -------- -------------------------------------------------------* 2.00a rmm  11/21/05 New* </pre>*******************************************************************************//***************************** Include Files *********************************/#include "xtemac.h"/************************** Constant Definitions *****************************//**************************** Type Definitions *******************************//***************** Macros (Inline Functions) Definitions *********************//************************** Function Prototypes ******************************//*****************************************************************************//*** Initialize a specific XTemac instance/driver for systems that do not use* address translation. This function performs the same initialization steps as* does XTemac_VmInitialize() except that the base address of the device is* derived from the physical address contained in the configuration structure.** See XTemac_CfgInitialize() for further information on what occurs during* initialization.** @param InstancePtr is a pointer to the instance to be worked on.* @param DeviceId is the unique id of the device controlled by this XTemac*        instance.  Passing in a device id associates the generic XTemac*        instance to a specific device, as chosen by the caller or application*        developer.** @return* - XST_SUCCESS if initialization was successful* - XST_DEVICE_NOT_FOUND if device configuration information was not found for*   a device with the supplied device ID.* - XST_FAILURE if initialization of packet FIFOs or DMA channels failed.*******************************************************************************/XStatus XTemac_Initialize(XTemac *InstancePtr, u16 DeviceId){    XTemac_Config *CfgPtr;    /* Verify arguments */    XASSERT_NONVOID(InstancePtr != NULL);    /* Lookup the configuration information for this device */    CfgPtr = XTemac_LookupConfig(DeviceId);    if (CfgPtr == NULL)    {        return(XST_DEVICE_NOT_FOUND);    }    /* Perform rest of init */    return(XTemac_CfgInitialize(InstancePtr, CfgPtr, CfgPtr->BaseAddress));}/*****************************************************************************//*** Initialize a specific XTemac instance/driver for systems that use address* translation. This function performs the same initialization steps as does* XTemac_Initialize() except for how the base address of the device derived.* Instead of using the physical address found in the configuration table for* the given device ID, the supplied virtual address is used.** See XTemac_CfgInitialize() for further information on what occurs during* initialization.** @param InstancePtr is a pointer to the instance to be worked on.* @param DeviceId is the unique id of the device controlled by this XTemac*        instance.  Passing in a device id associates the generic XTemac*        instance to a specific device, as chosen by the caller or application*        developer.* @param VirtualAddress is the virtual base address of the device if address*        translation is being utilized. This address must translate to the*        physical address as defined in the XTemac_ConfigTable array for the*        given DeviceId. The translation must be setup by the user prior to*        calling this function.** @return* - XST_SUCCESS if initialization was successful* - XST_DEVICE_NOT_FOUND if device configuration information was not found for*   a device with the supplied device ID.* - XST_FAILURE if initialization of packet FIFOs or DMA channels failed.*******************************************************************************/XStatus XTemac_VmInitialize(XTemac *InstancePtr, u16 DeviceId,                            u32 VirtualAddress){    XTemac_Config *CfgPtr;    /* Verify arguments */    XASSERT_NONVOID(InstancePtr != NULL);    /* Lookup the configuration information for this device */    CfgPtr = XTemac_LookupConfig(DeviceId);    if (CfgPtr == NULL)    {        return(XST_DEVICE_NOT_FOUND);    }    /* Perform rest of init */    return(XTemac_CfgInitialize(InstancePtr, CfgPtr, VirtualAddress));}/*****************************************************************************//*** Lookup the device configuration based on the unique device ID.  The table* contains the configuration info for each device in the system.** @param DeviceId is the unique device ID of the device being looked up.** @return* A pointer to the configuration table entry corresponding to the given* device ID, or NULL if no match is found.*******************************************************************************/XTemac_Config *XTemac_LookupConfig(u16 DeviceId){    extern XTemac_Config XTemac_ConfigTable[];    XTemac_Config *CfgPtr = NULL;    int i;    for (i=0; i < XPAR_XTEMAC_NUM_INSTANCES; i++)    {        if (XTemac_ConfigTable[i].DeviceId == DeviceId)        {            CfgPtr = &XTemac_ConfigTable[i];            break;        }    }    return(CfgPtr);}

⌨️ 快捷键说明

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