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

📄 syslib.c

📁 INTEL IXP425的VXWORKS BSP
💻 C
📖 第 1 页 / 共 4 页
字号:
** This routine returns the address of the first missing byte of memory,* which indicates the top of memory.** Normally, the user specifies the amount of physical memory with the* macro LOCAL_MEM_SIZE in config.h.  BSPs that support run-time* memory sizing do so only if the macro LOCAL_MEM_AUTOSIZE is defined.* If not defined, then LOCAL_MEM_SIZE is assumed to be, and must be, the* true size of physical memory.** NOTE: Do not adjust LOCAL_MEM_SIZE to reserve memory for application* use.	See sysMemTop() for more information on reserving memory.** RETURNS: The address of the top of physical memory.** SEE ALSO: sysMemTop()*/char *sysPhysMemTop (void)    {    static char * physTop = NULL;    if (physTop == NULL)        {#ifdef LOCAL_MEM_AUTOSIZE/* auto-sizing is possible  */        physTop = (char *)(LOCAL_MEM_LOCAL_ADRS + sysPhysMemSize ());#else/* Don't do autosizing, if size is given */        physTop = (char *)(LOCAL_MEM_LOCAL_ADRS + LOCAL_MEM_SIZE);#endif /* LOCAL_MEM_AUTOSIZE */        }    return physTop;    }/********************************************************************************* sysMemTop - get the address of the top of memory** This routine returns the address of the first missing byte of memory,* which indicates the top of memory.** RETURNS: The address of the top of memory.*/char *sysMemTop (void)    {#ifdef LOCAL_MEM_AUTOSIZE/* auto-sizing is possible  */    return((char *)LOCAL_MEM_LOCAL_ADRS + (sysPhysMemSize () - USER_RESERVED_MEM));#else/* Don't do autosizing, if size is given */    return((char *)LOCAL_MEM_LOCAL_ADRS + (LOCAL_MEM_SIZE - USER_RESERVED_MEM));#endif /* LOCAL_MEM_AUTOSIZE */    }/********************************************************************************* sysToMonitor - transfer control to the ROM monitor** This routine transfers control to the ROM monitor.  It is usually called* only by reboot() -- which services ^X -- and bus errors at interrupt* level.  However, in some circumstances, the user may wish to introduce a* new <startType> to enable special boot ROM facilities.** startType - passed to ROM to tell it how to boot** RETURNS: Does not return.*/STATUS sysToMonitor (int startType)    {    FUNCPTR pRom;#if defined(INCLUDE_END)    END_OBJ * pEnd;    UINT32      i;#endif  /* INCLUDE_END */#if defined(INCLUDE_END)#ifdef INCLUDE_FEI82557END    /*     * If the Ethernet driver were left alone, the controller chip might     * alter memory, so we stop the controller before jumping to the bootrom.     */    for (i = 0; i < IXP425_PCI_MAX_DEV; i++)        {        if ( (pEnd = endFindByName ("fei", i)) != NULL)            pEnd->pFuncTable->stop(pEnd->devObject.pDevice);        }#endif /* INCLUDE_FEI82557END */#ifdef INCLUDE_IXETHACCEND    for (i = 0; i < IX_ETH_ACC_NUMBER_OF_PORTS; i++)        {        if ( (pEnd = endFindByName ("ixe", i)) != NULL)            pEnd->pFuncTable->stop(pEnd->devObject.pDevice);        }#endif /* INCLUDE_IXETHACCEND */#endif  /* INCLUDE_END */#if defined(INCLUDE_SERIAL)    sysSerialReset ();  /* put serial devices into quiet state */#endif    sysClkDisable();    intIFLock ();    IXP425_MASK_ALL_INTERRUPTS()#ifdef INCLUDE_MMU    cacheArmXSCALEDClearDisable ();    cacheArmXSCALEIClearDisable ();    mmuArmXSCALETLBIDFlushAll ();    mmuArmXSCALEADisable ();#endif     /* The problem at this point is that the ROM is mapped to      * is alternate position and ram is at zero.     * We need to jump to an aliased version of the SDRAM.     * Then put the flash back to zero.      * Then jump to the real ROM_TEXT_ADRS.     */    sysToMonSwitchFlashRam();    /* Now running on aliased memory and flash at 0 */    if (startType != BOOT_COLD)        pRom = (FUNCPTR) (0x1000 + 4);   /* warm boot */    else        pRom = (FUNCPTR) (0x1000);         /* cold boot */    (*pRom)(startType); /* jump to boot ROM */    return OK;      /* in case we ever continue from ROM monitor */    }/*** BSP Info Routines ***//****************************************************************************** sysProcNumGet - get the processor number** This routine returns the processor number for the CPU board, which is* set with sysProcNumSet().** RETURNS: The processor number for the CPU board.** SEE ALSO: sysProcNumSet()*/int sysProcNumGet (void)    {    return sysProcNum;    }/****************************************************************************** sysProcNumSet - set the processor number** Set the processor number for the CPU board.  Processor numbers should be* unique on a single backplane.** NOTE* By convention, only processor 0 should dual-port its memory.** RETURNS: N/A** SEE ALSO: sysProcNumGet()*/void sysProcNumSet(int procNum     /* processor number */)    {    sysProcNum = procNum;    }/********************************************************************************* sysModel - return the model name of the CPU board** This routine returns the model name of the CPU board.** RETURNS: A pointer to a string identifying the board and CPU.*/char *sysModel (void)    {    return(BOARD_DESC);    }/********************************************************************************* sysBspRev - return the bsp version with the revision eg 1.1/<x>** This function returns a pointer to a bsp version with the revision.* for eg. 1.1/<x>. BSP_REV is concatanated to BSP_VERSION to form the* BSP identification string.** RETURNS: A pointer to the BSP version/revision string.*/char * sysBspRev (void)    {    return(BSP_VERSION BSP_REV);    }/********************************************************************************* ixp425BoardRev - returns board revision** RETURNS: the 4bit integer value contained in the board revision register*/int ixp425BoardRev (void)    {    return(0x0); /* Return a dummy version for the simulator  */    }/* Wrappers *//********************************************************************************* sysIntDisable - disable an external interrupt level** This routine disables a specified interrupt level.** .nT** RETURNS: OK, or ERROR if <intLevel> is out of range.** SEE ALSO: sysIntEnable(),* .sA*/STATUS sysIntDisable(int intLevel       /* interrupt level to disable */)    {    return(ixp425IntLvlDisable (intLevel)); /* see ixp425IntrCtl.c */    }/********************************************************************************* sysIntEnable - enable an interrupt level** This routine enables a specified IXP425 interrupt level.** .nT** RETURNS: OK, or ERROR if <intLevel> is out of range.** SEE ALSO: sysIntDisable(),* .sA*/STATUS sysIntEnable(int intLevel       /* interrupt level to enable (1-31) */)    {    return(ixp425IntLvlEnable (intLevel)); /* see ixp425IntrCtl.c */    }/******************************************************************************** sysFlashWriteEnable - enable  writes to flash ** This routine enables the writes to cs0** .nT** RETURNS: N/A** SEE ALSO: sysFlashWriteDisable(),* .sA*/void sysFlashWriteEnable(void)    {    unsigned volatile long *ptr;    ptr = (unsigned long *) IXP425_EXP_CS0_REG;    *ptr = IXDP425_FLASH_CS_SETTING_WR_EN;    }/******************************************************************************** sysFlashWriteDisable - Disable  writes to flash ** This routine Disable the writes to cs0** .nT** RETURNS: void ** SEE ALSO: sysFlashWriteEnable(),* .sA*/void sysFlashWriteDisable(void)    {    unsigned volatile long *ptr;    ptr = (unsigned long *)IXP425_EXP_CS0_REG;    *ptr = (unsigned long )IXDP425_FLASH_CS_DEFAULT;    return;    }#define MAX_LINE        160	/* max line length for input to 'm' routine */#define MAX_ADR_SIZE 	6 LOCAL STATUS modMac(UINT8* storage, char *inline)    {    UINT8 line[8];    UINT8 *pLine,*pInline = inline;    UINT32 value;           /* value found in line */    UINT8 excess;    UINT32 i;    for (i = 0; i < 6; i++)        {        bcopy(pInline, line,2);        line[2] = 0;        for (pLine = line; isspace ((int) *pLine); ++pLine) /* skip leading spaces*/            ;        if (*pLine == EOS)          /* skip field if just CR */            continue;        if (sscanf (pLine, "%x%1s", &value, &excess) != 1)            {            return ERROR;            }        storage[i]  = (UINT8)value;     /* assign new value */        pInline += 2;        if(*pInline == ':')            pInline++;        }    return OK;    }/***************************************************************************** * ixdp425IfZero - Zero the MAC and IP address storage areas * * This routine permits the zeroing of all ethernet MAC addresses along * with the specification of the IP address to be associated with a * given interface. * * RETURNS: N/A *

⌨️ 快捷键说明

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