📄 syslib.c.bak
字号:
* configuration necessary.** RETURNS: NA*/void sysHwInit2 (void) { LOCAL BOOL configured = FALSE; int immrVal = vxImmrGet(); CACHE_PIPE_FLUSH(); if (!configured) { /* initialize serial interrupts */ sysSerialHwInit2(); * M8260_SCCR(immrVal) &= ~M8260_SCCR_TBS; CACHE_PIPE_FLUSH(); configured = TRUE;#ifdef INCLUDE_FEI_END sys557PciInit (); /* Intel 82557/9 device */#endif /* INCLUDE_FEI_END */#ifdef INCLUDE_PCI_DMA pciDmaInit();#endif /* INCLUDE_PCI_DMA */#ifdef INCLUDE_PCI_ERROR_HANDLING pciErrorHandlingInit();#endif /* INCLUDE_PCI_ERROR_HANDLING */ } }/******************************************************************************** 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.** Not applicable for the busless 8260Ads.** RETURNS: NA** SEE ALSO: sysProcNumGet()**/void sysProcNumSet ( int procNum /* processor number */ ) { sysProcNum = procNum; }/******************************************************************************** sysLocalToBusAdrs - convert a local address to a bus address** This routine gets the VMEbus address that accesses a specified local* memory address.** Not applicable for the 8260Ads** RETURNS: ERROR, always.** 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 */ ) { return (ERROR); }/******************************************************************************** sysBusToLocalAdrs - convert a bus address to a local address** This routine gets the local address that accesses a specified VMEbus* physical memory address.** Not applicable for the 8260Ads** RETURNS: ERROR, always.** 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 */ ) { return (ERROR); }/******************************************************************************** sysBusTas - test and set a location across the bus** This routine does an atomic test-and-set operation across the backplane.** Not applicable for the 8260Ads.** RETURNS: FALSE, always.** SEE ALSO: vxTas()*/BOOL sysBusTas ( char * adrs /* address to be tested-and-set */ ) { return (FALSE); }/******************************************************************************** sysBusClearTas - test and clear** This routine is a null function.** RETURNS: NA*/void sysBusClearTas ( volatile char * address /* address to be tested-and-cleared */ ) { }/********************************************************************************* vxImmrGet - return the current IMMR value** This routine returns the current IMMR value** RETURNS: current IMMR value**/UINT32 vxImmrGet (void) { return (INTERNAL_MEM_MAP_ADDR & IMMR_ISB_MASK); }#ifdef INCLUDE_MOTFCCEND/********************************************************************************* sysFccEnetAddrGet - get the hardware Ethernet address** This routine provides the six byte Ethernet hardware address that will be* used by each individual FCC device unit. This routine must copy* the six byte address to the space provided by <addr>.** RETURNS: OK, or ERROR if the Ethernet address cannot be returned.*/STATUS sysFccEnetAddrGet ( int unit, /* base address of the on-chip RAM */ UCHAR * addr /* where to copy the Ethernet address */ ) { bcopy ((char *) sysFccEnetAddr[unit], (char *) addr, sizeof (sysFccEnetAddr)); return (OK); }#endif /* INCLUDE_MOTFCCEND */#ifdef INCLUDE_PCI /* board level PCI routines *//********************************************************************************* sysPciSpecialCycle - generate a special cycle with a message** This routine generates a special cycle with a message.** NOMANUAL** RETURNS: OK*/STATUS sysPciSpecialCycle ( int busNo, UINT32 message ) { int deviceNo = 0x0000001f; int funcNo = 0x00000007; PCI_OUT_LONG (sysPciConfAddr, pciConfigBdfPack (busNo, deviceNo, funcNo) | 0x80000000); PCI_OUT_LONG (sysPciConfData, message); return (OK); }/********************************************************************************* sysPciConfigRead - read from the PCI configuration space** This routine reads either a byte, word or a long word specified by* the argument <width>, from the PCI configuration space* This routine works around a problem in the hardware which hangs* PCI bus if device no 12 is accessed from the PCI configuration space.** NOMANUAL** RETURNS: OK, or ERROR if this library is not initialized*/STATUS sysPciConfigRead ( int busNo, /* bus number */ int deviceNo, /* device number */ int funcNo, /* function number */ int offset, /* offset into the configuration space */ int width, /* width to be read */ void * pData /* data read from the offset */ ) { UINT8 retValByte = 0; UINT16 retValWord = 0; UINT32 retValLong = 0; STATUS retStat = ERROR; if ((busNo == 0) && (deviceNo == 12)) return (ERROR); switch (width) { case 1: /* byte */ PCI_OUT_LONG (sysPciConfAddr, pciConfigBdfPack (busNo, deviceNo, funcNo) | (offset & 0xfc) | 0x80000000); retValByte = PCI_IN_BYTE (sysPciConfData + (offset & 0x3)); *((UINT8 *)pData) = retValByte; retStat = OK; break; case 2: /* word */ PCI_OUT_LONG (sysPciConfAddr, pciConfigBdfPack (busNo, deviceNo, funcNo) | (offset & 0xfc) | 0x80000000); retValWord = PCI_IN_WORD (sysPciConfData + (offset & 0x2)); *((UINT16 *)pData) = retValWord; retStat = OK; break; case 4: /* long */ PCI_OUT_LONG (sysPciConfAddr, pciConfigBdfPack (busNo, deviceNo, funcNo) | (offset & 0xfc) | 0x80000000); retValLong = PCI_IN_LONG (sysPciConfData); *((UINT32 *)pData) = retValLong; retStat = OK; break; default: retStat = ERROR; break; } return (retStat); }/********************************************************************************* sysPciConfigWrite - write to the PCI configuration space** This routine writes either a byte, word or a long word specified by* the argument <width>, to the PCI configuration space* This routine works around a problem in the hardware which hangs* PCI bus if device no 12 is accessed from the PCI configuration space.** NOMANUAL** RETURNS: OK, or ERROR if this library is not initialized*/STATUS sysPciConfigWrite ( int busNo, /* bus number */ int deviceNo, /* device number */ int funcNo, /* function number */ int offset, /* offset into the configuration space */ int width, /* width to write */ ULONG data /* data to write */ ) { if ((busNo == 0) && (deviceNo == 12)) return (ERROR); switch (width) { case 1: /* byte */ PCI_OUT_LONG (sysPciConfAddr, pciConfigBdfPack (busNo, deviceNo, funcNo) | (offset & 0xfc) | 0x80000000); PCI_OUT_BYTE ((sysPciConfData + (offset & 0x3)), data); break; case 2: /* word */ PCI_OUT_LONG (sysPciConfAddr, pciConfigBdfPack (busNo, deviceNo, funcNo) | (offset & 0xfc) | 0x80000000); PCI_OUT_WORD ((sysPciConfData + (offset & 0x2)), data); break; case 4: /* long */ PCI_OUT_LONG (sysPciConfAddr, pciConfigBdfPack (busNo, deviceNo, funcNo) | (offset & 0xfc) | 0x80000000); PCI_OUT_LONG (sysPciConfData, data); break; default: return (ERROR); } return (OK); }#endif /* INCLUDE_PCI */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -