/************************************************************************** * * Copyright (c) 2024-2025 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file AlarmMgmt.h * * @author (last) Michael Garthwaite * @date (last) 11-Sep-2025 * * @author (original) Sean Nash * @date (original) 01-Aug-2024 * ***************************************************************************/ #ifndef __ALARM_MGMT_H__ #define __ALARM_MGMT_H__ #ifdef _TD_ #include "TDCommon.h" #endif #ifdef _DD_ #include "DDCommon.h" #endif #include "AlarmDefs.h" #include "AlarmMgmtSWFaults.h" #include "MessageSupport.h" /** * @defgroup AlarmManagement AlarmManagement * @brief Alarm Management service unit. Provides general alarm management * functionality including support functions for triggering and clearing * specific alarms. * * @addtogroup AlarmManagement * @{ */ #pragma pack(push, 4) /// Record structure for unsigned integer alarm data. typedef struct { U32 data; ///< Alarm data of unsigned integer type. } ALARM_DATA_U32_T; /// Record structure for signed integer alarm data. typedef struct { S32 data; ///< Alarm data of signed integer type. } ALARM_DATA_S32_T; /// Record structure for floating point alarm data. typedef struct { F32 data; ///< Alarm data of floating point type. } ALARM_DATA_F32_T; /// Record structure for boolean alarm data. typedef struct { 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 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; ///< The type of alarm data provided. ALARM_DATAS_T data; ///< The alarm data of specified type. } ALARM_DATA_T; /// Payload record structure for the alarm triggered message. typedef struct { U32 alarm; ///< ID of alarm that was triggered U32 almDataType1; ///< Supporting data type #1 U32 almData1; ///< Supporting data #1 U32 almDataType2; ///< Supporting data type #2 U32 almData2; ///< Supporting data #2 U32 almPriority; ///< Alarm priority U32 almRank; ///< Alarm rank BOOL almClrTopOnly; ///< Alarm clear (when on top) should only clear top alarm } ALARM_TRIGGERED_PAYLOAD_T; #pragma pack(pop) /// Alarm ID data publish typedef struct { U32 alarmID; ///< Alarm ID. } ALARM_ID_DATA_PUBLISH_T; // ********** public function prototypes ********** void initAlarmMgmt( void ); #if defined (__ALARM_MGMT_C__) || defined(__ALARM_MGMT_DD_C__) || defined(__ALARM_MGMT_TD_C__) || defined(__ALARM_MGMT_FP_C__) ALARM_T getAlarmProperties( ALARM_ID_T alarm ); ALARM_RANK_T getAlarmRank( U32 index ); #endif void activateAlarm( ALARM_ID_T alarm ); void clearAlarm( ALARM_ID_T alarm ); void clearAlarmCondition( ALARM_ID_T alarm ); void setAlarmActive( ALARM_ID_T alarm, BOOL active ); void setAlarmConditionDetected( ALARM_ID_T alarm, BOOL detected ); BOOL isAlarmActive( ALARM_ID_T alarm ); BOOL isAlarmConditionDetected( ALARM_ID_T alarm ); BOOL isAlarmRecoverable( ALARM_ID_T alarm ); BOOL testAlarmStateOverride( MESSAGE_T *message ); /**@}*/ #endif