Index: firmware/App/Services/StateServices/TubeSetAutoEject.h =================================================================== diff -u -r4ea39ac34ede5011de1954b7c58761df25120fcf -r4c35d4de9fd7fccaf7aa4adb9a68115e823adf64 --- firmware/App/Services/StateServices/TubeSetAutoEject.h (.../TubeSetAutoEject.h) (revision 4ea39ac34ede5011de1954b7c58761df25120fcf) +++ firmware/App/Services/StateServices/TubeSetAutoEject.h (.../TubeSetAutoEject.h) (revision 4c35d4de9fd7fccaf7aa4adb9a68115e823adf64) @@ -49,11 +49,11 @@ // ********** public function prototypes ********** -void initTubeSetAutoEject( void ); ///< Initialize this service -void execTubeSetAutoEject( void ); ///< Execute the service state machine (call from ModePostTreat and ModeTreatment) +void initTubeSetAutoEject( void ); // Initialize this service +void execTubeSetAutoEject( void ); // Execute the service state machine (call from ModePostTreat and ModeTreatment) -BOOL isTubeSetAutoEjectComplete( void ); ///< Returns True once auto-eject finished successfully -BOOL handleAutoEjectRequest( MESSAGE_T *message ); ///< Handle UI auto-eject confirmation request +BOOL isTubeSetAutoEjectComplete( void ); // Returns True once auto-eject finished successfully +BOOL handleAutoEjectRequest( MESSAGE_T *message ); // Handle UI auto-eject confirmation request /**@}*/ Index: firmware/App/Services/StateServices/TubeSetInstall.h =================================================================== diff -u -r4ea39ac34ede5011de1954b7c58761df25120fcf -r4c35d4de9fd7fccaf7aa4adb9a68115e823adf64 --- firmware/App/Services/StateServices/TubeSetInstall.h (.../TubeSetInstall.h) (revision 4ea39ac34ede5011de1954b7c58761df25120fcf) +++ firmware/App/Services/StateServices/TubeSetInstall.h (.../TubeSetInstall.h) (revision 4c35d4de9fd7fccaf7aa4adb9a68115e823adf64) @@ -47,14 +47,14 @@ // ********** public function prototypes ********** -void initTubeSetInstall( void ); ///< Initialize this service -void execTubeSetInstall( void ); ///< Execute the service state machine (call from ModePreTreat and ModeTreatment) +void initTubeSetInstall( void ); // Initialize this service +void execTubeSetInstall( void ); // Execute the service state machine (call from ModePreTreat and ModeTreatment) -BOOL isTubeSetInstallComplete( void ); ///< Returns True once auto-load finished successfully -BOOL handleAutoLoadRequest( MESSAGE_T *message ); ///< Handle UI auto-load confirmation request +BOOL isTubeSetInstallComplete( void ); // Returns True once auto-load finished successfully +BOOL handleAutoLoadRequest( MESSAGE_T *message ); // Handle UI auto-load confirmation request -void setTubeSetType( TUBE_SET_TYPE_T type ); ///< Set the current installed tube set type -TUBE_SET_TYPE_T getTubeSetType( void ); ///< Get the current installed tube set type +void setTubeSetType( TUBE_SET_TYPE_T type ); // Set the current installed tube set type +TUBE_SET_TYPE_T getTubeSetType( void ); // Get the current installed tube set type /**@}*/ Index: firmware/App/Services/SystemCommTD.c =================================================================== diff -u -rf8a6d0d2b55d834e1e25ec98370e538ff547e148 -r4c35d4de9fd7fccaf7aa4adb9a68115e823adf64 --- firmware/App/Services/SystemCommTD.c (.../SystemCommTD.c) (revision f8a6d0d2b55d834e1e25ec98370e538ff547e148) +++ firmware/App/Services/SystemCommTD.c (.../SystemCommTD.c) (revision 4c35d4de9fd7fccaf7aa4adb9a68115e823adf64) @@ -14,35 +14,35 @@ * @date (original) 01-Aug-2024 * ***************************************************************************/ - -#include // For memcpy() - -#include "can.h" -#include "sci.h" -#include "sys_dma.h" - -#include "Comm.h" + +#include // For memcpy() + +#include "can.h" +#include "sci.h" +#include "sys_dma.h" + +#include "Comm.h" #include "Interrupts.h" -#include "Messaging.h" +#include "Messaging.h" #include "OperationModes.h" #include "SystemCommTD.h" -#include "Timers.h" -#include "Utilities.h" - +#include "Timers.h" +#include "Utilities.h" + /** * @addtogroup SystemCommTD * @{ */ -// ********** private definitions ********** - +// ********** private definitions ********** + #define UI_COMM_TIMEOUT_IN_MS 7500 ///< Maximum time (in ms) that UI is allowed to wait before checking in with HD. -#define UI_COMM_SERVICE_MODE_TIMEOUT_IN_MS (2 * SEC_PER_MIN * MS_PER_SECOND) ///< Maximum time (in ms) that UI is allowed to wait before checking in with HD when in service mode. -#define DG_COMM_TIMEOUT_IN_MS 1000 ///< DG has not checked in for this much time - -#define MAX_COMM_CRC_FAILURES 5 ///< Maximum number of CRC errors within window period before alarm -#define MAX_COMM_CRC_FAILURE_WINDOW_MS (10 * SEC_PER_MIN * MS_PER_SECOND) ///< CRC error window - +#define UI_COMM_SERVICE_MODE_TIMEOUT_IN_MS (2 * SEC_PER_MIN * MS_PER_SECOND) ///< Maximum time (in ms) that UI is allowed to wait before checking in with HD when in service mode. +#define DG_COMM_TIMEOUT_IN_MS 1000 ///< DG has not checked in for this much time + +#define MAX_COMM_CRC_FAILURES 5 ///< Maximum number of CRC errors within window period before alarm +#define MAX_COMM_CRC_FAILURE_WINDOW_MS (10 * SEC_PER_MIN * MS_PER_SECOND) ///< CRC error window + #define MAX_FPGA_CLOCK_SPEED_ERRORS 3 ///< maximum number of FPGA clock speed errors within window period before alarm #define MAX_FPGA_CLOCK_SPEED_ERROR_WINDOW_MS (10 * SEC_PER_MIN * MS_PER_SECOND) ///< FPGA clock speed error window @@ -70,122 +70,122 @@ COMM_BUFFER_IN_CAN_PC, }; -// ********** private data ********** - +// ********** private data ********** + static volatile BOOL tdIsOnlyCANNode = TRUE; ///< Flag indicating whether HD is alone on CAN bus. -static volatile BOOL ddIsCommunicating = FALSE; ///< Has DD sent a message since last check -static U32 timeOfLastDDCheckIn = 0; ///< Last time DD 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 ddIsCommunicating = FALSE; ///< Has DD sent a message since last check +static U32 timeOfLastDDCheckIn = 0; ///< Last time DD 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 - -// ********** private function prototypes ********** - - -/*********************************************************************//** - * @brief + +// ********** private function prototypes ********** + + +/*********************************************************************//** + * @brief * The initSystemCommTD function initializes the system communication unit - * for the TD firmware. - * @details \b Inputs: none - * @details \b Outputs: SystemComm unit initialized. - * @return none - *************************************************************************/ -void initSystemCommTD( void ) + * for the TD firmware. + * @details \b Inputs: none + * @details \b Outputs: SystemComm unit initialized. + * @return none + *************************************************************************/ +void initSystemCommTD( void ) { // Initialize common system comm unit initSystemComm(); - + // Initialize bad message CRC time windowed count initTimeWindowedCount( TIME_WINDOWED_COUNT_BAD_MSG_CRC, MAX_COMM_CRC_FAILURES, MAX_COMM_CRC_FAILURE_WINDOW_MS ); // Initialize FPGA clock speed error time windowed count initTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_CLOCK_SPEED_ERROR, MAX_FPGA_CLOCK_SPEED_ERRORS, MAX_FPGA_CLOCK_SPEED_ERROR_WINDOW_MS); -} - -/*********************************************************************//** - * @brief - * The checkInFromDD function checks in the DD with the TD - indicating that - * the DD is communicating. - * @details \b Inputs: none - * @details \b Outputs: ddIsCommunicating, timeOfLastDDCheckIn - * @return none - *************************************************************************/ -void checkInFromDD( void ) -{ - ddIsCommunicating = TRUE; +} + +/*********************************************************************//** + * @brief + * The checkInFromDD function checks in the DD with the TD - indicating that + * the DD is communicating. + * @details \b Inputs: none + * @details \b Outputs: ddIsCommunicating, timeOfLastDDCheckIn + * @return none + *************************************************************************/ +void checkInFromDD( void ) +{ + ddIsCommunicating = TRUE; timeOfLastDDCheckIn = getMSTimerCount(); if ( TRUE == isAlarmActive( ALARM_ID_TD_DD_COMM_TIMEOUT ) ) { clearAlarmCondition( ALARM_ID_TD_DD_COMM_TIMEOUT ); - } -} - -/*********************************************************************//** - * @brief - * The checkInFromUI function checks in the UI with the TD - indicating that - * the UI is communicating. - * @details \b Inputs: none - * @details \b Outputs: uiIsCommunicating, timeOfLastUICheckIn, uiDidCommunicate - * @return none - *************************************************************************/ -void checkInFromUI( void ) -{ + } +} + +/*********************************************************************//** + * @brief + * The checkInFromUI function checks in the UI with the TD - indicating that + * the UI is communicating. + * @details \b Inputs: none + * @details \b Outputs: uiIsCommunicating, timeOfLastUICheckIn, uiDidCommunicate + * @return none + *************************************************************************/ +void checkInFromUI( void ) +{ if ( FALSE == uiDidCommunicate ) { // Start DD check-in timer when UI first communicates timeOfLastDDCheckIn = getMSTimerCount(); } - - uiIsCommunicating = TRUE; - timeOfLastUICheckIn = getMSTimerCount(); - uiDidCommunicate = TRUE; -} - -/*********************************************************************//** - * @brief - * The isDDCommunicating function determines whether the DD is communicating - * with the TD. - * @details \b Inputs: ddIsCommunicating - * @details \b Outputs: none - * @return TRUE if DD is communicating, FALSE if not - *************************************************************************/ -BOOL isDDCommunicating( void ) -{ - return ddIsCommunicating; -} - -/*********************************************************************//** - * @brief - * The isUICommunicating function determines whether the UI is communicating - * with the TD. - * @details \b Inputs: uiIsCommunicating - * @details \b Outputs: uiIsCommunicating - * @return TRUE if UI has checked in since last call, FALSE if not - *************************************************************************/ -BOOL isUICommunicating( void ) -{ - BOOL result = uiIsCommunicating; - - uiIsCommunicating = FALSE; - - return result; -} - -/*********************************************************************//** - * @brief + + uiIsCommunicating = TRUE; + timeOfLastUICheckIn = getMSTimerCount(); + uiDidCommunicate = TRUE; +} + +/*********************************************************************//** + * @brief + * The isDDCommunicating function determines whether the DD is communicating + * with the TD. + * @details \b Inputs: ddIsCommunicating + * @details \b Outputs: none + * @return TRUE if DD is communicating, FALSE if not + *************************************************************************/ +BOOL isDDCommunicating( void ) +{ + return ddIsCommunicating; +} + +/*********************************************************************//** + * @brief + * The isUICommunicating function determines whether the UI is communicating + * with the TD. + * @details \b Inputs: uiIsCommunicating + * @details \b Outputs: uiIsCommunicating + * @return TRUE if UI has checked in since last call, FALSE if not + *************************************************************************/ +BOOL isUICommunicating( void ) +{ + BOOL result = uiIsCommunicating; + + uiIsCommunicating = FALSE; + + return result; +} + +/*********************************************************************//** + * @brief * The uiCommunicated function determines whether the UI has started communicating - * since power up. - * @details \b Inputs: uiDidCommunicate - * @details \b Outputs: none - * @return TRUE if UI has communicated since power up, FALSE if not - *************************************************************************/ -BOOL uiCommunicated( void ) + * since power up. + * @details \b Inputs: uiDidCommunicate + * @details \b Outputs: none + * @return TRUE if UI has communicated since power up, FALSE if not + *************************************************************************/ +BOOL uiCommunicated( void ) { #ifdef TEST_PROCESS_TASKS_WO_UI uiDidCommunicate = TRUE; #endif - return uiDidCommunicate; + return uiDidCommunicate; } /*********************************************************************//** @@ -213,8 +213,8 @@ void setOnlyCANNode( BOOL only ) { tdIsOnlyCANNode = only; -} - +} + /*********************************************************************//** * @brief * The clearCANXmitBuffers function clears all CAN transmit buffers. @@ -232,34 +232,34 @@ } } -/*********************************************************************//** - * @brief - * The checkForCommTimeouts function checks for sub-system communication +/*********************************************************************//** + * @brief + * The checkForCommTimeouts function checks for sub-system communication * timeout errors. * @details \b Alarm: ALARM_ID_TD_UI_COMM_TIMEOUT if UI no longer communicating. - * @details \b Alarm: ALARM_ID_TD_DD_COMM_TIMEOUT if DD no longer communicating. - * @details \b Inputs: timeOfLastDDCheckIn, timeOfLastUICheckIn - * @details \b Outputs: none - * @return none - *************************************************************************/ -void checkForCommTimeouts( void ) -{ - if ( TRUE == uiDidCommunicate ) + * @details \b Alarm: ALARM_ID_TD_DD_COMM_TIMEOUT if DD no longer communicating. + * @details \b Inputs: timeOfLastDDCheckIn, timeOfLastUICheckIn + * @details \b Outputs: none + * @return none + *************************************************************************/ +void checkForCommTimeouts( void ) +{ + if ( TRUE == uiDidCommunicate ) { TD_OP_MODE_T opMode = getCurrentOperationMode(); U32 uiTO_MS = ( MODE_SERV == opMode ? UI_COMM_SERVICE_MODE_TIMEOUT_IN_MS : UI_COMM_TIMEOUT_IN_MS ); - if ( TRUE == didTimeout( timeOfLastUICheckIn, uiTO_MS ) ) + if ( TRUE == didTimeout( timeOfLastUICheckIn, uiTO_MS ) ) { #ifndef _RELEASE_ // if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_UI_COMM_ALARMS ) != SW_CONFIG_ENABLE_VALUE ) #endif - { + { #ifndef TEST_DISABLE_UI_ALARMS activateAlarmNoData( ALARM_ID_TD_UI_COMM_TIMEOUT ); #endif } - } + } if ( TRUE == didTimeout( timeOfLastDDCheckIn, DG_COMM_TIMEOUT_IN_MS ) ) { @@ -353,21 +353,21 @@ return result; -} - -/*********************************************************************//** - * @brief - * The processReceivedMessage function processes a given message. - * @details \b Inputs: none - * @details \b Outputs: message processed - * @param message Pointer to the message to process. - * @return none - *************************************************************************/ -void processReceivedMessage( MESSAGE_T *message ) -{ +} + +/*********************************************************************//** + * @brief + * The processReceivedMessage function processes a given message. + * @details \b Inputs: none + * @details \b Outputs: message processed + * @param message Pointer to the message to process. + * @return none + *************************************************************************/ +void processReceivedMessage( MESSAGE_T *message ) +{ // Handle any messages from other sub-systems - handleIncomingMessage( message ); -} + handleIncomingMessage( message ); +} /*************************************************************************