Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -r1afb454d97cc2b73d61ea291205a6ed06d85577d -r933a18d740285e70be9d00696ed0f5a5381bc8e4 --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 1afb454d97cc2b73d61ea291205a6ed06d85577d) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 933a18d740285e70be9d00696ed0f5a5381bc8e4) @@ -18,7 +18,7 @@ #include "mibspi.h" #include "AlarmLamp.h" -#include "OperationModes.h" +#include "OperationModes.h" #include "SystemCommMessages.h" #include "TaskGeneral.h" #include "Timers.h" @@ -37,7 +37,9 @@ #define ALM_ESC_1_MIN (1 * SEC_PER_MIN * MS_PER_SECOND) ///< Number of ms in 1 minute. #define ALM_ESC_4_MIN (4 * SEC_PER_MIN * MS_PER_SECOND) ///< Number of ms in 4 minutes. #define ALM_ESC_5_MIN (5 * SEC_PER_MIN * MS_PER_SECOND) ///< Number of ms in 5 minutes. -#define ALM_ESC_10_MIN (10 * SEC_PER_MIN * MS_PER_SECOND) ///< Number of ms in 10 minutes. +#define ALM_ESC_10_MIN (10 * SEC_PER_MIN * MS_PER_SECOND) ///< Number of ms in 10 minutes. + +#define SUPERVISOR_ALARM_KEY 0xD2C3B4A5 ///< 32-bit key required for clear all alarms request. #pragma pack(push,1) /// Record defining the properties of each individual alarm. @@ -160,12 +162,13 @@ { ALARM_PRIORITY_HIGH, 0, ALARM_ID_NO_ALARM, TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , FALSE }, // ALARM_ID_DG_THERMISOTRS_TEMPERATURE_OUT_OF_RANGE { ALARM_PRIORITY_HIGH, 0, ALARM_ID_NO_ALARM, TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , FALSE }, // ALARM_ID_DG_FAN_RPM_OUT_OF_RANGE { ALARM_PRIORITY_HIGH, 0, ALARM_ID_NO_ALARM, TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , FALSE }, // ALARM_ID_DG_DIALYSATE_FILL_OUT_OF_TIME - { ALARM_PRIORITY_HIGH, 0, ALARM_ID_NO_ALARM, TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , FALSE }, // ALARM_ID_CP1_SPEED_CONTROL_ERROR = 100 - { ALARM_PRIORITY_HIGH, 0, ALARM_ID_NO_ALARM, TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , FALSE }, // ALARM_ID_CP2_SPEED_CONTROL_ERROR = 101 - { ALARM_PRIORITY_HIGH, 0, ALARM_ID_NO_ALARM, TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , FALSE }, // ALARM_ID_FLOW_RATE_OUT_OF_RANGE = 102 + { ALARM_PRIORITY_HIGH, 0, ALARM_ID_NO_ALARM, TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , FALSE }, // ALARM_ID_CP1_SPEED_CONTROL_ERROR + { ALARM_PRIORITY_HIGH, 0, ALARM_ID_NO_ALARM, TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , FALSE }, // ALARM_ID_CP2_SPEED_CONTROL_ERROR + { ALARM_PRIORITY_HIGH, 0, ALARM_ID_NO_ALARM, TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , FALSE }, // ALARM_ID_FLOW_RATE_OUT_OF_RANGE { ALARM_PRIORITY_HIGH, 0, ALARM_ID_NO_ALARM, TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , FALSE }, // ALARM_ID_RO_PUMP_PRESSURE_OUT_OF_RANGE { ALARM_PRIORITY_HIGH, 0, ALARM_ID_NO_ALARM, TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , FALSE }, // ALARM_ID_DRAIN_PUMP_RPM_OUT_OF_RANGE { ALARM_PRIORITY_HIGH, 0, ALARM_ID_NO_ALARM, TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , FALSE }, // ALARM_ID_DG_HEATERS_NEGATIVE_COLD_JUNCTION_TEMPERATURE + { ALARM_PRIORITY_HIGH, 0, ALARM_ID_NO_ALARM, TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , TRUE , FALSE }, // ALARM_ID_DG_HEATERS_FAULT }; // *** This declaration will cause a compiler error if alarmTable does not have same # of alarms as the Alarm_List enumeration. @@ -869,6 +872,7 @@ { BOOL result = FALSE; + // verify tester has logged in with HD if ( TRUE == isTestingActivated() ) { U32 intvl = value / TASK_GENERAL_INTERVAL; @@ -893,6 +897,7 @@ { BOOL result = FALSE; + // verify tester has logged in with HD if ( TRUE == isTestingActivated() ) { result = TRUE; @@ -920,6 +925,7 @@ if ( alarmID < NUM_OF_ALARM_IDS ) { + // verify tester has logged in with HD if ( TRUE == isTestingActivated() ) { if ( TRUE == state ) @@ -952,6 +958,7 @@ if ( alarmID < NUM_OF_ALARM_IDS ) { + // verify tester has logged in with HD if ( TRUE == isTestingActivated() ) { result = TRUE; @@ -978,6 +985,7 @@ if ( alarmID < NUM_OF_ALARM_IDS ) { + // verify tester has logged in with HD if ( TRUE == isTestingActivated() ) { U32 tim = getMSTimerCount(); @@ -1009,6 +1017,7 @@ if ( alarmID < NUM_OF_ALARM_IDS ) { + // verify tester has logged in with HD if ( TRUE == isTestingActivated() ) { result = TRUE; @@ -1018,6 +1027,50 @@ } return result; +} + +/*********************************************************************//** + * @brief + * The testClearAllAlarms function clears all active alarms, even if they + * are non-recoverable or faults. The caller of this function must provide + * the correct 32-bit key. A Dialin user must also be logged into HD. + * @details Inputs: none + * @details Outputs: alarmIsActive[], alarmStartedAt[] + * @param key 32-bit supervior alarm key required to perform this function + * @return TRUE if override reset successful, FALSE if not + *************************************************************************/ +BOOL testClearAllAlarms( U32 key ) +{ + BOOL result = FALSE; + + // verify key + if ( SUPERVISOR_ALARM_KEY == key ) + { + // verify tester has logged in with HD + if ( TRUE == isTestingActivated() ) + { + ALARM_ID_T a; + + // clear all active alarms + for ( a = ALARM_ID_NO_ALARM; a < NUM_OF_ALARM_IDS; a++ ) + { + if ( TRUE == alarmIsActive[ a ] ) + { + broadcastAlarmCleared( a ); + alarmIsActive[ a ] = FALSE; + alarmStartedAt[ a ].data = 0; + // clear FIFO if this alarm was in it + if ( alarmPriorityFIFO[ alarmTable[ a ].alarmPriority ] == a ) + { + resetAlarmPriorityFIFO( alarmTable[ a ].alarmPriority ); + } + } + } + result = TRUE; + } + } + + return result; } /**@}*/