Communication: Add GPTPStatus

This commit is contained in:
Yasser Yassine
2024-12-20 23:22:25 +00:00
committed by Kyle Schwarz
parent c4ce803d62
commit dc0f16b1d2
26 changed files with 488 additions and 16 deletions
+1
View File
@@ -109,6 +109,7 @@ public:
LINSettingsNotAvailable = 0x2053,
ModeNotFound = 0x2054,
AppErrorParsingFailed = 0x2055,
GPTPNotSupported = 0x2056,
// Transport Events
FailedToRead = 0x3000,
+1
View File
@@ -51,6 +51,7 @@ enum class ExtendedCommand : uint16_t {
StartDHCPServer = 0x0016,
StopDHCPServer = 0x0017,
GetSupportedFeatures = 0x0018,
GetGPTPStatus = 0x0019,
GetComponentVersions = 0x001A,
Reboot = 0x001C,
SetRootFSEntryFlags = 0x0027,
@@ -0,0 +1,103 @@
#ifndef __GPTPSTATUSMESSAGE_H_
#define __GPTPSTATUSMESSAGE_H_
#ifdef __cplusplus
#include "icsneo/communication/message/message.h"
#include "icsneo/communication/command.h"
#include "icsneo/api/eventmanager.h"
namespace icsneo {
class GPTPStatus : public Message {
public:
typedef uint64_t TimeInterval;
typedef uint64_t ClockID;
struct Timestamp {
uint64_t seconds;
uint32_t nanoseconds;
double toSeconds() const {
static constexpr double billion = 1e9;
return (double)seconds + ((double)nanoseconds) / billion;
}
};
struct ScaledNanoSeconds {
int16_t nanosecondsMSB; // The most significant bits
int64_t nanosecondsLSB; // The least significant bits
int16_t fractionalNanoseconds; // Fractional part
};
struct PortID {
ClockID clockIdentity;
uint16_t portNumber;
};
struct ClockQuality {
uint8_t clockClass;
uint8_t clockAccuracy;
uint16_t offsetScaledLogVariance;
};
struct SystemID {
uint8_t priority1;
ClockQuality clockQuality;
uint8_t priority2;
ClockID clockID;
};
struct PriorityVector {
SystemID sysID;
uint16_t stepsRemoved;
PortID portID;
uint16_t portNumber;
};
struct ParentDS {
PortID parentPortIdentity;
int32_t cumulativeRateRatio;
ClockID grandmasterIdentity;
uint8_t gmClockQualityClockClass;
uint8_t gmClockQualityClockAccuracy;
uint16_t gmClockQualityOffsetScaledLogVariance;
uint8_t gmPriority1;
uint8_t gmPriority2;
};
struct CurrentDS {
uint16_t stepsRemoved;
TimeInterval offsetFromMaster;
ScaledNanoSeconds lastgmPhaseChange;
double lastgmFreqChange;
uint16_t gmTimeBaseIndicator;
uint32_t gmChangeCount;
uint32_t timeOfLastgmChangeEvent;
uint32_t timeOfLastgmPhaseChangeEvent;
uint32_t timeOfLastgmFreqChangeEvent;
};
GPTPStatus() : Message(Message::Type::GPTPStatus) {}
static std::shared_ptr<GPTPStatus> DecodeToMessage(std::vector<uint8_t>& bytes, const device_eventhandler_t& report);
Timestamp currentTime;
PriorityVector gmPriority;
int64_t msOffsetNs;
uint8_t isSync;
uint8_t linkStatus;
int64_t linkDelayNS;
uint8_t selectedRole;
uint8_t asCapable;
uint8_t isSyntonized;
Timestamp lastRXSyncTS; // t2 in IEEE 1588-2019 Figure-16
CurrentDS currentDS;
ParentDS parentDS;
bool shortFormat = false; // Set to true if the above variables weren't set (some firmware versions do not contain all the above variables)
};
}
#endif
#endif
@@ -41,6 +41,7 @@ public:
HardwareInfo = 0x8010,
TC10Status = 0x8011,
AppError = 0x8012,
GPTPStatus = 0x8013
};
Message(Type t) : type(t) {}
+4
View File
@@ -50,6 +50,7 @@
#include "icsneo/disk/vsa/vsa.h"
#include "icsneo/disk/vsa/vsaparser.h"
#include "icsneo/communication/message/versionmessage.h"
#include "icsneo/communication/message/gptpstatusmessage.h"
#define ICSNEO_FINDABLE_DEVICE_BASE(className, type) \
@@ -727,12 +728,15 @@ public:
virtual bool supportsComponentVersions() const { return false; }
virtual bool supportsTC10() const { return false; }
virtual bool supportsGPTP() const { return false; }
bool requestTC10Wake(Network::NetID network);
bool requestTC10Sleep(Network::NetID network);
std::optional<TC10StatusMessage> getTC10Status(Network::NetID network);
std::optional<GPTPStatus> getGPTPStatus(std::chrono::milliseconds timeout = std::chrono::milliseconds(100));
protected:
bool online = false;
+9 -8
View File
@@ -444,20 +444,21 @@ typedef struct LOGGER_SETTINGS_t
#define RAD_GPTP_NUM_PORTS 1 // 1 because only supported as gPTP endpoint
typedef struct RAD_GPTP_SETTINGS_t
{
uint32_t neighborPropDelayThresh;//ns
uint32_t sys_phc_sync_interval;//ns
int8_t logPDelayReqInterval;// log2ms
int8_t logSyncInterval;// log2ms
int8_t logAnnounceInterval;// log2ms
uint32_t neighborPropDelayThresh; //ns
uint32_t sys_phc_sync_interval; //ns
int8_t logPDelayReqInterval; // log2ms
int8_t logSyncInterval; // log2ms
int8_t logAnnounceInterval; // log2ms
uint8_t profile;
uint8_t priority1;
uint8_t clockclass;
uint8_t clockaccuracy;
uint8_t priority2;
uint16_t offset_scaled_log_variance;
uint8_t gPTPportRole[RAD_GPTP_NUM_PORTS];
uint8_t portEnable[RAD_GPTP_NUM_PORTS];
uint8_t rsvd[16];
uint8_t gptpPortRole;
uint8_t gptpEnabledPort;
uint8_t enableClockSyntonization;
uint8_t rsvd[15];
} RAD_GPTP_SETTINGS;//36 Bytes with RAD_GPTP_NUM_PORTS = 1
#define RAD_GPTP_SETTINGS_SIZE 36
@@ -79,6 +79,8 @@ protected:
bool supportsLiveData() const override { return true; }
bool supportsGPTP() const override { return true; }
std::optional<MemoryAddress> getCoreminiStartAddressFlash() const override {
return 33*1024*1024;
}
@@ -90,6 +92,7 @@ protected:
bool supportsEraseMemory() const override {
return true;
}
};
}
@@ -36,6 +36,7 @@ public:
}
bool supportsComponentVersions() const override { return true; }
bool supportsGPTP() const override { return true; }
protected:
NeoVIRED2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
@@ -40,6 +40,7 @@ public:
}
size_t getEthernetActivationLineCount() const override { return 1; }
bool supportsGPTP() const override { return true; }
protected:
RADA2B(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
@@ -77,6 +78,7 @@ protected:
std::optional<MemoryAddress> getCoreminiStartAddressSD() const override {
return 0;
}
};
}
@@ -31,6 +31,7 @@ public:
}
bool getEthPhyRegControlSupported() const override { return true; }
bool supportsGPTP() const override { return true; }
protected:
using Device::Device;
@@ -45,6 +45,7 @@ public:
bool getEthPhyRegControlSupported() const override { return true; }
bool supportsTC10() const override { return true; }
bool supportsGPTP() const override { return true; }
protected:
RADComet3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
@@ -61,6 +61,7 @@ public:
}
size_t getEthernetActivationLineCount() const override { return 1; }
bool supportsGPTP() const override { return true; }
protected:
RADGalaxy(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
@@ -65,6 +65,7 @@ public:
size_t getEthernetActivationLineCount() const override { return 1; }
bool supportsTC10() const override { return true; }
bool supportsGPTP() const override { return true; }
protected:
RADGalaxy2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
@@ -22,7 +22,8 @@ public:
bool getEthPhyRegControlSupported() const override { return true; }
bool supportsTC10() const override { return true; }
bool supportsGPTP() const override { return true; }
protected:
RADGigastar(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
initialize<RADGigastarSettings>(makeDriver);
@@ -76,7 +76,8 @@ namespace icsneo
bool getEthPhyRegControlSupported() const override { return true; }
bool supportsTC10() const override { return true; }
bool supportsGPTP() const override { return true; }
protected:
RADGigastar2(neodevice_t neodevice, const driver_factory_t &makeDriver) : Device(neodevice)
{
@@ -19,6 +19,7 @@ public:
ICSNEO_FINDABLE_DEVICE(RADMars, DeviceType::RADMars, "GL");
size_t getEthernetActivationLineCount() const override { return 1; }
bool supportsGPTP() const override { return true; }
protected:
RADMars(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {