Index: Common.h =================================================================== diff -u -rcfa1142455dbcebceda091ae61e5d1f5e889fa6e -r1eb896aac1f2d3ab20bf8c1a2a8e751b8df6a740 --- Common.h (.../Common.h) (revision cfa1142455dbcebceda091ae61e5d1f5e889fa6e) +++ Common.h (.../Common.h) (revision 1eb896aac1f2d3ab20bf8c1a2a8e751b8df6a740) @@ -177,6 +177,79 @@ activateAlarm2Data( a, dat1, dat2 ); \ } +/// Record structure for unsigned integer event data. +typedef struct +{ + U32 data; ///< Event data of unsigned integer type. +} EVENT_DATA_U32_T; + +/// Record structure for signed integer event data. +typedef struct +{ + S32 data; ///< Event data of signed integer type. +} EVENT_DATA_S32_T; + +/// Record structure for floating point event data. +typedef struct +{ + F32 data; ///< Event data of floating point type. +} EVENT_DATA_F32_T; + +/// Record structure for boolean event data. +typedef struct +{ + BOOL data; ///< Event data of boolean type. +} EVENT_DATA_BOOL_T; + +/// Record structure for event data of any supported type. +typedef union +{ + EVENT_DATA_U32_T uInt; ///< Event data of unsigned integer type. + EVENT_DATA_S32_T sInt; ///< Event data of signed integer type. + EVENT_DATA_F32_T flt; ///< Event data of floating point type. + EVENT_DATA_BOOL_T bln; ///< Event data of boolean type. +} EVENT_DATAS_T; + +/// Event data types list. +typedef enum Event_Data_Types +{ + EVENT_DATA_TYPE_NONE = 0, ///< No data given. + EVENT_DATA_TYPE_U32 = 1, ///< Event data is unsigned 32-bit integer type. + EVENT_DATA_TYPE_S32 = 2, ///< Event data is signed 32-bit integer type. + EVENT_DATA_TYPE_F32 = 3, ///< Event data is 32-bit floating point type. + EVENT_DATA_TYPE_BOOL = 4, ///< Event data is 32-bit boolean type. + NUM_OF_EVENT_DATA_TYPES ///< Total number of event data types. +} EVENT_DATA_TYPES_T; + +/// Record structure for event data including the data type to aid in interpretation. +typedef struct +{ + EVENT_DATA_TYPES_T dataType; ///< The type of event data provided. + EVENT_DATAS_T data; ///< The event data of specified type. +} EVENT_DATA_T; + +/// Macro to set a specific alarm with 2 pieces of unsigned 32-bit alarm data. +#define SEND_EVENT_WITH_2_U32_DATA(e,d1,d2) { \ + EVENT_DATA_T dat1; \ + EVENT_DATA_T dat2; \ + dat1.dataType = EVENT_DATA_TYPE_U32; \ + dat1.data.uInt.data = (U32)(d1); \ + dat2.dataType = EVENT_DATA_TYPE_U32; \ + dat2.data.uInt.data = (U32)(d2); \ + sendEvent( e, dat1, dat2 ); \ +} + +/// Macro to set a specific alarm with 2 pieces of floating point alarm data. +#define SEND_EVENT_WITH_2_F32_DATA(e,d1,d2) { \ + EVENT_DATA_T dat1; \ + EVENT_DATA_T dat2; \ + dat1.dataType = EVENT_DATA_TYPE_F32; \ + dat1.data.flt.data = (F32)(d1); \ + dat2.dataType = EVENT_DATA_TYPE_F32; \ + dat2.data.flt.data = (F32)(d2); \ + sendEvent( e, dat1, dat2 ); \ +} + // **** VectorCAST Definitions **** #ifdef _VECTORCAST_