Index: SystemComm.c =================================================================== diff -u -r5fb988facecb08dceb2bba1c462d3097b53617f0 -r36a1b6d023b48c376f6a244b1ba716e04faf1550 --- SystemComm.c (.../SystemComm.c) (revision 5fb988facecb08dceb2bba1c462d3097b53617f0) +++ SystemComm.c (.../SystemComm.c) (revision 36a1b6d023b48c376f6a244b1ba716e04faf1550) @@ -94,7 +94,7 @@ static void consumeBufferPaddingBeforeSync( COMM_BUFFER_T buffer ); static void processReceivedMessages( void ); -static BOOL matchACKtoPendingACKList( S16 seqNo ); +static void matchACKtoPendingACKList( S16 seqNo ); static void checkPendingACKList( void ); /*********************************************************************//** @@ -570,10 +570,10 @@ /*********************************************************************//** * @brief - * The processReceivedMessages function processes any messages in the - * received message queues. - * @details Inputs: Received Message Queues - * @details Outputs: Message(s) processed. + * The processReceivedMessages function processes all messages in the + * received message queue. + * @details \b Inputs: none + * @details \b Outputs: none * @return none *************************************************************************/ static void processReceivedMessages( void ) @@ -617,13 +617,15 @@ * @brief * The addMsgToPendingACKList function adds a given message to the pending * ACK list. Messages in this list will require receipt of an ACK message - * for this particular message within a limited time. - * @details Inputs: pendingAckList[] - * @details Outputs: pendingAckList[] - * @param msg pointer to msg within the message data - * @param msgData pointer to message data to add to pending ACK list - * @param len number of bytes of message data - * @return TRUE if message added successfully, FALSE if not + * for this particular message within a limited time. + * @note List operations are thread protected by disabling IRQ interrupts. + * @details \b Inputs: pendingAckList[] + * @details \b Outputs: pendingAckList[] + * @param msg Pointer to the message record (needed for header info) + * @param channel CAN channel that the message was transmitted on (needed for re-send attempts) + * @param msgData Pointer to serialized message data to add to pending ACK list (needed for re-send attempts) + * @param len Number of bytes of message data (needed for re-send attempts) + * @return TRUE if the message was added to the list successfully, FALSE if not *************************************************************************/ BOOL addMsgToPendingACKList( MESSAGE_T *msg, COMM_BUFFER_T channel, U08 *msgData, U32 len ) { @@ -661,24 +663,23 @@ /*********************************************************************//** * @brief * The matchACKtoPendingACKList function searches the pending ACK list to - * see if the sequence # from a received ACK msg matches any. If found, - * the list entry is removed. - * @details Inputs: pendingAckList[] - * @details Outputs: pendingAckList[] - * @param seqNo sequence # to match to an entry in the list - * @return TRUE if a match was found, FALSE if not + * see if the sequence # from a received ACK msg matches any transmitted + * messages pending an ACK. If found, the list entry is removed (no longer + * pending). + * @details \b Inputs: pendingAckList[] + * @details \b Outputs: pendingAckList[] + * @param seqNo sequence number to match to an entry in the list + * @return none *************************************************************************/ -static BOOL matchACKtoPendingACKList( S16 seqNo ) +static void matchACKtoPendingACKList( S16 seqNo ) { - BOOL result = FALSE; U32 i; // Find match for ( i = 0; i < PENDING_ACK_LIST_SIZE; i++ ) { if ( ( TRUE == pendingAckList[ i ].used ) && ( pendingAckList[ i ].seqNo == seqNo ) ) { - result = TRUE; #ifdef _TD_ // Remove message pending ACK from list if ( ( ( getU32OverrideValue( &pendingACKOverride ) != PENDING_ACK_LIST_OVERRIDE_UI_CHANNEL ) || ( pendingAckList[ i ].channel != COMM_BUFFER_OUT_CAN_TD_2_UI ) ) && @@ -702,17 +703,16 @@ break; } } - - return result; } /*********************************************************************//** * @brief * The checkPendingACKList function searches the pending ACK list to * see if any have expired. Any such messages will be queued for retransmission - * and if max retries reached a fault is triggered. - * @details Inputs: pendingAckList[] - * @details Outputs: pendingAckList[] + * if max retries not yet reached + * @details \b Alarm: ALARM_ID_XX_CAN_MESSAGE_NOT_ACKED_BY_XX if expired and max retries reached. + * @details \b Inputs: pendingAckList[] + * @details \b Outputs: pendingAckList[] * @return none *************************************************************************/ static void checkPendingACKList( void ) @@ -736,23 +736,32 @@ U16 msgID; memcpy( &msgID, (U08*)&pendingAckList[ i ].msg[ sizeof( U08 ) + sizeof( U16) ], sizeof( U16 ) ); - //TODO : validate code changes #ifdef _TD_ if ( pendingAckList[ i ].channel != COMM_BUFFER_OUT_CAN_TD_2_DD ) + { + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_TD_CAN_MESSAGE_NOT_ACKED_BY_UI, (U32)msgID ); + } + else + { + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_TD_CAN_MESSAGE_NOT_ACKED_BY_DD, (U32)msgID ); + } #endif #ifdef _DD_ if ( pendingAckList[ i ].channel != COMM_BUFFER_OUT_CAN_DD_2_TD ) -#endif -#ifdef _RO_ - if ( pendingAckList[ i ].channel != COMM_BUFFER_OUT_CAN_RO_2_DD ) -#endif { - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_TD_CAN_MESSAGE_NOT_ACKED_BY_UI, (U32)msgID ); + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DD_CAN_MESSAGE_NOT_ACKED_BY_TD, (U32)msgID ); } else { - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_TD_CAN_MESSAGE_NOT_ACKED_BY_DD, (U32)msgID ); + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_DD_CAN_MESSAGE_NOT_ACKED_BY_RO, (U32)msgID ); } +#endif +#ifdef _RO_ + if ( pendingAckList[ i ].channel != COMM_BUFFER_OUT_CAN_RO_2_DD ) + { + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_RO_CAN_MESSAGE_NOT_ACKED_BY_DD, (U32)msgID ); + } +#endif pendingAckList[ i ].used = FALSE; // Take pending message off of list } } @@ -767,11 +776,10 @@ /*********************************************************************//** * @brief - * The testSetPendingACKOverride function overrides the - * pendingACKOverride variable. - * @details Inputs: none - * @details Outputs: pendingACKOverride - * @param value override for pendingACKOverride + * The testSetPendingACKOverride function overrides the pendingACKOverride variable. + * @details \b Inputs: none + * @details \b Outputs: pendingACKOverride + * @param value Value to override pendingACKOverride with * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testSetPendingACKOverride( U32 value ) @@ -790,10 +798,10 @@ /*********************************************************************//** * @brief - * The testResetPendingACKOverride function resets the override - * of the pendingACKOverride variable. - * @details Inputs: none - * @details Outputs: pendingACKOverride + * The testResetPendingACKOverride function resets the override of the + * pendingACKOverride variable. + * @details \b Inputs: none + * @details \b Outputs: pendingACKOverride * @return TRUE if override reset successful, FALSE if not *************************************************************************/ BOOL testResetPendingACKOverride( void )