Index: firmware/App/Services/DDInterface.c =================================================================== diff -u -r9ea1971251bb0064e626c21e7d94215114254a98 -r3518e8a088c32e75c0c8960d5e629a7401095feb --- firmware/App/Services/DDInterface.c (.../DDInterface.c) (revision 9ea1971251bb0064e626c21e7d94215114254a98) +++ firmware/App/Services/DDInterface.c (.../DDInterface.c) (revision 3518e8a088c32e75c0c8960d5e629a7401095feb) @@ -56,9 +56,9 @@ /*********************************************************************//** * @brief - * The initDDInterface function initializes the DDInterface module. - * @details Inputs: none - * @details Outputs: DDInterface module initialized. + * The initDDInterface function initializes the DDInterface unit. + * @details \b Inputs: none + * @details \b Outputs: DDInterface unit initialized. * @return none *************************************************************************/ void initDDInterface( void ) @@ -84,12 +84,15 @@ /**********************************************************************//** * @brief - * The checkDGDataFreshness function checks the condition - * for triggering an alarm if the DG fresh data is not received for 2 seconds. - * @details Inputs: none - * @details Outputs: an alarm is triggered or an alarm condition is cleared + * The checkDGDataFreshness function checks the freshness of data coming from + * the DD sub-system. + * @details \b Alarm: Given alarm is triggered if DD is communicating but has + * not published new data for too long. + * @details \b Inputs: DD communicating flag + * @details \b Outputs: none * @param alarm ID of alarm to check - * @param flag to signal the fresh data processing + * @param dgFreshDataFlag Pointer to flag indicating whether new data has been + * received since last time this function has seen it. * @return None *************************************************************************/ static void checkDGDataFreshness( ALARM_ID_T alarmID, BOOL *dgFreshDataFlag ) @@ -114,27 +117,22 @@ /*********************************************************************//** * @brief - * The execDGInterfaceMonitor function executes the DG Interface monitoring - * function. Ensures DG is sending fresh data in a timely manner. - * @details Inputs: dgLoadCellDataFreshFlag, dgDialysateTemperatureDataFreshFlag, - * dgReservoirsDataFreshFlag, dgOpModeDataFreshFlag - * @details Outputs: dgLoadCellDataFreshFlag, dgDialysateTemperatureDataFreshFlag, - * dgReservoirsDataFreshFlag, dgOpModeDataFreshFlag + * The execDGInterfaceMonitor function executes the DD Interface monitoring + * function. Ensures DD is sending fresh data in a timely manner. + * @details \b Inputs: ddOpModeDataFreshFlag + * @details \b Outputs: ddOpModeDataFreshFlag * @return none *************************************************************************/ void execDDInterfaceMonitor( void ) { // if ( getCPLDACPowerLossDetected() != TRUE ) { - // Trigger alarm if not receiving new dialysate temperature data message in timely manner -// checkDGDataFreshness( ALARM_ID_HD_NEW_DIALYSATE_TEMP_DATA_MESSAGE_NOT_RECEIVE, &dgDialysateTemperatureDataFreshFlag ); - - // Trigger alarm if not receiving new DG op mode message in timely manner -// checkDGDataFreshness( ALARM_ID_HD_DG_NEW_OPERATION_MODE_MESSAGE_NOT_RECEIVE, &dgOpModeDataFreshFlag ); -// if ( TRUE == isAlarmActive( ALARM_ID_HD_DG_NEW_OPERATION_MODE_MESSAGE_NOT_RECEIVE ) ) + // Trigger alarm if not receiving new DD op mode message in timely manner +// checkDDDataFreshness( ALARM_ID_TD_DD_NEW_OPERATION_MODE_MESSAGE_NOT_RECEIVE, &ddOpModeDataFreshFlag ); +// if ( TRUE == isAlarmActive( ALARM_ID_TD_DD_NEW_OPERATION_MODE_MESSAGE_NOT_RECEIVE ) ) // { -// // we don't want to keep thinking DG is in a useful mode - set it to fault mode until DG is able to report its' true mode status -// setDGOpMode( DG_MODE_FAUL, 0 ); +// // we don't want to keep thinking DD is in a useful mode - set it to fault mode until DD is able to report its' true mode status +// setDDOpMode( DD_MODE_FAUL, 0 ); // } // Check to see if DD has restarted @@ -144,10 +142,10 @@ /*********************************************************************//** * @brief - * The getDDOpMode function gets the current DD operating mode. - * @details Inputs: ddCurrentOpMode - * @details Outputs: none - * @return Current DD operating mode. + * The getDDOpMode function gets the current latest reported DD operating mode. + * @details \b Inputs: ddCurrentOpMode + * @details \b Outputs: none + * @return Latest reported DD operating mode. *************************************************************************/ DD_OP_MODE_T getDDOpMode( void ) { @@ -156,10 +154,10 @@ /*********************************************************************//** * @brief - * The getDGSubMode function gets the current DG operating sub-mode. - * @details Inputs: dgSubMode - * @details Outputs: none - * @return Current DG operating sub-mode. + * The getDGSubMode function gets the latest reported DD operating sub-mode. + * @details \b Inputs: ddSubMode + * @details \b Outputs: none + * @return Latest reported DD operating sub-mode. *************************************************************************/ U32 getDDSubMode( void ) { @@ -168,12 +166,13 @@ /*********************************************************************//** * @brief - * The setDGOpMode function sets the latest DG operating mode reported by - * the DG. - * @details Inputs: none - * @details Outputs: dgCurrentOpMode, dgSubMode, dgOpModeDataFreshFlag - * @param opMode operating mode reported by DG - * @param subMode sub-mode (current state) of operating mode reported by DG + * The setDDOpMode function sets the latest DD operating mode reported by + * the DD (called by DD published message handler). + * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if reported DD mode is invalid. + * @details \b Inputs: none + * @details \b Outputs: ddCurrentOpMode, ddSubMode, ddOpModeDataFreshFlag + * @param opMode The operating mode reported by DD + * @param subMode The sub-mode of operating mode reported by DD * @return none *************************************************************************/ void setDDOpMode( U32 opMode, U32 subMode ) @@ -200,9 +199,13 @@ /*********************************************************************//** * @brief * The handleDDCommandResponse function processes the latest DD command response. - * @details Inputs: none - * @details Outputs: process command response from DD - * @param ddCmdRespPtr pointer to DD command response data record + * @details \b Alarm: ALARM_ID_TD_DD_COMMAND_INVALID_PARAMETER_FAULT if reported + * response indicates DD rejected command due to invalid parameter. + * @details \b Alarm: ALARM_ID_TD_SOFTWARE_FAULT if reported response is to an + * invalid command. + * @details \b Inputs: none + * @details \b Outputs: ddCmdResp[] + * @param ddCmdRespPtr Pointer to the received DD command response * @return none *************************************************************************/ void handleDDCommandResponse( DD_CMD_RESPONSE_T *ddCmdRespPtr ) @@ -224,14 +227,13 @@ switch ( ddCmdRespPtr->rejectCode ) { case DD_CMD_REQUEST_REJECT_REASON_INVALID_PARAMETER: -// SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_DG_COMMAND_INVALID_PARAMETER_FAULT, ddCmdRespPtr->commandID ); +// SET_ALARM_WITH_1_U32_DATA( ALARM_ID_TD_DD_COMMAND_INVALID_PARAMETER_FAULT, ddCmdRespPtr->commandID ); break; case DD_CMD_REQUEST_REJECT_REASON_NONE: case DD_CMD_REQUEST_REJECT_REASON_INVALID_MODE: default: - // Our state machines will detect and handle DG mode out of sync - // TODO Consider a generic handler for all state machine + // Our state machines will detect and handle DD mode out of sync break; } } @@ -240,11 +242,13 @@ /*********************************************************************//** * @brief * The getDDCommandResponse function gets the latest command response from DD. - * @details Inputs: ddCmdResp - * @details Outputs: none - * @param commandID id of specific interested command response - * @param cmdRespPtr pointer to data record to copy DD command response to - * @return TRUE if a specific command response has been received, otherwise FALSE + * @details \b Inputs: ddCmdResp[] + * @details \b Outputs: cmdRespPtr reference variable is set to the received + * command response. + * @param commandID ID of specific command that caller wants a response to + * @param cmdRespPtr Pointer to command response record to populate with received + * response + * @return TRUE if a response was received for the given command, FALSE if not. *************************************************************************/ BOOL getDDCommandResponse( U32 commandID, DD_CMD_RESPONSE_T *cmdRespPtr ) { @@ -261,10 +265,11 @@ /*********************************************************************//** * @brief - * The checkDDRestart function checks to see if DD has restarted after started - * by TD and triggers appropriate alarm. - * @details Inputs: ddStartCommandSent, ddStarted, ddCurrentOpMode - * @details Outputs: ddStartCommandSent, ddStarted, triggers a fault alarm if DD restarted + * The checkDDRestart function checks to see if the DD sub-system has restarted + * after an operation was started by TD. + * @details \b Alarm: ALARM_ID_TD_DD_RESTARTED_FAULT if DD has restarted unexpectedly. + * @details \b Inputs: ddStartCommandSent, ddStarted, ddCurrentOpMode + * @details \b Outputs: ddStartCommandSent, ddStarted * @return none *************************************************************************/ static void checkDDRestart( void ) @@ -280,7 +285,7 @@ // if ( ( DG_MODE_FAUL != ddCurrentOpMode ) && ( DG_MODE_GEND != ddCurrentOpMode ) && // ( DG_MODE_FILL != ddCurrentOpMode ) && ( DG_MODE_DRAI != ddCurrentOpMode ) ) // { -// activateAlarmNoData( ALARM_ID_HD_DG_RESTARTED_FAULT ); +// activateAlarmNoData( ALARM_ID_TD_DD_RESTARTED_FAULT ); // ddStarted = FALSE; // do not want to re-trigger alarm after alarm is cleared // } // }