Index: firmware/App/Services/SystemCommDD.c =================================================================== diff -u -r52ded7b22d4b413aa8182f1343e4fbb78e8c3b0a -r090cfb22a7c0b4738299c3fb411ca77aaba8d968 --- firmware/App/Services/SystemCommDD.c (.../SystemCommDD.c) (revision 52ded7b22d4b413aa8182f1343e4fbb78e8c3b0a) +++ firmware/App/Services/SystemCommDD.c (.../SystemCommDD.c) (revision 090cfb22a7c0b4738299c3fb411ca77aaba8d968) @@ -38,7 +38,7 @@ // ********** private definitions ********** -#define HD_COMM_TIMEOUT_IN_MS 2000 ///< HD has not sent any broadcast messages for this much time +#define TD_COMM_TIMEOUT_IN_MS 2000 ///< TD has not sent any broadcast messages 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 @@ -55,7 +55,6 @@ COMM_BUFFER_OUT_CAN_DD_ALARM, COMM_BUFFER_OUT_CAN_DD_2_TD, COMM_BUFFER_OUT_CAN_DD_2_RO, - //COMM_BUFFER_OUT_CAN_DD_2_UI, COMM_BUFFER_OUT_CAN_DD_BROADCAST, COMM_BUFFER_OUT_CAN_PC }; @@ -70,26 +69,28 @@ COMM_BUFFER_IN_CAN_TD_BROADCAST, COMM_BUFFER_IN_CAN_RO_2_DD, COMM_BUFFER_IN_CAN_RO_BROADCAST, - //COMM_BUFFER_IN_CAN_UI_2_DD, COMM_BUFFER_IN_CAN_UI_BROADCAST, COMM_BUFFER_IN_CAN_PC, }; static volatile BOOL ddIsOnlyCANNode = TRUE; ///< flag indicating whether DG is alone on CAN bus. -static OVERRIDE_U32_T hdCommunicationStatus = {0, 0, 0, 0}; ///< has HD sent a message since last check -static volatile U32 timeOfLastHDCheckIn = 0; ///< last time we received an HD broadcast +static OVERRIDE_U32_T tdCommunicationStatus = {0, 0, 0, 0}; ///< has TD sent a message since last check +static volatile U32 timeOfLastTDCheckIn = 0; ///< last time we received an TD broadcast // ********** private function prototypes ********** /*********************************************************************//** * @brief * The initSystemCommDD function initializes the DD SystemComm module. - * @details Inputs: none - * @details Outputs: SystemComm module initialized. + * @details \b Inputs: none + * @details \b Outputs: SystemComm module initialized. * @return none *************************************************************************/ void initSystemCommDD( 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 ); @@ -102,21 +103,21 @@ * @brief * The isTDCommunicating function determines whether the TD is communicating * with the DD. - * @details Inputs: hdIsCommunicating - * @details Outputs: none - * @return TRUE if HD has broadcast since last call, FALSE if not + * @details \b Inputs: tdIsCommunicating + * @details \b Outputs: none + * @return TRUE if TD has broadcast since last call, FALSE if not *************************************************************************/ BOOL isTDCommunicating( void ) { - return getU32OverrideValue( &hdCommunicationStatus ); + return getU32OverrideValue( &tdCommunicationStatus ); } /*********************************************************************//** * @brief * The isOnlyCANNode function determines whether the DD is the only node * currently on the CAN bus. - * @details Inputs: ddIsOnlyCANNode - * @details Outputs: none + * @details \b Inputs: ddIsOnlyCANNode + * @details \b Outputs: none * @return TRUE if DD is only node on CAN bus, FALSE if not *************************************************************************/ BOOL isOnlyCANNode( void ) @@ -128,9 +129,9 @@ * @brief * The setOnlyCANNode function sets whether the DD is the only node * currently on the CAN bus. - * @details Inputs: none - * @details Outputs: ddIsOnlyCANNode - * @return only TRUE if HD is only node on CAN bus, FALSE if not + * @details \b Inputs: none + * @details \b Outputs: ddIsOnlyCANNode + * @return only TRUE if TD is only node on CAN bus, FALSE if not *************************************************************************/ void setOnlyCANNode( BOOL only ) { @@ -140,8 +141,8 @@ /*********************************************************************//** * @brief * The clearCANXmitBuffers function clears all CAN transmit buffers. - * @details Inputs: CAN_OUT_BUFFERS[] - * @details Outputs: CAN transmit buffers cleared. + * @details \b Inputs: CAN_OUT_BUFFERS[] + * @details \b Outputs: CAN transmit buffers cleared. * @return none *************************************************************************/ void clearCANXmitBuffers( void ) @@ -157,26 +158,26 @@ /*********************************************************************//** * @brief * The checkForCommTimeouts function checks for sub-system communication timeout errors. - * @details Inputs: timeOfLastDGCheckIn, timeOfLastUICheckIn - * @details Outputs: possibly a comm t/o alarm + * @details \b Inputs: timeOfLastDGCheckIn, timeOfLastUICheckIn + * @details \b Outputs: possibly a comm t/o alarm * @return none *************************************************************************/ void checkForCommTimeouts( void ) { - if ( TRUE == didTimeout( timeOfLastHDCheckIn, HD_COMM_TIMEOUT_IN_MS ) ) + if ( TRUE == didTimeout( timeOfLastTDCheckIn, TD_COMM_TIMEOUT_IN_MS ) ) { - hdCommunicationStatus.data = FALSE; - //setHDOperationMode( 0, 0 ); // If HD off or not connected, consider HD mode is fault. - //stopHeater( DG_TRIMMER_HEATER ); // If HD off or not connected, ensure trimmer heater is off. + tdCommunicationStatus.data = FALSE; + setTDOperationMode( 0, 0 ); // If TD off or not connected, consider TD mode is fault. + //stopHeater( DG_TRIMMER_HEATER ); // If TD off or not connected, ensure trimmer heater is off. } } /*********************************************************************//** * @brief * The getInBufferID function gets the buffer ID for a given buffer index. - * @details Inputs: CAN_IN_BUFFERS[] - * @details Outputs: none + * @details \b Inputs: CAN_IN_BUFFERS[] + * @details \b Outputs: none * @param idx incoming buffer index (e.g. 0 indicates first incoming buffer) * @return buffer id associated with given incoming buffer index *************************************************************************/ @@ -202,15 +203,16 @@ * The checkTooManyBadMsgCRCs function checks for too many bad message CRCs * within a set period of time. Assumed function is being called when a new * bad CRC is detected so a new bad CRC will be added to the list. - * @details Inputs: badCRCTimeStamps[], badCRCListIdx, badCRCListCount - * @details Outputs: possibly a "too many bad CRCs" alarm + * @details \b Inputs: badCRCTimeStamps[], badCRCListIdx, badCRCListCount + * @details \b Outputs: possibly a "too many bad CRCs" alarm + * @details \b Alarm: ALARM_ID_DD_COMM_TOO_MANY_BAD_CRCS when too many bad + * message CRC seen. * @return none *************************************************************************/ void checkTooManyBadMsgCRCs( void ) { if ( TRUE == incTimeWindowedCount( TIME_WINDOWED_COUNT_BAD_MSG_CRC ) ) { - //TODO : define alarm ID SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DD_COMM_TOO_MANY_BAD_CRCS, 2 ); // 2 for DG } } @@ -219,8 +221,8 @@ /*********************************************************************//** * @brief * The getOutBufferID function gets the buffer ID for a given buffer index. - * @details Inputs: CAN_OUT_BUFFERS[] - * @details Outputs: none + * @details \b Inputs: CAN_OUT_BUFFERS[] + * @details \b Outputs: none * @param idx outgoing buffer index (e.g. 0 indicates first outgoing buffer) * @return buffer id associated with given outgoing buffer index *************************************************************************/ @@ -245,8 +247,8 @@ /*********************************************************************//** * @brief * The processReceivedMessage function processes a given message. - * @details Inputs: none - * @details Outputs: message processed + * @details \b Inputs: none + * @details \b Outputs: message processed * @param message pointer to message to process * @return none *************************************************************************/ @@ -264,43 +266,43 @@ /*********************************************************************//** * @brief - * The testSetHDCommunicationStatus function sets the override - * of the HD communication status. - * @details Inputs: none - * @details Outputs: hdCommunicationStatus + * The testSetTDCommunicationStatus function sets the override + * of the TD communication status. + * @details \b Inputs: none + * @details \b Outputs: tdCommunicationStatus * @return TRUE if reset successful, FALSE if not *************************************************************************/ -BOOL testSetHDCommunicationStatus( U32 value ) +BOOL testSetTDCommunicationStatus( U32 value ) { BOOL result = FALSE; if (TRUE == isTestingActivated() ) { result = TRUE; - hdCommunicationStatus.ovData = value; - hdCommunicationStatus.override = OVERRIDE_KEY; + tdCommunicationStatus.ovData = value; + tdCommunicationStatus.override = OVERRIDE_KEY; } return result; } /*********************************************************************//** * @brief - * The testResetHDCommuncationStatus function resets the override - * of the HD communication status. - * @details Inputs: none - * @details Outputs: hdCommunicationStatus + * The testResetTDCommuncationStatus function resets the override + * of the TD communication status. + * @details \b Inputs: none + * @details \b Outputs: tdCommunicationStatus * @return TRUE if reset successful, FALSE if not *************************************************************************/ -BOOL testResetHDCommuncationStatus( void ) +BOOL testResetTDCommuncationStatus( void ) { BOOL result = FALSE; if (TRUE == isTestingActivated() ) { result = TRUE; - hdCommunicationStatus.override = OVERRIDE_RESET; - hdCommunicationStatus.ovData = hdCommunicationStatus.ovInitData; + tdCommunicationStatus.override = OVERRIDE_RESET; + tdCommunicationStatus.ovData = tdCommunicationStatus.ovInitData; } return result;