📄 syslib.c
字号:
* BSP_VERSION and returned.** RETURNS: A pointer to the BSP version/revision string.*/char * sysBspRev (void) { return (BSP_VERSION BSP_REV); } /****************************************************************************** * * sysCpmFreqGet - Determines the CPM Operating Frequency * * From page 9-2 Rev. 0 MPC8260 PowerQUICC II User's Manual * * RETURNS: CPM clock frequency for the current MOD_CK and MOD_CK_H settings */UINT32 sysCpmFreqGet ( void ) { UINT n; UINT32 modck_H = MOD_CK_H; UINT32 modck13 = MOD_CK; UINT32 oscFreq = OSCILLATOR_FREQ; for (n=0; modckH_modck13[n].coreFreq != END_OF_TABLE ;n++) { if ((modckH_modck13[n].modck_h == modck_H) && (modckH_modck13[n].modck13 == modck13)) { if (modckH_modck13[n].inputFreq == oscFreq) return modckH_modck13[n].cpmFreq; } } return ERROR; }/******************************************************************************** sysBaudClkFreq - Obtains frequency of the BRG_CLK in HZ** From page 9-5 in Rev. 0 MPC8260 PowerQUICC II User's Manual** baud clock = 2*cpm_freq/2^2*(DFBRG+1) where DFBRG = 01* = 2*cpm_freq/16** RETURNS: frequency of the BRG_CLK in HZ*/int sysBaudClkFreq ( void ) { UINT32 cpmFreq = sysCpmFreqGet(); if (cpmFreq == ERROR) return ERROR; else return cpmFreq*2/16; }/****************************************************************************** * * sysHwMemInit - initialize and configure system memory. * * This routine is called before sysHwInit(). It performs memory auto-sizing * and updates the system's physical regions table, `sysPhysRgnTbl'. It may * include the code to do runtime configuration of extra memory controllers. * * NOTE: This routine should not be called directly by the user application. It * cannot be used to initialize interrupt vectors. * * RETURNS: N/A */void sysHwMemInit (void) { /* Call sysPhysMemTop() to do memory autosizing if available */ sysPhysMemTop (); }/******************************************************************************** sysHwInit - initialize the system hardware** This routine initializes various feature of the MPC8260 ADS board. It sets up* the control registers, initializes various devices if they are present.** NOTE: This routine should not be called directly by the user.** RETURNS: NA*/void sysHwInit (void) { int immrVal = vxImmrGet(); /* set the BRGCLK division factor */ * M8260_SCCR(immrVal) = BRGCLK_DIV_FACTOR; /* set DPPC in SIUMCR to 10 so that timer is enabled (TBEN) */ * M8260_SIUMCR(immrVal) &= ~M8260_DPPC_MASK; /* clear the dppc */ * M8260_SIUMCR(immrVal) |= M8260_DPPC_VALUE; /* or in the desired value */ /* reset the Communications Processor */ *M8260_CPCR(immrVal) = 0x80010000; CACHE_PIPE_FLUSH(); /* Get the Baud Rate Generator Clock frequency */ baudRateGenClk = sysBaudClkFreq(); /* Reset serial channels */ sysSerialHwInit(); /* Initialize interrupts */ m8260IntrInit(); /* handle the LXT970 properly */#ifdef INCLUDE_MOTFCCEND miiPhyOptFuncSet ((FUNCPTR) sysMiiOptRegsHandle);#endif /* INCLUDE_MOTFCCEND */ /* * The power management mode is initialized here. Reduced power mode * is activated only when the kernel is iddle (cf vxPowerDown). * Power management mode is selected via vxPowerModeSet(). * DEFAULT_POWER_MGT_MODE is defined in config.h. */ vxPowerModeSet (DEFAULT_POWER_MGT_MODE); }/********************************************************************************* 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.** RETURNS: The address of the top of physical memory.** SEE ALSO: sysMemTop()*/char * sysPhysMemTop (void) { LOCAL char * physTop = NULL; if (physTop == NULL) { physTop = (char *)(LOCAL_MEM_LOCAL_ADRS + LOCAL_MEM_SIZE); } return (physTop) ; }/********************************************************************************* 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) { LOCAL 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 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 */ intLock(); cacheDisable(INSTRUCTION_CACHE); cacheDisable(DATA_CACHE); sysAuxClkDisable(); /* disable both RS232 ports on the board */ *BCSR1 |= (BCSR1_RS232EN_1_L); *BCSR1 |= (BCSR1_RS232EN_2_L); sysSerialReset(); /* reset the serial device */ vxMsrSet (0); (*pRom) (startType); /* jump to bootrom entry point */ return (OK); /* in case we ever continue from ROM monitor */ }/******************************************************************************** sysHwInit2 - additional system configuration and initialization** This routine connects system interrupts and does any additional* 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; } }/******************************************************************************** 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*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -