📄 sysnet.c
字号:
/* sysNet.c - system-dependent Network Library *//* Copyright 1984-2002 Wind River Systems, Inc. *//*modification history--------------------01d,29jan02,g_h Add #ifdef INCLUDE_VWARE_LAUNCH before calling to sysCheckIfVware().01c,18jan02,g_h Change NvRAM logic to work with visionWARE01b,24sep01,g_h move FCC & SCC routines to sysMotFccEnd.c & sysMotSccEnd01b,07jul01,g_h add support for defrent MAC address when using the two channels.01a,05mar99,est adopted from estMdpBasic8xx/sysNet.c*//*DESCRIPTIONThis library contains board-specific routines for network subsystems.*/#if defined (INCLUDE_NETWORK)#include "vxWorks.h"#include "vme.h"#include "memLib.h"#include "cacheLib.h"#include "sysLib.h"#include "config.h"#include "string.h"#include "intLib.h"#include "logLib.h"#include "stdio.h"#include "taskLib.h" #include "vxLib.h"#include "tyLib.h"#include "arch/ppc/vxPpcLib.h"#include "arch/ppc/mmu603Lib.h"#include "private/vmLibP.h"#include "drv/parallel/m8260IOPort.h"#include "drv/sio/m8260CpmMux.h"#include "drv/sio/m8260Cp.h"/* locals *//* include source *//* globals */unsigned char glbEnetAddr [MAC_ADRS_LEN] = ETHERNET_MAC_ADRS;/************************************************************************* sysEnetAddrSet - sets the 6 byte ethernet address** This routine sets the 6 byte ethernet address used by the ethernet device.** RETURNS: N/A** SEE ALSO: sysEnetAddrGet()*/void sysEnetAddrSet ( UCHAR byte5, UCHAR byte4, UCHAR byte3, UCHAR byte2, UCHAR byte1, UCHAR byte0 ) { glbEnetAddr[0] = byte5; glbEnetAddr[1] = byte4; glbEnetAddr[2] = byte3; glbEnetAddr[3] = byte2; glbEnetAddr[4] = byte1; glbEnetAddr[5] = byte0;#if (NV_RAM_SIZE != NONE) /* * If we come from visionWARE we don't need to save the * MAC address in the NvRAM, otherwise we need. */ #ifdef INCLUDE_VWARE_LAUNCH if (!sysCheckIfVware ()) #endif /* INCLUDE_VWARE_LAUNCH */ { /* We didn't come from visionWARE, so save MAC address in NvRAM. */ sysNvRamSet ((char *)&glbEnetAddr[0], MAC_ADRS_LEN, NV_MAC_ADRS_OFFSET); }#endif /* (NV_RAM_SIZE != NONE) */ }/************************************************************************* sysEnetAddrGet - gets the 6 byte ethernet address** This routine gets the 6 byte ethernet address used by the ethernet device.** RETURNS: OK** SEE ALSO: sysEnetAddrSet()*/STATUS sysEnetAddrGet ( int unit , /* not used */ UINT8 * addr /* Location address is returned in */ ) { int n; for ( n=0; n < MAC_ADRS_LEN ;n++) *(addr+n) = (char)glbEnetAddr[n]; /* If NvRAM supported overwrite it with data from NvRAM */#if (NV_RAM_SIZE != NONE) /* * If we come from visionWARE we don't need to get the * MAC address from the NvRAM, otherwise we need. */ #ifdef INCLUDE_VWARE_LAUNCH if (!sysCheckIfVware ()) #endif /* INCLUDE_VWARE_LAUNCH */ { /* We didn't come from visionWARE, so get MAC address from NvRAM. */ sysNvRamGet (addr, MAC_ADRS_LEN, NV_MAC_ADRS_OFFSET); }#endif /* (NV_RAM_SIZE != NONE) */ return(OK); }#endif /* INCLUDE_NETWORK */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -