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

📄 syslib.c

📁 WINDRIVER MCP750 BSP
💻 C
📖 第 1 页 / 共 5 页
字号:
    sysMpicInit ();    /*     *	The LANCE has a real driver associated with it, so     *	no additional initialization is done here.  It's done     *	at kernel init time.     *     *	The SCSI has a real driver associated with it, so     *	no additional initialization is done here.  It's done     *	at kernel init time.     */    /* set pointer to bus probing hook */    _func_vxMemProbeHook = (FUNCPTR)sysBusProbe;    /* Initialize COM1 and COM2 serial channels */    sysSerialHwInit ();    /*     * Extract the Ethernet address out of non-volatile RAM.     * The Motorola convention for the Ethernet address is that they only     * save the low 3 bytes in BBRAM.  The high three bytes are the     * manufacturers code, and Motorola software knows its own.     * The Motorola code is 0x08003Exxx.     */    sysNvRamGet ((char *)lnEnetAddr, 6, ((int) BB_ENET - NV_BOOT_OFFSET));#ifdef INCLUDE_NETWORK    sysNetHwInit();#endif    /* Disable the watchdog timer */    sysNvWrite ((ULONG)WD_TIMER, 0);    /*     * If mmu tables are used, this is where we would dynamically     * update the entry describing main memory, using sysPhysMemTop().     * We must call sysPhysMemTop () at sysHwInit() time to do     * the memory autosizing if available.     */    sysPhysMemTop ();    /* clear Raven error conditions */    sysRavenErrClr ();    /* Upon completion, clear BFL (Board Fail) LED */#ifdef CONFIG1_SYS_REG_BRDFAIL_LED    *(UINT8 *)z8536_PORTA_DATA &= ~z8536_PORTA_BRDFAIL;#endif#ifdef CONFIG2_SYS_REG_BRDFAIL_LED    *(UINT8 *)SYS_REG_BRDFAIL_LED &= (~SYS_REG_BRDFAIL_LED_ON);#endif    }/********************************************************************************* sysPhysMemTop - get the address of the top of physical memory** 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 * sysPhysMemSize = NULL;	/* ptr to top of mem + 1 */#ifdef LOCAL_MEM_AUTOSIZE    UINT32	  dramAttr;    UINT32	  dramIndex;    int 	  i;    static UINT32 dramSize[8] =    /*     *	 0,	    16MB,	32MB,	    64MB,     * 128MB,	   256MB,	 1GB,	      0     */    {0x00000000, 0x01000000, 0x02000000, 0x04000000,     0x08000000, 0x10000000, 0x40000000, 0x00000000};#endif /* LOCAL_MEM_AUTOSIZE */    if (sysPhysMemSize == NULL)	{#ifdef LOCAL_MEM_AUTOSIZE	/*	 * Do dynamic memory sizing.	 *	 * Since Falcon memory controller chip has already been set to	 * control all memory, just read and interpret its DRAM Attributes	 * Register.	 */	dramAttr = sysIn32 ((UINT32 *)FALCON_DRAM_ATTR);	for (i = 0; i < 4; ++i)	    {	    if ((dramAttr & 0x80) != 0)		{		dramIndex = dramAttr & 0x07;		sysPhysMemSize = (unsigned char *) ((UINT32) sysPhysMemSize                                                    + dramSize[dramIndex]);		}	    dramAttr >>= 8;	    }	/* Adjust initial DRAM size to actual physical memory. */	sysPhysMemDesc[1].len = (ULONG)sysPhysMemSize -				(ULONG)sysPhysMemDesc[1].physicalAddr;#else /* not LOCAL_MEM_AUTOSIZE */	/* Don't do auto-sizing, use defined constants. */	sysPhysMemSize = (char *)(LOCAL_MEM_LOCAL_ADRS + LOCAL_MEM_SIZE);#endif /* LOCAL_MEM_AUTOSIZE */	}    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 + 4); /* Warm reboot */#if defined(INCLUDE_CACHE_SUPPORT) && defined(INCLUDE_CACHE_L2)    sysL2CacheDisable ();	/* Disable the L2 Cache */#endif    cacheDisable (0);		/* Disable the Instruction Cache */    cacheDisable (1);		/* Disable the Data Cache */#if	(CPU == PPC604)    vxHid0Set (vxHid0Get () & ~_PPC_HID0_SIED); /* Enable Serial Instr Exec */#endif	/* (CPU == PPC604) */    sysSerialReset ();		/* reset serial devices */    sysRavenErrClr ();		/* clear Raven error conditions */    /* Clear the MSR */    vxMsrSet (0);    /* reset the H/W */    *((char *)(VIA_ISA_PORT92_ADDRESS)) = VIA_ISA_PORT92_RESET;    (*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)	{#ifdef CONFIG1_PLANAR_PCI	sysZ8536Init ();	intConnect (INUM_TO_IVEC(Z8536_INT_VEC), sysClkIntCIO, 0);	intEnable (Z8536_INT_LVL);#endif#ifdef INCLUDE_RAVEN_AUXCLK	sysAuxClkInit ();	intConnect (INUM_TO_IVEC(TIMER0_INT_VEC), sysAuxClkInt, 0);	intEnable (TIMER0_INT_LVL);#endif /* INCLUDE_RAVEN_AUXCLK */	/* initialize serial interrupts */	sysSerialHwInit2 ();	/* capture raven window configuration */	sysRavenCapt ();#ifdef INCLUDE_DEC2155X	/* Initialize Dec2155x interrupts */	sysDec2155xInit2 ();#endif  /* INCLUDE_DEC2155X */#ifdef INCLUDE_DPE	/* enable processor data bus parity checking */	sysConfigDpe ();#endif  /* INCLUDE_DPE */	/* connect a dummy routine for the spurious interrupt (0x07) */#ifdef INCLUDE_CACHE_L2#ifdef INCLUDE_CACHE_SUPPORT#ifdef USER_L2_CACHE_ENABLE	/* initialize the L2 cache */	sysL2CacheInit ();#else  /* USER_L2_CACHE_ENABLE */	sysL2CacheDisable ();#endif  /* USER_L2_CACHE_ENABLE */#endif  /* INCLUDE_CACHE_SUPPORT */#endif  /* INCLUDE_CACHE_L2 */#ifdef INCLUDE_NETWORK        sysNetHwInit2 ();#endif  /* INCLUDE_NETWORK */#ifdef DEC2155X_SYSTEM_SUPPORT	/* Connect Dec2155x primary bus interrupt handler */	sysDec2155xPriIntConnect ();#endif  /* DEC2155X_SYSTEM_SUPPORT */#ifdef INCLUDE_SM_COMMON	sysSmParamsCompute ();#endif  /* INCLUDE_SM_COMMON */	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.** 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;    }/* miscellaneous support routines *//******************************************************************************** sysRavenCapt - capture Raven window information** This routine captures the configuration of the Raven PPC and PCI slave* registers. This information is used to perform address translations from* CPU to PCI addresses and vice versa.** RETURNS: N/A** SEE ALSO: sysBusToLocalAdrs(), sysLocalToBusAdrs()*/LOCAL void sysRavenCapt (void)    {    UINT32 index;		/* widow counter */    UINT8  attr;		/* window attribute */    UINT32 temp;		/* working variable */    UINT16 trans;		/* window translation value */    RAVEN_OFFSETS * pRavOff;	/* pointer to raven addresses and offsets */    RAVEN_WIN_STRUCT * pRavCpu; /* pointer to cpu windows */    RAVEN_WIN_STRUCT * pRavPci; /* poiner to pci windows */    /* initialize number of valid windows found */    sysValidRavenWindows = 0;    /* point to window save arrays */    pRavCpu = &sysRavCpuToPciWin[0];    pRavPci = &sysRavPciToCpuWin[0];    /* start with the cpu to pci windows (ppc slaves) */    pRavOff = &sysRavCpuWinOff[0];    /* loop through each window */    for (index = 0; index < RAVEN_CPU_WIN_CNT; index++)	{	/* read the window attributes */	attr = sysInByte (pRavOff->attr);	if (attr & RAVEN_RDWR_ENA)	    {	    /* active window found, bump valid window counter */	    sysValidRavenWindows++;	    /* determine the window type (memory or i/o) */	    pRavCpu->winType = (attr & CPU2PCI_ATTR_MEM) ? PCI_BAR_SPACE_MEM :				PCI_BAR_SPACE_IO;	    pRavPci->winType = pRavCpu->winType;	    /* read the window range */	    temp = sysIn32 ((UINT32 *)pRavOff->range);	    trans = sysIn16 ((UINT16 *)pRavOff->offset);	    pRavCpu->winBase = temp & ~0xffff;	    pRavCpu->winLimit = (temp << 16) | 0xffff;	    /* calculate translated values */	    pRavPci->winBase = pRavCpu->winBase + (trans << 16);	    pRavPci->winLimit = pRavCpu->winLimit + (trans << 16);	    /* advance in preparation for next valid window */	    pRavCpu++;	    pRavPci++;	    }	/* advance to next set of raven offsets */	pRavOff++;	}    /* switch to raven pci to cpu windows (pci slaves) */    pRavOff = &sysRavPciWinOff[0];    /* loop through each window */    for (index = 0; index < RAVEN_PCI_WIN_CNT; index++)	{	/* read the window attributes */	pciConfigInByte (sysRavPciBusNo, sysRavPciDevNo, sysRavPciFuncNo,                         pRavOff->attr, &attr);	if (attr & RAVEN_RDWR_ENA)	    {	    /* active window found, bump valid window counter */	    sysValidRavenWindows++;	    /* set the window type to memory */	    pRavCpu->winType = PCI_BAR_SPACE_MEM;	    pRavPci->winType = PCI_BAR_SPACE_MEM;	    /* read the window range */	    pciConfigInLong (sysRavPciBusNo, sysRavPciDevNo, sysRavPciFuncNo,			     pRavOff->range, &temp);	    pciConfigInWord (sysRavPciBusNo, sysRavPciDevNo, sysRavPciFuncNo,			     pRavOff->offset, &trans);	    /* isolate the window base (start) and limit (end) */

⌨️ 快捷键说明

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