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

📄 xemac_sinit.c

📁 powerpc405开发板的linux网口驱动程序
💻 C
字号:
/* $Id: xemac_sinit.c,v 1.1 2005/12/16 16:04:37 meinelte Exp $ *//********************************************************************************       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.*******************************************************************************//*****************************************************************************//**** @file xemac_sinit.c** The XEmac static initilaization functions.* See xemac.h for a detailed description of the driver.** <pre>* MODIFICATION HISTORY:** Ver   Who  Date     Changes* ----- ---- -------- -------------------------------------------------------* 1.01a ecm  09/26/05 First release* </pre>******************************************************************************//***************************** Include Files *********************************/#include "xbasic_types.h"#include "xenv.h"#include "xemac_i.h"/************************** Constant Definitions *****************************//**************************** Type Definitions *******************************//***************** Macros (Inline Functions) Definitions *********************//************************** Function Prototypes ******************************/extern XEmac_Config *XEmac_LookupConfig(Xuint16 DeviceId);extern XStatus Initialize(XEmac *InstancePtr, XEmac_Config *ConfigPtr);/************************** Variable Definitions *****************************//*****************************************************************************//**** Initialize a specific XEmac instance/driver.** Retrieves the configuration table associated with the DeviceID provided.* Sets up the Instance data as determined bu the configuration table* Calls the unified local Initialize function contained in xemac,c** @param InstancePtr is a pointer to the XEmac instance to be worked on.* @param DeviceId is the unique id of the device controlled by this XEmac*        instance.  Passing in a device id associates the generic XEmac*        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.** @note** None.*******************************************************************************/XStatus XEmac_Initialize(XEmac *InstancePtr, Xuint16 DeviceId){    XASSERT_NONVOID(InstancePtr != XNULL);    /* Clear instance memory */    XENV_MEM_FILL(InstancePtr, 0, sizeof(XEmac));    /*     * Lookup the device configuration in the xemac_g.c table. Use this     * configuration info when calling the local intiialize for this component.     */    InstancePtr->ConfigPtr = XEmac_LookupConfig(DeviceId);    if (InstancePtr->ConfigPtr == XNULL)    {        return XST_DEVICE_NOT_FOUND;    }    /*     * Save the baseaddress for faster access     */    InstancePtr->BaseAddress = InstancePtr->ConfigPtr->BaseAddress;    InstancePtr->PhysAddress = InstancePtr->ConfigPtr->BaseAddress;    return (Initialize(InstancePtr, InstancePtr->ConfigPtr));}/*****************************************************************************//**** Initialize a specific XEmac instance/driver, virtual memory method.** Retrieves the configuration table associated with the DeviceID provided.* Sets up the Instance data as determined bu the configuration table* Calls the unified local Initialize function contained in xemac,c** @param InstancePtr is a pointer to the XEmac instance to be worked on.* @param DeviceId is the unique id of the device controlled by this XEmac*        instance.  Passing in a device id associates the generic XEmac*        instance to a specific device, as chosen by the caller or application*        developer.* @param VirtualAddress is the address for the base address in the instance.*        This method is specific to Linux usage.** @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.** @note** None.*******************************************************************************/XStatus XEmac_VmInitialize(XEmac *InstancePtr, Xuint16 DeviceId,                           Xuint32 VirtualAddress){   XASSERT_NONVOID(InstancePtr != XNULL);   /* Clear instance memory */   XENV_MEM_FILL(InstancePtr, 0, sizeof(XEmac));   /*    * Lookup the device configuration in the temporary CROM table. Use this    * configuration info down below when initializing this component.    */   InstancePtr->ConfigPtr = XEmac_LookupConfig(DeviceId);   if (InstancePtr->ConfigPtr == XNULL)   {       return XST_DEVICE_NOT_FOUND;   }   /*    * Save the baseaddress for faster access    */   InstancePtr->BaseAddress = VirtualAddress;   InstancePtr->PhysAddress = InstancePtr->ConfigPtr->BaseAddress;   return (Initialize(InstancePtr, InstancePtr->ConfigPtr));}

⌨️ 快捷键说明

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