return pdurResp;\r
}\r
\r
+\r
// - - - - - - - - - - - - - -\r
\r
\r
CanTp_ChannelPrivateType *txRuntime = NULL;\r
BufReq_ReturnType res = BUFREQ_NOT_OK;\r
Std_ReturnType ret = 0;\r
+ PduIdType CanTp_InternalTxNSduId;\r
\r
DEBUG( DEBUG_MEDIUM, "CanTp_Transmit called in polite index: %d!\n", CanTpTxSduId);\r
\r
SERVICE_ID_CANTP_TRANSMIT, CANTP_E_UNINIT ); /** @req CANTP031 */\r
VALIDATE( CanTpTxSduId < CANTP_NSDU_CONFIG_LIST_SIZE, SERVICE_ID_CANTP_TRANSMIT, CANTP_E_INVALID_TX_ID );\r
\r
- txConfig =&CanTpConfig.CanTpNSduList[CanTpTxSduId].configData.CanTpTxNSdu;\r
-\r
- txRuntime = &CanTpRunTimeData.runtimeDataList[txConfig->CanTpTxChannel]; // Runtime data.\r
- if (txRuntime->iso15765.state == IDLE) {\r
- txRuntime->pdurBufferCount = 0;\r
- txRuntime->pdurBufferCount = 0;\r
- txRuntime->transferCount = 0;\r
- txRuntime->iso15765.framesHandledCount = 0;\r
- txRuntime->transferTotal = CanTpTxInfoPtr->SduLength; /** @req CANTP225 */\r
- txRuntime->iso15765.stateTimeoutCount = CANTP_CONVERT_MS_TO_MAIN_CYCLES(txConfig->CanTpNcs);\r
- txRuntime->mode = CANTP_TX_PROCESSING;\r
- txRuntime->iso15765.state = TX_WAIT_CAN_TP_TRANSMIT_CAN_TP_PROVIDE_TX_BUFFER;\r
-\r
- res = canTpTransmitHelper(txConfig, txRuntime);\r
- switch (res) {\r
- case BUFREQ_OK:\r
- case BUFREQ_BUSY:\r
- ret = E_OK;\r
- break;\r
- case BUFREQ_NOT_OK:\r
- ret = E_NOT_OK; /** @req CANTP072 */\r
- break;\r
- default:\r
- ret = E_NOT_OK;\r
- break;\r
+ if( CanTpConfig.CanTpRxIdList[CanTpTxSduId].CanTpNSduIndex != 0xFFFF ) {\r
+ CanTp_InternalTxNSduId = CanTpConfig.CanTpRxIdList[CanTpTxSduId].CanTpNSduIndex;\r
+\r
+ txConfig =&CanTpConfig.CanTpNSduList[CanTp_InternalTxNSduId].configData.CanTpTxNSdu;\r
+\r
+ txRuntime = &CanTpRunTimeData.runtimeDataList[txConfig->CanTpTxChannel]; // Runtime data.\r
+ if (txRuntime->iso15765.state == IDLE) {\r
+ txRuntime->pdurBufferCount = 0;\r
+ txRuntime->pdurBufferCount = 0;\r
+ txRuntime->transferCount = 0;\r
+ txRuntime->iso15765.framesHandledCount = 0;\r
+ txRuntime->transferTotal = CanTpTxInfoPtr->SduLength; /** @req CANTP225 */\r
+ txRuntime->iso15765.stateTimeoutCount = CANTP_CONVERT_MS_TO_MAIN_CYCLES(txConfig->CanTpNcs);\r
+ txRuntime->mode = CANTP_TX_PROCESSING;\r
+ txRuntime->iso15765.state = TX_WAIT_CAN_TP_TRANSMIT_CAN_TP_PROVIDE_TX_BUFFER;\r
+\r
+ res = canTpTransmitHelper(txConfig, txRuntime);\r
+ switch (res) {\r
+ case BUFREQ_OK:\r
+ case BUFREQ_BUSY:\r
+ ret = E_OK;\r
+ break;\r
+ case BUFREQ_NOT_OK:\r
+ ret = E_NOT_OK; /** @req CANTP072 */\r
+ break;\r
+ default:\r
+ ret = E_NOT_OK;\r
+ break;\r
+ }\r
+ } else {\r
+ DEBUG( DEBUG_MEDIUM, "CanTp can't transmit, it is already occupied!\n", CanTpTxSduId);\r
+ ret = E_NOT_OK; /** @req CANTP123 *//** @req CANTP206 */\r
}\r
- } else {\r
- DEBUG( DEBUG_MEDIUM, "CanTp can't transmit, it is already occupied!\n", CanTpTxSduId);\r
- ret = E_NOT_OK; /** @req CANTP123 *//** @req CANTP206 */\r
}\r
+\r
return ret; // CAN level error code.\r
}\r
\r
const CanTp_AddressingFormantType *addressingFormat; // Configured\r
CanTp_ChannelPrivateType *runtimeParams; // Params reside in RAM.\r
ISO15765FrameType frameType;\r
+ PduIdType CanTpTxNSduId, CanTpRxNSduId;\r
\r
DEBUG( DEBUG_MEDIUM, "CanTp_RxIndication: PduId=%d, [", CanTpRxPduId);\r
for (int i=0; i<CanTpRxPduPtr->SduLength; i++) {\r
VALIDATE_NO_RV( CanTpRunTimeData.internalState == CANTP_ON,\r
SERVICE_ID_CANTP_RX_INDICATION, CANTP_E_UNINIT ); /** @req CANTP031 */\r
\r
- if ( CanTpConfig.CanTpNSduList[CanTpRxPduId].direction == IS015765_TRANSMIT ) {\r
- txConfigParams = (CanTp_TxNSduType*)&CanTpConfig.CanTpNSduList[CanTpRxPduId].configData; /** @req CANTP120 */\r
- addressingFormat = &txConfigParams->CanTpAddressingMode;\r
- runtimeParams = &CanTpRunTimeData.runtimeDataList[txConfigParams->CanTpTxChannel]; /** @req CANTP096 *//** @req CANTP121 *//** @req CANTP122 *//** @req CANTP190 */\r
+ addressingFormat = &CanTpConfig.CanTpRxIdList[CanTpRxPduId].CanTpAddressingMode;\r
+\r
+ /* TODO John - Use a different indication of not set than 0xFFFF? */\r
+ frameType = getFrameType(addressingFormat, CanTpRxPduPtr); /** @req CANTP094 *//** @req CANTP095 */\r
+ if( frameType == FLOW_CONTROL_CTS_FRAME ) {\r
+ if( CanTpConfig.CanTpRxIdList[CanTpRxPduId].CanTpReferringTxIndex != 0xFFFF ) {\r
+ CanTpTxNSduId = CanTpConfig.CanTpRxIdList[CanTpRxPduId].CanTpReferringTxIndex;\r
+ txConfigParams = (CanTp_TxNSduType*)&CanTpConfig.CanTpNSduList[CanTpTxNSduId].configData;\r
+ runtimeParams = &CanTpRunTimeData.runtimeDataList[txConfigParams->CanTpTxChannel];\r
+ }\r
+ else {\r
+ txConfigParams = NULL;\r
+ }\r
rxConfigParams = NULL;\r
- } else {\r
- rxConfigParams = (CanTp_RxNSduType*)&CanTpConfig.CanTpNSduList[CanTpRxPduId].configData; /** @req CANTP120 */\r
- addressingFormat = &rxConfigParams->CanTpAddressingFormant;\r
- runtimeParams = &CanTpRunTimeData.runtimeDataList[rxConfigParams->CanTpRxChannel]; /** @req CANTP096 *//** @req CANTP121 *//** @req CANTP122 *//** @req CANTP190 */\r
+ }\r
+ else {\r
+ if( CanTpConfig.CanTpRxIdList[CanTpRxPduId].CanTpNSduIndex != 0xFFFF ) {\r
+ CanTpRxNSduId = CanTpConfig.CanTpRxIdList[CanTpRxPduId].CanTpNSduIndex;\r
+ rxConfigParams = (CanTp_RxNSduType*)&CanTpConfig.CanTpNSduList[CanTpRxNSduId].configData; /** @req CANTP120 */\r
+ runtimeParams = &CanTpRunTimeData.runtimeDataList[rxConfigParams->CanTpRxChannel]; /** @req CANTP096 *//** @req CANTP121 *//** @req CANTP122 *//** @req CANTP190 */\r
+ }\r
+ else {\r
+ rxConfigParams = NULL;\r
+ }\r
txConfigParams = NULL;\r
}\r
\r
- frameType = getFrameType(addressingFormat, CanTpRxPduPtr); /** @req CANTP094 *//** @req CANTP095 */\r
+\r
+\r
switch (frameType) {\r
case SINGLE_FRAME: {\r
if (rxConfigParams != NULL) {\r
\r
void CanTp_TxConfirmation(PduIdType CanTpTxPduId) /** @req CANTP076 */\r
{\r
+ PduIdType CanTpNSduId;\r
const CanTp_RxNSduType *rxConfigParams = NULL;\r
const CanTp_TxNSduType *txConfigParams = NULL;\r
\r
SERVICE_ID_CANTP_TX_CONFIRMATION, CANTP_E_INVALID_TX_ID ); /** @req CANTP158 */\r
\r
/** @req CANTP236 */\r
- if ( CanTpConfig.CanTpNSduList[CanTpTxPduId].direction == IS015765_TRANSMIT ) {\r
- txConfigParams = (CanTp_TxNSduType*)&CanTpConfig.CanTpNSduList[CanTpTxPduId].configData;\r
- CanTpRunTimeData.runtimeDataList[txConfigParams->CanTpTxChannel].iso15765.NasNarPending = FALSE;\r
+ if( CanTpConfig.CanTpRxIdList[CanTpTxPduId].CanTpNSduIndex != 0xFFFF ) {\r
+ CanTpNSduId = CanTpConfig.CanTpRxIdList[CanTpTxPduId].CanTpNSduIndex;\r
+ if ( CanTpConfig.CanTpNSduList[CanTpNSduId].direction == IS015765_TRANSMIT ) {\r
+ txConfigParams = (CanTp_TxNSduType*)&CanTpConfig.CanTpNSduList[CanTpNSduId].configData;\r
+ CanTpRunTimeData.runtimeDataList[txConfigParams->CanTpTxChannel].iso15765.NasNarPending = FALSE;\r
#if (CANTP_IMMEDIATE_TX_CONFIRMATION == STD_OFF)\r
- CanTpRunTimeData.runtimeDataList[txConfigParams->CanTpTxChannel].iso15765.txConfirmed = TRUE;\r
+ CanTpRunTimeData.runtimeDataList[txConfigParams->CanTpTxChannel].iso15765.txConfirmed = TRUE;\r
#endif\r
- } else {\r
- rxConfigParams = (CanTp_RxNSduType*)&CanTpConfig.CanTpNSduList[CanTpTxPduId].configData;\r
- CanTpRunTimeData.runtimeDataList[rxConfigParams->CanTpRxChannel].iso15765.NasNarPending = FALSE;\r
+ } else {\r
+ rxConfigParams = (CanTp_RxNSduType*)&CanTpConfig.CanTpNSduList[CanTpNSduId].configData;\r
+ CanTpRunTimeData.runtimeDataList[rxConfigParams->CanTpRxChannel].iso15765.NasNarPending = FALSE;\r
+ }\r
}\r
+\r
+\r
}\r
\r
// - - - - - - - - - - - - - -\r
} CanTp_NSaType; /** @req CANTP253 */\r
\r
typedef struct {\r
- uint32 CanTpNTa; /** @req CANTP255 */\r
+ uint32 CanTpNTa; /** @req CANTP255 */ /* TODO John: Why is this 32-bit */\r
} CanTp_NTaType; /** @req CANTP139 */\r
\r
typedef struct {\r
\r
\r
typedef struct {\r
+ const PduIdType CanTp_FcPduId; // When recieving this Pdu this conf can be used (if TA match in extended).\r
const PduIdType CanIf_FcPduId; // The polite CanIf PDU index.\r
const PduIdType PduR_PduId; // The polite PduR index.\r
const CanTp_AddressingFormantType CanTpAddressingFormant; /** @req CANTP242 */\r
typedef struct {\r
const PduIdType CanIf_PduId; // The polite CanIf index.\r
const PduIdType PduR_PduId; // The polite PduR index.\r
+ const PduIdType CanTp_FcPduId;\r
const CanTp_AddressingFormantType CanTpAddressingMode; /** @req CANTP262 */\r
const uint16 CanTpNas; /** @req CANTP263 */ /* N_As timeout for transmission of any CAN frame. */\r
const uint16 CanTpNbs; /** @req CANTP264 */ /* N_Bs timeout of transmission until reception of next Flow Control. */\r
} configData;\r
} CanTp_NSduType;\r
\r
+typedef struct {\r
+ const CanTp_AddressingFormantType CanTpAddressingMode;\r
+ const PduIdType CanTpNSduIndex;\r
+ const PduIdType CanTpReferringTxIndex;\r
+} CanTp_RxIdType;\r
+\r
// - - - - - - - - - - -\r
\r
/** Top level config container for CANTP implementation. */\r
/** */\r
const CanTp_NSduType *CanTpNSduList;\r
\r
+ const CanTp_RxIdType *CanTpRxIdList;\r
+\r
/** */\r
//const CanTp_RxNSduType *CanTpRxNSduList;\r
\r