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

📄 syslib_5100.c

📁 sysLib.c - generic PPC system-dependent library 5100BSP重要文件
💻 C
📖 第 1 页 / 共 5 页
字号:
        sysPhysMemSize = (char *)(LOCAL_MEM_LOCAL_ADRS + LOCAL_MEM_SIZE);#endif /* LOCAL_MEM_AUTOSIZE */#ifdef EXTENDED_VME        /* check for invalid DRAM/VME A32 configuration */        if ((UINT32)sysPhysMemSize > VME_A32_MSTR_LOCAL)            {            int  dscEn;            char dbgMsg [80];            sprintf (dbgMsg,                "\r\nERROR: Increase VME_A32_MSTR_LOCAL to at least 0x%x.\r\n",                (UINT)sysMemTop());             sysDebugMsg (dbgMsg, CONTINUE_EXECUTION);            /*              * Find and adjust initial starting addresses of VME PCI memory              * to allow board to come up.              */            for (dscEn = 0; dscEn < sysPhysMemDescNumEnt; dscEn++)                {                if ((UINT32)sysPhysMemDesc[dscEn].virtualAddr ==                    VME_A32_MSTR_LOCAL)                    {                    sysPhysMemDesc[dscEn].virtualAddr = (void *)sysPhysMemSize;                    sysPhysMemDesc[dscEn].physicalAddr = (void *)sysPhysMemSize;                    break;                    }                }            }#endif /* EXTENDED_VME */        }    return sysPhysMemSize;    }/********************************************************************************* sysMemTop - get the address of the top of VxWorks memory** This routine returns a pointer to the first byte of memory not* controlled or used by VxWorks.** The user can reserve memory space by defining the macro USER_RESERVED_MEM* in config.h.  This routine returns the address of the reserved memory* area.  The value of USER_RESERVED_MEM is in bytes.** RETURNS: The address of the top of VxWorks memory.*/char * sysMemTop (void)    {    static char * memTop = NULL;    if (memTop == NULL)        {        memTop = sysPhysMemTop () - USER_RESERVED_MEM;        }    return memTop;    }/******************************************************************************** sysToMonitor - transfer control to the ROM monitor** This routine transfers control to the ROM monitor.  Normally, it is called* only by reboot()--which services ^X--and by bus errors at interrupt level.* However, in some circumstances, the user may wish to introduce a* <startType> to enable special boot ROM facilities.** RETURNS: Does not return.*/STATUS sysToMonitor    (    int startType    /* parameter passed to ROM to tell it how to boot */    )    {    FUNCPTR pRom = (FUNCPTR) (ROM_TEXT_ADRS + 8); /* Warm reboot (for MAX) */    /* L2 disabled via cacheLib */    cacheDisable (0);        /* Disable the Instruction Cache */    cacheDisable (1);        /* Disable the Data Cache */    sysUniverseReset ();     /* reset Universe chip */    sysSerialReset ();       /* reset serial devices */    sysHawkErrClr ();        /* clear Hawk error conditions */    /* Clear the MSR */    vxMsrSet (0);    /* set the Board Fail LED */    *(UINT8 *)BRD_MOD_FAIL_REG_ADRS |= BRD_MOD_FAIL_MASK;    (*pRom) (startType);    return (OK);             /* in case we ever continue from ROM monitor */    }/******************************************************************************** sysHwInit2 - initialize additional system hardware** This routine connects system interrupt vectors and configures any * required features not configured by sysHwInit().** RETURNS: N/A*/void sysHwInit2 (void)    {    static BOOL configured = FALSE;    /* Int connects for various devices */    if (!configured)        {        /* connect Vme to PCI interrupt */        intConnect (INUM_TO_IVEC(UNIV_INT_VEC), sysUnivVmeIntr, 0);        /* interrupts can only be turned on ultimately by the PIC int ctrlr */        intEnable (UNIV_INT_LVL);#ifdef INCLUDE_HAWK_AUXCLK        sysAuxClkInit ();        intConnect (INUM_TO_IVEC(TIMER0_INT_VEC), sysAuxClkInt, 0);        intEnable (TIMER0_INT_LVL);#endif /* INCLUDE_HAWK_AUXCLK */       /* initialize fei network interface */#ifdef INCLUDE_FEI_END	sys557PciInit ();#endif        /* initialize serial interrupts */        sysSerialHwInit2();        /* connect a dummy routine for the spurious interrupt (0x07) */        intConnect (INUM_TO_IVEC(PP_INT_LVL), sysSpuriousIntHandler, 0);#ifdef INCLUDE_BPE        /* enable processor data and address bus parity checking */        sysConfigBpe ();#endif /* INCLUDE_BPE */#if defined(INCLUDE_CACHE_SUPPORT) && defined(INCLUDE_CACHE_L2)#   ifdef USER_L2_CACHE_ENABLE        /* initialize the L2 cache */        sysL2CacheInit();#   else        sysL2CacheDisable();#   endif /* USER_L2_CACHE_ENABLE */#endif /* defined(INCLUDE_CACHE_SUPPORT) && defined(INCLUDE_CACHE_L2) */#if     defined (INCLUDE_ALTIVEC)       _func_altivecProbeRtn = sysAltivecProbe;#endif  /* INCLUDE_ALTIVEC */        /* report any errors detected before they could be reported. */        reportBootromErrors ();        configured = TRUE;        }    }/******************************************************************************** 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** This routine sets the processor number for the CPU board.  Processor numbers* should be unique on a single backplane.  It also maps local resources onto* the VMEbus.** RETURNS: N/A** SEE ALSO: sysProcNumGet()*/void sysProcNumSet    (    int     procNum            /* processor number */    )    {    /*     *    Init global variable - this needs to be done before     *    calling sysUniverseInit2() because it calls sysProcNumGet()     *    via the MACRO definition.     */    sysProcNum = procNum;    /* Set up the node's VME slave decoders. */    sysUniverseInit2(procNum);    }/* miscellaneous support routines *//******************************************************************************** sysLocalToBusAdrs - convert a local address to a bus address** This routine returns a VMEbus address as it would be seen on the bus.* The local address that is passed into this routine is the address of* the local resource as seen by the CPU.** RETURNS: OK, or ERROR if the address space is unknown or the mapping is not* possible.** SEE ALSO: sysBusToLocalAdrs()*/ STATUS sysLocalToBusAdrs    (    int     adrsSpace,    /* bus address space where busAdrs resides */    char *    localAdrs,    /* local address to convert */     char **    pBusAdrs    /* where to return bus address */     )    {    switch (adrsSpace)        {        case VME_AM_EXT_SUP_PGM:        case VME_AM_EXT_SUP_DATA:        case VME_AM_EXT_USR_PGM:        case VME_AM_EXT_USR_DATA:            if ((VME_A32_SLV_SIZE != 0) &&                ((ULONG)localAdrs >= VME_A32_SLV_LOCAL) &&                ((ULONG)localAdrs < (VME_A32_SLV_LOCAL + VME_A32_SLV_SIZE)))                {                *pBusAdrs = localAdrs + (VME_A32_SLV_BUS - VME_A32_SLV_LOCAL);                return (OK);                }            else                return (ERROR);        case VME_AM_STD_SUP_PGM:        case VME_AM_STD_SUP_DATA:        case VME_AM_STD_USR_PGM:        case VME_AM_STD_USR_DATA:            if ((VME_A24_SLV_SIZE != 0) &&                ((ULONG)localAdrs >= VME_A24_SLV_LOCAL) &&                ((ULONG)localAdrs < (VME_A24_SLV_LOCAL + VME_A24_SLV_SIZE)))                {                *pBusAdrs = localAdrs + (VME_A24_SLV_BUS - VME_A24_SLV_LOCAL);                return (OK);                }            else                return (ERROR);        case VME_AM_SUP_SHORT_IO:        case VME_AM_USR_SHORT_IO:            if ((VME_A16_SLV_SIZE != 0) &&                ((ULONG)localAdrs >= VME_A16_SLV_LOCAL) &&                ((ULONG)localAdrs < (VME_A16_SLV_LOCAL + VME_A16_SLV_SIZE)))                {                *pBusAdrs = localAdrs + (VME_A16_SLV_BUS - VME_A16_SLV_LOCAL);                return (OK);                }            else                return (ERROR);         default:            return (ERROR);        }    }/******************************************************************************** sysBusToLocalAdrs - convert a bus address to a local address** This routine returns a local address that is used to access the VMEbus.* The bus address that is passed into this routine is the VMEbus address* as it would be seen on the bus.** RETURNS: OK, or ERROR if the address space is unknown or the mapping is not* possible.** SEE ALSO: sysLocalToBusAdrs()*/STATUS sysBusToLocalAdrs    (    int      adrsSpace,     /* bus address space where busAdrs resides */    char *    busAdrs,       /* bus address to convert */    char **    pLocalAdrs     /* where to return local address */    )    {    switch (adrsSpace)        {        case VME_AM_EXT_SUP_PGM:        case VME_AM_EXT_USR_PGM:        case VME_AM_EXT_SUP_DATA:        case VME_AM_EXT_USR_DATA:            if ((VME_A32_MSTR_SIZE != 0) &&                ((ULONG) busAdrs >= VME_A32_MSTR_BUS) &&                ((ULONG) busAdrs < (VME_A32_MSTR_BUS + VME_A32_MSTR_SIZE)))                {                *pLocalAdrs = (char *)busAdrs + (VME_A32_MSTR_LOCAL -                              VME_A32_MSTR_BUS);                return (OK);                }        /* This handles the VME register access image window */        if (((ULONG) busAdrs >= VME_RAI_MSTR_BUS) &&            ((ULONG) busAdrs < (VME_RAI_MSTR_BUS +                   VME_RAI_MSTR_SIZE)))            {            *pLocalAdrs = (char *)busAdrs + (VME_RAI_MSTR_LOCAL -                                 VME_RAI_MSTR_BUS);            return (OK);            }        return (ERROR);        break;        case VME_AM_STD_SUP_PGM:        case VME_AM_STD_USR_PGM:        case VME_AM_STD_SUP_DATA:        case VME_AM_STD_USR_DATA:            if ((VME_A24_MSTR_SIZE == 0) ||                ((ULONG) busAdrs < VME_A24_MSTR_BUS) ||                ((ULONG) busAdrs >= (VME_A24_MSTR_BUS + VME_A24_MSTR_SIZE)))                {                return (ERROR);                }            *pLocalAdrs = (char *) busAdrs +                (VME_A24_MSTR_LOCAL - VME_A24_MSTR_BUS);             return (OK);             break;        case VME_AM_SUP_SHORT_IO:        case VME_AM_USR_SHORT_IO:            if ((VME_A16_MSTR_SIZE == 0) ||                ((ULONG) busAdrs < VME_A16_MSTR_BUS) ||                ((ULONG) busAdrs >= (VME_A16_MSTR_BUS + VME_A16_MSTR_SIZE)))                {                return (ERROR);                }            *pLocalAdrs = (char *) busAdrs +                 (VME_A16_MSTR_LOCAL - VME_A16_MSTR_BUS);            return (OK);        default:            return (ERROR);        }    }/********************************************************************************* sysBusTas - test and set a specified location** This routine performs a test-and-set (TAS) instruction on the specified* address.  To prevent deadlocks, interrupts are disabled during the* test-and-set operation.  The following table defines the method used to* insure an atomic operation.** .CS*        Master        Slave_1        Slave_2** VME Chip    Don't Care    U1        U1*        ----------    ----        ----* Method    VOWN        VOWN        VOWN** VME Chip    Don't Care    U1        U2*        ----------    ----        ----* Method    VOWN        VOWN        RMW** VME Chip    U1 or        U2        U2*        U2+*        ----------    ----        ----* Method    VOWN+++        RMW        RMW** VME Chip    U2++        U2        U2* PCI Bridge    or Hawk*        ----------    ----        ----* Method    lwarx/stwcx    RMW        RMW**  +   = Refer to target.txt file for explaination of older boards*     with Universe II (U2).*  ++  = Refer to target.txt file for explaination of newer boards*     with Universe II (U2).*  +++ = The master's hardware does not preserve the atomic RMW.* ++++ = If SM_OFF_BOARD == TRUE,  the method used will be the same*     as if the master board is acting like a slave board; namely:*         RMW for UNIVERSE_II and VOWN for UNIVERSE_I* .CE** NOTE: Although the address passed-in to sysBusTas() is defined as* "char *", vxTas() operates on the address as a "void *".* For PowerPC, this implies that the location tested-and-set is* actually a 32-bit entity.* * RETURNS: TRUE if the value had not been set but is now, or* FALSE if the value was set already.** SEE ALSO: vxTas(), sysBusTasClear()*/

⌨️ 快捷键说明

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