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

📄 syslib7445.c

📁 sysLib.c - generic PPC system-dependent library 7445BSP重要文件
💻 C
📖 第 1 页 / 共 5 页
字号:
	intDisable (ix + INT_NUM_IRQ0);	}    for (ix = 0; ix < EPIC_MAX_EXT_IRQS; ix++)	{	intDisable (ix);	}    sysEpicInit(EPIC_DIRECT_IRQ, (ULONG)0); /* reset the epic registers */    #if FALSE /* sandpoint errata: do not enable this until fixed in X3 rev */    {    UINT8 	resetVal;    pciConfigInByte  (WB_PCI_BUS, WB_PCI_DEV, WB_PCI_FUNC,                       WB_PCI_CLK_DIV_INDX, &resetVal);    pciConfigOutByte (WB_PCI_BUS, WB_PCI_DEV, WB_PCI_FUNC,                      WB_PCI_CLK_DIV_INDX, (resetVal | WB_RSTDRV_BIT));    /* 50 ms delay to allow ISA & PCI RST to settle */    sysMsDelay (50);    }#endif    vxMsrSet (0);		/* Clear the MSR */    (*pRom) (startType);	/* jump off to romInit.s */    return (OK);		/* in case we continue from ROM monitor */    }/********************************************************************************* 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.** For bus systems, it is assumes that processor 0 is the bus master and* exports its memory to the bus.** RETURNS: N/A** SEE ALSO: sysProcNumGet()*/void sysProcNumSet    (    int procNum			/* processor number */    )    {    sysProcNum = procNum;    if (procNum == 0)        {	}    }/********************************************************************************* sysCpuCheck - confirm the CPU type** This routine validates the cpu type.  If the wrong cpu type is discovered* a message is printed using the serial channel in polled mode.** RETURNS: N/A.*/void sysCpuCheck (void)    {    int msgSize;    int msgIx;    SIO_CHAN * pSioChan;        /* serial I/O channel */    /* Check for a valid CPU type;  If one is found, just return */#if (CPU == PPC603)	/* five kinds of 603 */    if ((CPU_TYPE == CPU_TYPE_603)  || 	(CPU_TYPE == CPU_TYPE_603E) ||        (CPU_TYPE == CPU_TYPE_603P) ||	(CPU_TYPE == CPU_TYPE_750)  ||	(CPU_TYPE == CPU_TYPE_8245)  ||	(CPU_TYPE == CPU_TYPE_8240))	{	return; 	}#elif (CPU == PPC604) /* four kinds of 604 */    if	((CPU_TYPE == CPU_TYPE_604) || 	(CPU_TYPE == CPU_TYPE_604E) ||	(CPU_TYPE == CPU_TYPE_604R) ||	(CPU_TYPE == CPU_TYPE_750)  ||	(CPU_TYPE == CPU_TYPE_7400) ||	(CPU_TYPE == CPU_TYPE_7410) ||	(CPU_TYPE == CPU_TYPE_7450) ||	(CPU_TYPE == CPU_TYPE_7455))	{	return; 	}#endif	/* (CPU == PPC604) */    /* Invalid CPU type; polling print of error message and bail */    msgSize = strlen (wrongCpuMsg);    sysSerialHwInit ();    pSioChan = sysSerialChanGet (0);    sioIoctl (pSioChan, SIO_MODE_SET, (void *) SIO_MODE_POLL);    for (msgIx = 0; msgIx < msgSize; msgIx++)    	{    	while (sioPollOutput (pSioChan, wrongCpuMsg[msgIx]) == EAGAIN);    	}    sysToMonitor (BOOT_NO_AUTOBOOT);    }/********************************************************************************* sysDelay - delay for approximately one millisecond** Delay for approximately one milli-second.** RETURNS: N/A*/void sysDelay (void)    {    sysMsDelay (1);    }/********************************************************************************* sysMsDelay - delay for the specified amount of time (MS)** This routine will delay for the specified amount of time by counting* decrementer ticks.** This routine is not dependent on a particular rollover value for* the decrementer, it should work no matter what the rollover* value is.** A small amount of count may be lost at the rollover point resulting in* the sysMsDelay() causing a slightly longer delay than requested.** This routine will produce incorrect results if the delay time requested* requires a count larger than 0xffffffff to hold the decrementer* elapsed tick count.  For a System Bus Speed of 67 MHZ this amounts to* about 258 seconds.** RETURNS: N/A*/void sysMsDelay    (    UINT        delay                   /* length of time in MS to delay */    )    {    register UINT oldval;               /* decrementer value */    register UINT newval;               /* decrementer value */    register UINT totalDelta;           /* Dec. delta for entire delay period */    register UINT decElapsed;           /* cumulative decrementer ticks */    /*     * Calculate delta of decrementer ticks for desired elapsed time.     * The macro DEC_CLOCK_FREQ MUST REFLECT THE PROPER 6xx BUS SPEED.     */    totalDelta = ((DEC_CLOCK_FREQ / 4) / 1000) * delay;    /*     * Now keep grabbing decrementer value and incrementing "decElapsed" until     * we hit the desired delay value.  Compensate for the fact that we may     * read the decrementer at 0xffffffff before the interrupt service     * routine has a chance to set in the rollover value.     */    decElapsed = 0;    oldval = vxDecGet ();    while (decElapsed < totalDelta)        {        newval = vxDecGet ();        if ( DELTA(oldval,newval) < 1000 )            decElapsed += DELTA(oldval,newval);  /* no rollover */        else            if (newval > oldval)                decElapsed += abs((int)oldval);  /* rollover */        oldval = newval;        }    }/********************************************************************************* sysIntConnect - connect the BSP interrupt to the proper epic/i8259 handler.** This routine checks the INT level and connects the proper routine.* pciIntConnect() or intConnect().** RETURNS:* OK, or ERROR if the interrupt handler cannot be built.**/STATUS sysIntConnect    (    VOIDFUNCPTR *vector,        /* interrupt vector to attach to     */    VOIDFUNCPTR routine,        /* routine to be called              */    int parameter               /* parameter to be passed to routine */    )    {    int tmpStat = ERROR;    UINT32 read;    if (((int) vector < 0) || ((int) vector > INT_VEC_IRQ0 + WB_MAX_IRQS))	{	logMsg ("Error in sysIntConnect: Level = %d.\n",		(int)vector,2,3,4,5,6);	return (ERROR);	}    if (vxMemProbe ((char *) routine, VX_READ, 4, (char *) &read) != OK)	{	logMsg ("Error in sysIntConnect: Cannot access routine.\n",		1,2,3,4,5,6);	return (ERROR);	}    switch ((int)vector)	{        /*         * add INT_VEC_IRQ0 before calling pciIntConnect since it subtracts         * it and the EPIC which deals with PCI ints needs to be passed         * original vector         */	case (PCI_XINT1_LVL):	    {	    tmpStat = pciIntConnect (vector+INT_VEC_IRQ0, routine, parameter);	    break;	    }	case (PCI_XINT2_LVL):	    {	    tmpStat = pciIntConnect (vector+INT_VEC_IRQ0, routine, parameter);	    break;	    }	case (PCI_XINT3_LVL):	    {	    tmpStat = pciIntConnect (vector+INT_VEC_IRQ0, routine, parameter);	    break;	    }	case (PCI_XINT4_LVL):	    {	    tmpStat = pciIntConnect (vector+INT_VEC_IRQ0, routine, parameter);	    break;	    }	default:	    {	    tmpStat = intConnect (vector, routine, parameter);	    break;	    }	} /* End switch */    if (tmpStat == ERROR)	{	logMsg ("Error in sysIntConnect: vector = %d.\n",		(int)vector,2,3,4,5,6);	}    return (tmpStat);    }/********************************************************************************* sysIntEnablePIC - enable an ISA/PCI interrupt** This function call is used to enable an ISA/PCI interrupt.** RETURNS: OK or ERROR if unable to enable interrupt.*/STATUS sysIntEnablePIC    (    int intNum    )    {    if ((intNum < INT_NUM_IRQ0) || (intNum > (INT_NUM_IRQ0 + WB_MAX_IRQS)))	{	logMsg ("sysIntEnablePIC: Invalid interrupt number %d.\n", 		intNum,2,3,4,5,6);	return (ERROR);	}    return (intEnable (intNum));    }/********************************************************************************* sysIntEnable - enable an interrupt** This function call is used to enable an ISA/PCI interrupt.** RETURNS: OK or ERROR if unable to enable interrupt.*/STATUS sysIntEnable    (    int intNum    )    {    return (sysIntEnablePIC (intNum));    }/********************************************************************************* sysIntDisable - disable an interrupt** This function call is used to disable an interrupt.** RETURNS: OK or ERROR if unable to disable interrupt.*/STATUS sysIntDisable    (    int intNum    )    {    return (intDisable (intNum));    }#ifdef	INCLUDE_ATA/********************************************************************************* sysInByteString - reads a string of bytes from an io address.** This function reads a byte string from a specified o address.** RETURNS: N/A*/void sysInByteString    (    ULONG 	ioAddr,    char * 	bufPtr,    int    	nBytes    )    {    int loopCtr;    for (loopCtr = 0; loopCtr < nBytes; loopCtr++)        *bufPtr++ = *(char *)ioAddr;    PPC_EIEIO_SYNC;    }/********************************************************************************* sysOutByteString - writes a string of bytes to an io address.** This function writes a byte string to a specified io address.** RETURNS: N/A*/void sysOutByteString    (    ULONG 	ioAddr,    char * 	bufPtr,    int   	nBytes    )    {    int loopCtr;    for (loopCtr = 0; loopCtr < nBytes; loopCtr++)        *(char *)ioAddr = *bufPtr++;    PPC_EIEIO_SYNC;    }/********************************************************************************* sysInWordString - reads a string of words from an io address.** This function reads a word string from a specified io address.** RETURNS: N/A*/void sysInWordString    (    ULONG	ioAddr,    UINT16 *	bufPtr,    int		nWords    )    {    int loopCtr;    for (loopCtr = 0; loopCtr < nWords; loopCtr++)        *bufPtr++ = *(short *)ioAddr;    PPC_EIEIO_SYNC;    }/********************************************************************************* sysInWordStringRev - reads a string of words that are byte reversed** This function reads a string of words that are byte reversed from a* specified io address.** RETURNS: N/A*/void sysInWordStringRev    (    ULONG      ioAddr,    UINT16 *   bufPtr,    int        nWords    )    {    int loopCtr;    for (loopCtr = 0; loopCtr < nWords; loopCtr++)        *bufPtr++ = sysInWord (ioAddr);    }/********************************************************************************* sysOutWordString - writes a string of words to an io address.** This function writes a word string from a specified io address.** RETURNS: N/A*/void sysOutWordString    (    ULONG	ioAddr,    UINT16 *	bufPtr,    int		nWords    )    {    int loopCtr;    for (loopCtr = 0; loopCtr < nWords; loopCtr++)

⌨️ 快捷键说明

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