📄 sysmon.c
字号:
dbmsg_ftrace( DBM_SYSTEM, "Low-power mode change cc = %d\r\n", ccLPMode );
dbmsg_ftrace( DBM_SYSTEM, "Memory test cc = %d\r\n", ccMemTest );
if( ccMemTest != PASS )
{
dbmsg_ftrace( DBM_SYSTEM, " Failed_Col_Address = %04x\r\n", resultMemTest.Failed_Col_Address );
dbmsg_ftrace( DBM_SYSTEM, " Failed_Row_Address = %04x\r\n", resultMemTest.Failed_Row_Address );
dbmsg_ftrace( DBM_SYSTEM, " Failed_Bank_Address = %04x\r\n", resultMemTest.Failed_Bank_Address );
dbmsg_ftrace( DBM_SYSTEM, " Failed_Packet = %04x\r\n", resultMemTest.Failed_Packet );
dbmsg_ftrace( DBM_SYSTEM, " Failed_Err_Flags = %04x\r\n", resultMemTest.Failed_Err_Flags );
}
if( EXEC_CC_FATAL == eeprom_init())
llFault( LLFAULT_SYS_FATAL_INIT, FALSE );
dbmsg_setmask( EE_GETCONST( UserSystem.DebugMsgMask, uint32 ));
dbmsg_ftrace( DBM_SYSTEM, "System mailbox ID = %08x\r\n", sysMbxID );
/****************************************************/
/* Show configuration version numbers. */
/****************************************************/
apiver = API_GetVersion();
if( apiver.API_Bits.Major != API_VER_MAJOR || apiver.API_Bits.Minor != API_VER_MINOR || apiver.API_Bits.Patch != API_VER_PATCH )
dbmsg_trace( DBM_ALWAYS, "Error: API lib version does not match API header version!\r\n" );
dbmsg_ftrace( DBM_ALWAYS, "API version: %02x.%02x.%02x\r\n", apiver.API_Bits.Major, apiver.API_Bits.Minor, (apiver.API_Bits.Patch & 0xFF) );
dbmsg_ftrace( DBM_ALWAYS, "App version: %02x.%02x.%02x\r\n", SW_VER_MAJOR, SW_VER_MINOR, (SW_VER_PATCH & 0xFF) );
revInfo.SeqAsicConfigNum = CONFIGNO_SEQ;
revInfo.SwAsicConfigNum = CONFIGNO_SWASIC;
DDP_GetAsicConfigRevision( &revInfo );
dbmsg_trace ( DBM_ALWAYS, "Configuration layout versions:\r\n" );
dbmsg_ftrace( DBM_ALWAYS, " Seq Map: %02x.%02x.%04x\r\n",
0xff & ( revInfo.SeqConfigRevision >> 24 ),
0xff & ( revInfo.SeqConfigRevision >> 16 ),
0xffff & revInfo.SeqConfigRevision );
dbmsg_ftrace( DBM_ALWAYS, " SW Map: %02x.%02x.%04x\r\n",
0xff & ( revInfo.SwConfigRevision >> 24 ),
0xff & ( revInfo.SwConfigRevision >> 16 ),
0xffff & revInfo.SwConfigRevision );
dbmsg_ftrace( DBM_ALWAYS, " EEPROM: %02d.%02d.%04d\r\n",
gpSettings -> Version.Major, gpSettings -> Version.Minor, gpSettings -> Version.Subminor );
/****************************************************/
/* Init the ASIC hardware before performing the app */
/* initialization. */
/****************************************************/
if( 0 != DDP_Init( DDP_FN_ASIC ))
{
dbmsg_trace( DBM_ALWAYS, "Can't DDP_Init( DDP_FN_ASIC ) in _sysReset()\r\n" );
llFault( LLFAULT_SYS_ASIC, FALSE );
}
if( PASS != FRAME_Init()) /* API frame task */
dbmsg_trace( DBM_ALWAYS, "Can't initialize frameTask in _sysReset()\r\n" );
if( PASS != PMD_Init())
dbmsg_trace( DBM_ALWAYS, "Can't initialize PMD1000 _sysReset()\r\n" );
CW_SetMotorType( CW_MOTOR_TYPE_1 );
CW_SetWheel( CW_WHEEL_TYPE_1 );
if( 0 != DDP_Init( DDP_FN_CW | DDP_FN_SEQ ))
dbmsg_trace( DBM_ALWAYS, "Can't initialize CW/SEQ in _sysReset()\r\n" );
DDP_EnableEmergencyShutdown( gpConfiguration -> System.EnableASICEmergencyShutdown );
/****************************************************/
/* Continue. */
/****************************************************/
iox_init(); /* IO expander */
watchdog_init(); /* watchdog */
heartbeat_init(); /* heartbeat */
keypad_init(); /* keypad */
enviro_init(); /* environment monitor */
irfunc_init(); /* IR remote */
if( EXEC_CC_FATAL == pollTask_init()) /* polling task */
llFault( LLFAULT_SYS_FATAL_INIT, FALSE );
usbIO_init(); /* USB task */
pctl_init(); /* projector control task */
rfc_init(); /* remote function call task */
guiTask_init(); /* gui task */
datapath_init(); /* datapath task */
illum_init(); /* illumination */
audio_init(); /* audio */
if( gpConfiguration -> Peripherals.DdcciConfig )
ddc_init(); /* DDC/CI */
/****************************************************/
/* Operation will continue on any error other than */
/* fatal, so report success. */
/****************************************************/
return EXEC_CC_PASS;
}
/****************************************************************************/
/* Set projector to normal run mode. */
/****************************************************************************/
static EXEC_CC_ENUM _sysNormalRun( void )
{
BOOL pass = TRUE;
dbmsg_trace( DBM_SYSTEM, "Sysmon: Transition to normal operating mode\r\n" );
/****************************************************/
/* Set up commonly-used test points. */
/* This must be called after DDP_Init() */
/****************************************************/
TPM_ConfigureHWTestMux(TPM_TP0, TPM_VSYNC);
TPM_ConfigureHWTestMux(TPM_TP1, TPM_DELAYED_CW_INDEX);
TPM_ConfigureHWTestMux(TPM_TP2, TPM_CW_INDEX);
TPM_ConfigureHWTestMux(TPM_TP3, TPM_SEQUENCE_INDEX);
/****************************************************/
/* Start the system API tasks, then the datapath. */
/* Datapath must be set up prior to illumination so */
/* that valid vsyncs are available to the color */
/* wheel. Then attempt to start illumination. If */
/* this passes, continue with startup. */
/****************************************************/
if( EXEC_CC_PASS != enviro_powerNormal())
{
pass = FALSE;
dbmsg_trace( DBM_ALWAYS, "Fault in environment transition to operating mode\r\n" );
}
if( EXEC_CC_PASS != guiTask_powerNormal())
{
pass = FALSE;
dbmsg_trace( DBM_ALWAYS, "Fault in GUI transition to operating mode\r\n" );
}
if( EXEC_CC_PASS != datapath_powerNormal())
{
pass = FALSE;
dbmsg_trace( DBM_ALWAYS, "Fault in datapath transition to operating mode\r\n" );
}
if( EXEC_CC_PASS != illum_powerNormal())
{
pass = FALSE;
dbmsg_trace( DBM_ALWAYS, "Fault in illumination transition to operating mode\r\n" );
}
audio_powerNormal();
if( !pass )
{
dbmsg_trace( DBM_ALWAYS, "Sysmon can't transition to operating mode\r\n" );
_sysStandby(); /* ensure everything back to standby */
}
else
{
dbmsg_trace( DBM_SYSTEM, "Sysmon: Transition to normal mode complete\r\n" );
}
return pass ? EXEC_CC_PASS : EXEC_CC_FAIL;
}
/****************************************************************************/
/* Set projector to standby mode. */
/****************************************************************************/
static EXEC_CC_ENUM _sysStandby( void )
{
BOOL pass = TRUE; /* assume all operations will pass */
if( EXEC_CC_PASS != illum_powerStandby()) /* lamp and color wheel off */
{
pass = FALSE;
dbmsg_trace( DBM_ALWAYS, "Fault in illumination transition to standby\r\n" );
}
if( EXEC_CC_PASS != enviro_powerStandby()) /* start standby transition */
{
pass = FALSE;
dbmsg_trace( DBM_ALWAYS, "Fault in environment transition to standby\r\n" );
}
if( EXEC_CC_PASS != guiTask_powerStandby()) /* inform GUI */
{
pass = FALSE;
dbmsg_trace( DBM_ALWAYS, "GUI won't transition to standby\r\n" );
}
if( EXEC_CC_PASS != datapath_powerStandby()) /* inform datapath */
{
pass = FALSE;
dbmsg_trace( DBM_ALWAYS, "Datapath won't transition to standby\r\n" );
}
audio_powerStandby(); // test kludge
return pass ? EXEC_CC_PASS : EXEC_CC_FAIL;
}
/****************************************************************************/
/* ARM exception report and system shutdown. */
/****************************************************************************/
static void _sysException( char *eType, uint08 faultCode )
{
char errString[80];
uint32 exceptionAddr = INT_GetR14FromException();
/****************************************************/
/* Shut down lamp and color wheel. These operations */
/* are performed locally rather than calling the */
/* expected illum_powerStandby() function. This is */
/* done to avoid printing debug messages and making */
/* API calls that cannot be performed in an */
/* exception handler. */
/****************************************************/
INT_DisableARMInterrupts(); /* prevents re-enable of ints in API calls */
LMP_Enable( FALSE );
DMD_Park();
CW_Stop();
DMD_Power( FALSE );
/****************************************************/
/* Report exception. String formatting is done lo- */
/* cally rather than calling the expected debug */
/* message to avoid its API calls that cannot be */
/* performed in an exception handler. */
/****************************************************/
sprintf( errString, "*** %s near %08x ***\r\n\n", eType, exceptionAddr );
dbmsg_ptrace( errString ); /* polled output */
llFault( faultCode, FALSE );
}
/****************************************************************************/
/* Data abort exception. */
/****************************************************************************/
static void _sysExceptionDataAbort( void )
{
_sysException( "Data abort", LLFAULT_EX_DATA );
}
/****************************************************************************/
/* Instruction prefetch exception. */
/****************************************************************************/
static void _sysExceptionPrefetchAbort( void )
{
_sysException( "Prefetch abort", LLFAULT_EX_PREFETCH );
}
/****************************************************************************/
/* Undefined instruction exception. */
/****************************************************************************/
static void _sysExceptionUndefInstruction( void )
{
_sysException( "Undefined instruction", LLFAULT_EX_INSTRUCT );
}
/****************************************************************************/
/* Set application configuration addresses. */
/****************************************************************************/
BOOL _sysSetCfgAddr( void )
{
struct appconfigstruct *pAppCfg; /* pointer to configuration structure */
if( PASS != FLASH_GetFlashAddr( APPL_CONFIG, 0, (uint32*)&pAppCfg ))
return FALSE;
gpSettings = &pAppCfg -> Settings; /* EEPROM settings */
gpConfiguration = &pAppCfg -> Defaults; /* App Config */
gpCalStructure = &pAppCfg -> Calibration; /* Calibration */
gpEdidStructure = &pAppCfg -> Edid; /* Edid data arrays */
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -