📄 bspcfg.c
字号:
/* @(#) pSOSystem PowerPC/V2.2.2: bsps/fuc8xx/bspcfg.c V0.0 98/7/1 */
/***********************************************************************/
/* */
/* MODULE: bspcfg.c */
/* DATE: 98/7/1 */
/* AUTHOR: Shan Zhengguang */
/* PURPOSE: BSP code which is compiled when executable image is built*/
/* */
/*---------------------------------------------------------------------*/
/* */
/* Copyright 1998 - 1999, ZHONGXING TELECOM CO.,LTD. */
/* ALL RIGHTS RESERVED */
/* */
/*---------------------------------------------------------------------*/
/* */
/* NOTE: The nature of this file is to provide a way to configure */
/* the bsp at application compile time. Since the bsp.lib is */
/* independent of the application a means to provide the */
/* application some control over the configuration of the bsp. */
/* is needed. For example the lan driver needs to know if */
/* it will be required to do multicast addressing and if so */
/* how many multicast address will there be. The lan driver */
/* will then allocate buffers for multicast based on the number */
/* needed. Rather than this value being hard-coded into the */
/* driver to be included in bsp.lib, the user can set a */
/* define in the application file "sys_conf.h". The BspSetup */
/* function in this file will use that define to allocate */
/* space file the multicast buffers and set a global pointer */
/* to allow the lan driver access to the buffers. */
/* */
/***********************************************************************/
#include "sys_conf.h"
#include <machine.h>
#include "src/board.h"
#include "bspcomm.h"
#include "bspspec.h"
#include "bsp.h"
#include <bspfuncs.h>
#include <configs.h>
#include <lan/lan8xx.h>
#if SC_PROFILER
#include <stdio.h>
#include <proflib.h>
struct prof_info *pip;
struct prof_stack *psp;
#endif
extern void (*ptrPsosEnter)(void), (*ptrPsosExit)(void);
extern void (*ptrPmontEnter)(void), (*ptrPmontExit)(void);
extern NODE_CT *anchor;
extern void SysMachChk(void);
extern void GenIsr(void);
extern void PsosIsr(void);
extern void PmontIsr(void);
extern void HwAbortHandler(void);
#if ((SC_PSOS != USEROM) && (SC_PSOSM != USEROM))
#if SC_PSOSM
#define PSOS_SVC pSOSm_Svc
extern void PSOS_SVC(void);
#elif SC_PSOS
#define PSOS_SVC pSOS_Svc
extern void PSOS_SVC(void);
#endif
#else
extern NODE_CT *oldanchor;
#endif
#ifdef ALIGN
#undef ALIGN
#define ALIGN(addr, boundary) (((ULONG)(addr)+(ULONG)(boundary)-1) \
& ~((ULONG)(boundary)-1))
#endif
#if ((BSP_LAN1_FLAGS) & (IFF_MULTICAST))
struct MCTable_struct lan_mcast; /* Multicast address table */
#endif
#if (SC_BOOT_ROM == YES)
ULONG NrTxBds = BD_SCC_TX_BDS_ROM; /* Number of transmit BDs */
ULONG NrTxHdrs = BD_SCC_TXHDRS_ROM; /* Number of transmit headers */
TX_HDR TxHeaders[BD_SCC_TXHDRS_ROM]; /* The actual headers */
#else
ULONG NrTxBds = BD_SCC_TX_BDS; /* Number of transmit BDs */
ULONG NrTxHdrs = BD_SCC_TXHDRS; /* Number of transmit headers */
TX_HDR TxHeaders[BD_SCC_TXHDRS]; /* The actual headers */
#endif
#ifdef USE_UNCACHE_SECTION
#pragma use_section UNCACHE TxHeaders
#endif
/******************************************************************/
/* don't use any globle variables in this function because it may */
/* be called from the start-up code before the RAM is initialized.*/
/******************************************************************/
ULONG bspGetInputClkHz(void)
{
return BD_INPUT_CLOCK;
}
/***********************************************************************/
/* vectorSetup: */
/* */
/* INPUTS: var1 = */
/* */
/* RETURNS: */
/* OUTPUTS: */
/* NOTE(S): 1. Still need to set this up to handle various */
/* component combinations. */
/* */
/***********************************************************************/
void vectorSetup(void)
{
unsigned long ProcType;
unsigned long msrORval; /* NEED TO SET THIS!!! */
/*---------------------------------------------------------------------*/
/* Machine check exceptions are handled in a "daisy-chained" fashion, */
/* where various handlers are called in order until one of them */
/* recognizes the particular exception as one it should handle, and */
/* handles it. If none of the handlers handle it, pROBE is finally */
/* given control. Here we call a routine to initialize the handler */
/* list, and then set the machine check exception vector to transfer */
/* control to the handler caller. */
/*---------------------------------------------------------------------*/
#if (SC_STARTUP_DIALOG==YES && SC_BOOT_ROM==YES && SC_PROBE==YES)
disableSWT();
#endif
SysHandlerInit();
SysSetVector(V_MACH_CK, SysMachChk, VT_REG, MSR_ME | MSR_FP, 0);
msrORval = 0;
#if (BSP_FPU == YES)
msrORval = MSR_FP | MSR_FE0 | MSR_FE1;
#endif
SysSetVector(V_INTRPT, GenIsr, VT_STACK, msrORval, 0);
SysSetVector(V_DCRMNTR, GenIsr, VT_STACK, msrORval, 0);
SysSetVector(V_RESET, HwAbortHandler, VT_REG, 0, 0);
#if (!SC_PROBE)
SysSetVector(V_MACH_CK,(void (*)())ExceptionHandle,VT_REG,0,0);
SysSetVector(V_DA,(void (*)())ExceptionHandle,VT_REG,0,0);
SysSetVector(V_IA,(void (*)())ExceptionHandle,VT_REG,0,0);
SysSetVector(V_ALIGN,(void (*)())ExceptionHandle,VT_REG,0,0);
SysSetVector(V_SEI821,(void (*)())ExceptionHandle,VT_REG,0,0);
SysSetVector(V_PROGRAM,(void (*)())ExceptionHandle,VT_REG,0,0);
SysSetVector(V_ITLB_ERR,(void (*)())ExceptionHandle,VT_REG,0,0);
SysSetVector(V_DTLB_ERR,(void (*)())ExceptionHandle,VT_REG,0,0);
SysSetVector(V_IA_BP821, (void (*)())ExceptionHandle,VT_REG, 0, 0);
SysSetVector(V_DA_BP821, (void (*)())ExceptionHandle,VT_REG, 0, 0);
#endif
}
#if (SC_PROBE)
/***********************************************************************/
/* ProbeVecSetup: */
/* */
/* INPUTS: none */
/* */
/* RETURNS: */
/* OUTPUTS: */
/***********************************************************************/
void ProbeVecSetup(unsigned long probe_start)
{
unsigned long offset;
unsigned long ProcType;
unsigned long max_offset;
ProcType = BspCpuType() & 0xFF;
if(ProcType == PPC860)
ProcType = PPC821;
else if(ProcType == PPC603e || ProcType == PPC603p)
ProcType = PPC603;
else if(ProcType == PPC604p || ProcType == PPC604e)
ProcType = PPC604;
if(ProcType == PPC821)
max_offset = 0x1f00;
else
max_offset = 0x2f00;
/*---------------------------------------------------------------------*/
/* First initialize all of the vectors to pass control to pROBE+. */
/*---------------------------------------------------------------------*/
for (offset = 0x100; offset <= max_offset; offset += 0x100) {
if( offset == V_SYSCALL ||
offset == V_INTRPT ||
offset == V_MACH_CK ||
(offset == V_TIMERS && ProcType == PPC403GA) ||
(offset == V_DCRMNTR && ProcType != PPC403GA) )
continue;
SysSetVector(offset,
(void (*)())(probe_start + PROBE_RSRV_EXCP_OFFSET),
VT_REG, 0, 0);
}
/*---------------------------------------------------------------------*/
/* Set vectors for various exceptions to transfer control to */
/* special-purpose entries of pROBE+. */
/*---------------------------------------------------------------------*/
if (ProcType != PPC403GA)
{
SysSetVector(V_DA, (void (*)())(probe_start + PROBE_DA_BE_OFFSET),
VT_REG, 0, 0);
SysSetVector(V_IA, (void (*)())(probe_start + PROBE_IA_EXCP_OFFSET),
VT_REG, 0, 0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -