📄 sysnet.c
字号:
/* sysNet.c - system network interface support library *//*DESCRIPTIONThis library contains board-specific routines for network subsystems.*/#if defined (INCLUDE_NETWORK)/* includes */#include "copyright_wrs.h"#include "vxWorks.h"#include "taskLib.h"#include "sysLib.h"#include "config.h"#ifdef INCLUDE_FEC_END/* set the following array to a unique Ethernet hardware address */unsigned char sysFecEnetAddr [6] = {0x08, 0x00, 0x3e, 0x32, 0x53, 0x22};IMPORT STATUS sysFecEnetDisable (UINT32 fecBaseaddr);#include "end.h"#include "drv/end/m5200FecEnd.h"#endif /* INCLUDE_FEC_END */#ifdef INCLUDE_FEI_END#include "sysFei82557End.c"#endif /* INCLUDE_FEI_END */#if defined(INCLUDE_PCI) && defined(INCLUDE_EL_3C90X_END)#include "sysEl3c90xEnd.c" /* el3c90xEnd support routines */#endif/************************************************************************* sysNetHwInit - initialize the network interface** This routine initializes the network hardware to a quiescent state. It* does not connect interrupts.** Only polled mode operation is possible after calling this routine.* Interrupt mode operation is possible after the memory system has been* initialized and sysNetHwInit2() has been called.** RETURNS: N/A** SEE ALSO: sysHwInit()*/void sysNetHwInit ( void ) {#ifdef INCLUDE_FEI_END sys557PciInit (); /* Intel 82557/9 device */#endif /* INCLUDE_FEI_END */#ifdef INCLUDE_EL_3C90X_END sysEl3c90xPciInit (); /* 3COM 3C90x device */#endif /* INCLUDE_LN_97X_END */#ifdef INCLUDE_FEC_END /* disable the FEC */ sysFecEnetDisable ( (UINT32)ETH_BASE_ADRS ); { ULONG * pStdPortConfig; pStdPortConfig = (ULONG *)(GPIO_STD_BASE_ADRS + GPIO_STD_PORT_CONFIG); *pStdPortConfig &= ~GPIO_STD_PC_ETH_MASK; *pStdPortConfig |= GPIO_STD_PC_ETH_18WIRE; }#endif /* INCLUDE_FEC_END */ }/************************************************************************* sysNetHwInit2 - initialize additional features of the network interface** This routine completes initialization needed for interrupt mode operation* of the network device drivers. Interrupt handlers can be connected.* Interrupt or DMA operations can begin.** RETURNS: N/A** SEE ALSO: sysHwInit2()*/void sysNetHwInit2 ( void ) { }#ifdef INCLUDE_FEC_END/********************************************************************************* sysFecEnetEnable - enable the MII interface of the Fast Ethernet controller** This routine is expected to perform any target specific functions required* to enable the Ethernet device and the MII interface of the Fast Ethernet * controller. None required here** This routine does not enable the 7-wire serial interface.** RETURNS: OK, or ERROR if the Fast Ethernet controller cannot be enabled.*/STATUS sysFecEnetEnable ( UINT32 fecBaseAddr /* base address of the on-chip RAM */ ) { return (OK); }/********************************************************************************* sysFecEnetDisable - disable MII interface to the Fast Ethernet controller** This routine is expected to perform any target specific functions required* to disable the Ethernet device and the MII interface to the Fast Ethernet * controller. This involves restoring the default values for all the Port * signals.** RETURNS: OK, always.*/STATUS sysFecEnetDisable ( UINT32 fecBaseAddr /* base address of the on-chip RAM */ ) { int intLevel = intLock(); /* volatile UINT32 *FEC_END_CTRL = (volatile UINT32 *)((void *)(fecBaseAddr + FEC_END_CTRL_OFF)); */ /* disable the Ethernet device for the FEC */ /* *FEC_END_CTRL = 0; remove ETHER_EN */ intUnlock (intLevel); return (OK); }/******************************************************************************** sysEnetAddrGet - get the hardware Ethernet address** This routine provides the six byte Ethernet hardware address that will be* used by each individual Fast Ethernet device unit. This routine must copy* the six byte address to the space provided by <addr>.** RETURNS: OK, or ERROR if the Ethernet address cannot be returned.*/STATUS sysEnetAddrGet ( UINT32 fecBaseAddr, /* base address of the on-chip RAM */ UCHAR * addr /* where to copy the Ethernet address */ ) { bcopy ((char *) sysFecEnetAddr, (char *) addr, sizeof (sysFecEnetAddr)); return (OK); }/******************************************************************************** sysEnetAddrSet - set the hardware Ethernet address** This routine modifies the six byte Ethernet hardware address that will be* used by each individual Fast Ethernet device unit. This routine must copy* the six byte address from the space provided by <addr>.** RETURNS: OK, or ERROR if the Ethernet address cannot be changed.*/STATUS sysEnetAddrSet ( UINT32 fecBaseAddr, /* base address of the on-chip RAM */ UCHAR * addr /* where to get the new Ethernet address */ ) { bcopy ((char *) addr, (char *) sysFecEnetAddr, sizeof (sysFecEnetAddr)); return (OK); }#endif /* INCLUDE_FEC_END */#endif /* INCLUDE_NETWORK */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -