From 2ac9d31fe4d3d4c107b9a85d11560ee46fee0704 Mon Sep 17 00:00:00 2001 From: john Date: Mon, 28 May 2012 12:50:32 +0200 Subject: [PATCH] Added wait for tx confirm when sending CF (#1440). Added check for timeout in wait state (#1441). --- communication/CanTp/CanTp.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/communication/CanTp/CanTp.c b/communication/CanTp/CanTp.c index 9beb5481..b7a3bd18 100644 --- a/communication/CanTp/CanTp.c +++ b/communication/CanTp/CanTp.c @@ -160,7 +160,7 @@ typedef enum { TX_WAIT_CAN_TP_TRANSMIT_CAN_TP_PROVIDE_TX_BUFFER, /** @req CANTP226 */ TX_WAIT_CAN_TP_TRANSMIT_PENDING, /* CanTP_Transmit was called but no buffer was received (BUSY). */ TX_WAIT_SEND_CONSECUTIVE_FRAME, TX_WAIT_FLOW_CONTROL, - TX_WAIT_TX_CONFIRMATION + TX_WAIT_TX_CONFIRMATION, TX_WAIT_TX_CONFIRMATION_CF } ISO15765TransferStateTypes; typedef enum { @@ -754,12 +754,12 @@ static INLINE void handleConsecutiveFrameSent( } else { // Send next consecutive frame! txRuntime->iso15765.stateTimeoutCount = CANTP_CONVERT_MS_TO_MAIN_CYCLES(txRuntime->iso15765.STmin); - txRuntime->iso15765.state = TX_WAIT_SEND_CONSECUTIVE_FRAME; + txRuntime->iso15765.state = TX_WAIT_TX_CONFIRMATION_CF; } } else { // Send next consecutive frame! txRuntime->iso15765.stateTimeoutCount = CANTP_CONVERT_MS_TO_MAIN_CYCLES(txRuntime->iso15765.STmin); - txRuntime->iso15765.state = TX_WAIT_SEND_CONSECUTIVE_FRAME; + txRuntime->iso15765.state = TX_WAIT_TX_CONFIRMATION_CF; } } @@ -1458,15 +1458,22 @@ void CanTp_MainFunction(void) txRuntimeListItem->mode = CANTP_TX_WAIT; } break; -#if (CANTP_IMMEDIATE_TX_CONFIRMATION == STD_OFF) + case TX_WAIT_TX_CONFIRMATION_CF: + if (txRuntimeListItem->iso15765.txConfirmed) { + txRuntimeListItem->iso15765.state = TX_WAIT_SEND_CONSECUTIVE_FRAME; + } else { + checkNasNarTimeout( txRuntimeListItem ); + } + break; case TX_WAIT_TX_CONFIRMATION: if (txRuntimeListItem->iso15765.txConfirmed) { PduR_CanTpTxConfirmation(txConfigListItem->PduR_PduId, NTFRSLT_OK); /** @req CANTP074 *//** @req CANTP09 *//** @req CANTP204 */ txRuntimeListItem->iso15765.state = IDLE; txRuntimeListItem->mode = CANTP_TX_WAIT; + } else { + checkNasNarTimeout( txRuntimeListItem ); } break; -#endif default: break; } -- 2.39.2