📄 syslib.c
字号:
#endif
/***********************************************************************
*
* sysModel - return the model name of the CPU board
*
* This routine returns the model name of the CPU board.
*
* RETURNS: A pointer to the string.
*/
char * sysModel
(
void
)
{
return( "MPC8260a - Foundercom, V100R001SCB" ) ;
}
/***********************************************************************
*
* sysBspRev - return the BSP version and revision number
*
* This routine returns a pointer to a BSP version and revision number, for
* example, 1.2/0. BSP_REV is concatenated to BSP_VERSION and returned.
*
* RETURNS: A pointer to the BSP version/revision string.
*/
char * sysBspRev
(
void
)
{
return( BSP_VERSION BSP_REV );
}
/***********************************************************************
*
* sysHwInit - initialize the system hardware
*
* This routine initializes various feature of the V100R001 SCB 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: N/A
*/
void sysHwInit
(
void
)
{
#if 0
volatile UINT32 temp;
#endif
int ix;
ULONG * pDPRAM1;
/* Get the physical location of the IMMR register */
int immrVal = vxImmrGet ();
/* Issue a Software Reset Command to the CPM core */
sysCpmReset ();
/* Initialize DPRAM1 to zero. DPRAM1: 16KBytes */
pDPRAM1 = (unsigned long *)immrVal;
for (ix = 0; ix < 0x1000; ix++)
*pDPRAM1++ = 0;
/* reset mpc8260 I/O ports */
m8260IOPortInit();
/*
* <SICR>: SIU interrupt configuration register
* - HP(bit2~7): highest priority.
* - GSIU(bit14): 0(XSIU grouped)
* - SPS(bit15): 0(YCC grouped)
*/
*M8260_SICR( immrVal ) = 0x00000000;
/* Initialize interrupts - default interrupt level. */
m8260IntrInit ();
#if 0
/*
* DPPC(4~5): data parity pin configuration
* - 10: enable TBEN
* - 00: IRQ pins. SCB HW use 00
*/
if (MPC8260_MASKNUM_PREA1 == sysChipRev ())
{
temp = *M8260_SIUMCR(immrVal);
temp &= 0xf3ffffff; /* first clear DPPC */
temp |= 0x08000000; /* then enable TBEN */
*M8260_SIUMCR( immrVal ) = temp;
}
#endif
/* Initialize the DPRAM lib */
m82xxDpramLibInit ();
/* configure SCB board I/O pins */
sysGpioInit();
#if defined(INCLUDE_SYSLED)
/* Initialize the LEDs */
sysLedInit ();
#endif
/* Reset serial channels.*/
sysSerialHwInit();
#ifdef FORCE_DEFAULT_BOOT_LINE
strncpy (sysBootLine,DEFAULT_BOOT_LINE,strlen(DEFAULT_BOOT_LINE)+1);
#endif
#ifdef INCLUDE_MOTFCCEND
sysFccEnetDisable(immrVal, 1); /* FCC1 */
sysFccEnetDisable(immrVal, 3); /* FCC3 */
#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 in system memory partition.
*
* 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 no adjust LOCAL_MEM_SIZE to reserve memory for application
* use.See sysMemTop() for more information on reserving memory.
* - There are 3 memory partition in V100R001 SCB board, only memSysPartId
* is reflected by this routine, that is CS3(64MB on 60x bus).
* [May be changed]
*
* RETURNS: The address of the top of physical memory.
*
* SEE ALSO: sysMemTop()
*/
char * sysPhysMemTop
(
void
)
{
static char * physTop = NULL;
if (NULL == physTop)
{
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 in system memory partition.
*
* 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 (NULL == memTop)
{
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, +8? */
#ifdef INCLUDE_MOTFCCEND
/* Get the physical location of the IMMR register */
int immrVal = vxImmrGet ();
#endif
intLock ();
cacheDisable (INSTRUCTION_CACHE);
cacheDisable (DATA_CACHE);
#if defined(INCLUDE_AUX_CLK)
sysAuxClkDisable();
#endif
#ifdef INCLUDE_MOTFCCEND
/* disable the FCC */
sysFccEnetDisable(immrVal, 1);
sysFccEnetDisable(immrVal, 3);
#endif
sysSerialReset (); /* reset the serial device */
vxMsrSet(0);
(*pRom) (startType); /* jump to bootrom entry point */
return( OK ); /* in case we 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 ;
if ( ! configured )
{
#if defined(INCLUDE_AUX_CLK)
/* initialize, start auxiliary clock */
sysAuxClkEnable();
/* set clock rate */
sysAuxClkRateSet(AUX_CLK_RATE);
#endif
#if defined(INCLUDE_TIMESTAMP)
/* enable timestamp */
sysTimestampEnable();
#endif
/* initialize serial interrupts */
sysSerialHwInit2 ();
/* Indicate we have been through this procedure for reentrancy. */
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 */
)
{
sysProcNum = procNum;
}
/***********************************************************************
*
* vxImmrSet - Set the IMMR to a specific value
*
* This routine sets the IMMR to a specific value.
*
* RETURNS: N/A
*/
void vxImmrSet
(
UINT32 value
)
{
immrAddress = value;
return;
}
/***********************************************************************
*
* vxImmrGet - return the current IMMR value
*
* This routine returns the current IMMR value.
*
* RETURNS: current IMMR value
*
*/
UINT32 vxImmrGet
(
void
)
{
return (immrAddress);
}
/***********************************************************************
*
* sysBaudClkFreq - returns the frequency of the BRG clock
*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -