Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r754057a5f3b2412271b23bfffef39ada8fab7bcb -r97a93f387f6797fc747895fc915323220db12573 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 754057a5f3b2412271b23bfffef39ada8fab7bcb) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 97a93f387f6797fc747895fc915323220db12573) @@ -60,6 +60,8 @@ #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 +#define PENDING_ACK_LIST_OVERRIDE_UI_CHANNEL 1 ///< Value for determining UI or DG channel when Pending ACKs are overriden. + #pragma pack(push, 1) /// Record for transmitted message that is pending acknowledgment from receiver. @@ -112,7 +114,8 @@ 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 uiDidCommunicate = FALSE; ///< Has UI every sent a message +static OVERRIDE_U32_T pendingACKOverride = { 0, 0, 0, 0 }; ///< Pending ACK override data structure. // ********** private function prototypes ********** @@ -907,7 +910,8 @@ // Find expired messages pending ACK for ( i = 0; i < PENDING_ACK_LIST_SIZE; i++ ) { // Pending ACK expired? - if ( ( TRUE == pendingAckList[ i ].used ) && ( TRUE == didTimeout( pendingAckList[ i ].timeStamp, MSG_NOT_ACKED_TIMEOUT_MS ) ) ) + if ( ( ( TRUE == pendingAckList[ i ].used ) && ( TRUE == didTimeout( pendingAckList[ i ].timeStamp, MSG_NOT_ACKED_TIMEOUT_MS ) ) ) || + ( getU32OverrideValue( &pendingACKOverride ) > 0 ) ) { // If retries left, reset and resend pending message if ( pendingAckList[ i ].retries > 0 ) { // Re-queue message for transmit @@ -921,10 +925,13 @@ U16 msgID; memcpy( &msgID, (U08*)&pendingAckList[ i ].msg[ sizeof( U08 ) + sizeof( U16) ], sizeof( U16 ) ); - if ( pendingAckList[ i ].channel != COMM_BUFFER_OUT_CAN_HD_2_DG ) + + if ( ( pendingAckList[ i ].channel != COMM_BUFFER_OUT_CAN_HD_2_DG ) || + ( getU32OverrideValue( &pendingACKOverride ) == PENDING_ACK_LIST_OVERRIDE_UI_CHANNEL ) ) { SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_CAN_MESSAGE_NOT_ACKED_BY_UI, (U32)msgID ); } + else { SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_CAN_MESSAGE_NOT_ACKED_BY_DG, (U32)msgID ); @@ -1798,6 +1805,10 @@ handleTestHDRAMStatusOverrideRequest( message ); break; + case MSG_ID_HD_CAN_RECEIVE_ACK_MESSAGE_OVERRIDE: + handleTestHDPendingACKOverrideRequest( message ); + break; + // The default cannot be reached in VectorCAST since the cases are run in a for loop default: // Unrecognized message ID received - ignore @@ -1806,4 +1817,54 @@ } } + +/************************************************************************* + * TEST SUPPORT FUNCTIONS + *************************************************************************/ + + +/*********************************************************************//** + * @brief + * The testSetPendingACKOverride function overrides the + * pendingACKOverride variable. + * @details Inputs: none + * @details Outputs: pendingACKOverride + * @param value override for pendingACKOverride + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testSetPendingACKOverride( U32 value ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + pendingACKOverride.ovData = value; + pendingACKOverride.override = OVERRIDE_KEY; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The testResetPendingACKOverride function resets the override + * of the pendingACKOverride variable. + * @details Inputs: none + * @details Outputs: pendingACKOverride + * @return TRUE if override reset successful, FALSE if not + *************************************************************************/ +BOOL testResetPendingACKOverride( void ) +{ + BOOL result = FALSE; + + if ( TRUE == isTestingActivated() ) + { + result = TRUE; + pendingACKOverride.override = OVERRIDE_RESET; + pendingACKOverride.ovData = pendingACKOverride.ovInitData; + } + + return result; +} /**@}*/ Index: firmware/App/Services/SystemComm.h =================================================================== diff -u -r0a4dcd288d4347b85baaa0b07da568b6add5eac7 -r97a93f387f6797fc747895fc915323220db12573 --- firmware/App/Services/SystemComm.h (.../SystemComm.h) (revision 0a4dcd288d4347b85baaa0b07da568b6add5eac7) +++ firmware/App/Services/SystemComm.h (.../SystemComm.h) (revision 97a93f387f6797fc747895fc915323220db12573) @@ -57,7 +57,9 @@ BOOL isUICommunicating( void ); BOOL uiCommunicated( void ); BOOL isHDOnlyCANNode( void ); -BOOL addMsgToPendingACKList( MESSAGE_T *msg, COMM_BUFFER_T channel, U08 *msgData, U32 len ); +BOOL addMsgToPendingACKList( MESSAGE_T *msg, COMM_BUFFER_T channel, U08 *msgData, U32 len ); +BOOL testSetPendingACKOverride( U32 value ); +BOOL testResetPendingACKOverride( void ); /**@}*/ Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -r0826b00090b65c16a3e52e006cc3c016a6bf6a08 -r97a93f387f6797fc747895fc915323220db12573 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 0826b00090b65c16a3e52e006cc3c016a6bf6a08) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 97a93f387f6797fc747895fc915323220db12573) @@ -8431,4 +8431,36 @@ sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); } +/*********************************************************************//** + * @brief + * The handleTestHDPendingACKOverrideRequest function handles a + * request to override pending ACKs. + * @details Inputs: none + * @details Outputs: message handled + * @param message : a pointer to the message to handle + * @return none + *************************************************************************/ +void handleTestHDPendingACKOverrideRequest( MESSAGE_T *message ) +{ + TEST_OVERRIDE_PAYLOAD_T payload; + BOOL result = FALSE; + + // Verify payload length + if ( sizeof( TEST_OVERRIDE_PAYLOAD_T ) == message->hdr.payloadLen ) + { + memcpy( &payload, message->payload, sizeof( TEST_OVERRIDE_PAYLOAD_T ) ); + if ( FALSE == payload.reset ) + { + result = testSetPendingACKOverride( payload.state.u32 ); + } + else + { + result = testResetPendingACKOverride(); + } + } + + // Respond to request + sendTestAckResponseMsg( (MSG_ID_T)message->hdr.msgID, result ); +} + /**@}*/ Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -r0826b00090b65c16a3e52e006cc3c016a6bf6a08 -r97a93f387f6797fc747895fc915323220db12573 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 0826b00090b65c16a3e52e006cc3c016a6bf6a08) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 97a93f387f6797fc747895fc915323220db12573) @@ -1010,6 +1010,9 @@ // MSG_ID_HD_RAM_STATUS_OVERRIDE void handleTestHDRAMStatusOverrideRequest( MESSAGE_T* message ); +// MSG_ID_HD_CAN_RECEIVE_ACK_MESSAGE_OVERRIDE +void handleTestHDPendingACKOverrideRequest( MESSAGE_T* message ); + /**@}*/ #endif