📄 board.c
字号:
/***********************************************************************/
/* */
/* MODULE: bsps/5000/src/board.c */
/* DATE: 99/05/27 */
/* PURPOSE: Board specific routines for board initialization */
/* */
/***********************************************************************/
#include "vxWorks.h"
#include "bsp.h"
#include <pub/bsps.h>
#include <bspfuncs.h>
#include "board.h"
#include "pci/pcihdr.h"
#include <libsys/misc.h>
#include <disi.h>
#include "ixp425Gpio.h"
/*---------------------------------------------------------------------*/
/* DEBUG */
/*---------------------------------------------------------------------*/
/* #define DEBUG_PRINT 1 */
extern int rawprint();
extern void BspRawPrint(char * format,...);
/*---------------------------------------------------------------------*/
/* Bsp Specific Function Declarations */
/*---------------------------------------------------------------------*/
extern ULONG FreeMemStart;
extern char * SysInit(char * freemem_p);
/************************************************************************/
/* Board information functions */
/************************************************************************/
ULONG BoardInfoEpromBase(void)
{
return BD_EPROM_BASE_ADDR;
}
USHORT BoardInfoPasswordJump(void)
{
return gBoardInfo.PasswordJump;
}
USHORT BoardInfoReserveJump(void)
{
return gBoardInfo.ReserveJump;
}
ULONG BoardInfoDecClkRateHz(void)
{
return gBoardInfo.DecClkRateHz;
}
void SetBoardInfoBoardType( USHORT type )
{
gBoardInfo.BoardType = type;
}
ULONG BoardInfoFlashOnBoardBaseaddr(void)
{
return FLASH_TYPE_ON_BOARD_BASEADDR_IXP425;
}
/************************************************************************/
/* The following functions are provided for compatibility */
/************************************************************************/
ULONG BspCpuClkRate(void)
{
return BoardInfoCpuClkRate();
}
/***********************************************************************/
/* */
/* GetIMMR: Return the IMMR register contents, for now this is */
/* hardcoded because the IMMR has to be set before the actual */
/* IMMR register can be read. */
/* */
/* INPUTS: None */
/* */
/* RETURNS: None */
/* OUTPUTS: None */
/* NOTE(S): */
/* */
/***********************************************************************/
ULONG GetIMMR(void)
{
return(0);
}
/************************************************************************/
/* probe the dram size */
/************************************************************************/
static ULONG ProbeDramSize(void)
{
ULONG size;
size = 0x08000000;
return size;
}
void SetupBoardInfo(void)
{
ULONG *addr1, *addr2;
ULONG cpuClkRate_Hz; /* External CPU bus freq Hz */
gBoardInfo.RouterType = BspInitEpromInfo();
#if 0
gBoardInfo.CpuBusClkRate = sysClkFreqGet();
cpuClkRate_Hz = sysCoreFreqGet();
/*---------------------------------------------------------------------*/
/* Calculate the time constant. The decrementer decrements once every */
/* four external bus clocks. 1000000 / 4 = 250000. */
/*---------------------------------------------------------------------*/
gBoardInfo.DecClkRateHz = (gBoardInfo.CpuBusClkRate / 8);
/*---------------------------------------------------------------------*/
/* Setup the clock rate variables for the board */
/*---------------------------------------------------------------------*/
gBoardInfo.CpuClkRate = cpuClkRate_Hz/1000000;
#endif
/*---------------------------------------------------------------------*/
/* Setup dram attributes */
/*---------------------------------------------------------------------*/
gBoardInfo.DramBase = 0;
gBoardInfo.DramSize = ProbeDramSize();
/*---------------------------------------------------------------------*/
/* 8560 kernel supports PCI */
/*---------------------------------------------------------------------*/
gBoardInfo.PciSupport = PCI_SUPPORT_NONE;
gBoardInfo.FlashType = FLASH_TYPE_INTEL;
gBoardInfo.FlashBase = FLASH_TYPE_ON_BOARD_BASEADDR_IXP425;
#if 0
gBoardInfo.FlashSize = FLASH_TYPE_ON_BOARD_SIZE;
gBoardInfo.FlashType = FLASH_TYPE_INTEL;
#endif
}
/***********************************************************************/
/* */
/* InitBoard: Initialize the Yellowknife/Sandpoint hardware */
/* */
/***********************************************************************/
char * InitBoard(char * FreeMemPtr)
{
int cpu;
*((volatile unsigned int *)0xc8004004)=0x2080; /*initialize gpio*/
*((volatile unsigned int *)0xc8004000)=0x0c00;
*((volatile unsigned char *)0xc8004003)=0x01;
#if (BSP_USE_SERIAL_MUX == YES)
{
/*-----------------------------------------------------------------*/
/* Initialize Serial Multiplexer */
/*-----------------------------------------------------------------*/
InitSerialMux();
SetupPc16x50Driver();
}
#endif
/*---------------------------------------------------------------------*/
/* Initialize the Realtime Clock */
/*---------------------------------------------------------------------*/
RtcDS1338Init();
/*EnableMachineCheck();*/
return SysInit(FreeMemPtr);
}
/***********************************************************************/
/* SysInitFail: Report a system initalization failure */
/* */
/* INPUTS: string = pointer to text of message */
/* OUTPUTS: None */
/* */
/* NOTE: Doesn't return. Just continually prints the error message on */
/* the serial channel once per second. */
/* */
/***********************************************************************/
void SysInitFail(const char *string)
{
Print("\n\n\nsys init fail!\n\n\n");
while(1){}
}
void Init_Pci()
{
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -