Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -rfc7328b2b8158c88e11a063204d7e87519f472ca -rcd5be724d5a3ba7457e761191d82f278654d7f5c --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision fc7328b2b8158c88e11a063204d7e87519f472ca) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision cd5be724d5a3ba7457e761191d82f278654d7f5c) @@ -1,14 +1,14 @@ /************************************************************************** * -* Copyright (c) 2019-2023 Diality Inc. - All Rights Reserved. +* Copyright (c) 2019-2024 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file SystemComm.c * * @author (last) Sean Nash -* @date (last) 07-Jul-2023 +* @date (last) 10-Oct-2023 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -60,6 +60,9 @@ #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 channel when Pending ACKs are overriden. +#define PENDING_ACK_LIST_OVERRIDE_DG_CHANNEL 2 ///< Value for determining DG channel when Pending ACKs are overriden. + #pragma pack(push, 1) /// Record for transmitted message that is pending acknowledgment from receiver. @@ -112,7 +115,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 ********** @@ -875,15 +879,20 @@ static BOOL matchACKtoPendingACKList( S16 seqNo ) { BOOL result = FALSE; - U32 i; + U32 i; // Find match for ( i = 0; i < PENDING_ACK_LIST_SIZE; i++ ) { if ( ( TRUE == pendingAckList[ i ].used ) && ( pendingAckList[ i ].seqNo == seqNo ) ) - { // Remove message pending ACK from list - pendingAckList[ i ].used = FALSE; - result = TRUE; + { + result = TRUE; + // Remove message pending ACK from list + if ( ( ( getU32OverrideValue( &pendingACKOverride ) != PENDING_ACK_LIST_OVERRIDE_UI_CHANNEL ) || ( pendingAckList[ i ].channel != COMM_BUFFER_OUT_CAN_HD_2_UI ) ) && + ( ( getU32OverrideValue( &pendingACKOverride ) != PENDING_ACK_LIST_OVERRIDE_DG_CHANNEL ) || ( pendingAckList[ i ].channel != COMM_BUFFER_OUT_CAN_HD_2_DG ) ) ) + { + pendingAckList[ i ].used = FALSE; + } break; } } @@ -921,6 +930,7 @@ 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 ) { SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_CAN_MESSAGE_NOT_ACKED_BY_UI, (U32)msgID ); @@ -1210,7 +1220,7 @@ } // Handle any test messages if tester has logged in successfully - if ( ( msgID > MSG_ID_FIRST_TESTER_MESSAGE ) && ( msgID <= END_OF_MSG_IDS ) && ( TRUE == isTestingActivated() ) ) + if ( ( msgID > MSG_ID_FIRST_TESTER_MESSAGE ) && ( TRUE == isTestingActivated() ) ) { switch ( msgID ) { @@ -1374,7 +1384,7 @@ handleTestSetTreatmentParameter( message ); break; - case MSG_ID_VALVES_STATES_PUBLISH_INTERVAL_OVERRIDE: + case MSG_ID_HD_VALVES_STATES_PUBLISH_INTERVAL_OVERRIDE: handleTestHDValvesBroadcastIntervalOverrideRequest( message ); break; @@ -1794,6 +1804,18 @@ handleTestHDSetRecoverFromFaultModeSignal( message ); break; + case MSG_ID_HD_RAM_STATUS_OVERRIDE: + handleTestHDRAMStatusOverrideRequest( message ); + break; + + case MSG_ID_HD_CAN_RECEIVE_ACK_MESSAGE_OVERRIDE: + handleTestHDPendingACKOverrideRequest( message ); + break; + + case MSG_ID_HD_RECIRULATION_PCT_OVERRIDE: + handleTestHDRecirulationPctOverrideRequest( message ); + break; + // The default cannot be reached in VectorCAST since the cases are run in a for loop default: // Unrecognized message ID received - ignore @@ -1802,4 +1824,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; +} /**@}*/