mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Fix FlexRay extension bugs and implement FlexRay example
This commit is contained in:
@@ -10,8 +10,6 @@
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class Device;
|
||||
|
||||
class DeviceExtension {
|
||||
public:
|
||||
DeviceExtension(Device& device) : device(device) {}
|
||||
|
||||
@@ -21,14 +21,14 @@ typedef enum {
|
||||
FLEXRAY_BAUDRATE_5M = 1, // 5Mbit currently not supported in the monitor
|
||||
FLEXRAY_BAUDRATE_2M5 = 2, // 2.5Mbit currently not supported in the monitor
|
||||
FLEXRAY_BAUDRATE_2M5_ALT = 3 // Per the ERAY spec, 0b11 also means 2.5MBits
|
||||
} neoflexray_speed_t;
|
||||
} SpeedType;
|
||||
|
||||
typedef enum {
|
||||
FLEXRAY_SPP_5 = 0, // FlexRay 2.1 requires this value to be 0
|
||||
FLEXRAY_SPP_4 = 1,
|
||||
FLEXRAY_SPP_6 = 2,
|
||||
FLEXRAY_SPP_5_ALT = 3 // Per the ERAY spec, 0b11 also means sample point 5
|
||||
} neoflexray_spp_t;
|
||||
} SPPType;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -48,50 +48,39 @@ typedef struct {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
neoflexray_speed_t Speed INIT(FLEXRAY_BAUDRATE_10M /* = 0 */); // gdSampleClockPeriod, pSamplesPerMicrotick, Baud Rate Prescaler
|
||||
neoflexray_spp_t StrobePointPosition INIT(FLEXRAY_SPP_5 /* = 0 */);
|
||||
SpeedType Speed INIT(FLEXRAY_BAUDRATE_10M /* = 0 */); // gdSampleClockPeriod, pSamplesPerMicrotick, Baud Rate Prescaler
|
||||
SPPType StrobePointPosition INIT(FLEXRAY_SPP_5 /* = 0 */);
|
||||
|
||||
uint8_t ActionPointOffset INIT(0);
|
||||
uint32_t BitTimeNS INIT(0);
|
||||
uint8_t CASRxLowMax INIT(0);
|
||||
uint8_t ColdStartAttempts INIT(0);
|
||||
uint32_t CycleCountMax INIT(0);
|
||||
double CycleDurationSec INIT(0);
|
||||
bool DetectNITError INIT(false);
|
||||
uint8_t DynamicSlotIdlePhaseMinislots INIT(0); // In Minislot increments [0..2]
|
||||
uint32_t IgnoreAfterTx INIT(0);
|
||||
uint8_t ListenNoiseMacroticks INIT(0);
|
||||
uint16_t MacroticksPerCycle INIT(0);
|
||||
double MacrotickDurationSec INIT(0);
|
||||
uint8_t MaxWithoutClockCorrectionFatal INIT(0);
|
||||
uint8_t MaxWithoutClockCorrectionPassive INIT(0);
|
||||
uint8_t MinislotActionPointOffsetMacroticks INIT(0);
|
||||
uint32_t MinislotDurationMacroticks INIT(0); // gdMinislot
|
||||
uint32_t NetworkIdleTimeMacroticks INIT(0);
|
||||
uint8_t NetworkManagementVectorLengthBytes INIT(0);
|
||||
uint32_t NumberOfMinislots INIT(0);
|
||||
uint16_t NumberOfStaticSlots INIT(0);
|
||||
uint32_t OffsetCorrectionStartMacroticks INIT(0);
|
||||
uint8_t PayloadLengthOfStaticSlotInWords INIT(0);
|
||||
uint32_t SafetyMarginMacroticks INIT(0);
|
||||
|
||||
double SampleClockPeriodSec INIT(0);
|
||||
bool UseSampleClockPeriodSec INIT(false);
|
||||
uint8_t ActionPointOffset INIT(0); // gdActionPointOffset
|
||||
uint8_t CASRxLowMax INIT(0); // gdCASRxLowMax
|
||||
uint8_t ColdStartAttempts INIT(0); // gColdStartAttempts
|
||||
uint16_t CycleDurationMicroSec INIT(0); // gdCycle
|
||||
uint8_t DynamicSlotIdlePhaseMinislots INIT(0); // gdDynamicSlotIdlePhase, In Minislot increments [0..2]
|
||||
uint8_t ListenNoiseMacroticks INIT(0); // gListenNoise
|
||||
uint16_t MacroticksPerCycle INIT(0); // gMacroPerCycle
|
||||
uint8_t MacrotickDurationMicroSec INIT(0); // gdMacroTick
|
||||
uint8_t MaxWithoutClockCorrectionFatal INIT(0); // gMaxWithoutClockCorrectionFatal
|
||||
uint8_t MaxWithoutClockCorrectionPassive INIT(0); // gMaxWithoutClockCorrectionPassive
|
||||
uint8_t MinislotActionPointOffsetMacroticks INIT(0); // gdMinislotActionPointOffset
|
||||
uint8_t MinislotDurationMacroticks INIT(0); // gdMinislot
|
||||
uint16_t NetworkIdleTimeMacroticks INIT(0); // gdNIT
|
||||
uint8_t NetworkManagementVectorLengthBytes INIT(0); // gNetworkManagementVectorLength
|
||||
uint16_t NumberOfMinislots INIT(0); // gNumberOfMinislots
|
||||
uint16_t NumberOfStaticSlots INIT(0); // gNumberOfStaticSlots
|
||||
uint16_t OffsetCorrectionStartMacroticks INIT(0); // gOffsetCorrectionStart
|
||||
uint8_t PayloadLengthOfStaticSlotInWords INIT(0); // gPayloadLengthStatic
|
||||
|
||||
uint16_t StaticSlotMacroticks INIT(0); // gdStaticSlot
|
||||
uint32_t SymbolWindowMacroticks INIT(0);
|
||||
uint32_t SymbolWindowMacroticks INIT(0); // gdSymbolWindow
|
||||
uint32_t SymbolWindowActionPointOffsetMacroticks INIT(0);
|
||||
uint16_t SyncFrameIDCountMax INIT(0); // gSyncNodeMax
|
||||
|
||||
double TransceiverStandbyDelaySec INIT(false);
|
||||
bool UseTransceiverStandbyDelaySec INIT(0);
|
||||
uint8_t SyncFrameIDCountMax INIT(0); // gSyncNodeMax
|
||||
|
||||
uint8_t TransmissionStartSequenceDurationBits INIT(0); // gdTSSTransmitter
|
||||
uint8_t WakeupRxIdleBits INIT(0);
|
||||
uint8_t WakeupRxLowBits INIT(0);
|
||||
uint8_t WakeupRxIdleBits INIT(0); // gdWakeupSymbolRxIdle
|
||||
uint8_t WakeupRxLowBits INIT(0); // gdWakeupSymbolRxLow
|
||||
uint16_t WakeupRxWindowBits INIT(0); // gdWakeupSymbolRxWindow
|
||||
uint8_t WakeupTxActiveBits INIT(0); // gdWakeupSymbolTxLow (active = low here)
|
||||
uint8_t WakeupTxIdleBits INIT(0);
|
||||
uint8_t WakeupTxIdleBits INIT(0); // gdWakeupSymbolTxIdle
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
|
||||
@@ -26,11 +26,8 @@ namespace FlexRay {
|
||||
class Controller {
|
||||
public:
|
||||
Controller(Device& device, uint8_t index, Network net) : device(device), index(index), network(net) {}
|
||||
void _setStatus(std::shared_ptr<FlexRayControlMessage> msg);
|
||||
|
||||
// Begin Public Interface
|
||||
std::shared_ptr<FlexRayControlMessage> getStatus() const;
|
||||
|
||||
const Network& getNetwork() const { return network; }
|
||||
|
||||
struct Configuration; // Forward declaration
|
||||
@@ -104,7 +101,6 @@ private:
|
||||
Network network;
|
||||
mutable std::mutex statusLock;
|
||||
mutable std::mutex readRegisterLock;
|
||||
std::shared_ptr<FlexRayControlMessage> status;
|
||||
bool startWhenGoingOnline = false;
|
||||
bool allowColdstart = false;
|
||||
bool wakeupBeforeStart = false;
|
||||
@@ -124,29 +120,23 @@ public:
|
||||
typedef struct {
|
||||
#endif // __cplusplus
|
||||
|
||||
uint16_t AcceptStartupRangeMicroticks INIT(0);
|
||||
bool AllowHaltDueToClock INIT(false);
|
||||
uint16_t AcceptStartupRangeMicroticks INIT(0); // pdAcceptedStartupRange
|
||||
bool AllowHaltDueToClock INIT(false); // pAllowHaltDueToClock
|
||||
|
||||
uint8_t AllowPassiveToActiveCyclePairs INIT(0);
|
||||
uint8_t AllowPassiveToActiveCyclePairs INIT(0); // pAllowPassiveToActive
|
||||
|
||||
uint8_t ClusterDriftDamping INIT(0);
|
||||
uint8_t ClusterDriftDamping INIT(0); // pClusterDriftDamping
|
||||
|
||||
bool ChannelA INIT(false);
|
||||
bool ChannelB INIT(false);
|
||||
bool ChannelA INIT(false); // pChannels
|
||||
bool ChannelB INIT(false); // pChannels
|
||||
|
||||
uint8_t DecodingCorrectionMicroticks INIT(0);
|
||||
uint8_t DelayCompensationAMicroticks INIT(0);
|
||||
uint8_t DelayCompensationBMicroticks INIT(0);
|
||||
uint8_t ExternOffsetCorrectionControl INIT(0);
|
||||
uint8_t ExternRateCorrectionControl INIT(0);
|
||||
uint8_t ExternOffsetCorrectionMicroticks INIT(0);
|
||||
uint8_t ExternRateCorrectionMicroticks INIT(0);
|
||||
|
||||
bool ExternalSync INIT(false);
|
||||
bool UseExternalSync INIT(false);
|
||||
|
||||
bool FallBackInternal INIT(false);
|
||||
bool UseFallBackInternal INIT(false);
|
||||
uint8_t DecodingCorrectionMicroticks INIT(0); // pDecodingCorrection
|
||||
uint8_t DelayCompensationAMicroticks INIT(0); // pDelayCompensation[A]
|
||||
uint8_t DelayCompensationBMicroticks INIT(0); // pDelayCompensation[B]
|
||||
uint8_t ExternOffsetCorrectionControl INIT(0); // pExternOffsetControl
|
||||
uint8_t ExternRateCorrectionControl INIT(0); // pExternRateControl
|
||||
uint8_t ExternOffsetCorrectionMicroticks INIT(0); // pExternOffsetCorrection
|
||||
uint8_t ExternRateCorrectionMicroticks INIT(0); // pExternRateCorrection
|
||||
|
||||
uint16_t KeySlotID INIT(0);
|
||||
|
||||
@@ -154,39 +144,28 @@ public:
|
||||
bool KeySlotUsedForStartup INIT(false); // pKeySlotUsedForStartup (TXST)
|
||||
bool KeySlotUsedForSync INIT(false); // pKeySlotUsedForSync (TXSY)
|
||||
|
||||
uint16_t LatestTxMinislot INIT(0);
|
||||
uint32_t ListenTimeout INIT(0);
|
||||
uint16_t LatestTxMinislot INIT(0); // pLatestTx
|
||||
uint32_t ListenTimeout INIT(0); // pdListenTimeout
|
||||
|
||||
uint8_t MacroInitialOffsetA INIT(0); // Valid 2..72
|
||||
uint8_t MacroInitialOffsetB INIT(0); // Valid 2..72
|
||||
uint8_t MacroInitialOffsetA INIT(0); // pMacroInitialOffset[A], Valid 2..72
|
||||
uint8_t MacroInitialOffsetB INIT(0); // pMacroInitialOffset[B], Valid 2..72
|
||||
|
||||
uint32_t MaximumDynamicPayloadLengthWords INIT(0);
|
||||
uint8_t MicroInitialOffsetA INIT(0); // pMicroInitialOffset[A], Valid 0..240
|
||||
uint8_t MicroInitialOffsetB INIT(0); // pMicroInitialOffset[B], Valid 0..240
|
||||
|
||||
uint8_t MicroInitialOffsetA INIT(0); // Valid 0..240
|
||||
uint8_t MicroInitialOffsetB INIT(0); // Valid 0..240
|
||||
|
||||
uint32_t MicroPerCycle INIT(0);
|
||||
|
||||
double MicrotickDurationSec INIT(0);
|
||||
bool UseMicrotickDurationSec INIT(false);
|
||||
uint32_t MicroPerCycle INIT(0); // pMicroPerCycle
|
||||
|
||||
bool MTSOnA INIT(false);
|
||||
bool MTSOnB INIT(false);
|
||||
|
||||
bool NMVectorEarlyUpdate INIT(false);
|
||||
bool UseNMVectorEarlyUpdate INIT(false);
|
||||
|
||||
uint16_t OffsetCorrectionOutMicroticks INIT(0);
|
||||
uint16_t OffsetCorrectionOutMicroticks INIT(0); // pOffsetCorrectionOut
|
||||
uint16_t RateCorrectionOutMicroticks INIT(0); // pdMaxDrift and pRateCorrectionOut
|
||||
|
||||
uint32_t SamplesPerMicrotick INIT(0);
|
||||
bool UseSamplesPerMicrotick INIT(false);
|
||||
|
||||
uint16_t SecondKeySlotID INIT(0);
|
||||
bool TwoKeySlotMode INIT(false);
|
||||
|
||||
uint8_t WakeupPattern INIT(0);
|
||||
bool WakeupOnChannelB INIT(false);
|
||||
bool WakeupOnChannelB INIT(false); // pWakeupChannel
|
||||
|
||||
#ifndef __cplusplus
|
||||
} neoflexray_controller_config_t;
|
||||
|
||||
@@ -24,7 +24,6 @@ public:
|
||||
void onGoOnline() override;
|
||||
void onGoOffline() override;
|
||||
|
||||
void handleMessage(const std::shared_ptr<Message>& message) override;
|
||||
bool transmitHook(const std::shared_ptr<Frame>& frame, bool& success) override;
|
||||
|
||||
std::shared_ptr<Controller> getController(uint8_t index) const {
|
||||
|
||||
@@ -27,15 +27,15 @@ typedef struct {
|
||||
bool isDynamic INIT(false);
|
||||
bool isSync INIT(false); // Must be set if isStartup is set!
|
||||
bool isStartup INIT(false);
|
||||
bool isNMFrame INIT(false);
|
||||
bool isNetworkManagementFrame INIT(false);
|
||||
bool isTransmit INIT(false);
|
||||
uint16_t frameID INIT(0);
|
||||
uint16_t frameID INIT(0); // Frame/Slot ID
|
||||
bool channelA INIT(false);
|
||||
bool channelB INIT(false);
|
||||
uint8_t frameLengthBytes INIT(0);
|
||||
uint8_t baseCycle INIT(0);
|
||||
uint8_t cycleRepetition INIT(0);
|
||||
bool continuousMode INIT(false);
|
||||
bool continuousMode INIT(false); // If false, mode is continuous mode
|
||||
uint16_t _dataPointer INIT(0); // For internal use
|
||||
uint16_t _id INIT(0); // For internal use
|
||||
|
||||
|
||||
Reference in New Issue
Block a user