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

📄 sysnet.c

📁 WINDRIVER 8260 ATM BSP
💻 C
字号:
/* sysNet.c - system-dependent Network Library *//* Copyright 1984-2002 Wind River Systems, Inc. *//*modification history--------------------01e,29jan02,g_h  Add #ifdef INCLUDE_VWARE_LAUNCH before calling		 sysCheckIfVware().01d,25jan02,g_h  Remove unused varibale "uninit"01c,18jan02,g_h  Change NvRAM logic to work with visionWARE01b,24sep01,g_h  move FCC & SCC routines to sysMotFccEnd.c & sysMotSccEnd01a,05may01,g_h	 adopted from sbc8260/sysNet.c (ver 01a)*/#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"#include "wrSbc8260Atm.h"/* locals *//* include source *//* globals */static UINT8 glbEnetAddr[MAX_MAC_ADRS][MAC_ADRS_LEN] = {	{ WR_ENET0, WR_ENET1, WR_ENET2, CUST_ENET3_0, CUST_ENET4, CUST_ENET5 },	{ WR_ENET0, WR_ENET1, WR_ENET2, CUST_ENET3_1, CUST_ENET4, CUST_ENET5 },	{ WR_ENET0, WR_ENET1, WR_ENET2, CUST_ENET3_2, CUST_ENET4, CUST_ENET5 },	{ WR_ENET0, WR_ENET1, WR_ENET2, CUST_ENET3_3, CUST_ENET4, CUST_ENET5 },	{ WR_ENET0, WR_ENET1, WR_ENET2, CUST_ENET3_4, CUST_ENET4, CUST_ENET5 },	{ WR_ENET0, WR_ENET1, WR_ENET2, CUST_ENET3_5, CUST_ENET4, CUST_ENET5 },	{ WR_ENET0, WR_ENET1, WR_ENET2, CUST_ENET3_6, CUST_ENET4, CUST_ENET5 },	{ WR_ENET0, WR_ENET1, WR_ENET2, CUST_ENET3_6, CUST_ENET4, CUST_ENET5 },};IMPORT BOOL sysCheckIfVware(void);/************************************************************************* 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    )    {    BOOL   next;    int    offset;    int    unit =0;    /* Check if we come for visionWARE */#ifdef INCLUDE_VWARE_LAUNCH    if (!sysCheckIfVware ())#endif /* INCLUDE_VWARE_LAUNCH */        {        /* We came from VxWorks bootrom */	do            {            next = FALSE; 	    printf ("Please enter the Unit number between 0 - 7: ");            scanf ("%d", &unit); 	    /* Check if the unit number is between 0 to 7 */            if ((unit < 0) || (unit >= MAX_MAC_ADRS))		{		printf ("\n");		printf ("The unit number is not between 0 - 7, please enter it again.\n");		next = TRUE;		}	    }while (next);        printf ("\n");	}    offset = unit * MAC_ADRS_LEN;    glbEnetAddr[unit][0] = byte5;    glbEnetAddr[unit][1] = byte4;    glbEnetAddr[unit][2] = byte3;    glbEnetAddr[unit][3] = byte2;    glbEnetAddr[unit][4] = byte1;    glbEnetAddr[unit][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[unit], MAC_ADRS_LEN, NV_MAC_ADRS_OFFSET + 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 ,           UINT8 * addr     /* Location address is returned in                 */    )    {    int   offset;    char *pEnet;    pEnet  = (char*)glbEnetAddr[unit];    offset = unit * MAC_ADRS_LEN;#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 + offset);        if (memcmp (addr,pEnet,MAC_ADRS_LEN))            {             return OK;            }        }    sysNvRamSet (pEnet,MAC_ADRS_LEN,NV_MAC_ADRS_OFFSET + offset);#endif /* (NV_RAM_SIZE != NONE) */    /* mac address in memory only */    memcpy (addr,pEnet,MAC_ADRS_LEN);    return (OK);    }

⌨️ 快捷键说明

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