Index: firmware/App/Services/AlarmMgmt.h =================================================================== diff -u -rd830f37cf6a42a16399c87985bd51dfd9312ced3 -r60a95cb6e1325abd179b4a01d83b8aabe20ccda5 --- firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision d830f37cf6a42a16399c87985bd51dfd9312ced3) +++ firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 60a95cb6e1325abd179b4a01d83b8aabe20ccda5) @@ -1,4 +1,4 @@ -/************************************************************************** +/**********************************************************************//** * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. * @@ -17,123 +17,96 @@ #ifndef __ALARM_MGMT_H__ #define __ALARM_MGMT_H__ -// ********** public definitions ********** +#include "Common.h" -typedef enum Alarm_List -{ - ALARM_ID_NO_ALARM = 0, - ALARM_ID_SOFTWARE_FAULT, - ALARM_ID_STUCK_BUTTON_TEST_FAILED, - ALARM_ID_FPGA_POST_TEST_FAILED, - ALARM_ID_WATCHDOG_POST_TEST_FAILED, - ALARM_ID_UI_COMM_POST_FAILED, // 5 - ALARM_ID_BLOOD_PUMP_MC_CURRENT_CHECK, - ALARM_ID_BLOOD_PUMP_MC_SPEED_CHECK, - ALARM_ID_BLOOD_PUMP_MC_DIRECTION_CHECK, - ALARM_ID_BLOOD_PUMP_ROTOR_SPEED_CHECK, - ALARM_ID_DIAL_IN_PUMP_MC_CURRENT_CHECK, // 10 - ALARM_ID_DIAL_IN_PUMP_MC_SPEED_CHECK, - ALARM_ID_DIAL_IN_PUMP_MC_DIRECTION_CHECK, - ALARM_ID_DIAL_IN_PUMP_ROTOR_SPEED_CHECK, - ALARM_ID_DIAL_OUT_PUMP_MC_CURRENT_CHECK, - ALARM_ID_DIAL_OUT_PUMP_MC_SPEED_CHECK, // 15 - ALARM_ID_DIAL_OUT_PUMP_MC_DIRECTION_CHECK, - ALARM_ID_DIAL_OUT_PUMP_ROTOR_SPEED_CHECK, - ALARM_ID_WATCHDOG_EXPIRED, - ALARM_ID_RTC_COMM_ERROR, - ALARM_ID_RTC_CONFIG_ERROR, // 20 - ALARM_ID_DG_COMM_TIMEOUT, - ALARM_ID_UI_COMM_TIMEOUT, - ALARM_ID_COMM_TOO_MANY_BAD_CRCS, - ALARM_ID_TREATMENT_STOPPED_BY_USER, - ALARM_ID_BLOOD_SITTING_WARNING, // 25 - ALARM_ID_BLOOD_SITTING_TOO_LONG_NO_RESUME, - ALARM_ID_BLOOD_SITTING_TOO_LONG_NO_RINSEBACK, - ALARM_ID_CAN_MESSAGE_NOT_ACKED, - ALARM_ID_OCCLUSION_BLOOD_PUMP, - ALARM_ID_OCCLUSION_DIAL_IN_PUMP, // 30 - ALARM_ID_OCCLUSION_DIAL_OUT_PUMP, - ALARM_ID_ARTERIAL_PRESSURE_LOW, - ALARM_ID_ARTERIAL_PRESSURE_HIGH, - ALARM_ID_VENOUS_PRESSURE_LOW, - ALARM_ID_VENOUS_PRESSURE_HIGH, // 35 - NUM_OF_ALARM_IDS -} ALARM_ID_T; +/** + * @defgroup AlarmManagement AlarmManagement + * @brief Alarm Management service module. Provides general alarm management \n + * functionality including support functions for triggering and clearing \n + * specific alarms. + * + * @addtogroup AlarmManagement + * @{ + */ -typedef enum Alarm_Priorities -{ - ALARM_PRIORITY_NONE = 0, - ALARM_PRIORITY_LOW, - ALARM_PRIORITY_MEDIUM, - ALARM_PRIORITY_HIGH, - NUM_OF_ALARM_PRIORITIES -} ALARM_PRIORITY_T; +// ********** public definitions ********** +#include "AlarmDefs.h" + +/// Alarm data types list. typedef enum Alarm_Data_Types { - ALARM_DATA_TYPE_NONE = 0, - ALARM_DATA_TYPE_U32, - ALARM_DATA_TYPE_S32, - ALARM_DATA_TYPE_F32, - ALARM_DATA_TYPE_BOOL, - NUM_OF_ALARM_DATA_TYPES + ALARM_DATA_TYPE_NONE = 0, ///< No data given. + ALARM_DATA_TYPE_U32 = 1, ///< Alarm data is unsigned 32-bit integer type. + ALARM_DATA_TYPE_S32 = 2, ///< Alarm data is signed 32-bit integer type. + ALARM_DATA_TYPE_F32 = 3, ///< Alarm data is 32-bit floating point type. + ALARM_DATA_TYPE_BOOL = 4, ///< Alarm data is 32-bit boolean type. + NUM_OF_ALARM_DATA_TYPES ///< Total # of alarm data types. } ALARM_DATA_TYPES_T; #pragma pack(push,4) +/// Record structure for detailing the properties of the current composite alarm status. typedef struct { - ALARM_PRIORITY_T alarmsState; // current alarm priority level - BOOL alarmsSilenced; // alarms are currently silenced? - U32 alarmsSilenceStart; // time stamp for when alarms were silenced (ms) - U32 alarmsSilenceExpiresIn; // time until alarm silence expires (seconds) - BOOL alarmsToEscalate; // are any active alarms due to escalate (should UI show count down timer?) - U32 alarmsEscalatesIn; // time until alarm will escalate (seconds) - ALARM_ID_T alarmTop; // ID of current top alarm that will drive lamp/audio and UI should be displaying right now - BOOL systemFault; // a system fault is active? - BOOL stop; // we should be in controlled stop right now - BOOL noClear; // no recovery will be possible - BOOL noResume; // treatment may not be resumed at this time - BOOL noRinseback; // rinseback may not be initiated at this time - BOOL noEndTreatment; // ending the treatment is not an option at this time - BOOL noNewTreatment; // no new treatments may be started even if current treatment is ended - BOOL bypassDialyzer; // the dialyzer should be bypassed at this time + ALARM_PRIORITY_T alarmsState; ///< current alarm priority level + BOOL alarmsSilenced; ///< alarms are currently silenced? + U32 alarmsSilenceStart; ///< time stamp for when alarms were silenced (ms) + U32 alarmsSilenceExpiresIn; ///< time until alarm silence expires (seconds) + BOOL alarmsToEscalate; ///< are any active alarms due to escalate (should UI show count down timer?) + U32 alarmsEscalatesIn; ///< time until alarm will escalate (seconds) + ALARM_ID_T alarmTop; ///< ID of current top alarm that will drive lamp/audio and UI should be displaying right now + BOOL systemFault; ///< a system fault is active? + BOOL stop; ///< we should be in controlled stop right now + BOOL noClear; ///< no recovery will be possible + BOOL noResume; ///< treatment may not be resumed at this time + BOOL noRinseback; ///< rinseback may not be initiated at this time + BOOL noEndTreatment; ///< ending the treatment is not an option at this time + BOOL noNewTreatment; ///< no new treatments may be started even if current treatment is ended + BOOL bypassDialyzer; ///< the dialyzer should be bypassed at this time } COMP_ALARM_STATUS_T; +/// Record structure for unsigned integer alarm data. typedef struct { - U32 data; + U32 data; ///< Alarm data of unsigned integer type. } ALARM_DATA_U32_T; +/// Record structure for signed integer alarm data. typedef struct { - S32 data; + S32 data; ///< Alarm data of signed integer type. } ALARM_DATA_S32_T; +/// Record structure for floating point alarm data. typedef struct { - F32 data; + F32 data; ///< Alarm data of floating point type. } ALARM_DATA_F32_T; +/// Record structure for boolean alarm data. typedef struct { - BOOL data; + BOOL data; ///< Alarm data of boolean type. } ALARM_DATA_BOOL_T; +/// Record structure for alarm data of any supported type. typedef union { - ALARM_DATA_U32_T uInt; - ALARM_DATA_S32_T sInt; - ALARM_DATA_F32_T flt; - ALARM_DATA_BOOL_T bln; + ALARM_DATA_U32_T uInt; ///< Alarm data of unsigned integer type. + ALARM_DATA_S32_T sInt; ///< Alarm data of signed integer type. + ALARM_DATA_F32_T flt; ///< Alarm data of floating point type. + ALARM_DATA_BOOL_T bln; ///< Alarm data of boolean type. } ALARM_DATAS_T; +/// Record structure for alarm data including the data type to aid in interpretation. typedef struct { - ALARM_DATA_TYPES_T dataType; - ALARM_DATAS_T data; + ALARM_DATA_TYPES_T dataType; ///< The type of alarm data provided. + ALARM_DATAS_T data; ///< The alarm data of specified type. } ALARM_DATA_T; #pragma pack(pop) +// Listing of specific software faults for logging purposes. typedef enum { SW_FAULT_ID_NONE = 0, @@ -203,6 +176,8 @@ void clearAlarm( ALARM_ID_T alarm ); BOOL isAlarmActive( ALARM_ID_T alarm ); +/**@}*/ + BOOL testSetAlarmStatusPublishIntervalOverride( U32 value ); BOOL testResetAlarmStatusPublishIntervalOverride( void ); BOOL testSetAlarmStateOverride( U32 alarmID, BOOL value );