#include "SchM_CanTp.h" /** req: CanTp156.4 **/\r
//#include "MemMap.h" /** req: CanTp156.5 **/\r
#include "String.h"\r
+#define USE_DEBUG_PRINTF\r
#include "debug.h"\r
\r
#if ( CANTP_DEV_ERROR_DETECT == STD_ON )\r
\r
switch (*formatType) {\r
case CANTP_STANDARD:\r
+ DEBUG( DEBUG_MEDIUM, "CANTP_STANDARD\n")\r
tpci = CanTpRxPduPtr->SduDataPtr[0];\r
break;\r
case CANTP_EXTENDED:\r
+ DEBUG( DEBUG_MEDIUM, "CANTP_EXTENDED\n")\r
tpci = CanTpRxPduPtr->SduDataPtr[1];\r
break;\r
default:\r
} else if (pdurResp == BUFREQ_BUSY) {\r
ret = E_OK; // We will remain in this state, called again later, not data lost/destoryed?\r
} else {\r
+ DEBUG( DEBUG_MEDIUM, "sendConsecutiveFrame failed, no buffer provided!\n");\r
ret = E_NOT_OK; // Serious malfunction, function caller should cancel this transfer.\r
+ break;\r
}\r
}\r
}\r
VALIDATE( CanTpTxSduId < CANTP_NSDU_CONFIG_LIST_SIZE, SERVICE_ID_CANTP_TRANSMIT, CANTP_E_INVALID_TX_ID );\r
\r
txConfig = (CanTp_TxNSduType*)&CanTpConfig.CanTpNSduList[CanTpTxSduId].configData;\r
+\r
txRuntime = &CanTpRunTimeData.runtimeDataList[txConfig->CanTpTxChannel]; // Runtime data.\r
+ txRuntime->pdurBufferCount = 0;\r
+ txRuntime->pdurBufferCount = 0;\r
+ txRuntime->pduTransferedBytesCount = 0;\r
+ txRuntime->iso15765.framesHandledCount = 0;\r
+ //txRuntime->iso15765->framesHandledCount = 0;\r
txRuntime->pduLenghtTotalBytes = CanTpTxInfoPtr->SduLength;\r
txRuntime->iso15765.stateTimeoutCount =\r
CANTP_CONVERT_MS_TO_MAIN_CYCLES(txConfig->CanTpNcs);\r
VALIDATE_NO_RV( CanTpRunTimeData.internalState == CANTP_ON,\r
SERVICE_ID_CANTP_RX_INDICATION, CANTP_E_UNINIT ); /* req: CanTp031 */\r
\r
+ DEBUG( DEBUG_MEDIUM, "CanTp_RxIndication: PduId=%d, [", CanTpRxPduId);\r
item.PduId = CanTpRxPduId;\r
item.SduLength = CanTpRxPduPtr->SduLength;\r
for (int i=0; i<item.SduLength; i++) {\r
item.SduData[i] = CanTpRxPduPtr->SduDataPtr[i];\r
+ DEBUG( DEBUG_MEDIUM, "%x, ", item.SduData[i]);\r
}\r
+ DEBUG( DEBUG_MEDIUM, "]");\r
if ( fifoQueueWrite( &CanTpRunTimeData.fifo, &item ) == FALSE ) {\r
; //qqq: TODO: Report overrun.\r
}\r
CanTp_ChannelPrivateType *runtimeParams; // Params reside in RAM.\r
ISO15765FrameType frameType;\r
\r
- DEBUG( DEBUG_MEDIUM, "CanTp_RxIndication_Main, polite index: %d!\n", CanTpRxPduId );\r
+ DEBUG( DEBUG_MEDIUM, "CanTp_RxIndication - CanTpRxPduId: %x!\n", CanTpRxPduId );\r
+\r
\r
VALIDATE_NO_RV( CanTpRunTimeData.internalState == CANTP_ON,\r
SERVICE_ID_CANTP_RX_INDICATION, CANTP_E_UNINIT ); /* req: CanTp031 */\r
frameType = getFrameType(addressingFormat, CanTpRxPduPtr);\r
switch (frameType) {\r
case SINGLE_FRAME: {\r
- if (rxConfigParams != NULL)\r
+ if (rxConfigParams != NULL) {\r
+ DEBUG( DEBUG_MEDIUM, "calling handleSingleFrame!\n");\r
handleSingleFrame(rxConfigParams, runtimeParams, CanTpRxPduPtr);\r
+ }\r
else\r
DEBUG( DEBUG_MEDIUM, "Single frame received on ISO15765-Tx flow control - is ingnored!\n");\r
break;\r
}\r
case FIRST_FRAME: {\r
- if (rxConfigParams != NULL)\r
+ if (rxConfigParams != NULL) {\r
+ DEBUG( DEBUG_MEDIUM, "calling handleFirstFrame!\n");\r
handleFirstFrame(rxConfigParams, runtimeParams, CanTpRxPduPtr);\r
- else\r
+ } else\r
DEBUG( DEBUG_MEDIUM, "First frame received on ISO15765-Tx flow control - is ignored!\n");\r
break;\r
}\r
case CONSECUTIVE_FRAME: {\r
- if (rxConfigParams != NULL)\r
+ if (rxConfigParams != NULL) {\r
+ DEBUG( DEBUG_MEDIUM, "calling handleConsecutiveFrame!\n");\r
handleConsecutiveFrame(rxConfigParams, runtimeParams, CanTpRxPduPtr);\r
- else\r
+ } else\r
DEBUG( DEBUG_MEDIUM, "Consecutive frame received on ISO15765-Tx flow control - is ignored!\n");\r
break;\r
}\r
case FLOW_CONTROL_CTS_FRAME: {\r
- if (txConfigParams != NULL)\r
+ if (txConfigParams != NULL) {\r
+ DEBUG( DEBUG_MEDIUM, "calling handleFlowControlFrame!\n");\r
handleFlowControlFrame(txConfigParams, runtimeParams, CanTpRxPduPtr);\r
- else\r
- DEBUG( DEBUG_MEDIUM, "Consecutive frame received on ISO15765-Tx flow control - is ignored!\n");\r
+ } else\r
+ DEBUG( DEBUG_MEDIUM, "Flow control frame received on ISO15765-RX flow control - is ignored!\n");\r
break;\r
}\r
case INVALID_FRAME: {\r
- return; // qqq: Failure, should go to log-file.\r
+ DEBUG( DEBUG_MEDIUM, "INVALID_FRAME recived, doing nothing!!\n");\r
break;\r
}\r
default:\r
const Dcm_DsdServiceTableType *serviceTable;\r
Dcm_ProtocolAddrTypeType addrType;\r
PduIdType txPduId;\r
+ PduIdType rxPduId;\r
} MsgDataType;\r
\r
// In "queue" to DSD\r
msgData.pduTxData->SduDataPtr[1] = currentSid;\r
msgData.pduTxData->SduDataPtr[2] = responseCode;\r
msgData.pduTxData->SduLength = 3;\r
- DslDsdProcessingDone(msgData.txPduId, DSD_TX_RESPONSE_READY); /** @req DCM114 **/ /** @req DCM232.1 **/\r
+ DslDsdProcessingDone(msgData.rxPduId, DSD_TX_RESPONSE_READY); /** @req DCM114 **/ /** @req DCM232.1 **/\r
}\r
else {\r
- DslDsdProcessingDone(msgData.txPduId, DSD_TX_RESPONSE_SUPPRESSED);\r
+ DslDsdProcessingDone(msgData.rxPduId, DSD_TX_RESPONSE_SUPPRESSED);\r
}\r
}\r
\r
if (!suppressPosRspMsg) { /** @req DCM200 **/ /** @req DCM231 **/\r
/** @req DCM222 **/\r
msgData.pduTxData->SduDataPtr[0] = currentSid | SID_RESPONSE_BIT; /** @req DCM223 **/ /** @req DCM224 **/\r
- DslDsdProcessingDone(msgData.txPduId, DSD_TX_RESPONSE_READY); /** @req DCM114 **/ /** @req DCM225 **/ /** @req DCM232.2 **/\r
+ DslDsdProcessingDone(msgData.rxPduId, DSD_TX_RESPONSE_READY); /** @req DCM114 **/ /** @req DCM225 **/ /** @req DCM232.2 **/\r
}\r
else {\r
DspDcmConfirmation(msgData.txPduId); /** @req DCM236 **/ /** @req DCM240 **/\r
- DslDsdProcessingDone(msgData.txPduId, DSD_TX_RESPONSE_SUPPRESSED);\r
+ DslDsdProcessingDone(msgData.rxPduId, DSD_TX_RESPONSE_SUPPRESSED);\r
}\r
}\r
else {\r
}\r
\r
\r
-void DsdDslDataIndication(const PduInfoType *pduRxData, const Dcm_DsdServiceTableType *protocolSIDTable, Dcm_ProtocolAddrTypeType addrType, PduIdType txPduId, PduInfoType *pduTxData)\r
+void DsdDslDataIndication(const PduInfoType *pduRxData, const Dcm_DsdServiceTableType *protocolSIDTable, Dcm_ProtocolAddrTypeType addrType, PduIdType txPduId, PduInfoType *pduTxData, PduIdType rxContextPduId)\r
{\r
+ msgData.rxPduId = rxContextPduId;\r
msgData.txPduId = txPduId;\r
msgData.pduRxData = pduRxData;\r
msgData.pduTxData = pduTxData;\r
#include "ComM_Dcm.h"\r
#include "PduR_Dcm.h"\r
#include "ComStack_Types.h"\r
+\r
+#define USE_DEBUG_PRINTF\r
#include "debug.h"\r
\r
#define TIMER_DECREMENT(timer) \\r
const Dcm_DslProtocolRowType *protocolRowEntry = NULL;\r
const Dcm_DslProtocolTimingRowType *timeParams = NULL;\r
Dcm_DslRunTimeProtocolParametersType *runtime = NULL;\r
+ int debug_count = 0;\r
\r
protocolRowEntry = DCM_Config.Dsl->DslProtocol->DslProtocolRowList;\r
while (protocolRowEntry->Arc_EOL == FALSE) {\r
break;\r
case PROVIDED_TO_DSD:\r
{\r
+ DEBUG( DEBUG_MEDIUM, "debug_count=%d\n", debug_count);\r
TIMER_DECREMENT(runtime->stateTimeoutCount);\r
DEBUG( DEBUG_MEDIUM, "state PROVIDED_TO_DSD!\n");\r
if (runtime->stateTimeoutCount == 0) {\r
// Make sure that response pending or general reject have not been issued,\r
// if so we can not transmit to PduR because we would not know from where\r
// the Tx confirmation resides later.\r
+ DEBUG( DEBUG_MEDIUM, "debug_count=%d\n", debug_count);\r
DEBUG( DEBUG_MEDIUM, "state DSD_PENDING_RESPONSE_SIGNALED!\n");\r
if (runtime->localTxBuffer.status == NOT_IN_USE) {\r
const uint32 txPduId =\r
}\r
}\r
protocolRowEntry++;\r
+ debug_count++;\r
}\r
}\r
\r
protocolRow->DslProtocolSIDTable,\r
protocolRx->DslProtocolAddrType,\r
mainConnection->DslProtocolTx->PduR_DcmDslTxPduId,\r
- &(runtime->diagnosticResponseFromDsd));\r
+ &(runtime->diagnosticResponseFromDsd),\r
+ dcmRxPduId);\r
\r
}\r
}\r
*/\r
DEBUG( DEBUG_MEDIUM, "Released external buffer sucessfully!\n");\r
externalBufferReleased = TRUE;\r
- DsdDataConfirmation(dcmTxPduId, result); /** @req DCM117 **//** @req DCM235 **/\r
+ DsdDataConfirmation(mainConnection->DslProtocolTx->PduR_DcmDslTxPduId, result); /** @req DCM117 **//** @req DCM235 **/\r
break;\r
}\r
default:\r