Index: Integrity.c =================================================================== diff -u -r5a6ad1d7cd7a517fbf0a8eb1293cb6d4d0dff13b -r597d414dea37e4c05518cd81b1043d2cd3fc8219 --- Integrity.c (.../Integrity.c) (revision 5a6ad1d7cd7a517fbf0a8eb1293cb6d4d0dff13b) +++ Integrity.c (.../Integrity.c) (revision 597d414dea37e4c05518cd81b1043d2cd3fc8219) @@ -24,6 +24,8 @@ #include "SystemCommMessages.h" #include "TaskGeneral.h" #include "Utilities.h" +#include "DGDefs.h" +#include "HDDefs.h" /** * @addtogroup Integrity @@ -52,6 +54,8 @@ static SELF_TEST_STATUS_T integrityTestStatus; ///< Current firmware integrity test status. static U32 processorRAMStatusCounter = 0; ///< Counter used to check processor RAM error. static BOOL singleBitRAMErrorFlag = FALSE; ///< Flag to signal the processor RAM error. +/// Time threshold to check RAM error is 2 seconds +static const U32 RAM_ERROR_CHECK_TIME_THRESHOLD = ((2 * MS_PER_SECOND) / TASK_GENERAL_INTERVAL); /*********************************************************************//** * @brief Index: PersistentAlarm.c =================================================================== diff -u -r5a6ad1d7cd7a517fbf0a8eb1293cb6d4d0dff13b -r597d414dea37e4c05518cd81b1043d2cd3fc8219 --- PersistentAlarm.c (.../PersistentAlarm.c) (revision 5a6ad1d7cd7a517fbf0a8eb1293cb6d4d0dff13b) +++ PersistentAlarm.c (.../PersistentAlarm.c) (revision 597d414dea37e4c05518cd81b1043d2cd3fc8219) @@ -220,6 +220,64 @@ persistentAlarms[ alarmId ].errorClearedStartTime = 0; } +/*********************************************************************//** + * @brief + * The checkFPGAPersistentAlarms function checks the FPGA persistent alarm + * status of the provided FPGA persistent alarm group. + * @details Inputs: fpgaPersistentAlarmGroup + * @details Outputs: fpgaPersistentAlarmGroup + * @param alarmGroup which is the alarm group of the persistent alarm + * (i.e. 2-wire temperature sensor) + * @param errorCount which is the FPGA error count of the sensor group + * @param readCount which is the FPGA read count of the sensor group + * @return none + *************************************************************************/ +void checkFPGAPersistentAlarms( FPGA_PERSISTENT_ALARMS_GROUP_T group, U32 errorCount, U32 readCount ) +{ + if ( group < NUM_OF_FPGA_SENSOR_GROUPS ) + { + FPGA_ERROR_TYPE_T type = NUM_OF_FPGA_ERROR_TYPES; + BOOL isReadPersTrgrd = isFPGAPersistentAlarmTriggered( &fpgaPersistentAlarmGroup[ group ], readCount, FPGA_READ_ERROR ); + BOOL isErroPersTrgrd = isFPGAPersistentAlarmTriggered( &fpgaPersistentAlarmGroup[ group ], errorCount, FPGA_ERROR_ERROR ); + + if ( TRUE == isReadPersTrgrd ) + { + type = FPGA_READ_ERROR; + } + + if ( TRUE == isErroPersTrgrd ) + { + type = FPGA_ERROR_ERROR; + } + + if ( ( TRUE == isReadPersTrgrd ) || ( TRUE == isErroPersTrgrd ) ) + { + SET_ALARM_WITH_2_U32_DATA( fpgaPersistentAlarmGroup[ group ].fpgaAlarm, type, group ); + } + } + else + { +#ifdef _DG_ + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_FPGA_SENSOR_GROUP_SELECTED, (U32)group ); +#endif +#ifdef _HD_ + //SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_INVALID_FPGA_SENSOR_GROUP_SELECTED, (U32)group ); +#endif + } +} + +/*********************************************************************//** + * @brief + * The isFPGAPersistentAlarmTriggered function checks whether persistent alarm + * has been triggered or not. + * @details Inputs: alarmGroup + * @details Outputs: alarmGroup + * @param alarmGroup which is the alarm group of the persistent alarm + * (i.e. 2-wire temperature sensor) + * @param fpgaCount which is the FPGA count of the sensor group + * @param errorType which is the FPGA error type (i.e. read or error count) + * @return TRUE if the persistent alarm is triggered otherwise, FALSE + *************************************************************************/ static BOOL isFPGAPersistentAlarmTriggered( FPGA_PERSISTENT_ALARM_GROUP_T* alarmGroup, U32 fpgaCount, FPGA_ERROR_TYPE_T errorType ) { BOOL isPersistentTriggered = FALSE;