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; +} /**@}*/