Index: firmware/App/Services/AlarmMgmt.c =================================================================== diff -u -r4459be59bdc2896b44bcf6cd42d2762190e23c16 -r8dad6fab1c33602ad94908fd31b8b15153a9eb6e --- firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 4459be59bdc2896b44bcf6cd42d2762190e23c16) +++ firmware/App/Services/AlarmMgmt.c (.../AlarmMgmt.c) (revision 8dad6fab1c33602ad94908fd31b8b15153a9eb6e) @@ -144,25 +144,25 @@ const ALARM_DATA_T blankAlarmData = { ALARM_DATA_TYPE_NONE, 0 }; // pin assignment for backup alarm audio enable -#define BACKUP_AUDIO_ENABLE_SPI3_PORT_MASK 0x00000001 // (SPI3-CS0 - re-purposed as output GPIO) +#define BACKUP_AUDIO_ENABLE_SPI3_PORT_MASK 0x00000001 ///< pin SPI3-CS0 - re-purposed as output GPIO for back audio enable. // backup alarm audio enable/disable macros -#define SET_BACKUP_AUDIO_ENABLE() {mibspiREG3->PC3 |= BACKUP_AUDIO_ENABLE_SPI3_PORT_MASK;} -#define CLR_BACKUP_AUDIO_ENABLE() {mibspiREG3->PC3 &= ~BACKUP_AUDIO_ENABLE_SPI3_PORT_MASK;} +#define SET_BACKUP_AUDIO_ENABLE() {mibspiREG3->PC3 |= BACKUP_AUDIO_ENABLE_SPI3_PORT_MASK;} ///< Macro to enable backup alarm audio. +#define CLR_BACKUP_AUDIO_ENABLE() {mibspiREG3->PC3 &= ~BACKUP_AUDIO_ENABLE_SPI3_PORT_MASK;} ///< Macro to disable backup alarm audio. // ********** private data ********** /// interval (in ms) at which to publish alarm status to CAN bus DATA_DECL( U32, AlarmStatusPub, alarmStatusPublishInterval, ALARM_STATUS_PUBLISH_INTERVAL, ALARM_STATUS_PUBLISH_INTERVAL ); -static U32 alarmStatusPublicationTimerCounter = 0; ///< Used to schedule alarm status publication to CAN bus. +static U32 alarmStatusPublicationTimerCounter = 0; ///< Used to schedule alarm status publication to CAN bus. /// table - current state of each alarm static BOOL alarmIsActive[ NUM_OF_ALARM_IDS ]; /// table - when alarm became active for each alarm (if active) or zero (if inactive) DATA_ARRAY_DECL( U32, AlarmStarts, NUM_OF_ALARM_IDS, alarmStartedAt ); -static COMP_ALARM_STATUS_T alarmStatus; ///< Record for the current composite alarm status. +static COMP_ALARM_STATUS_T alarmStatus; ///< Record for the current composite alarm status. -static ALARM_ID_T alarmPriorityFIFO[ NUM_OF_ALARM_PRIORITIES ]; +static ALARM_ID_T alarmPriorityFIFO[ NUM_OF_ALARM_PRIORITIES ]; ///< FIFO - first activated alarm in each alarm priority category. // ********** private function prototypes ********** @@ -179,8 +179,8 @@ static DATA_ARRAY_GET_PROTOTYPE( U32, getAlarmStartTime, alarmID ); static DATA_GET_PROTOTYPE( U32, getPublishAlarmStatusInterval ); -/************************************************************************* - * @brief initAlarmMgmt +/*********************************************************************//** + * @brief * The initAlarmMgmt function initializes the AlarmMgmt module. * @details * Inputs : none @@ -226,14 +226,14 @@ alarmStatus.bypassDialyzer = FALSE; } -/************************************************************************* - * @brief execAlarmMgmt +/*********************************************************************//** + * @brief * The execAlarmMgmt function executes the alarm management functions to be * done periodically. The composite alarm state is updated, alarm lamp and * audio patterns are updated, and status is sent out to the rest of the system. * @details - * Inputs : larmStatusTable[], alarmTable[] - * Outputs : larmStatus + * Inputs : alarmStatusTable[], alarmTable[] + * Outputs : alarmStatus * @return none *************************************************************************/ void execAlarmMgmt( void ) @@ -251,8 +251,8 @@ } } -/************************************************************************* - * @brief activateAlarm +/*********************************************************************//** + * @brief * The activateAlarm function activates a given alarm. * @details * Inputs : none @@ -288,16 +288,15 @@ } } -/************************************************************************* - * @brief activateAlarmNoData +/*********************************************************************//** + * @brief * The activateAlarmNoData function activates a given alarm. Also, an alarm * message is broadcast to the rest of the system. This function will * include given data in the broadcast message for logging. * @details * Inputs : none * Outputs : alarm triggered message sent, alarm activated * @param alarm ID of alarm to activate - * @param alarmData supporting data to include in alarm msg * @return none *************************************************************************/ void activateAlarmNoData( ALARM_ID_T alarm ) @@ -322,8 +321,8 @@ #endif } -/************************************************************************* - * @brief activateAlarm1Data +/*********************************************************************//** + * @brief * The activateAlarm1Data function activates a given alarm. Also, an alarm * message is broadcast to the rest of the system. This function will * include given data in the broadcast message for logging. @@ -356,8 +355,8 @@ #endif } -/************************************************************************* - * @brief activateAlarm1Data +/*********************************************************************//** + * @brief * The activateAlarm2Data function activates a given alarm. Also, an alarm * message is broadcast to the rest of the system. This function will * include two given data in the broadcast message for logging. @@ -391,8 +390,8 @@ #endif } -/************************************************************************* - * @brief clearAlarm +/*********************************************************************//** + * @brief * The clearAlarm function clears a given alarm if it is recoverable. Also * an alarm message is broadcast to the rest of the system. * @details @@ -440,14 +439,14 @@ } } -/************************************************************************* - * @brief isAlarmActive +/*********************************************************************//** + * @brief * The isAlarmActive function determines whether a given alarm is currently * active. * @details * Inputs : alarmIsActive[] * Outputs : none - * @param alarmID ID of alarm to check + * @param alarm ID of alarm to check * @return TRUE if given alarm is active, FALSE if not *************************************************************************/ BOOL isAlarmActive( ALARM_ID_T alarm ) @@ -457,19 +456,40 @@ return result; } -/************************************************************************* - * @brief getAlarmStartTime +/*********************************************************************//** + * @brief * The getAlarmStartTime function gets the active state of a given alarm. * @details * Inputs : alarmStartedAt[] * Outputs : none * @param alarmID ID of alarm to check * @return The start time stamp of given alarm ID *************************************************************************/ -static DATA_ARRAY_GET( U32, getAlarmStartTime, alarmID, NUM_OF_ALARM_IDS-1, alarmStartedAt, 0 ) +U32 getAlarmStartTime( U32 alarmID ) +{ + U32 result = 0; + + if ( alarmID <= NUM_OF_ALARM_IDS-1 ) + { + if ( OVERRIDE_KEY == alarmStartedAt[ alarmID ].override ) + { + result = alarmStartedAt[ alarmID ].ovData; + } + else + { + result = alarmStartedAt[ alarmID ].data; + } + } + else + { + activateAlarmNoData( ALARM_ID_HD_SOFTWARE_FAULT ); + } + + return result; +} -/************************************************************************* - * @brief updateAlarmsState +/*********************************************************************//** + * @brief * The updateAlarmsState function updates the alarms state and alarm to * display. * @details @@ -507,8 +527,8 @@ alarmStatus.systemFault = faultsActive; } -/************************************************************************* - * @brief setAlarmLampAndAudio +/*********************************************************************//** + * @brief * The setAlarmLampAndAudio function sets the alarm lamp and audio patterns * according to the current state of alarms. * @details @@ -584,8 +604,8 @@ } } -/************************************************************************* - * @brief updateAlarmsSilenceStatus +/*********************************************************************//** + * @brief * The updateAlarmsSilenceStatus function updates the alarms silence state. * @details * Inputs : alarmStatus @@ -620,12 +640,12 @@ } } -/************************************************************************* - * @brief handleAlarmEscalations +/*********************************************************************//** + * @brief * The handleAlarmEscalations function handles alarm escalation. * @details - * Inputs : none - * Outputs : none + * Inputs : alarmIsActive[], alarmTable[] + * Outputs : alarm(s) escalated when appropriate * @return none *************************************************************************/ static void handleAlarmEscalations( void ) @@ -682,13 +702,13 @@ } } -/************************************************************************* - * @brief updateAlarmsFlags +/*********************************************************************//** + * @brief * The updateAlarmsFlags function updates the alarms flags of the alarms * status record. * @details * Inputs : none - * Outputs : none + * Outputs : alarmStatus * @return none *************************************************************************/ static void updateAlarmsFlags( void ) @@ -737,8 +757,8 @@ alarmStatus.bypassDialyzer = bypassDialyzer; } -/************************************************************************* - * @brief resetAlarmPriorityFIFO +/*********************************************************************//** + * @brief * The resetAlarmPriorityFIFO function resets a FIFO for a given alarm * priority. * @details @@ -760,27 +780,35 @@ } } -/************************************************************************* - * @brief getPublishAlarmStatusInterval +/*********************************************************************//** + * @brief * The getPublishAlarmStatusInterval function gets the alarm status * publication interval. * @details * Inputs : alarmStatusPublishInterval * Outputs : none * @return the current alarm status publication interval (in ms). *************************************************************************/ -DATA_GET( U32, getPublishAlarmStatusInterval, alarmStatusPublishInterval ) +U32 getPublishAlarmStatusInterval( void ) +{ + U32 result = alarmStatusPublishInterval.data; + + if ( OVERRIDE_KEY == alarmStatusPublishInterval.override ) + { + result = alarmStatusPublishInterval.ovData; + } + + return result; +} -/**@}*/ - /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ -/************************************************************************* - * @brief testSetAlarmStatusPublishIntervalOverride +/*********************************************************************//** + * @brief * The testSetAlarmStatusPublishIntervalOverride function overrides the * alarm status publish interval. * @details @@ -805,8 +833,8 @@ return result; } -/************************************************************************* - * @brief testResetAlarmStatusPublishIntervalOverride +/*********************************************************************//** + * @brief * The testResetAlarmStatusPublishIntervalOverride function resets the override * of the alarm status publish interval. * @details @@ -828,7 +856,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The testSetAlarmStateOverride function overrides the state of the * alarm active state for a given alarm with the alarm management with @@ -863,7 +891,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The testResetAlarmStateOverride function resets the override of the * state of the active state for a given alarm with the alarm management. @@ -889,8 +917,8 @@ return result; } -/************************************************************************* - * @brief testSetAlarmStartOverride +/*********************************************************************//** + * @brief * The testSetAlarmStartOverride function overrides the start time * for a given alarm with the alarm management with a given start time. * @details @@ -922,8 +950,8 @@ return result; } -/************************************************************************* - * @brief testResetAlarmStartOverride +/*********************************************************************//** + * @brief * The testResetAlarmStartOverride function resets the override of the * start time for a given alarm with the alarm management. * @details @@ -948,5 +976,5 @@ return result; } - - + +/**@}*/ Index: firmware/App/Services/AlarmMgmt.h =================================================================== diff -u -r4459be59bdc2896b44bcf6cd42d2762190e23c16 -r8dad6fab1c33602ad94908fd31b8b15153a9eb6e --- firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 4459be59bdc2896b44bcf6cd42d2762190e23c16) +++ firmware/App/Services/AlarmMgmt.h (.../AlarmMgmt.h) (revision 8dad6fab1c33602ad94908fd31b8b15153a9eb6e) @@ -107,7 +107,7 @@ } ALARM_DATA_T; #pragma pack(pop) -// Listing of specific software faults for logging purposes. +/// Listing of specific software faults for logging purposes. typedef enum { SW_FAULT_ID_NONE = 0, @@ -198,13 +198,13 @@ 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 ); BOOL testResetAlarmStateOverride( U32 alarmID ); BOOL testSetAlarmStartOverride( U32 alarmID, U32 value ); BOOL testResetAlarmStartOverride( U32 alarmID ); +/**@}*/ + #endif Index: firmware/App/Services/CommBuffers.c =================================================================== diff -u -r4459be59bdc2896b44bcf6cd42d2762190e23c16 -r8dad6fab1c33602ad94908fd31b8b15153a9eb6e --- firmware/App/Services/CommBuffers.c (.../CommBuffers.c) (revision 4459be59bdc2896b44bcf6cd42d2762190e23c16) +++ firmware/App/Services/CommBuffers.c (.../CommBuffers.c) (revision 8dad6fab1c33602ad94908fd31b8b15153a9eb6e) @@ -23,25 +23,30 @@ #include "SystemCommMessages.h" #include "Timers.h" +/** + * @addtogroup CommBuffers + * @{ + */ + // ********** private definitions ********** -#define COMM_BUFFER_LENGTH 512 // max bytes in each comm buffer (double if you count double buffers) -#define DOUBLE_BUFFERS 2 // need 2 buffers for double buffering -#define BUFFER_OVERFLOW_PERSISTENCE_MS 5000 // how many ms buffer overflows must persist before fault +#define COMM_BUFFER_LENGTH 512 ///< max bytes in each comm buffer (each side of double buffer is this size) +#define DOUBLE_BUFFERS 2 ///< need 2 buffers for double buffering +#define BUFFER_OVERFLOW_PERSISTENCE_MS 5000 ///< how many ms buffer overflows must persist before fault // ********** private data ********** -static volatile U32 commBufferByteCount[ NUM_OF_COMM_BUFFERS ][ DOUBLE_BUFFERS ]; // for each buffer, how many bytes does it contain? (also index to next available) -static volatile U32 activeDoubleBuffer[ NUM_OF_COMM_BUFFERS ]; // for each buffer, which double buffer is being fed right now? -static U08 commBuffers[ NUM_OF_COMM_BUFFERS ][ DOUBLE_BUFFERS ][ COMM_BUFFER_LENGTH ]; // each is double buffered to avoid thread contention -static U32 firstBufferOverflowTimeStamp = 0; // time stamp of a prior overflow event - allows for an overflow persistence check +static volatile U32 commBufferByteCount[ NUM_OF_COMM_BUFFERS ][ DOUBLE_BUFFERS ]; ///< for each buffer, how many bytes does it contain? (also index to next available) +static volatile U32 activeDoubleBuffer[ NUM_OF_COMM_BUFFERS ]; ///< for each buffer, which double buffer is being fed right now? +static U08 commBuffers[ NUM_OF_COMM_BUFFERS ][ DOUBLE_BUFFERS ][ COMM_BUFFER_LENGTH ]; ///< each is double buffered to avoid thread contention +static U32 firstBufferOverflowTimeStamp = 0; ///< time stamp of a prior overflow event - allows for an overflow persistence check // ********** private function prototypes ********** static U32 switchDoubleBuffer( COMM_BUFFER_T buffer ); static void getDataFromInactiveBuffer( COMM_BUFFER_T buffer, U08 *data, U32 len ); -/************************************************************************* +/*********************************************************************//** * @brief * The initCommBuffers function initializes the CommBuffers module. * @details @@ -60,7 +65,7 @@ } } -/************************************************************************* +/*********************************************************************//** * @brief * The clearBuffer function clears (empties) a given buffer. * Caller should ensure buffer won't be used while this function is clearing @@ -92,7 +97,7 @@ } } -/************************************************************************* +/*********************************************************************//** * @brief * The addToCommBuffer function adds data of specified length to a specified * communication buffer. S/W fault if buffer too full to add data. @@ -189,7 +194,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The getFromCommBuffer function fills a given byte array with a given * number of bytes from a given buffer and returns the number of bytes @@ -250,7 +255,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The peekFromCommBuffer function fills a given byte array with a given * number of bytes from a given buffer. This function does NOT consume @@ -308,7 +313,7 @@ return numOfBytesPeeked; } -/************************************************************************* +/*********************************************************************//** * @brief * The numberOfBytesInCommBuffer function determines how many bytes * are currently contained in a given comm buffer. Both double buffers @@ -339,7 +344,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The switchDoubleBuffer function switches the active and inactive buffers * for the given buffer. @@ -365,7 +370,7 @@ return inactiveBuffer; } -/************************************************************************* +/*********************************************************************//** * @brief * The getDataFromInactiveBuffer function retrieves a given number of bytes * from the inactive buffer of a given buffer. This function should only be @@ -402,3 +407,5 @@ switchDoubleBuffer( buffer ); // switch will zero count off inactive buffer } } + +/**@}*/ Index: firmware/App/Services/CommBuffers.h =================================================================== diff -u -rcd2ba56ddf9443fc624c21764e6478766b7fd6ed -r8dad6fab1c33602ad94908fd31b8b15153a9eb6e --- firmware/App/Services/CommBuffers.h (.../CommBuffers.h) (revision cd2ba56ddf9443fc624c21764e6478766b7fd6ed) +++ firmware/App/Services/CommBuffers.h (.../CommBuffers.h) (revision 8dad6fab1c33602ad94908fd31b8b15153a9eb6e) @@ -20,29 +20,40 @@ #include "HDCommon.h" +/** + * @defgroup CommBuffers CommBuffers + * @brief The communication buffers module provides buffering services for + * incoming and outgoing CAN data. A separate buffer is provided for each + * CAN ID (channel) so that frame order is maintained for a given channel. + * + * @addtogroup CommBuffers + * @{ + */ + // ********** public definitions ********** - + +/// Enumeration of CAN communication buffers. Buffers are ordered by priority. typedef enum Comm_Buffers { - COMM_BUFFER_NOT_USED = 0, // CAN message boxes start at 1 - COMM_BUFFER_OUT_CAN_HD_ALARM, - COMM_BUFFER_IN_CAN_DG_ALARM, - COMM_BUFFER_IN_CAN_UI_ALARM, - COMM_BUFFER_OUT_CAN_HD_2_DG, - COMM_BUFFER_IN_CAN_DG_2_HD, - COMM_BUFFER_OUT_CAN_HD_2_UI, - COMM_BUFFER_OUT_CAN_HD_BROADCAST, - COMM_BUFFER_IN_CAN_DG_BROADCAST, - COMM_BUFFER_IN_CAN_UI_2_HD, - COMM_BUFFER_IN_CAN_UI_BROADCAST, - COMM_BUFFER_IN_CAN_PC, - COMM_BUFFER_OUT_CAN_PC, - COMM_BUFFER_LAST_CAN_BUFFER = COMM_BUFFER_OUT_CAN_PC, + COMM_BUFFER_NOT_USED = 0, ///< CAN message boxes start at 1 so we will not use this buffer + COMM_BUFFER_OUT_CAN_HD_ALARM, ///< Buffer for outgoing HD alarm messages + COMM_BUFFER_IN_CAN_DG_ALARM, ///< Buffer for incoming DG alarm messages + COMM_BUFFER_IN_CAN_UI_ALARM, ///< Buffer for incoming UI alarm messages + COMM_BUFFER_OUT_CAN_HD_2_DG, ///< Buffer for outgoing HD to DG messages + COMM_BUFFER_IN_CAN_DG_2_HD, ///< Buffer for incoming DG to HD messages + COMM_BUFFER_OUT_CAN_HD_2_UI, ///< Buffer for outgoing HD to UI messages + COMM_BUFFER_OUT_CAN_HD_BROADCAST, ///< Buffer for outgoing HD broadcast messages + COMM_BUFFER_IN_CAN_DG_BROADCAST, ///< Buffer for incoming DG broadcast messages + COMM_BUFFER_IN_CAN_UI_2_HD, ///< Buffer for incoming UI to HD messages + COMM_BUFFER_IN_CAN_UI_BROADCAST, ///< Buffer for incoming UI broadcast messages + COMM_BUFFER_IN_CAN_PC, ///< Buffer for incoming PC to HD messages + COMM_BUFFER_OUT_CAN_PC, ///< Buffer for outgoing HD to PC messages + COMM_BUFFER_LAST_CAN_BUFFER = COMM_BUFFER_OUT_CAN_PC, ///< Last CAN buffer #ifdef DEBUG_ENABLED COMM_BUFFER_IN_UART_PC, COMM_BUFFER_OUT_UART_PC, #endif - NUM_OF_COMM_BUFFERS + NUM_OF_COMM_BUFFERS ///< Number of CAN communication buffers } COMM_BUFFER_T; // ********** public function prototypes ********** @@ -54,4 +65,6 @@ U32 peekFromCommBuffer( COMM_BUFFER_T buffer, U08 *data, U32 len ); U32 numberOfBytesInCommBuffer( COMM_BUFFER_T buffer ); +/**@}*/ + #endif Index: firmware/App/Services/Interrupts.c =================================================================== diff -u -r4459be59bdc2896b44bcf6cd42d2762190e23c16 -r8dad6fab1c33602ad94908fd31b8b15153a9eb6e --- firmware/App/Services/Interrupts.c (.../Interrupts.c) (revision 4459be59bdc2896b44bcf6cd42d2762190e23c16) +++ firmware/App/Services/Interrupts.c (.../Interrupts.c) (revision 8dad6fab1c33602ad94908fd31b8b15153a9eb6e) @@ -48,23 +48,23 @@ #define MAX_COMM_ERRORS 5 ///< Maximum number of a given comm error for a given time window. #define COMM_ERROR_TIME_WINDOW_MS (10 * SEC_PER_MIN * MS_PER_SECOND) ///< Time window for comm error counts. -#define HET1_EDGE_BP_ROTOR_HALL_SENSOR 0 -#define HET1_EDGE_DPI_ROTOR_HALL_SENSOR 1 -#define HET1_EDGE_DPO_ROTOR_HALL_SENSOR 2 +#define HET1_EDGE_BP_ROTOR_HALL_SENSOR 0 ///< HET1 edge detector associated with blood pump rotor hall sensor. +#define HET1_EDGE_DPI_ROTOR_HALL_SENSOR 1 ///< HET1 edge detector associated with dialysate inlet pump rotor hall sensor. +#define HET1_EDGE_DPO_ROTOR_HALL_SENSOR 2 ///< HET1 edge detector associated with dialysate outlet pump rotor hall sensor. // ********** private data ********** #ifdef DEBUG_ENABLED static U32 sci1FrameErrorCnt = 0; static U32 sci1OverrunErrorCnt = 0; #endif -static U32 sci2FrameErrorCnt = 0; -static U32 sci2OverrunErrorCnt = 0; +static U32 sci2FrameErrorCnt = 0; ///< FPGA serial frame error counter. +static U32 sci2OverrunErrorCnt = 0; ///< FPGA serial overrun error counter. -static U32 can1PassiveCnt = 0; -static U32 can1WarningCnt = 0; -static U32 can1BusOffCnt = 0; -static U32 can1ParityCnt = 0; +static U32 can1PassiveCnt = 0; ///< CAN passive mode counter. +static U32 can1WarningCnt = 0; ///< CAN warning mode counter. +static U32 can1BusOffCnt = 0; ///< CAN buss off mode counter. +static U32 can1ParityCnt = 0; ///< CAN parity error counter. // ********** private function prototypes ********** Index: firmware/App/Services/MessagePayloads.h =================================================================== diff -u -rc6f3b01d1b0a5e3fdf480a7ee205ca349e10d6d2 -r8dad6fab1c33602ad94908fd31b8b15153a9eb6e --- firmware/App/Services/MessagePayloads.h (.../MessagePayloads.h) (revision c6f3b01d1b0a5e3fdf480a7ee205ca349e10d6d2) +++ firmware/App/Services/MessagePayloads.h (.../MessagePayloads.h) (revision 8dad6fab1c33602ad94908fd31b8b15153a9eb6e) @@ -22,20 +22,28 @@ #pragma pack(push,1) +/** + * @addtogroup SystemCommMessages + * @{ + */ + +/// Payload record structure for an off button confirmation message from the UI. typedef struct { - U08 confirmed; // 1 = confirmed, 0 = rejected/timed out + U08 confirmed; ///< 1 = confirmed, 0 = rejected/timed out } OFF_BUTTON_MESSAGE_FROM_UI_PAYLOAD_T; +/// Payload record structure for an alarm status message. typedef struct { - U32 alarmState; // 0 = no alarms, 1 = low priority, 2 = medium priority, 3 = high priority - U32 alarmTop; // ID of top active alarm - U32 escalatesIn; // seconds - U32 silenceExpiresIn; // seconds - U16 alarmsFlags; // bit flags: 1 = true, 0 = false for each bit + U32 alarmState; ///< Alarm state: 0 = no alarms, 1 = low priority, 2 = medium priority, 3 = high priority + U32 alarmTop; ///< ID of top active alarm + U32 escalatesIn; ///< Top active alarm escalates in this many seconds + U32 silenceExpiresIn; ///< Silencing of alarms expires in this many seconds + U16 alarmsFlags; ///< bit flags: 1 = true, 0 = false for each bit flag } ALARM_COMP_STATUS_PAYLOAD_T; +/// Payload record structure for an HD versions message. typedef struct { U08 major; @@ -48,19 +56,22 @@ U08 fpgaLab; } HD_VERSIONS_T; +/// Payload record structure for a linear calibration message. typedef struct { F32 gain; F32 offset; } LINEAR_F32_CAL_PAYLOAD_T; +/// Payload record structure for an accelerometer calibration message. typedef struct { F32 xOffset; F32 yOffset; F32 zOffset; } ACCEL_CAL_PAYLOAD_T; +/// Payload record structure for a peristaltic pump data message. typedef struct { U32 setPoint; @@ -72,6 +83,7 @@ F32 pwmDC; } PERISTALTIC_PUMP_STATUS_PAYLOAD_T; +/// Payload record structure for the pressure & occlusions data message. typedef struct { F32 arterialPressure; @@ -81,20 +93,23 @@ F32 doPumpOcclusion; } PRESSURE_OCCLUSION_DATA_T; +/// Payload record structure for a treatment time status message. typedef struct { U32 treatmentTimePrescribedinSec; U32 treatmentTimeElapsedinSec; U32 treatmentTimeRemaininginSec; } TREATMENT_TIME_DATA_T; +/// Payload record structure for a treatment state message. typedef struct { U32 treatmentSubMode; U32 uFState; U32 salineBolusState; } TREATMENT_STATE_DATA_T; +/// Payload record structure for a load cell data message. typedef struct { F32 res1PrimaryLoadCell; @@ -103,19 +118,22 @@ F32 res2BackupLoadCell; } LOAD_CELL_READINGS_PAYLOAD_T; +/// Payload record structure for an RO pump data message. typedef struct { U32 setPtPSI; F32 measFlowRateMlMin; F32 setPWM; } DG_RO_PUMP_DATA_PAYLOAD_T; +/// Payload record structure for a drain pump data message. typedef struct { U32 setPtRPM; F32 setPWM; } DG_DRAIN_PUMP_DATA_PAYLOAD_T; +/// Payload record structure for a DG pressures data message. typedef struct { F32 roInPSI; @@ -124,19 +142,22 @@ F32 drainOutPSI; } DG_PRESSURES_DATA_PAYLOAD_T; +/// Payload record structure for a reservoirs data message. typedef struct { U32 resID; U32 setFillToVolumeMl; U32 setDrainToVolumeMl; } DG_RESERVOIRS_DATA_PAYLOAD_T; +/// Payload record structure for an ultrafiltration volume change confirmation message. typedef struct { F32 volume_mL; U32 adjustType; } UF_SETTINGS_CHANGE_CONFIRMATION_PAYLOAD_T; +/// Payload record structure for DG temperature sensors data message. typedef struct { F32 TPi; @@ -153,13 +174,16 @@ F32 HtrTrimInternal; } DG_TEMPERATURES_T; +/// Payload record structure for a pump set point override message. typedef struct { BOOL reset; S32 setPt; U32 ctrlMode; } OVERRIDE_PUMP_SET_PT_PAYLOAD_T; +/**@}*/ + #pragma pack(pop) #endif Index: firmware/App/Services/MsgQueues.c =================================================================== diff -u -r4459be59bdc2896b44bcf6cd42d2762190e23c16 -r8dad6fab1c33602ad94908fd31b8b15153a9eb6e --- firmware/App/Services/MsgQueues.c (.../MsgQueues.c) (revision 4459be59bdc2896b44bcf6cd42d2762190e23c16) +++ firmware/App/Services/MsgQueues.c (.../MsgQueues.c) (revision 8dad6fab1c33602ad94908fd31b8b15153a9eb6e) @@ -17,25 +17,30 @@ #include "MsgQueues.h" +/** + * @addtogroup MsgQueues + * @{ + */ + // ********** private definitions ********** -#define MAX_MSG_QUEUE_SIZE 100 // messages +#define MAX_MSG_QUEUE_SIZE 100 ///< Number of messages a queue can hold. // ********** private data ********** -static U32 msgQueueCounts[ NUM_OF_MSG_QUEUES ]; -static U32 msgQueueStarts[ NUM_OF_MSG_QUEUES ]; -static U32 msgQueueNexts[ NUM_OF_MSG_QUEUES ]; -static MESSAGE_WRAPPER_T msgQueues[ NUM_OF_MSG_QUEUES ][ MAX_MSG_QUEUE_SIZE ]; +static U32 msgQueueCounts[ NUM_OF_MSG_QUEUES ]; ///< Number of messages in each queue. +static U32 msgQueueStarts[ NUM_OF_MSG_QUEUES ]; ///< Starting index for each queue. +static U32 msgQueueNexts[ NUM_OF_MSG_QUEUES ]; ///< Next index for each queue. +static MESSAGE_WRAPPER_T msgQueues[ NUM_OF_MSG_QUEUES ][ MAX_MSG_QUEUE_SIZE ]; ///< The messages in each queue. // ********** private function prototypes ********** -/************************************************************************* - * @brief initMsgQueues +/*********************************************************************//** + * @brief * The initMsgQueues function initializes the MsgQueues module. * @details * Inputs : none - * Outputs : none + * Outputs : msgQueueCounts[], msgQueueStarts[], msgQueueNexts[], msgQueues[][] * @return none *************************************************************************/ void initMsgQueues( void ) @@ -55,8 +60,8 @@ } } -/************************************************************************* - * @brief addToMsgQueue +/*********************************************************************//** + * @brief * The addToMsgQueue function adds a message to a given message queue. * This function should only be called from the General Task. * @details @@ -96,8 +101,8 @@ return result; } -/************************************************************************* - * @brief getFromMsgQueue +/*********************************************************************//** + * @brief * The getFromMsgQueue function retrieves the next message from a given * message queue. This function should only be called from the General Task. * @details @@ -138,11 +143,11 @@ return result; } -/************************************************************************* - * @brief isMsgQueueEmpty +/*********************************************************************//** + * @brief * The isMsgQueueEmpty function determines whether a given message queue is empty. * @details - * Inputs : none + * Inputs : msgQueueCounts[] * Outputs : none * @param queue the message queue to check * @return TRUE if a given message queue is empty, FALSE if not @@ -167,11 +172,11 @@ return result; } -/************************************************************************* - * @brief isMsgQueueFull +/*********************************************************************//** + * @brief * The isMsgQueueFull function determines whether a given message queue is full. * @details - * Inputs : none + * Inputs : msgQueueCounts[] * Outputs : none * @param queue the message queue to check * @return TRUE if the given message queue is full, FALSE if not @@ -196,12 +201,12 @@ return result; } -/************************************************************************* - * @brief blankMessage +/*********************************************************************//** + * @brief * The blankMessage function blanks a given message. * @details * Inputs : none - * Outputs : none + * Outputs : given message is blanked * @param message Pointer to the message to blank * @return none *************************************************************************/ @@ -218,12 +223,12 @@ } } -/************************************************************************* - * @brief blankMessageInWrapper +/*********************************************************************//** + * @brief * The blankMessageInWrapper function blanks a given message in a wrapper. * @details * Inputs : none - * Outputs : none + * Outputs : given wrapped message is blanked * @param message Pointer to the message in a wrapper to blank * @return none *************************************************************************/ @@ -242,3 +247,5 @@ // set msg ID out of bounds in case blank message goes somewhere message->msg.hdr.msgID = 0xFFFF; } + +/**@}*/ Index: firmware/App/Services/MsgQueues.h =================================================================== diff -u -rde5a0d43bdef611d963d11855bc958a8d8899a09 -r8dad6fab1c33602ad94908fd31b8b15153a9eb6e --- firmware/App/Services/MsgQueues.h (.../MsgQueues.h) (revision de5a0d43bdef611d963d11855bc958a8d8899a09) +++ firmware/App/Services/MsgQueues.h (.../MsgQueues.h) (revision 8dad6fab1c33602ad94908fd31b8b15153a9eb6e) @@ -20,38 +20,52 @@ #include "HDCommon.h" +/** + * @defgroup MsgQueues MsgQueues + * @brief The message queues module provides queuing services for + * incoming CAN messages. + * + * @addtogroup MsgQueues + * @{ + */ + // ********** public definitions ********** -#define MAX_MSG_PAYLOAD_SIZE 100 // bytes - +#define MAX_MSG_PAYLOAD_SIZE 100 ///< bytes + +/// Enumeration of message queues. typedef enum Msg_Queues { - MSG_Q_IN = 0, - NUM_OF_MSG_QUEUES + MSG_Q_IN = 0, ///< Incoming CAN message queue. + NUM_OF_MSG_QUEUES ///< Number of message queues. } MSG_QUEUE_T; -#pragma pack(push,1) +#pragma pack(push,1) + +/// Record structure for message header. typedef struct { - S16 seqNo; // sequence # (and ACK required bit) of message - U16 msgID; // ID of message - U08 payloadLen; // length of payload in bytes + S16 seqNo; ///< sequence number (and ACK required bit) of message + U16 msgID; ///< ID of message + U08 payloadLen; ///< length of payload in bytes } MESSAGE_HEADER_T; - + +/// Record structure for a message (header + payload). typedef struct { - MESSAGE_HEADER_T hdr; // message header - U08 payload[ MAX_MSG_PAYLOAD_SIZE ]; // message payload + MESSAGE_HEADER_T hdr; ///< message header + U08 payload[ MAX_MSG_PAYLOAD_SIZE ]; ///< message payload } MESSAGE_T; - + +/// Record structure for a wrapped message (message + CRC). typedef struct { - MESSAGE_T msg; // message - U08 crc; // message CRC + MESSAGE_T msg; ///< message + U08 crc; ///< message CRC } MESSAGE_WRAPPER_T; #pragma pack(pop) -#define MESSAGE_OVERHEAD_SIZE (sizeof(MESSAGE_HEADER_T) + sizeof(U08)) +#define MESSAGE_OVERHEAD_SIZE (sizeof(MESSAGE_HEADER_T) + sizeof(U08)) ///< Byte size of a message's overhead (fixed at 6 bytes). // ********** public function prototypes ********** @@ -63,4 +77,6 @@ void blankMessage( MESSAGE_T *message ); void blankMessageInWrapper( MESSAGE_WRAPPER_T *message ); +/**@}*/ + #endif Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r4459be59bdc2896b44bcf6cd42d2762190e23c16 -r8dad6fab1c33602ad94908fd31b8b15153a9eb6e --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 4459be59bdc2896b44bcf6cd42d2762190e23c16) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 8dad6fab1c33602ad94908fd31b8b15153a9eb6e) @@ -112,13 +112,13 @@ static volatile PENDING_ACK_RECORD_T pendingAckList[ PENDING_ACK_LIST_SIZE ]; ///< list of outgoing messages that are awaiting an ACK -static volatile BOOL hdIsOnlyCANNode = TRUE; ///< flag indicating whether HD is alone on CAN bus. -static U32 canXmitRetryCtr = 0; ///< counter for CAN transmit retries. -static volatile BOOL dgIsCommunicating = FALSE; ///< has DG sent a message since last check -static U32 timeOfLastDGCheckIn = 0; ///< last time DG checked in -static volatile BOOL uiIsCommunicating = FALSE; ///< has UI sent a message since last check -static U32 timeOfLastUICheckIn = 0; ///< last time UI checked in -static volatile BOOL uiDidCommunicate = FALSE; ///< has UI every sent a message +static volatile BOOL hdIsOnlyCANNode = TRUE; ///< flag indicating whether HD is alone on CAN bus. +static U32 canXmitRetryCtr = 0; ///< counter for CAN transmit retries. +static volatile BOOL dgIsCommunicating = FALSE; ///< has DG sent a message since last check +static U32 timeOfLastDGCheckIn = 0; ///< last time DG checked in +static volatile BOOL uiIsCommunicating = FALSE; ///< has UI sent a message since last check +static U32 timeOfLastUICheckIn = 0; ///< last time UI checked in +static volatile BOOL uiDidCommunicate = FALSE; ///< has UI every sent a message #ifdef EMC_TEST_BUILD static U32 badCANCount; // test code in support of EMC testing Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r4459be59bdc2896b44bcf6cd42d2762190e23c16 -r8dad6fab1c33602ad94908fd31b8b15153a9eb6e --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 4459be59bdc2896b44bcf6cd42d2762190e23c16) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 8dad6fab1c33602ad94908fd31b8b15153a9eb6e) @@ -37,28 +37,33 @@ #include "WatchdogMgmt.h" #include "RTC.h" +/** + * @addtogroup SystemCommMessages + * @{ + */ + // ********** private definitions ********** -#define ACK_REQUIRED TRUE -#define ACK_NOT_REQUIRED FALSE +#define ACK_REQUIRED TRUE ///< Macro for functions that want to know if an outgoing message requires acknowledgement from receiver. +#define ACK_NOT_REQUIRED FALSE ///< Macro for functions that want to know if an outgoing message requires acknowledgement from receiver. #ifdef DEBUG_ENABLED #define DEBUG_EVENT_MAX_TEXT_LEN 40 #endif // ********** private data ********** -static BOOL testerLoggedIn = FALSE; -static volatile U16 nextSeqNo = 1; +static BOOL testerLoggedIn = FALSE; ///< Flag indicates whether an external tester (connected PC) has sent a valid login message. +static volatile U16 nextSeqNo = 1; ///< Value of sequence number to use for next transmitted message. // ********** private function prototypes ********** static U32 serializeMessage( MESSAGE_T msg, COMM_BUFFER_T buffer, BOOL ackReq ); static BOOL sendTestAckResponseMsg( MSG_ID_T msgID, BOOL ack ); static BOOL sendAckResponseMsg( MSG_ID_T msgID, COMM_BUFFER_T buffer, BOOL ack ); -/************************************************************************* - * @brief serializeMessage +/*********************************************************************//** + * @brief * The serializeMessage function serializes a given message into a given * array of bytes. A sequence # is added to the message here and the ACK * bit of the sequence # is set if ACK is required per parameter. A sync byte @@ -142,8 +147,8 @@ return result; } -/************************************************************************* - * @brief sendACKMsg +/*********************************************************************//** + * @brief * The sendACKMsg function constructs and queues for transmit an ACK message * for a given received message. * @details @@ -172,8 +177,8 @@ return result; } -/************************************************************************* - * @brief sendTestAckResponseMsg +/*********************************************************************//** + * @brief * The sendTestAckResponseMsg function constructs a simple response * message for a handled test message and queues it for transmit on the * appropriate UART channel. @@ -206,8 +211,8 @@ // ***************** Message Sending Helper Functions ******************** // *********************************************************************** -/************************************************************************* - * @brief sendOffButtonMsgToUI +/*********************************************************************//** + * @brief * The sendOffButtonMsgToUI function constructs an off button msg to the UI * and queues the msg for transmit on the appropriate CAN channel. * @details @@ -233,7 +238,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The sendChangeUFSettingsResponse function constructs a UF change settings * response to the UI and queues the msg for transmit on the appropriate CAN @@ -284,7 +289,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The sendChangeUFSettingsResponse function constructs a UF change settings * option response to the UI and queues the msg for transmit on the appropriate CAN @@ -326,7 +331,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The sendChangeTreatmentDurationResponse function constructs a treatment * duration change response to the UI and queues the msg for transmit on the @@ -365,7 +370,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The sendChangeBloodDialysateRateChangeResponse function constructs a change * blood and dialysate rate settings response to the UI and queues the msg for @@ -404,7 +409,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The sendTreatmentParamsRangesToUI function constructs a treatment parameter * ranges message to the UI and queues the msg for transmit on the appropriate CAN channel. @@ -448,7 +453,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The sendDialysateTempTargetsToDG function constructs a dialysate temperature * set points message for DG and queues the msg for transmit on the appropriate CAN channel. @@ -480,7 +485,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The sendDGSwitchReservoirCommand function constructs a DG set active * reservoir message for DG and queues the msg for transmit on the appropriate CAN channel. @@ -509,7 +514,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The sendDGFillCommand function constructs a DG fill command message * and queues the msg for transmit on the appropriate CAN channel. @@ -538,7 +543,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The sendDGDrainCommand function constructs a DG drain command message * and queues the msg for transmit on the appropriate CAN channel. @@ -567,7 +572,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The sendDGStartStopCommand function constructs a DG start/stop command * message and queues the msg for transmit on the appropriate CAN channel. @@ -596,7 +601,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The sendDGStartStopTrimmerHeaterCommand function constructs a DG start/stop * trimmer heater command message and queues the msg for transmit on the @@ -626,7 +631,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The sendDGSampleWaterCommand function constructs a DG sample water command * message and queues the msg for transmit on the appropriate CAN channel. @@ -651,7 +656,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The broadcastAccelData function constructs an accelerometer data msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. @@ -698,8 +703,8 @@ return result; } -/************************************************************************* - * @brief broadcastAlarmStatus +/*********************************************************************//** + * @brief * The broadcastAlarmStatus function constructs an alarm status msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. * @details @@ -742,8 +747,8 @@ return result; } -/************************************************************************* - * @brief broadcastAlarmTriggered +/*********************************************************************//** + * @brief * The broadcastAlarmTriggered function constructs an alarm triggered msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. * @details @@ -777,8 +782,8 @@ return result; } -/************************************************************************* - * @brief broadcastAlarmCleared +/*********************************************************************//** + * @brief * The broadcastAlarmCleared function constructs an alarm cleared msg to be * broadcast and queues the msg for transmit on the appropriate CAN channel. * @details @@ -806,8 +811,8 @@ return result; } -/************************************************************************* - * @brief broadcastBloodFlowData +/*********************************************************************//** + * @brief * The broadcastBloodFlowData function constructs a blood flow data msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. * @details @@ -850,8 +855,8 @@ return result; } -/************************************************************************* - * @brief broadcastDialInFlowData +/*********************************************************************//** + * @brief * The broadcastDialInFlowData function constructs a dialysate flow data msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. * @details @@ -894,8 +899,8 @@ return result; } -/************************************************************************* - * @brief broadcastDialInFlowData +/*********************************************************************//** + * @brief * The broadcastDialInFlowData function constructs a dialysate outlet flow data * msg to be broadcast and queues the msg for transmit on the appropriate CAN channel. * @details @@ -923,8 +928,8 @@ return result; } -/************************************************************************* - * @brief broadcastPresOcclData +/*********************************************************************//** + * @brief * The broadcastPresOcclData function constructs a pres/occl data msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. * @details @@ -963,8 +968,8 @@ return result; } -/************************************************************************* - * @brief broadcastRTCEpoch +/*********************************************************************//** + * @brief * The broadcastRTCEpoch function constructs an epoch msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. * @details @@ -992,7 +997,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The broadcastTreatmentTime function constructs a treatment time msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. @@ -1028,7 +1033,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The broadcastTreatmentState function constructs a treatment state msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. @@ -1064,7 +1069,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The broadcastPowerOffWarning function constructs a power off warning msg to * be broadcast and queues the msg for transmit on the appropriate CAN channel. @@ -1089,7 +1094,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The broadcastHDOperationMode function constructs an HD operation mode * broadcast message and queues the msg for transmit on the appropriate CAN channel. @@ -1145,8 +1150,8 @@ // **************** Message Handling Helper Functions ******************** // *********************************************************************** -/************************************************************************* - * @brief handleDGCheckIn +/*********************************************************************//** + * @brief * The handleDGCheckIn function handles a check-in from the DG. * @details * Inputs : none @@ -1159,8 +1164,8 @@ checkInFromDG(); } -/************************************************************************* - * @brief handleUICheckIn +/*********************************************************************//** + * @brief * The handleUICheckIn function handles a check-in from the UI. * @details * Inputs : none @@ -1173,7 +1178,7 @@ checkInFromUI(); } -/************************************************************************* +/*********************************************************************//** * @brief * The handleAlarmTriggered function handles a triggered alarm event message. * @details @@ -1203,7 +1208,7 @@ } } -/************************************************************************* +/*********************************************************************//** * @brief * The handleAlarmCleared function handles a cleared alarm event message. * @details @@ -1228,8 +1233,8 @@ } } -/************************************************************************* - * @brief handleOffButtonConfirmMsgFromUI +/*********************************************************************//** + * @brief * The handleOffButtonConfirmMsgFromUI function handles a response to an * off button message to the UI. * @details @@ -1249,7 +1254,7 @@ } } -/************************************************************************* +/*********************************************************************//** * @brief * The handleLoadCellReadingsFromDG function handles a load cell readings * broadcast message from the DG. @@ -1274,7 +1279,7 @@ // TODO - how to know if DG stops sending these? } -/************************************************************************* +/*********************************************************************//** * @brief * The handleDGTemperatureData function handles a temperature readings * broadcast message from the DG. @@ -1297,7 +1302,7 @@ // TODO - how to know if DG stops sending these? } -/************************************************************************* +/*********************************************************************//** * @brief * The handleROPumpData function handles an RO pump data broadcast * message from the DG. @@ -1319,7 +1324,7 @@ // TODO - what to do if invalid payload length? } -/************************************************************************* +/*********************************************************************//** * @brief * The handleDrainPumpData function handles a drain pump broadcast * message from the DG. @@ -1341,7 +1346,7 @@ // TODO - what to do if invalid payload length? } -/************************************************************************* +/*********************************************************************//** * @brief * The handleDGPressuresData function handles a DG pressure sensor readings * broadcast message from the DG. @@ -1363,7 +1368,7 @@ // TODO - what to do if invalid payload length? } -/************************************************************************* +/*********************************************************************//** * @brief * The handleDGReservoirData function handles a reservoir data broadcast * message from the DG. @@ -1385,7 +1390,7 @@ // TODO - what to do if invalid payload length? } -/************************************************************************* +/*********************************************************************//** * @brief * The handleUFPauseResumeRequest function handles a ultrafiltration pause * or resume request message from the UI. @@ -1417,7 +1422,7 @@ sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); } -/************************************************************************* +/*********************************************************************//** * @brief * The handleUIStartTreatmentMsg function handles a treatment start/cancel * message from the UI. @@ -1454,7 +1459,7 @@ sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); } -/************************************************************************* +/*********************************************************************//** * @brief * The handleTreatmentParametersFromUI function handles a treatment parameters * set and validate request message from the UI. @@ -1483,7 +1488,7 @@ } } -/************************************************************************* +/*********************************************************************//** * @brief * The handleUIUserConfirmTreatmentParameters function handles a user confirmation * of treatment parameters message from the UI. @@ -1505,7 +1510,7 @@ sendAckResponseMsg( (MSG_ID_T)message->hdr.msgID, COMM_BUFFER_OUT_CAN_HD_2_UI, result ); } -/************************************************************************* +/*********************************************************************//** * @brief * The sendTreatmentParametersResponseMsg function constructs a treatment parameters * response to the UI and queues the msg for transmit on the appropriate CAN channel. @@ -1538,7 +1543,7 @@ return result; } -/************************************************************************* +/*********************************************************************//** * @brief * The handleChangeUFSettingsRequest function handles a ultrafiltration * change settings request message from the UI. @@ -1564,7 +1569,7 @@ } } -/************************************************************************* +/*********************************************************************//** * @brief * The handleChangeUFSettingsConfirmation function handles a ultrafiltration * change setting confirmation message from the UI. @@ -1590,7 +1595,7 @@ } } -/************************************************************************* +/*********************************************************************//** * @brief * The handleChangeTreatmentDurationRequest function handles a treatment * duration setting change message from the UI. @@ -1616,7 +1621,7 @@ } } -/************************************************************************* +/*********************************************************************//** * @brief * The handleChangeBloodDialysateRateChangeRequest function handles a blood * and dialysate rate settings change message from the UI. @@ -1646,7 +1651,7 @@ } } -/************************************************************************* +/*********************************************************************//** * @brief * The handleDGOpMode function handles a DG broadcast of it's current mode. * @details @@ -1675,7 +1680,7 @@ } } -/************************************************************************* +/*********************************************************************//** * @brief * The handleFWVersionRequest function handles a request for HD f/w version. * @details @@ -1765,8 +1770,8 @@ } #endif -/************************************************************************* - * @brief isTestingActivated +/*********************************************************************//** + * @brief * The isTestingActivated function determines whether a tester has successfully * logged in to activate testing functionality. * @details @@ -1779,8 +1784,8 @@ return testerLoggedIn; } -/************************************************************************* - * @brief sendTestAckResponseMsg +/*********************************************************************//** + * @brief * The sendTestAckResponseMsg function constructs a simple response * message for a handled test message and queues it for transmit on the * appropriate UART channel. @@ -1808,8 +1813,8 @@ return result; } -/************************************************************************* - * @brief handleTesterLogInRequest +/*********************************************************************//** + * @brief * The handleTesterLogInRequest function handles a request to login as a * tester. * @details @@ -1835,7 +1840,7 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, testerLoggedIn ); } -/************************************************************************* +/*********************************************************************//** * @brief * The handleTestOffButtonStateOverrideRequest function handles a request to * override the state of the off button. @@ -1869,7 +1874,7 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -/************************************************************************* +/*********************************************************************//** * @brief * The handleTestStopButtonStateOverrideRequest function handles a request to * override the stop button state. @@ -1935,8 +1940,8 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -/************************************************************************* - * @brief handleTestWatchdogCheckInStateOverrideRequest +/*********************************************************************//** + * @brief * The handleTestWatchdogCheckInStateOverrideRequest function handles a * request to override the check-in status of a given task. * @details @@ -1947,8 +1952,8 @@ *************************************************************************/ DATA_ARRAY_OVERRIDE_HANDLER_FUNC_U32( BOOL, handleTestWatchdogCheckInStateOverrideRequest, testSetWatchdogTaskCheckInOverride, testResetWatchdogTaskCheckInOverride ) -/************************************************************************* - * @brief handleTestAlarmStateOverrideRequest +/*********************************************************************//** + * @brief * The handleTestAlarmStateOverrideRequest function handles a request to * override the active status of a given alarm. * @details @@ -1959,8 +1964,8 @@ *************************************************************************/ DATA_ARRAY_OVERRIDE_HANDLER_FUNC_U32( BOOL, handleTestAlarmStateOverrideRequest, testSetAlarmStateOverride, testResetAlarmStateOverride ) -/************************************************************************* - * @brief handleTestAlarmTimeOverrideRequest +/*********************************************************************//** + * @brief * The handleTestAlarmTimeOverrideRequest function handles a request to * override the time since activation of a given alarm. * @details @@ -1971,8 +1976,8 @@ *************************************************************************/ DATA_ARRAY_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestAlarmTimeOverrideRequest, testSetAlarmStartOverride, testResetAlarmStartOverride ) -/************************************************************************* - * @brief handleTestAlarmStatusBroadcastIntervalOverrideRequest +/*********************************************************************//** + * @brief * The handleTestAlarmStatusBroadcastIntervalOverrideRequest function handles a request to * override the broadcast interval for alarm status. * @details @@ -1983,8 +1988,8 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestAlarmStatusBroadcastIntervalOverrideRequest, testSetAlarmStatusPublishIntervalOverride, testResetAlarmStatusPublishIntervalOverride ) -/************************************************************************* - * @brief handleTestBloodFlowSetPointOverrideRequest +/*********************************************************************//** + * @brief * The handleTestBloodFlowSetPointOverrideRequest function handles a request to * override the set point for the blood flow rate (mL/min). * @details @@ -2015,8 +2020,8 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -/************************************************************************* - * @brief handleTestBloodFlowMeasuredOverrideRequest +/*********************************************************************//** + * @brief * The handleTestBloodFlowMeasuredOverrideRequest function handles a request to * override the measured blood flow rate (mL/min). * @details @@ -2027,8 +2032,8 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestBloodFlowMeasuredOverrideRequest, testSetMeasuredBloodFlowRateOverride, testResetMeasuredBloodFlowRateOverride ) -/************************************************************************* - * @brief handleTestBloodPumpRotorMeasuredSpeedOverrideRequest +/*********************************************************************//** + * @brief * The handleTestBloodPumpRotorMeasuredSpeedOverrideRequest function handles a request to * override the measured blood pump rotor speed (RPM). * @details @@ -2039,8 +2044,8 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestBloodPumpRotorMeasuredSpeedOverrideRequest, testSetMeasuredBloodPumpRotorSpeedOverride, testResetMeasuredBloodPumpRotorSpeedOverride ) -/************************************************************************* - * @brief handleTestBloodPumpMeasuredSpeedOverrideRequest +/*********************************************************************//** + * @brief * The handleTestBloodPumpMeasuredSpeedOverrideRequest function handles a request to * override the measured blood pump speed (RPM). * @details @@ -2051,8 +2056,8 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestBloodPumpMeasuredSpeedOverrideRequest, testSetMeasuredBloodPumpSpeedOverride, testResetMeasuredBloodPumpSpeedOverride ) -/************************************************************************* - * @brief handleTestBloodPumpMCMeasuredSpeedOverrideRequest +/*********************************************************************//** + * @brief * The handleTestBloodPumpMCMeasuredSpeedOverrideRequest function handles a request to * override the measured blood pump motor controller speed (RPM). * @details @@ -2063,8 +2068,8 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestBloodPumpMCMeasuredSpeedOverrideRequest, testSetMeasuredBloodPumpMCSpeedOverride, testResetMeasuredBloodPumpMCSpeedOverride ) -/************************************************************************* - * @brief handleTestBloodPumpMCMeasuredCurrentOverrideRequest +/*********************************************************************//** + * @brief * The handleTestBloodPumpMCMeasuredCurrentOverrideRequest function handles a request to * override the measured blood pump motor controller current (mA). * @details @@ -2075,8 +2080,8 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestBloodPumpMCMeasuredCurrentOverrideRequest, testSetMeasuredBloodPumpMCCurrentOverride, testResetMeasuredBloodPumpMCCurrentOverride ) -/************************************************************************* - * @brief handleTestBloodFlowBroadcastIntervalOverrideRequest +/*********************************************************************//** + * @brief * The handleTestBloodFlowBroadcastIntervalOverrideRequest function handles a request to * override the broadcast interval for blood flow data. * @details @@ -2087,8 +2092,8 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestBloodFlowBroadcastIntervalOverrideRequest, testSetBloodFlowDataPublishIntervalOverride, testResetBloodFlowDataPublishIntervalOverride ) -/************************************************************************* - * @brief handleTestDialInFlowSetPointOverrideRequest +/*********************************************************************//** + * @brief * The handleTestDialInFlowSetPointOverrideRequest function handles a request to * override the set point for the dialysate inlet flow rate (mL/min). * @details @@ -2119,7 +2124,7 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -/************************************************************************* +/*********************************************************************//** * @brief * The handleTestDialOutFlowSetPointOverrideRequest function handles a request to * override the set point for the dialysate outlet flow rate (mL/min). @@ -2151,8 +2156,8 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -/************************************************************************* - * @brief handleTestDialInFlowMeasuredOverrideRequest +/*********************************************************************//** + * @brief * The handleTestDialInFlowMeasuredOverrideRequest function handles a request to * override the measured dialysate inlet flow rate (mL/min). * @details @@ -2163,8 +2168,8 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestDialInFlowMeasuredOverrideRequest, testSetMeasuredDialInFlowRateOverride, testResetMeasuredDialInFlowRateOverride ) -/************************************************************************* - * @brief handleTestDialInPumpRotorMeasuredSpeedOverrideRequest +/*********************************************************************//** + * @brief * The handleTestDialInPumpRotorMeasuredSpeedOverrideRequest function handles a request to * override the measured dialysate inlet pump rotor speed (RPM). * @details @@ -2175,8 +2180,8 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestDialInPumpRotorMeasuredSpeedOverrideRequest, testSetMeasuredDialInPumpRotorSpeedOverride, testResetMeasuredDialInPumpRotorSpeedOverride ) -/************************************************************************* - * @brief handleTestDialInPumpMeasuredSpeedOverrideRequest +/*********************************************************************//** + * @brief * The handleTestDialInPumpMeasuredSpeedOverrideRequest function handles a request to * override the measured dialysate inlet pump speed (RPM). * @details @@ -2187,8 +2192,8 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestDialInPumpMeasuredSpeedOverrideRequest, testSetMeasuredDialInPumpSpeedOverride, testResetMeasuredDialInPumpSpeedOverride ) -/************************************************************************* - * @brief handleTestDialInPumpMCMeasuredSpeedOverrideRequest +/*********************************************************************//** + * @brief * The handleTestDialInPumpMCMeasuredSpeedOverrideRequest function handles a request to * override the measured dialysate inlet pump motor controller speed (RPM). * @details @@ -2199,8 +2204,8 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestDialInPumpMCMeasuredSpeedOverrideRequest, testSetMeasuredDialInPumpMCSpeedOverride, testResetMeasuredDialInPumpMCSpeedOverride ) -/************************************************************************* - * @brief handleTestDialInPumpMCMeasuredCurrentOverrideRequest +/*********************************************************************//** + * @brief * The handleTestDialInPumpMCMeasuredCurrentOverrideRequest function handles a request to * override the measured dialysate inlet pump motor controller current (mA). * @details @@ -2211,8 +2216,8 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestDialInPumpMCMeasuredCurrentOverrideRequest, testSetMeasuredDialInPumpMCCurrentOverride, testResetMeasuredDialInPumpMCCurrentOverride ) -/************************************************************************* - * @brief handleTestDialInFlowBroadcastIntervalOverrideRequest +/*********************************************************************//** + * @brief * The handleTestDialInFlowBroadcastIntervalOverrideRequest function handles a request to * override the broadcast interval for dialysate inlet flow data. * @details @@ -2223,8 +2228,8 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestDialInFlowBroadcastIntervalOverrideRequest, testSetDialInFlowDataPublishIntervalOverride, testResetDialInFlowDataPublishIntervalOverride ) -/************************************************************************* - * @brief handleTestArterialPressureOverrideRequest +/*********************************************************************//** + * @brief * The handleTestArterialPressureOverrideRequest function handles a request to * override the arterial pressure. * @details @@ -2235,8 +2240,8 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestArterialPressureOverrideRequest, testSetArterialPressureOverride, testResetArterialPressureOverride ) -/************************************************************************* - * @brief handleTestVenousPressureOverrideRequest +/*********************************************************************//** + * @brief * The handleTestVenousPressureOverrideRequest function handles a request to * override the venous pressure. * @details @@ -2247,8 +2252,8 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestVenousPressureOverrideRequest, testSetVenousPressureOverride, testResetVenousPressureOverride ) -/************************************************************************* - * @brief handleTestBloodPumpOcclusionOverrideRequest +/*********************************************************************//** + * @brief * The handleTestBloodPumpOcclusionOverrideRequest function handles a request to * override the blood pump occlusion sensor. * @details @@ -2259,8 +2264,8 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestBloodPumpOcclusionOverrideRequest, testSetBloodPumpOcclusionOverride, testResetBloodPumpOcclusionOverride ) -/************************************************************************* - * @brief handleTestDialysateInletPumpOcclusionOverrideRequest +/*********************************************************************//** + * @brief * The handleTestDialysateInletPumpOcclusionOverrideRequest function handles a request to * override the dialysate inlet pump occlusion sensor. * @details @@ -2271,8 +2276,8 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestDialysateInletPumpOcclusionOverrideRequest, testSetDialInPumpOcclusionOverride, testResetDialInPumpOcclusionOverride ) -/************************************************************************* - * @brief handleTestDialysateOutletPumpOcclusionOverrideRequest +/*********************************************************************//** + * @brief * The handleTestDialysateOutletPumpOcclusionOverrideRequest function handles a request to * override the dialysate outlet pump occlusion sensor. * @details @@ -2283,8 +2288,8 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestDialysateOutletPumpOcclusionOverrideRequest, testSetDialOutPumpOcclusionOverride, testResetDialOutPumpOcclusionOverride ) -/************************************************************************* - * @brief handleTestPresOcclBroadcastIntervalOverrideRequest +/*********************************************************************//** + * @brief * The handleTestPresOcclBroadcastIntervalOverrideRequest function handles a request to * override the broadcast interval for pressure/occlusion data. * @details @@ -2295,8 +2300,8 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestPresOcclBroadcastIntervalOverrideRequest, testSetPresOcclDataPublishIntervalOverride, testResetPresOcclDataPublishIntervalOverride ) -/************************************************************************* - * @brief handleSetRTCTimestamp +/*********************************************************************//** + * @brief * The handleSetRTCTimestamp function handles a request to write time and * date to RTC * @details @@ -2326,7 +2331,7 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -/************************************************************************* +/*********************************************************************//** * @brief * The handleTestDialOutFlowBroadcastIntervalOverrideRequest function handles * a request to override the broadcast interval for dialysate outlet pump data. @@ -2338,7 +2343,7 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestDialOutFlowBroadcastIntervalOverrideRequest, testSetDialOutPumpAndLoadCellDataPublishIntervalOverride, testResetDialOutPumpAndLoadCellDataPublishIntervalOverride ) -/************************************************************************* +/*********************************************************************//** * @brief * The handleTestDialOutUFReferenceVolumeOverrideRequest function handles a * request to override the ultrafiltration reference volume for the dialysate @@ -2351,7 +2356,7 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestDialOutUFReferenceVolumeOverrideRequest, testSetDialOutUFRefVolumeOverride, testResetDialOutUFRefVolumeOverride ) -/************************************************************************* +/*********************************************************************//** * @brief * The handleTestDialOutUFMeasuredVolumeOverrideRequest function handles a * request to override the ultrafiltration measured volume for the dialysate @@ -2364,7 +2369,7 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestDialOutUFMeasuredVolumeOverrideRequest, testSetDialOutUFTotVolumeOverride, testResetDialOutUFTotVolumeOverride ) -/************************************************************************* +/*********************************************************************//** * @brief * The handleTestDialOutPumpMCMeasuredSpeedOverrideRequest function handles a * request to override the measured motor controller speed for the dialysate @@ -2377,7 +2382,7 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestDialOutPumpMCMeasuredSpeedOverrideRequest, testSetMeasuredDialOutPumpMCSpeedOverride, testResetMeasuredDialOutPumpMCSpeedOverride ) -/************************************************************************* +/*********************************************************************//** * @brief * The handleTestDialOutPumpMCMeasuredCurrentOverrideRequest function handles a * request to override the measured motor controller current for the dialysate @@ -2390,7 +2395,7 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestDialOutPumpMCMeasuredCurrentOverrideRequest, testSetMeasuredDialOutPumpMCCurrentOverride, testResetMeasuredDialOutPumpMCCurrentOverride ) -/************************************************************************* +/*********************************************************************//** * @brief * The handleTestDialOutPumpMeasuredSpeedOverrideRequest function handles a * request to override the measured speed for the dialysate outlet pump. @@ -2402,7 +2407,7 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestDialOutPumpMeasuredSpeedOverrideRequest, testSetMeasuredDialOutPumpSpeedOverride, testResetMeasuredDialOutPumpSpeedOverride ) -/************************************************************************* +/*********************************************************************//** * @brief * The handleTestDialOutPumpMeasuredRotorSpeedOverrideRequest function handles a * request to override the measured rotor speed for the dialysate outlet pump. @@ -2414,7 +2419,7 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestDialOutPumpMeasuredRotorSpeedOverrideRequest, testSetMeasuredDialOutPumpRotorSpeedOverride, testResetMeasuredDialOutPumpRotorSpeedOverride ) -/************************************************************************* +/*********************************************************************//** * @brief * The handleTestDialOutLoadCellWeightOverrideRequest function handles a * request to override the measured load cell weight for the dialysate outlet pump. @@ -2426,7 +2431,7 @@ *************************************************************************/ DATA_ARRAY_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestDialOutLoadCellWeightOverrideRequest, testSetDialOutLoadCellWeightOverride, testResetDialOutLoadCellWeightOverride ) -/************************************************************************* +/*********************************************************************//** * @brief * The handleTestHDSafetyShutdownOverrideRequest function handles a * request to override the safety shutdown signal. @@ -2438,7 +2443,7 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestHDSafetyShutdownOverrideRequest, testSetSafetyShutdownOverride, testResetSafetyShutdownOverride ) -/************************************************************************* +/*********************************************************************//** * @brief * The handleTestHDAccelOverrideRequest function handles a request to * override the measured accelerometer sensor readings. @@ -2450,7 +2455,7 @@ *************************************************************************/ DATA_ARRAY_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestHDAccelOverrideRequest, testSetAccelAxisOverride, testResetAccelAxisOverride ) -/************************************************************************* +/*********************************************************************//** * @brief * The handleTestHDAccelMaxOverrideRequest function handles a request to * override the measured accelerometer sensor maximum readings. @@ -2462,7 +2467,7 @@ *************************************************************************/ DATA_ARRAY_OVERRIDE_HANDLER_FUNC_F32( F32, handleTestHDAccelMaxOverrideRequest, testSetAccelMaxOverride, testResetAccelMaxOverride ) -/************************************************************************* +/*********************************************************************//** * @brief * The handleTestHDAccelBroadcastIntervalOverrideRequest function handles a * request to override the broadcast interval for accelerometer data messages. @@ -2474,7 +2479,7 @@ *************************************************************************/ DATA_OVERRIDE_HANDLER_FUNC_U32( U32, handleTestHDAccelBroadcastIntervalOverrideRequest, testSetAccelDataPublishIntervalOverride, testResetAccelDataPublishIntervalOverride ) -/************************************************************************* +/*********************************************************************//** * @brief * The handleSetAccelCalibration function handles a request to set * accelerometer calibration factors. @@ -2500,7 +2505,7 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -/************************************************************************* +/*********************************************************************//** * @brief * The handleSetBloodFlowCalibration function handles a request to set * blood flow calibration factors. @@ -2526,7 +2531,7 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -/************************************************************************* +/*********************************************************************//** * @brief * The handleSetDialysateFlowCalibration function handles a request to set * dialysate flow calibration factors. @@ -2552,7 +2557,7 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } -/************************************************************************* +/*********************************************************************//** * @brief * The handleSetDialysateFlowCalibration function handles a request to set * dialysate flow calibration factors. @@ -2577,3 +2582,5 @@ // respond to request sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } + +/**@}*/ Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r07a352d02dc7e062dd5b6742891ac0b57679858c -r8dad6fab1c33602ad94908fd31b8b15153a9eb6e --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 07a352d02dc7e062dd5b6742891ac0b57679858c) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 8dad6fab1c33602ad94908fd31b8b15153a9eb6e) @@ -23,6 +23,15 @@ #include "DialOutFlow.h" #include "DGInterface.h" +/** + * @defgroup SystemCommMessages SystemCommMessages + * @brief The system communication messages module provides helper functions + * for sending outgoing system message and handling incoming system messages. + * + * @addtogroup SystemCommMessages + * @{ + */ + // ********** public definitions ********** // ********** public function prototypes ********** @@ -326,5 +335,6 @@ // MSG_ID_HD_SET_PARAMETER_TREATMENT_PARAMETER void handleTestSetTreatmentParameter( MESSAGE_T *message ); +/**@}*/ + #endif - Index: firmware/App/Services/WatchdogMgmt.c =================================================================== diff -u -r4459be59bdc2896b44bcf6cd42d2762190e23c16 -r8dad6fab1c33602ad94908fd31b8b15153a9eb6e --- firmware/App/Services/WatchdogMgmt.c (.../WatchdogMgmt.c) (revision 4459be59bdc2896b44bcf6cd42d2762190e23c16) +++ firmware/App/Services/WatchdogMgmt.c (.../WatchdogMgmt.c) (revision 8dad6fab1c33602ad94908fd31b8b15153a9eb6e) @@ -21,29 +21,35 @@ #include "Timers.h" #include "WatchdogMgmt.h" +/** + * @addtogroup WatchdogMgmt + * @{ + */ + // ********** private definitions ********** -#define MIN_WATCHDOG_PET_INTERVAL_MS 45 -#define WATCHDOG_POST_TIMEOUT_MS 100 -#define WATCHDOG_RECOVERY_TIME_MS 250 - -typedef enum Button_Self_Test_States +#define MIN_WATCHDOG_PET_INTERVAL_MS 45 ///< Minimum watchdog pet interval (in ms). +#define WATCHDOG_POST_TIMEOUT_MS 100 ///< Watchdog POST test timeout (in ms). +#define WATCHDOG_RECOVERY_TIME_MS 250 ///< After watchdog POST test, wait this long (in ms) before moving on. + +/// Enumeration of watchdog self test states. +typedef enum Watchdog_Self_Test_States { - WATCHDOG_SELF_TEST_STATE_START = 0, - WATCHDOG_SELF_TEST_STATE_IN_PROGRESS, - WATCHDOG_SELF_TEST_STATE_RECOVER, - WATCHDOG_SELF_TEST_STATE_COMPLETE, - NUM_OF_WATCHDOG_SELF_TEST_STATES + WATCHDOG_SELF_TEST_STATE_START = 0, ///< Watchdog self test start state + WATCHDOG_SELF_TEST_STATE_IN_PROGRESS, ///< Watchdog self test in progress state + WATCHDOG_SELF_TEST_STATE_RECOVER, ///< Watchdog self test recovery state + WATCHDOG_SELF_TEST_STATE_COMPLETE, ///< Watchdog self test completed state + NUM_OF_WATCHDOG_SELF_TEST_STATES ///< Number of watchdog self test states } WATCHDOG_SELF_TEST_STATE_T; // ********** private data ********** -static U32 lastWatchdogPetTime = 0; +static U32 lastWatchdogPetTime = 0; ///< Timestamp (ms counter) since last watchdog pet. -DATA_ARRAY_DECL( BOOL, TaskCheckIns, NUM_OF_TASKS, watchdogTaskCheckedIn ); +static OVERRIDE_U32_T watchdogTaskCheckedIn[ NUM_OF_TASKS ]; ///< Array of flags indicating whether individual tasks have checked in with watchdog manager. -static WATCHDOG_SELF_TEST_STATE_T watchdogSelfTestState = WATCHDOG_SELF_TEST_STATE_START; -static SELF_TEST_STATUS_T watchdogSelfTestStatus; +static WATCHDOG_SELF_TEST_STATE_T watchdogSelfTestState = WATCHDOG_SELF_TEST_STATE_START; ///< Current watchdog self test state. +static SELF_TEST_STATUS_T watchdogSelfTestStatus; ///< Watchdog self test state timer counter. static U32 watchdogSelfTestTimerCount = 0; // ********** private function prototypes ********** @@ -53,8 +59,8 @@ static void petWatchdog( void ); static DATA_ARRAY_GET_PROTOTYPE( BOOL, hasTaskGeneralCheckedIn, task ); -/************************************************************************* - * @brief initWatchdogMgmt +/*********************************************************************//** + * @brief * The initWatchdogMgmt function initializes the watchdog mgmt. module. * @details * Inputs : none @@ -79,12 +85,12 @@ } } -/************************************************************************* - * @brief execWatchdogMgmt +/*********************************************************************//** + * @brief * The execWatchdogMgmt function executes thewatchdog mgmt. service. * @details - * Inputs : none - * Outputs : + * Inputs : watchdogTaskCheckedIn[] + * Outputs : watchdogTaskCheckedIn[] * @return none *************************************************************************/ void execWatchdogMgmt( void ) @@ -123,8 +129,8 @@ } -/************************************************************************* - * @brief checkInWithWatchdogMgmt +/*********************************************************************//** + * @brief * The checkInWithWatchdogMgmt function checks a given task in with the * watchdog mgmt. service. * @details @@ -141,14 +147,14 @@ } } -/************************************************************************* - * @brief execWatchdogTest +/*********************************************************************//** + * @brief * The execWatchdogTest function executes the watchdog test. * This function should be called periodically until a pass or fail * result is returned. * @details - * Inputs : - * Outputs : + * Inputs : watchdogSelfTestState + * Outputs : watchdogSelfTestState * @return in progress, passed, or failed *************************************************************************/ SELF_TEST_STATUS_T execWatchdogTest( void ) @@ -203,8 +209,8 @@ return result; } -/************************************************************************* - * @brief resetWDTaskCheckIns +/*********************************************************************//** + * @brief * The resetWDTaskCheckIns function resets the task check-ins with the watchdog. * @details * Inputs : none @@ -222,9 +228,9 @@ } } -/************************************************************************* - * @brief haveAllTasksCheckedIn - * The haveAllTasksCheckedIn function determines whether all tasks have /n +/*********************************************************************//** + * @brief + * The haveAllTasksCheckedIn function determines whether all tasks have * checked in with watchdog mgmt. * @details * Inputs : watchdogTaskCheckedIn[] @@ -249,21 +255,42 @@ return result; } -/************************************************************************* - * @brief hasTaskGeneralCheckedIn - * The hasTaskGeneralCheckedIn function gets the check-in state of a given /n +/*********************************************************************//** + * @brief + * The hasTaskGeneralCheckedIn function gets the check-in state of a given * task. * @details * Inputs : watchdogTaskCheckedIn[] * Outputs : none * @param task ID of task to check * @return TRUE if given task has checked in, FALSE if not *************************************************************************/ -static DATA_ARRAY_GET( BOOL, hasTaskGeneralCheckedIn, task, NUM_OF_TASKS-1, watchdogTaskCheckedIn, FALSE ) +BOOL hasTaskGeneralCheckedIn( U32 task ) +{ + BOOL result = FALSE; + + if ( task <= NUM_OF_TASKS-1 ) + { + if ( OVERRIDE_KEY == watchdogTaskCheckedIn[ task ].override ) + { + result = (BOOL)watchdogTaskCheckedIn[ task ].ovData; + } + else + { + result = (BOOL)watchdogTaskCheckedIn[ task ].data; + } + } + else + { + activateAlarmNoData( ALARM_ID_HD_SOFTWARE_FAULT ); + } + + return result; +} -/************************************************************************* - * @brief petWatchdog - * The petWatchdog function pets the watchdog by pulsing the CPLD WD pet /n +/*********************************************************************//** + * @brief + * The petWatchdog function pets the watchdog by pulsing the CPLD WD pet * signal. * @details * Inputs : none @@ -287,17 +314,59 @@ *************************************************************************/ -/************************************************************************* - * @brief testSetWatchdogTaskCheckInOverride and testResetWatchdogTaskCheckInOverride +/*********************************************************************//** + * @brief * The testSetWatchdogTaskCheckInOverride function overrides the state of the * task check-in with the watchdog management with a given check-in state. - * The testResetWatchdogTaskCheckInOverride function resets the override of the - * state of the check-in with the watchdog management. * @details * Inputs : none * Outputs : watchdogTaskCheckedIn[] * @param task ID of task to override check-in state for * @param value override state for the given task ID * @return TRUE if override successful, FALSE if not *************************************************************************/ -DATA_ARRAY_OVERRIDE_FUNC( BOOL, testSetWatchdogTaskCheckInOverride, testResetWatchdogTaskCheckInOverride, watchdogTaskCheckedIn, task, NUM_OF_TASKS ) +BOOL testSetWatchdogTaskCheckInOverride( U32 task, BOOL value ) +{ + BOOL result = FALSE; + + if ( task < NUM_OF_TASKS ) + { + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + watchdogTaskCheckedIn[ task ].ovData = value; + watchdogTaskCheckedIn[ task ].override = OVERRIDE_KEY; + } + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetWatchdogTaskCheckInOverride function resets the override of the + * state of the check-in with the watchdog management. + * @details + * Inputs : none + * Outputs : watchdogTaskCheckedIn[] + * @param task ID of task to override check-in state for + * @return TRUE if override reset successful, FALSE if not + *************************************************************************/ +BOOL testResetWatchdogTaskCheckInOverride( U32 task ) +{ + BOOL result = FALSE; + + if ( task < NUM_OF_TASKS ) + { + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + watchdogTaskCheckedIn[ task ].override = OVERRIDE_RESET; + watchdogTaskCheckedIn[ task ].ovData = watchdogTaskCheckedIn[ task ].ovInitData; + } + } + + return result; +} + +/**@}*/ Index: firmware/App/Services/WatchdogMgmt.h =================================================================== diff -u -rde5a0d43bdef611d963d11855bc958a8d8899a09 -r8dad6fab1c33602ad94908fd31b8b15153a9eb6e --- firmware/App/Services/WatchdogMgmt.h (.../WatchdogMgmt.h) (revision de5a0d43bdef611d963d11855bc958a8d8899a09) +++ firmware/App/Services/WatchdogMgmt.h (.../WatchdogMgmt.h) (revision 8dad6fab1c33602ad94908fd31b8b15153a9eb6e) @@ -20,15 +20,25 @@ #include "HDCommon.h" +/** + * @defgroup WatchdogMgmt WatchdogMgmt + * @brief The watchdog management module provides functions for checking in + * with and petting the watchdog. + * + * @addtogroup WatchdogMgmt + * @{ + */ + // ********** public definitions ********** - + +/// Enumeration of tasks that must check in with the watchdog manager. typedef enum Tasks { - TASK_BG = 0, // Background - TASK_GENERAL, // General - TASK_PRIORITY, // Priority - TASK_TIMER, // Timer - NUM_OF_TASKS + TASK_BG = 0, ///< Background task + TASK_GENERAL, ///< General task + TASK_PRIORITY, ///< Priority task + TASK_TIMER, ///< Timer task + NUM_OF_TASKS ///< Number of tasks } TASK_T; // ********** public function prototypes ********** @@ -41,4 +51,6 @@ BOOL testSetWatchdogTaskCheckInOverride( U32 task, BOOL value ); BOOL testResetWatchdogTaskCheckInOverride( U32 task ); +/**@}*/ + #endif