From 9638d689f89ef87bee1db0f02d5c295208bc55d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20B=C3=B6rschig?= Date: Wed, 14 Jan 2026 16:54:13 +0100 Subject: [PATCH 01/12] flexray: add second keyslot to config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marius Börschig --- SilKit/include/silkit/capi/Flexray.h | 12 ++-- .../silkit/capi/InterfaceIdentifiers.h | 2 +- .../detail/impl/HourglassConversions.hpp | 4 ++ .../services/flexray/FlexrayController.hpp | 2 + .../services/flexray/FlexrayDatatypes.hpp | 17 +++--- SilKit/source/capi/CapiFlexray.cpp | 57 +++++++++++-------- .../source/services/flexray/FlexraySerdes.cpp | 7 ++- 7 files changed, 62 insertions(+), 39 deletions(-) diff --git a/SilKit/include/silkit/capi/Flexray.h b/SilKit/include/silkit/capi/Flexray.h index 038cf5c27..48f84daa5 100644 --- a/SilKit/include/silkit/capi/Flexray.h +++ b/SilKit/include/silkit/capi/Flexray.h @@ -216,12 +216,6 @@ struct SilKit_FlexrayNodeParameters //! Maximum permissible rate correction value (range 3-3846 MicroTicks). SilKit_FlexrayMicroTick pRateCorrectionOut; - ////! Not used by network simulator - // pSecondKeySlotID - - ////! Not used by network simulator - // pTwoKeySlotMode - //! Channel used by the node to send a wakeup pattern (values FlexrayChannel::A, FlexrayChannel::B). SilKit_FlexrayChannel pWakeupChannel; @@ -242,6 +236,12 @@ struct SilKit_FlexrayNodeParameters //! Number of samples per MicroTick (values 1 or 2). uint8_t pSamplesPerMicrotick; + + //! Second Key Slot ID of the key slot (range 0-1023, value 0 means that there is no key slot). + uint16_t pSecondKeySlotID; + + //! Second Key slot is used for startup with a single cold start node (range 0, 1). + uint8_t pTwoKeySlotMode; }; typedef struct SilKit_FlexrayNodeParameters SilKit_FlexrayNodeParameters; diff --git a/SilKit/include/silkit/capi/InterfaceIdentifiers.h b/SilKit/include/silkit/capi/InterfaceIdentifiers.h index 609b2870a..7490bd666 100644 --- a/SilKit/include/silkit/capi/InterfaceIdentifiers.h +++ b/SilKit/include/silkit/capi/InterfaceIdentifiers.h @@ -137,7 +137,7 @@ typedef struct #define SilKit_FlexrayWakeupEvent_VERSION 1 #define SilKit_FlexrayControllerConfig_VERSION 1 #define SilKit_FlexrayClusterParameters_VERSION 1 -#define SilKit_FlexrayNodeParameters_VERSION 1 +#define SilKit_FlexrayNodeParameters_VERSION 2 #define SilKit_FlexrayHostCommand_VERSION 1 #define SilKit_FlexrayHeader_VERSION 1 #define SilKit_FlexrayFrame_VERSION 1 diff --git a/SilKit/include/silkit/detail/impl/HourglassConversions.hpp b/SilKit/include/silkit/detail/impl/HourglassConversions.hpp index b242e4225..980dde1a6 100644 --- a/SilKit/include/silkit/detail/impl/HourglassConversions.hpp +++ b/SilKit/include/silkit/detail/impl/HourglassConversions.hpp @@ -221,6 +221,8 @@ inline void assignCxxToC(const SilKit::Services::Flexray::FlexrayNodeParameters& cOut.pWakeupPattern = cxxIn.pWakeupPattern; cOut.pdMicrotick = static_cast(cxxIn.pdMicrotick); cOut.pSamplesPerMicrotick = cxxIn.pSamplesPerMicrotick; + cOut.pTwoKeySlotMode = cxxIn.pTwoKeySlotMode; + cOut.pSecondKeySlotID = cxxIn.pSecondKeySlotID; } inline void assignCxxToC(const SilKit::Services::Flexray::FlexrayTxBufferConfig& cxxIn, @@ -651,6 +653,8 @@ inline void assignCToCxx(const SilKit_FlexrayNodeParameters* cIn, cxxOut.pWakeupPattern = cIn->pWakeupPattern; cxxOut.pdMicrotick = (SilKit::Services::Flexray::FlexrayClockPeriod)cIn->pdMicrotick; cxxOut.pSamplesPerMicrotick = cIn->pSamplesPerMicrotick; + cxxOut.pTwoKeySlotMode = cIn->pTwoKeySlotMode; + cxxOut.pSecondKeySlotID = cIn->pSecondKeySlotID; } // ----------------------------------- diff --git a/SilKit/include/silkit/detail/impl/services/flexray/FlexrayController.hpp b/SilKit/include/silkit/detail/impl/services/flexray/FlexrayController.hpp index 06150cd29..89a73ad9c 100644 --- a/SilKit/include/silkit/detail/impl/services/flexray/FlexrayController.hpp +++ b/SilKit/include/silkit/detail/impl/services/flexray/FlexrayController.hpp @@ -567,6 +567,8 @@ void CxxToC(const SilKit::Services::Flexray::FlexrayNodeParameters& cxxFlexrayNo cFlexrayNodeParameters.pWakeupPattern = cxxFlexrayNodeParameters.pWakeupPattern; cFlexrayNodeParameters.pdMicrotick = static_cast(cxxFlexrayNodeParameters.pdMicrotick); cFlexrayNodeParameters.pSamplesPerMicrotick = cxxFlexrayNodeParameters.pSamplesPerMicrotick; + cFlexrayNodeParameters.pTwoKeySlotMode = cxxFlexrayNodeParameters.pTwoKeySlotMode; + cFlexrayNodeParameters.pSecondKeySlotID = cxxFlexrayNodeParameters.pSecondKeySlotID; } void CxxToC(const SilKit::Services::Flexray::FlexrayTxBufferConfig& cxxFlexrayTxBufferConfig, diff --git a/SilKit/include/silkit/services/flexray/FlexrayDatatypes.hpp b/SilKit/include/silkit/services/flexray/FlexrayDatatypes.hpp index 62846f3ca..fded32d21 100644 --- a/SilKit/include/silkit/services/flexray/FlexrayDatatypes.hpp +++ b/SilKit/include/silkit/services/flexray/FlexrayDatatypes.hpp @@ -211,13 +211,6 @@ struct FlexrayNodeParameters //! Maximum permissible rate correction value (range 3-3846 MicroTicks). FlexrayMicroTick pRateCorrectionOut; - - ////! Not used by network simulator - //pSecondKeySlotID - - ////! Not used by network simulator - //pTwoKeySlotMode - //! Channel used by the node to send a wakeup pattern (values FlexrayChannel::A, FlexrayChannel::B). FlexrayChannel pWakeupChannel; @@ -238,6 +231,12 @@ struct FlexrayNodeParameters //! Number of samples per MicroTick (values 1 or 2). uint8_t pSamplesPerMicrotick; + + //! Second Key Slot ID of the key slot (range 0-1023, value 0 means that there is no key slot). + uint16_t pSecondKeySlotID; + + //! Second Key slot is used for startup with a single cold start node (range 0, 1). + uint8_t pTwoKeySlotMode; }; //! Transmission mode for FlexRay Tx-Buffer @@ -537,7 +536,9 @@ inline bool operator==(const FlexrayNodeParameters& lhs, const FlexrayNodeParame && lhs.pOffsetCorrectionStart == rhs.pOffsetCorrectionStart && lhs.pRateCorrectionOut == rhs.pRateCorrectionOut && lhs.pWakeupChannel == rhs.pWakeupChannel && lhs.pWakeupPattern == rhs.pWakeupPattern && lhs.pdMicrotick == rhs.pdMicrotick - && lhs.pSamplesPerMicrotick == rhs.pSamplesPerMicrotick; + && lhs.pSamplesPerMicrotick == rhs.pSamplesPerMicrotick && lhs.pSecondKeySlotID == rhs.pSecondKeySlotID + && lhs.pTwoKeySlotMode == rhs.pTwoKeySlotMode + ; } inline bool operator==(const FlexrayTxBufferConfig& lhs, const FlexrayTxBufferConfig& rhs) diff --git a/SilKit/source/capi/CapiFlexray.cpp b/SilKit/source/capi/CapiFlexray.cpp index 568f34df8..d6b5dd328 100644 --- a/SilKit/source/capi/CapiFlexray.cpp +++ b/SilKit/source/capi/CapiFlexray.cpp @@ -54,29 +54,40 @@ void assign(SilKit::Services::Flexray::FlexrayClusterParameters& cppClusterParam void assign(SilKit::Services::Flexray::FlexrayNodeParameters& cppNodeParameters, const SilKit_FlexrayNodeParameters* nodeParameters) { - cppNodeParameters.pAllowHaltDueToClock = nodeParameters->pAllowHaltDueToClock; - cppNodeParameters.pAllowPassiveToActive = nodeParameters->pAllowPassiveToActive; - cppNodeParameters.pChannels = (SilKit::Services::Flexray::FlexrayChannel)nodeParameters->pChannels; - cppNodeParameters.pClusterDriftDamping = nodeParameters->pClusterDriftDamping; - cppNodeParameters.pdAcceptedStartupRange = nodeParameters->pdAcceptedStartupRange; - cppNodeParameters.pdListenTimeout = nodeParameters->pdListenTimeout; - cppNodeParameters.pKeySlotId = nodeParameters->pKeySlotId; - cppNodeParameters.pKeySlotOnlyEnabled = nodeParameters->pKeySlotOnlyEnabled; - cppNodeParameters.pKeySlotUsedForStartup = nodeParameters->pKeySlotUsedForStartup; - cppNodeParameters.pKeySlotUsedForSync = nodeParameters->pKeySlotUsedForSync; - cppNodeParameters.pLatestTx = nodeParameters->pLatestTx; - cppNodeParameters.pMacroInitialOffsetA = nodeParameters->pMacroInitialOffsetA; - cppNodeParameters.pMacroInitialOffsetB = nodeParameters->pMacroInitialOffsetB; - cppNodeParameters.pMicroInitialOffsetA = nodeParameters->pMicroInitialOffsetA; - cppNodeParameters.pMicroInitialOffsetB = nodeParameters->pMicroInitialOffsetB; - cppNodeParameters.pMicroPerCycle = nodeParameters->pMicroPerCycle; - cppNodeParameters.pOffsetCorrectionOut = nodeParameters->pOffsetCorrectionOut; - cppNodeParameters.pOffsetCorrectionStart = nodeParameters->pOffsetCorrectionStart; - cppNodeParameters.pRateCorrectionOut = nodeParameters->pRateCorrectionOut; - cppNodeParameters.pWakeupChannel = (SilKit::Services::Flexray::FlexrayChannel)nodeParameters->pWakeupChannel; - cppNodeParameters.pWakeupPattern = nodeParameters->pWakeupPattern; - cppNodeParameters.pdMicrotick = (SilKit::Services::Flexray::FlexrayClockPeriod)nodeParameters->pdMicrotick; - cppNodeParameters.pSamplesPerMicrotick = nodeParameters->pSamplesPerMicrotick; + const auto inputVersion = SK_ID_GET_VERSION(SilKit_Struct_GetId(*nodeParameters)); + + if (inputVersion == 1 || inputVersion == 2) + { + cppNodeParameters.pAllowHaltDueToClock = nodeParameters->pAllowHaltDueToClock; + cppNodeParameters.pAllowPassiveToActive = nodeParameters->pAllowPassiveToActive; + cppNodeParameters.pChannels = (SilKit::Services::Flexray::FlexrayChannel)nodeParameters->pChannels; + cppNodeParameters.pClusterDriftDamping = nodeParameters->pClusterDriftDamping; + cppNodeParameters.pdAcceptedStartupRange = nodeParameters->pdAcceptedStartupRange; + cppNodeParameters.pdListenTimeout = nodeParameters->pdListenTimeout; + cppNodeParameters.pKeySlotId = nodeParameters->pKeySlotId; + cppNodeParameters.pKeySlotOnlyEnabled = nodeParameters->pKeySlotOnlyEnabled; + cppNodeParameters.pKeySlotUsedForStartup = nodeParameters->pKeySlotUsedForStartup; + cppNodeParameters.pKeySlotUsedForSync = nodeParameters->pKeySlotUsedForSync; + cppNodeParameters.pLatestTx = nodeParameters->pLatestTx; + cppNodeParameters.pMacroInitialOffsetA = nodeParameters->pMacroInitialOffsetA; + cppNodeParameters.pMacroInitialOffsetB = nodeParameters->pMacroInitialOffsetB; + cppNodeParameters.pMicroInitialOffsetA = nodeParameters->pMicroInitialOffsetA; + cppNodeParameters.pMicroInitialOffsetB = nodeParameters->pMicroInitialOffsetB; + cppNodeParameters.pMicroPerCycle = nodeParameters->pMicroPerCycle; + cppNodeParameters.pOffsetCorrectionOut = nodeParameters->pOffsetCorrectionOut; + cppNodeParameters.pOffsetCorrectionStart = nodeParameters->pOffsetCorrectionStart; + cppNodeParameters.pRateCorrectionOut = nodeParameters->pRateCorrectionOut; + cppNodeParameters.pWakeupChannel = (SilKit::Services::Flexray::FlexrayChannel)nodeParameters->pWakeupChannel; + cppNodeParameters.pWakeupPattern = nodeParameters->pWakeupPattern; + cppNodeParameters.pdMicrotick = (SilKit::Services::Flexray::FlexrayClockPeriod)nodeParameters->pdMicrotick; + cppNodeParameters.pSamplesPerMicrotick = nodeParameters->pSamplesPerMicrotick; + } + + if ( inputVersion == 2) + { + cppNodeParameters.pTwoKeySlotMode = nodeParameters->pTwoKeySlotMode; + cppNodeParameters.pSecondKeySlotID = nodeParameters->pSecondKeySlotID; + } } void assign(SilKit::Services::Flexray::FlexrayControllerConfig& cppConfig, const SilKit_FlexrayControllerConfig* config) diff --git a/SilKit/source/services/flexray/FlexraySerdes.cpp b/SilKit/source/services/flexray/FlexraySerdes.cpp index 5456eabdb..e33ae069c 100644 --- a/SilKit/source/services/flexray/FlexraySerdes.cpp +++ b/SilKit/source/services/flexray/FlexraySerdes.cpp @@ -149,7 +149,8 @@ inline SilKit::Core::MessageBuffer& operator<<(SilKit::Core::MessageBuffer& buff << nodeParams.pMacroInitialOffsetB << nodeParams.pMicroInitialOffsetA << nodeParams.pMicroInitialOffsetB << nodeParams.pMicroPerCycle << nodeParams.pOffsetCorrectionOut << nodeParams.pOffsetCorrectionStart << nodeParams.pRateCorrectionOut << nodeParams.pWakeupChannel << nodeParams.pWakeupPattern - << nodeParams.pdMicrotick << nodeParams.pSamplesPerMicrotick; + << nodeParams.pdMicrotick << nodeParams.pSamplesPerMicrotick << nodeParams.pSecondKeySlotID + << nodeParams.pTwoKeySlotMode; return buffer; } @@ -163,6 +164,10 @@ inline SilKit::Core::MessageBuffer& operator>>(SilKit::Core::MessageBuffer& buff >> nodeParams.pMicroPerCycle >> nodeParams.pOffsetCorrectionOut >> nodeParams.pOffsetCorrectionStart >> nodeParams.pRateCorrectionOut >> nodeParams.pWakeupChannel >> nodeParams.pWakeupPattern >> nodeParams.pdMicrotick >> nodeParams.pSamplesPerMicrotick; + if (buffer.RemainingBytesLeft() > 0) + { + buffer >> nodeParams.pSecondKeySlotID >> nodeParams.pTwoKeySlotMode; + } return buffer; } From d9d8b11e35cd48ab9d597653f4efb76d83336e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20B=C3=B6rschig?= Date: Thu, 15 Jan 2026 10:53:50 +0100 Subject: [PATCH 02/12] fixup! flexray: add second keyslot to config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit camel case Signed-off-by: Marius Börschig --- SilKit/include/silkit/capi/Flexray.h | 2 +- SilKit/include/silkit/detail/impl/HourglassConversions.hpp | 4 ++-- .../silkit/detail/impl/services/flexray/FlexrayController.hpp | 2 +- SilKit/include/silkit/services/flexray/FlexrayDatatypes.hpp | 4 ++-- SilKit/source/capi/CapiFlexray.cpp | 2 +- SilKit/source/services/flexray/FlexraySerdes.cpp | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/SilKit/include/silkit/capi/Flexray.h b/SilKit/include/silkit/capi/Flexray.h index 48f84daa5..3de090be9 100644 --- a/SilKit/include/silkit/capi/Flexray.h +++ b/SilKit/include/silkit/capi/Flexray.h @@ -238,7 +238,7 @@ struct SilKit_FlexrayNodeParameters uint8_t pSamplesPerMicrotick; //! Second Key Slot ID of the key slot (range 0-1023, value 0 means that there is no key slot). - uint16_t pSecondKeySlotID; + uint16_t pSecondKeySlotId; //! Second Key slot is used for startup with a single cold start node (range 0, 1). uint8_t pTwoKeySlotMode; diff --git a/SilKit/include/silkit/detail/impl/HourglassConversions.hpp b/SilKit/include/silkit/detail/impl/HourglassConversions.hpp index 980dde1a6..a323d02e7 100644 --- a/SilKit/include/silkit/detail/impl/HourglassConversions.hpp +++ b/SilKit/include/silkit/detail/impl/HourglassConversions.hpp @@ -222,7 +222,7 @@ inline void assignCxxToC(const SilKit::Services::Flexray::FlexrayNodeParameters& cOut.pdMicrotick = static_cast(cxxIn.pdMicrotick); cOut.pSamplesPerMicrotick = cxxIn.pSamplesPerMicrotick; cOut.pTwoKeySlotMode = cxxIn.pTwoKeySlotMode; - cOut.pSecondKeySlotID = cxxIn.pSecondKeySlotID; + cOut.pSecondKeySlotId = cxxIn.pSecondKeySlotId; } inline void assignCxxToC(const SilKit::Services::Flexray::FlexrayTxBufferConfig& cxxIn, @@ -654,7 +654,7 @@ inline void assignCToCxx(const SilKit_FlexrayNodeParameters* cIn, cxxOut.pdMicrotick = (SilKit::Services::Flexray::FlexrayClockPeriod)cIn->pdMicrotick; cxxOut.pSamplesPerMicrotick = cIn->pSamplesPerMicrotick; cxxOut.pTwoKeySlotMode = cIn->pTwoKeySlotMode; - cxxOut.pSecondKeySlotID = cIn->pSecondKeySlotID; + cxxOut.pSecondKeySlotId = cIn->pSecondKeySlotId; } // ----------------------------------- diff --git a/SilKit/include/silkit/detail/impl/services/flexray/FlexrayController.hpp b/SilKit/include/silkit/detail/impl/services/flexray/FlexrayController.hpp index 89a73ad9c..6234b21fa 100644 --- a/SilKit/include/silkit/detail/impl/services/flexray/FlexrayController.hpp +++ b/SilKit/include/silkit/detail/impl/services/flexray/FlexrayController.hpp @@ -568,7 +568,7 @@ void CxxToC(const SilKit::Services::Flexray::FlexrayNodeParameters& cxxFlexrayNo cFlexrayNodeParameters.pdMicrotick = static_cast(cxxFlexrayNodeParameters.pdMicrotick); cFlexrayNodeParameters.pSamplesPerMicrotick = cxxFlexrayNodeParameters.pSamplesPerMicrotick; cFlexrayNodeParameters.pTwoKeySlotMode = cxxFlexrayNodeParameters.pTwoKeySlotMode; - cFlexrayNodeParameters.pSecondKeySlotID = cxxFlexrayNodeParameters.pSecondKeySlotID; + cFlexrayNodeParameters.pSecondKeySlotId = cxxFlexrayNodeParameters.pSecondKeySlotId; } void CxxToC(const SilKit::Services::Flexray::FlexrayTxBufferConfig& cxxFlexrayTxBufferConfig, diff --git a/SilKit/include/silkit/services/flexray/FlexrayDatatypes.hpp b/SilKit/include/silkit/services/flexray/FlexrayDatatypes.hpp index fded32d21..622d7d280 100644 --- a/SilKit/include/silkit/services/flexray/FlexrayDatatypes.hpp +++ b/SilKit/include/silkit/services/flexray/FlexrayDatatypes.hpp @@ -233,7 +233,7 @@ struct FlexrayNodeParameters uint8_t pSamplesPerMicrotick; //! Second Key Slot ID of the key slot (range 0-1023, value 0 means that there is no key slot). - uint16_t pSecondKeySlotID; + uint16_t pSecondKeySlotId; //! Second Key slot is used for startup with a single cold start node (range 0, 1). uint8_t pTwoKeySlotMode; @@ -536,7 +536,7 @@ inline bool operator==(const FlexrayNodeParameters& lhs, const FlexrayNodeParame && lhs.pOffsetCorrectionStart == rhs.pOffsetCorrectionStart && lhs.pRateCorrectionOut == rhs.pRateCorrectionOut && lhs.pWakeupChannel == rhs.pWakeupChannel && lhs.pWakeupPattern == rhs.pWakeupPattern && lhs.pdMicrotick == rhs.pdMicrotick - && lhs.pSamplesPerMicrotick == rhs.pSamplesPerMicrotick && lhs.pSecondKeySlotID == rhs.pSecondKeySlotID + && lhs.pSamplesPerMicrotick == rhs.pSamplesPerMicrotick && lhs.pSecondKeySlotId == rhs.pSecondKeySlotId && lhs.pTwoKeySlotMode == rhs.pTwoKeySlotMode ; } diff --git a/SilKit/source/capi/CapiFlexray.cpp b/SilKit/source/capi/CapiFlexray.cpp index d6b5dd328..16e3f425a 100644 --- a/SilKit/source/capi/CapiFlexray.cpp +++ b/SilKit/source/capi/CapiFlexray.cpp @@ -86,7 +86,7 @@ void assign(SilKit::Services::Flexray::FlexrayNodeParameters& cppNodeParameters, if ( inputVersion == 2) { cppNodeParameters.pTwoKeySlotMode = nodeParameters->pTwoKeySlotMode; - cppNodeParameters.pSecondKeySlotID = nodeParameters->pSecondKeySlotID; + cppNodeParameters.pSecondKeySlotId = nodeParameters->pSecondKeySlotId; } } diff --git a/SilKit/source/services/flexray/FlexraySerdes.cpp b/SilKit/source/services/flexray/FlexraySerdes.cpp index e33ae069c..f7a4ea15f 100644 --- a/SilKit/source/services/flexray/FlexraySerdes.cpp +++ b/SilKit/source/services/flexray/FlexraySerdes.cpp @@ -149,7 +149,7 @@ inline SilKit::Core::MessageBuffer& operator<<(SilKit::Core::MessageBuffer& buff << nodeParams.pMacroInitialOffsetB << nodeParams.pMicroInitialOffsetA << nodeParams.pMicroInitialOffsetB << nodeParams.pMicroPerCycle << nodeParams.pOffsetCorrectionOut << nodeParams.pOffsetCorrectionStart << nodeParams.pRateCorrectionOut << nodeParams.pWakeupChannel << nodeParams.pWakeupPattern - << nodeParams.pdMicrotick << nodeParams.pSamplesPerMicrotick << nodeParams.pSecondKeySlotID + << nodeParams.pdMicrotick << nodeParams.pSamplesPerMicrotick << nodeParams.pSecondKeySlotId << nodeParams.pTwoKeySlotMode; return buffer; } @@ -166,7 +166,7 @@ inline SilKit::Core::MessageBuffer& operator>>(SilKit::Core::MessageBuffer& buff >> nodeParams.pdMicrotick >> nodeParams.pSamplesPerMicrotick; if (buffer.RemainingBytesLeft() > 0) { - buffer >> nodeParams.pSecondKeySlotID >> nodeParams.pTwoKeySlotMode; + buffer >> nodeParams.pSecondKeySlotId >> nodeParams.pTwoKeySlotMode; } return buffer; } From f6793464700f5e8bb34efa051697b3e0eff0edf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20B=C3=B6rschig?= Date: Thu, 15 Jan 2026 12:09:37 +0100 Subject: [PATCH 03/12] fixup! fixup! flexray: add second keyslot to config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit initialize structs Signed-off-by: Marius Börschig --- SilKit/source/services/flexray/Test_FlexrayController.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SilKit/source/services/flexray/Test_FlexrayController.cpp b/SilKit/source/services/flexray/Test_FlexrayController.cpp index 625345c55..5c08474b9 100644 --- a/SilKit/source/services/flexray/Test_FlexrayController.cpp +++ b/SilKit/source/services/flexray/Test_FlexrayController.cpp @@ -46,7 +46,7 @@ auto GetDummyConfig() -> SilKit::Config::FlexrayController auto MakeValidClusterParams() -> FlexrayClusterParameters { - FlexrayClusterParameters clusterParams; + FlexrayClusterParameters clusterParams{}; clusterParams.gColdstartAttempts = 2; clusterParams.gCycleCountMax = 7; clusterParams.gdActionPointOffset = 1; @@ -73,7 +73,7 @@ auto MakeValidClusterParams() -> FlexrayClusterParameters auto MakeValidNodeParams() -> FlexrayNodeParameters { - FlexrayNodeParameters nodeParams; + FlexrayNodeParameters nodeParams{}; nodeParams.pAllowHaltDueToClock = 0; nodeParams.pAllowPassiveToActive = 0; nodeParams.pChannels = FlexrayChannel::A; @@ -116,7 +116,7 @@ auto MakeValidTxBufferConfig() -> FlexrayTxBufferConfig auto GetDummyConfigWithValues() -> SilKit::Config::FlexrayController { - SilKit::Config::FlexrayController dummyConfig; + SilKit::Config::FlexrayController dummyConfig{}; dummyConfig.network = "testNetwork"; dummyConfig.name = "testController"; dummyConfig.clusterParameters = MakeValidClusterParams(); From 9cba8fcdffb4168ac5e6a6fabf98213857a22c89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20B=C3=B6rschig?= Date: Thu, 15 Jan 2026 12:47:52 +0100 Subject: [PATCH 04/12] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Daniel Edwards Signed-off-by: Marius Börschig --- SilKit/include/silkit/capi/Flexray.h | 3 +++ SilKit/include/silkit/services/flexray/FlexrayDatatypes.hpp | 3 +++ SilKit/source/capi/CapiFlexray.cpp | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/SilKit/include/silkit/capi/Flexray.h b/SilKit/include/silkit/capi/Flexray.h index 3de090be9..528f5b37f 100644 --- a/SilKit/include/silkit/capi/Flexray.h +++ b/SilKit/include/silkit/capi/Flexray.h @@ -237,6 +237,9 @@ struct SilKit_FlexrayNodeParameters //! Number of samples per MicroTick (values 1 or 2). uint8_t pSamplesPerMicrotick; + // ---------------------------------------------------------------------- + // Parameters according to B.3.2.1 (added in SIL Kit 5.0.3) + //! Second Key Slot ID of the key slot (range 0-1023, value 0 means that there is no key slot). uint16_t pSecondKeySlotId; diff --git a/SilKit/include/silkit/services/flexray/FlexrayDatatypes.hpp b/SilKit/include/silkit/services/flexray/FlexrayDatatypes.hpp index 622d7d280..e7d1c04c6 100644 --- a/SilKit/include/silkit/services/flexray/FlexrayDatatypes.hpp +++ b/SilKit/include/silkit/services/flexray/FlexrayDatatypes.hpp @@ -232,6 +232,9 @@ struct FlexrayNodeParameters //! Number of samples per MicroTick (values 1 or 2). uint8_t pSamplesPerMicrotick; + // ---------------------------------------------------------------------- + // Parameters according to B.3.2.1 (added in SIL Kit 5.0.3) + //! Second Key Slot ID of the key slot (range 0-1023, value 0 means that there is no key slot). uint16_t pSecondKeySlotId; diff --git a/SilKit/source/capi/CapiFlexray.cpp b/SilKit/source/capi/CapiFlexray.cpp index 16e3f425a..644706fce 100644 --- a/SilKit/source/capi/CapiFlexray.cpp +++ b/SilKit/source/capi/CapiFlexray.cpp @@ -83,7 +83,7 @@ void assign(SilKit::Services::Flexray::FlexrayNodeParameters& cppNodeParameters, cppNodeParameters.pSamplesPerMicrotick = nodeParameters->pSamplesPerMicrotick; } - if ( inputVersion == 2) + if (inputVersion == 2) { cppNodeParameters.pTwoKeySlotMode = nodeParameters->pTwoKeySlotMode; cppNodeParameters.pSecondKeySlotId = nodeParameters->pSecondKeySlotId; From b409e2d8337c1bffc8ba5257eeadaacb862e9c0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20B=C3=B6rschig?= Date: Mon, 26 Jan 2026 17:06:02 +0100 Subject: [PATCH 05/12] add missing config parsing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marius Börschig --- SilKit/source/config/ParticipantConfiguration_Full.json | 4 +++- SilKit/source/config/ParticipantConfiguration_Full.yaml | 3 +++ SilKit/source/config/YamlReader.cpp | 2 ++ SilKit/source/config/YamlWriter.cpp | 3 +++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/SilKit/source/config/ParticipantConfiguration_Full.json b/SilKit/source/config/ParticipantConfiguration_Full.json index 877094193..6f04a8ed1 100644 --- a/SilKit/source/config/ParticipantConfiguration_Full.json +++ b/SilKit/source/config/ParticipantConfiguration_Full.json @@ -116,7 +116,9 @@ "pWakeupPattern": 33, "pdAcceptedStartupRange": 212, "pdListenTimeout": 400162, - "pdMicrotick": "25ns" + "pdMicrotick": "25ns", + "pSecondKeySlotId": 1337, + "pTwoKeySlotMode": 1 }, "TxBufferConfigurations": [ { diff --git a/SilKit/source/config/ParticipantConfiguration_Full.yaml b/SilKit/source/config/ParticipantConfiguration_Full.yaml index 3f938d2bc..4c08d28a3 100644 --- a/SilKit/source/config/ParticipantConfiguration_Full.yaml +++ b/SilKit/source/config/ParticipantConfiguration_Full.yaml @@ -89,11 +89,14 @@ FlexrayControllers: pOffsetCorrectionStart: 3632 pRateCorrectionOut: 81 pSamplesPerMicrotick: 2 + pSecondKeySlotId: 1337 + pTwoKeySlotMode: 1 pWakeupChannel: A pWakeupPattern: 33 pdAcceptedStartupRange: 212 pdListenTimeout: 400162 pdMicrotick: 25ns + TxBufferConfigurations: - channels: A headerCrc: 0 diff --git a/SilKit/source/config/YamlReader.cpp b/SilKit/source/config/YamlReader.cpp index f53c07f94..6a796eb39 100644 --- a/SilKit/source/config/YamlReader.cpp +++ b/SilKit/source/config/YamlReader.cpp @@ -97,6 +97,8 @@ void YamlReader::Read(SilKit::Services::Flexray::FlexrayNodeParameters& obj) ReadKeyValue(obj.pWakeupChannel, "pWakeupChannel"); ReadKeyValue(obj.pdMicrotick, "pdMicrotick"); ReadKeyValue(obj.pChannels, "pChannels"); + OptionalRead(obj.pSecondKeySlotId, "pSecondKeySlotId"); + OptionalRead(obj.pTwoKeySlotMode, "pTwoKeySlotMode"); } void YamlReader::Read(SilKit::Services::Flexray::FlexrayTxBufferConfig& obj) diff --git a/SilKit/source/config/YamlWriter.cpp b/SilKit/source/config/YamlWriter.cpp index 6e817aa84..1bcadc815 100644 --- a/SilKit/source/config/YamlWriter.cpp +++ b/SilKit/source/config/YamlWriter.cpp @@ -99,6 +99,7 @@ void YamlWriter::Write(const SilKit::Services::Flexray::FlexrayClusterParameters void YamlWriter::Write(const SilKit::Services::Flexray::FlexrayNodeParameters& obj) { + static const SilKit::Services::Flexray::FlexrayNodeParameters defaultNodeParams{}; MakeMap(); WriteKeyValue("pAllowHaltDueToClock", obj.pAllowHaltDueToClock); WriteKeyValue("pAllowPassiveToActive", obj.pAllowPassiveToActive); @@ -123,6 +124,8 @@ void YamlWriter::Write(const SilKit::Services::Flexray::FlexrayNodeParameters& o WriteKeyValue("pWakeupChannel", obj.pWakeupChannel); WriteKeyValue("pdMicrotick", obj.pdMicrotick); WriteKeyValue("pChannels", obj.pChannels); + NonDefaultWrite(obj.pSecondKeySlotId, "pSecondKeySlotId", defaultNodeParams.pSecondKeySlotId); + NonDefaultWrite(obj.pTwoKeySlotMode, "pTwoKeySlotMode", defaultNodeParams.pTwoKeySlotMode); } From 7082e5520635bb9c8013d96e7f1f81bca3af237e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20B=C3=B6rschig?= Date: Mon, 26 Jan 2026 17:27:04 +0100 Subject: [PATCH 06/12] fixup! add missing config parsing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marius Börschig --- SilKit/source/config/YamlValidator.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SilKit/source/config/YamlValidator.cpp b/SilKit/source/config/YamlValidator.cpp index be94b362b..d22b36136 100644 --- a/SilKit/source/config/YamlValidator.cpp +++ b/SilKit/source/config/YamlValidator.cpp @@ -246,6 +246,10 @@ const std::set schemaPaths_v1 = { "/FlexRayControllers/NodeParameters/pWakeupChannel", "/FlexrayControllers/NodeParameters/pWakeupPattern", "/FlexRayControllers/NodeParameters/pWakeupPattern", + "/FlexrayControllers/NodeParameters/pSecondKeySlotId", + "/FlexRayControllers/NodeParameters/pSecondKeySlotId", + "/FlexrayControllers/NodeParameters/pTwoKeySlotMode", + "/FlexRayControllers/NodeParameters/pTwoKeySlotMode", "/FlexrayControllers/Replay", "/FlexRayControllers/Replay", "/FlexrayControllers/Replay/Direction", From 047998ad9ec773b928ccc1b30e3ca52d9d775135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20B=C3=B6rschig?= Date: Tue, 27 Jan 2026 07:19:05 +0100 Subject: [PATCH 07/12] default initialize config objects when deserializing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marius Börschig --- SilKit/source/config/YamlParser.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SilKit/source/config/YamlParser.hpp b/SilKit/source/config/YamlParser.hpp index 15bc54889..9684b5a4f 100644 --- a/SilKit/source/config/YamlParser.hpp +++ b/SilKit/source/config/YamlParser.hpp @@ -49,7 +49,7 @@ auto Deserialize(const std::string& input) -> T auto root = tree.crootref(); R reader{parser, root}; - T result; + T result{}; reader.Read(result); return result; } From 6b9e1a230a788265e4e350aa4bd56324d7873157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20B=C3=B6rschig?= Date: Tue, 27 Jan 2026 09:23:02 +0100 Subject: [PATCH 08/12] fixup! default initialize config objects when deserializing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit debugging failing test Signed-off-by: Marius Börschig --- SilKit/source/config/Test_ParticipantConfiguration.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/SilKit/source/config/Test_ParticipantConfiguration.cpp b/SilKit/source/config/Test_ParticipantConfiguration.cpp index 6b3c4cbec..28f02e78d 100644 --- a/SilKit/source/config/Test_ParticipantConfiguration.cpp +++ b/SilKit/source/config/Test_ParticipantConfiguration.cpp @@ -71,6 +71,7 @@ TEST_F(Test_ParticipantConfiguration, full_configuration_file_with_includes) auto participantConfig = *std::dynamic_pointer_cast(cfg); auto participantConfigRef = *std::dynamic_pointer_cast(ref_cfg); + EXPECT_EQ(participantConfig.flexrayControllers.at(0).nodeParameters, participantConfigRef.flexrayControllers.at(0).nodeParameters); ASSERT_EQ(participantConfig, participantConfigRef); } From a72f245b6c67d3d7adaed1656b266aa4d5b28c2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20B=C3=B6rschig?= Date: Tue, 27 Jan 2026 09:38:31 +0100 Subject: [PATCH 09/12] fixup! fixup! default initialize config objects when deserializing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marius Börschig --- SilKit/source/config/Test_ParticipantConfiguration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SilKit/source/config/Test_ParticipantConfiguration.cpp b/SilKit/source/config/Test_ParticipantConfiguration.cpp index 28f02e78d..12f14c119 100644 --- a/SilKit/source/config/Test_ParticipantConfiguration.cpp +++ b/SilKit/source/config/Test_ParticipantConfiguration.cpp @@ -71,7 +71,7 @@ TEST_F(Test_ParticipantConfiguration, full_configuration_file_with_includes) auto participantConfig = *std::dynamic_pointer_cast(cfg); auto participantConfigRef = *std::dynamic_pointer_cast(ref_cfg); - EXPECT_EQ(participantConfig.flexrayControllers.at(0).nodeParameters, participantConfigRef.flexrayControllers.at(0).nodeParameters); + EXPECT_EQ(participantConfig.flexrayControllers.at(0).nodeParameters.value(), participantConfigRef.flexrayControllers.at(0).nodeParameters.value()); ASSERT_EQ(participantConfig, participantConfigRef); } From 34fcc93294aff8f421265d3793ea289522158d86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20B=C3=B6rschig?= Date: Tue, 27 Jan 2026 11:03:07 +0100 Subject: [PATCH 10/12] fixup! fixup! fixup! default initialize config objects when deserializing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marius Börschig --- SilKit/source/config/YamlReader.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SilKit/source/config/YamlReader.hpp b/SilKit/source/config/YamlReader.hpp index d513e1d04..8e74b4fea 100644 --- a/SilKit/source/config/YamlReader.hpp +++ b/SilKit/source/config/YamlReader.hpp @@ -57,7 +57,7 @@ class BasicYamlReader auto&& child = GetChildSafe(name); if (child.IsValid()) { - T tmp; + T tmp{}; child.Read(tmp); val = std::move(tmp); // needs a proper setter to set "has_value" } From 56623b06ccd03f536214628a4b65b4c4cca8e358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20B=C3=B6rschig?= Date: Tue, 27 Jan 2026 15:00:16 +0100 Subject: [PATCH 11/12] fixup! fixup! fixup! fixup! default initialize config objects when deserializing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marius Börschig --- SilKit/source/config/Test_ParticipantConfiguration.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/SilKit/source/config/Test_ParticipantConfiguration.cpp b/SilKit/source/config/Test_ParticipantConfiguration.cpp index 12f14c119..6b3c4cbec 100644 --- a/SilKit/source/config/Test_ParticipantConfiguration.cpp +++ b/SilKit/source/config/Test_ParticipantConfiguration.cpp @@ -71,7 +71,6 @@ TEST_F(Test_ParticipantConfiguration, full_configuration_file_with_includes) auto participantConfig = *std::dynamic_pointer_cast(cfg); auto participantConfigRef = *std::dynamic_pointer_cast(ref_cfg); - EXPECT_EQ(participantConfig.flexrayControllers.at(0).nodeParameters.value(), participantConfigRef.flexrayControllers.at(0).nodeParameters.value()); ASSERT_EQ(participantConfig, participantConfigRef); } From 748e4503e84c2bfb15ae4f9dda68133332ffb981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20B=C3=B6rschig?= Date: Fri, 6 Feb 2026 16:27:34 +0100 Subject: [PATCH 12/12] ensure that we are backward compatible on a network protocol level MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marius Börschig --- .../source/services/flexray/FlexraySerdes.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/SilKit/source/services/flexray/FlexraySerdes.cpp b/SilKit/source/services/flexray/FlexraySerdes.cpp index f7a4ea15f..7a4948158 100644 --- a/SilKit/source/services/flexray/FlexraySerdes.cpp +++ b/SilKit/source/services/flexray/FlexraySerdes.cpp @@ -149,8 +149,7 @@ inline SilKit::Core::MessageBuffer& operator<<(SilKit::Core::MessageBuffer& buff << nodeParams.pMacroInitialOffsetB << nodeParams.pMicroInitialOffsetA << nodeParams.pMicroInitialOffsetB << nodeParams.pMicroPerCycle << nodeParams.pOffsetCorrectionOut << nodeParams.pOffsetCorrectionStart << nodeParams.pRateCorrectionOut << nodeParams.pWakeupChannel << nodeParams.pWakeupPattern - << nodeParams.pdMicrotick << nodeParams.pSamplesPerMicrotick << nodeParams.pSecondKeySlotId - << nodeParams.pTwoKeySlotMode; + << nodeParams.pdMicrotick << nodeParams.pSamplesPerMicrotick; return buffer; } @@ -164,10 +163,6 @@ inline SilKit::Core::MessageBuffer& operator>>(SilKit::Core::MessageBuffer& buff >> nodeParams.pMicroPerCycle >> nodeParams.pOffsetCorrectionOut >> nodeParams.pOffsetCorrectionStart >> nodeParams.pRateCorrectionOut >> nodeParams.pWakeupChannel >> nodeParams.pWakeupPattern >> nodeParams.pdMicrotick >> nodeParams.pSamplesPerMicrotick; - if (buffer.RemainingBytesLeft() > 0) - { - buffer >> nodeParams.pSecondKeySlotId >> nodeParams.pTwoKeySlotMode; - } return buffer; } @@ -189,12 +184,22 @@ inline SilKit::Core::MessageBuffer& operator<<(SilKit::Core::MessageBuffer& buff const FlexrayControllerConfig& config) { buffer << config.clusterParams << config.nodeParams << config.bufferConfigs; + // Support for struct FlexrayControllerConfig version 2: + // ensure that the pSecondKeySlotId and pTwoKeySlotMode are also serialized after the bufferConfigs + // otherwise we will confuse the buffer deserialization of the bufferConfigs + buffer << config.nodeParams.pSecondKeySlotId << config.nodeParams.pTwoKeySlotMode; return buffer; } inline SilKit::Core::MessageBuffer& operator>>(SilKit::Core::MessageBuffer& buffer, FlexrayControllerConfig& config) { buffer >> config.clusterParams >> config.nodeParams >> config.bufferConfigs; + // Support for struct FlexrayControllerConfig version 2: + // the pSecondKeySlotId and pTwoKeySlotMode were added after the bufferConfigs + if (buffer.RemainingBytesLeft() > 0) + { + buffer >> config.nodeParams.pSecondKeySlotId >> config.nodeParams.pTwoKeySlotMode; + } return buffer; }