\r
// - - - - - - - - - - - - - -\r
\r
+static Std_ReturnType getFcIndex(const PduIdType rxId, const CanTp_AddressingFormantType *formatType,\r
+ const PduInfoType *CanTpRxPduPtr, CanTp_TxNSduType* txConfig ) {\r
+ Std_ReturnType retValue = E_NOK;\r
+ boolean bIsExtended = (*formatType == CANTP_EXTENDED);\r
+ uint8 txId = START_OF_TX_CONFIG;\r
+\r
+ /* TODO: John - Manage if there are no Tx configs */\r
+ do {\r
+ txConfig = &CanTpConfig.CanTpNSduList[txId].configData;\r
+ if( txConfig->CanTp_FcPduId == rxId ) {\r
+ if( !(CANTP_EXTENDED == *formatType) &&\r
+ CANTP_EXTENDED != txConfig->CanTpAddressingFormant ) {\r
+ retValue = E_OK;\r
+ break;\r
+ } else {\r
+\r
+ if( CANTP_EXTENDED == txConfig->CanTpAddressingFormant &&\r
+ CanTpRxPduPtr->SduDataPtr[0] == txConfig->CanTp_NSaType->CanTpNSa ) {\r
+ /* TA in received frame matches SA in the tx channel */\r
+ retValue = E_OK;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ } while( &CanTpConfig.CanTpNSduList[txId].listItemType != CANTP_END_OF_LIST );\r
+\r
+ return retValue;\r
+}\r
+// - - - - - - - - - - - - - -\r
+\r
\r
Std_ReturnType CanTp_Transmit(PduIdType CanTpTxSduId,\r
const PduInfoType *CanTpTxInfoPtr) /** @req CANTP176 */\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
- rxConfigParams = NULL;\r
+ DEBUG( DEBUG_MEDIUM, "Received pduId which is not RECEIVE - ignoring!\n");\r
} else {\r
rxConfigParams = (CanTp_RxNSduType*)&CanTpConfig.CanTpNSduList[CanTpRxPduId].configData; /** @req CANTP120 */\r
addressingFormat = &rxConfigParams->CanTpAddressingFormant;\r
txConfigParams = NULL;\r
}\r
\r
+ /* TODO: John - Note that the addressing format is taken from the rxConfig\r
+ * (since we don't know if there is a tx config yet */\r
frameType = getFrameType(addressingFormat, CanTpRxPduPtr); /** @req CANTP094 *//** @req CANTP095 */\r
+\r
+ if( frameType == FLOW_CONTROL_CTS_FRAME ) {\r
+ Std_ReturnType ret = getFcIndex(CanTpRxPduId, addressingFormat, CanTpRxPduPtr, &rxConfigParams->CanTpNSa, &txConfigParams );\r
+ if( ret != E_OK ) {\r
+ /* No Tx channel found - set to NULL in order to ignore */\r
+ txConfigParams = NULL;\r
+ }\r
+ runtimeParams = &CanTpRunTimeData.runtimeDataList[txConfigParams->CanTpRxChannel]; /** @req CANTP096 *//** @req CANTP121 *//** @req CANTP122 *//** @req CANTP190 */\r
+ rxConfigParams = NULL;\r
+ }\r
+\r
switch (frameType) {\r
case SINGLE_FRAME: {\r
if (rxConfigParams != NULL) {\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