mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-11-04 12:59:07 +01:00
Device: Refactor T1S settings
This commit is contained in:
committed by
Kyle Schwarz
parent
fb241dc5cd
commit
1d3039775d
@@ -706,7 +706,7 @@ icsneoc2_error_t icsneoc2_settings_t1s_burst_timer_set(icsneoc2_device_t* device
|
|||||||
return icsneoc2_error_success;
|
return icsneoc2_error_success;
|
||||||
}
|
}
|
||||||
|
|
||||||
icsneoc2_error_t icsneoc2_settings_t1s_max_burst_timer_for_get(icsneoc2_device_t* device, icsneoc2_netid_t netid, uint8_t* value) {
|
icsneoc2_error_t icsneoc2_settings_t1s_max_burst_get(icsneoc2_device_t* device, icsneoc2_netid_t netid, uint8_t* value) {
|
||||||
// Make sure the device is valid
|
// Make sure the device is valid
|
||||||
auto res = icsneoc2_device_is_valid(device);
|
auto res = icsneoc2_device_is_valid(device);
|
||||||
if(res != icsneoc2_error_success) {
|
if(res != icsneoc2_error_success) {
|
||||||
@@ -725,7 +725,7 @@ icsneoc2_error_t icsneoc2_settings_t1s_max_burst_timer_for_get(icsneoc2_device_t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
icsneoc2_error_t icsneoc2_settings_t1s_max_burst_timer_for_set(icsneoc2_device_t* device, icsneoc2_netid_t netid, uint8_t value) {
|
icsneoc2_error_t icsneoc2_settings_t1s_max_burst_set(icsneoc2_device_t* device, icsneoc2_netid_t netid, uint8_t value) {
|
||||||
// Make sure the device is valid
|
// Make sure the device is valid
|
||||||
auto res = icsneoc2_device_is_valid(device);
|
auto res = icsneoc2_device_is_valid(device);
|
||||||
if(res != icsneoc2_error_success) {
|
if(res != icsneoc2_error_success) {
|
||||||
|
|||||||
@@ -1113,3 +1113,177 @@ bool IDeviceSettings::setLinuxConfigurationPort(LinuxConfigurationPort port) {
|
|||||||
(*os)->ethConfigurationPort = static_cast<uint8_t>(port);
|
(*os)->ethConfigurationPort = static_cast<uint8_t>(port);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
void reportT1SUnavailable(const icsneo::device_eventhandler_t& report) {
|
||||||
|
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<bool> t1sFlag(const ETHERNET10T1S_SETTINGS* t1s, uint8_t flag, const icsneo::device_eventhandler_t& report) {
|
||||||
|
if(t1s == nullptr) {
|
||||||
|
reportT1SUnavailable(report);
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
return (t1s->flags & flag) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool setT1SFlag(ETHERNET10T1S_SETTINGS* t1s, uint8_t flag, bool enable, const icsneo::device_eventhandler_t& report) {
|
||||||
|
if(t1s == nullptr) {
|
||||||
|
reportT1SUnavailable(report);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(enable)
|
||||||
|
t1s->flags |= flag;
|
||||||
|
else
|
||||||
|
t1s->flags = static_cast<uint8_t>(t1s->flags & ~flag);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<uint8_t> t1sByte(const uint8_t* field, const icsneo::device_eventhandler_t& report) {
|
||||||
|
if(field == nullptr) {
|
||||||
|
reportT1SUnavailable(report);
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
return *field;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool setT1SByte(uint8_t* field, uint8_t value, const icsneo::device_eventhandler_t& report) {
|
||||||
|
if(field == nullptr) {
|
||||||
|
reportT1SUnavailable(report);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
*field = value;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
std::optional<bool> IDeviceSettings::isT1SPLCAEnabledFor(Network net) const {
|
||||||
|
return t1sFlag(getT1SSettingsFor(net), ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IDeviceSettings::setT1SPLCAFor(Network net, bool enable) {
|
||||||
|
return setT1SFlag(getMutableT1SSettingsFor(net), ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA, enable, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<uint8_t> IDeviceSettings::getT1SLocalIDFor(Network net) const {
|
||||||
|
const auto* t1s = getT1SSettingsFor(net);
|
||||||
|
return t1sByte(t1s == nullptr ? nullptr : &t1s->local_id, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IDeviceSettings::setT1SLocalIDFor(Network net, uint8_t id) {
|
||||||
|
auto* t1s = getMutableT1SSettingsFor(net);
|
||||||
|
return setT1SByte(t1s == nullptr ? nullptr : &t1s->local_id, id, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<uint8_t> IDeviceSettings::getT1SMaxNodesFor(Network net) const {
|
||||||
|
const auto* t1s = getT1SSettingsFor(net);
|
||||||
|
return t1sByte(t1s == nullptr ? nullptr : &t1s->max_num_nodes, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IDeviceSettings::setT1SMaxNodesFor(Network net, uint8_t nodes) {
|
||||||
|
auto* t1s = getMutableT1SSettingsFor(net);
|
||||||
|
return setT1SByte(t1s == nullptr ? nullptr : &t1s->max_num_nodes, nodes, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<uint8_t> IDeviceSettings::getT1STxOppTimerFor(Network net) const {
|
||||||
|
const auto* t1s = getT1SSettingsFor(net);
|
||||||
|
return t1sByte(t1s == nullptr ? nullptr : &t1s->to_timer, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IDeviceSettings::setT1STxOppTimerFor(Network net, uint8_t timer) {
|
||||||
|
auto* t1s = getMutableT1SSettingsFor(net);
|
||||||
|
return setT1SByte(t1s == nullptr ? nullptr : &t1s->to_timer, timer, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<uint8_t> IDeviceSettings::getT1SMaxBurstFor(Network net) const {
|
||||||
|
const auto* t1s = getT1SSettingsFor(net);
|
||||||
|
return t1sByte(t1s == nullptr ? nullptr : &t1s->max_burst_count, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IDeviceSettings::setT1SMaxBurstFor(Network net, uint8_t burst) {
|
||||||
|
auto* t1s = getMutableT1SSettingsFor(net);
|
||||||
|
return setT1SByte(t1s == nullptr ? nullptr : &t1s->max_burst_count, burst, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<uint8_t> IDeviceSettings::getT1SBurstTimerFor(Network net) const {
|
||||||
|
const auto* t1s = getT1SSettingsFor(net);
|
||||||
|
return t1sByte(t1s == nullptr ? nullptr : &t1s->burst_timer, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IDeviceSettings::setT1SBurstTimerFor(Network net, uint8_t timer) {
|
||||||
|
auto* t1s = getMutableT1SSettingsFor(net);
|
||||||
|
return setT1SByte(t1s == nullptr ? nullptr : &t1s->burst_timer, timer, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<uint8_t> IDeviceSettings::getT1SLocalIDAlternateFor(Network net) const {
|
||||||
|
const auto* t1s = getT1SSettingsFor(net);
|
||||||
|
return t1sByte(t1s == nullptr ? nullptr : &t1s->local_id_alternate, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IDeviceSettings::setT1SLocalIDAlternateFor(Network net, uint8_t id) {
|
||||||
|
auto* t1s = getMutableT1SSettingsFor(net);
|
||||||
|
return setT1SByte(t1s == nullptr ? nullptr : &t1s->local_id_alternate, id, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<bool> IDeviceSettings::isT1STerminationEnabledFor(Network net) const {
|
||||||
|
return t1sFlag(getT1SSettingsFor(net), ETHERNET10T1S_SETTINGS_FLAG_TERMINATION, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IDeviceSettings::setT1STerminationFor(Network net, bool enable) {
|
||||||
|
return setT1SFlag(getMutableT1SSettingsFor(net), ETHERNET10T1S_SETTINGS_FLAG_TERMINATION, enable, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<bool> IDeviceSettings::isT1SBusDecodingBeaconsEnabledFor(Network net) const {
|
||||||
|
return t1sFlag(getT1SSettingsFor(net), ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_BEACONS, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IDeviceSettings::setT1SBusDecodingBeaconsFor(Network net, bool enable) {
|
||||||
|
return setT1SFlag(getMutableT1SSettingsFor(net), ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_BEACONS, enable, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<bool> IDeviceSettings::isT1SBusDecodingAllEnabledFor(Network net) const {
|
||||||
|
return t1sFlag(getT1SSettingsFor(net), ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_ALL, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IDeviceSettings::setT1SBusDecodingAllFor(Network net, bool enable) {
|
||||||
|
return setT1SFlag(getMutableT1SSettingsFor(net), ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_ALL, enable, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<uint8_t> IDeviceSettings::getT1SMultiIDEnableMaskFor(Network net) const {
|
||||||
|
const auto* ext = getT1SSettingsExtFor(net);
|
||||||
|
return t1sByte(ext == nullptr ? nullptr : &ext->enable_multi_id, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IDeviceSettings::setT1SMultiIDEnableMaskFor(Network net, uint8_t mask) {
|
||||||
|
auto* ext = getMutableT1SSettingsExtFor(net);
|
||||||
|
return setT1SByte(ext == nullptr ? nullptr : &ext->enable_multi_id, mask, report);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<uint8_t> IDeviceSettings::getT1SMultiIDFor(Network net, uint8_t index) const {
|
||||||
|
const auto* ext = getT1SSettingsExtFor(net);
|
||||||
|
if(ext == nullptr) {
|
||||||
|
reportT1SUnavailable(report);
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
if(index >= sizeof(ext->multi_id)) {
|
||||||
|
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
return ext->multi_id[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IDeviceSettings::setT1SMultiIDFor(Network net, uint8_t index, uint8_t id) {
|
||||||
|
auto* ext = getMutableT1SSettingsExtFor(net);
|
||||||
|
if(ext == nullptr) {
|
||||||
|
reportT1SUnavailable(report);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(index >= sizeof(ext->multi_id)) {
|
||||||
|
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ext->multi_id[index] = id;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ static int configure_t1s_port(icsneoc2_device_t* device, icsneoc2_netid_t netid,
|
|||||||
if(res != icsneoc2_error_success) return print_error_code("Failed to set T1S TX opportunity timer", res);
|
if(res != icsneoc2_error_success) return print_error_code("Failed to set T1S TX opportunity timer", res);
|
||||||
res = icsneoc2_settings_t1s_burst_timer_set(device, netid, T1S_BURST_TIMER);
|
res = icsneoc2_settings_t1s_burst_timer_set(device, netid, T1S_BURST_TIMER);
|
||||||
if(res != icsneoc2_error_success) return print_error_code("Failed to set T1S burst timer", res);
|
if(res != icsneoc2_error_success) return print_error_code("Failed to set T1S burst timer", res);
|
||||||
res = icsneoc2_settings_t1s_max_burst_timer_for_set(device, netid, T1S_MAX_BURST);
|
res = icsneoc2_settings_t1s_max_burst_set(device, netid, T1S_MAX_BURST);
|
||||||
if(res != icsneoc2_error_success) return print_error_code("Failed to set T1S max burst", res);
|
if(res != icsneoc2_error_success) return print_error_code("Failed to set T1S max burst", res);
|
||||||
|
|
||||||
res = icsneoc2_settings_t1s_is_termination_enabled_for(device, netid, &termination);
|
res = icsneoc2_settings_t1s_is_termination_enabled_for(device, netid, &termination);
|
||||||
|
|||||||
@@ -1205,143 +1205,32 @@ public:
|
|||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::optional<bool> isT1SPLCAEnabledFor(Network net) const {
|
// 10BASE-T1S. Devices expose a network by overriding getT1SSettingsFor / getT1SSettingsExtFor.
|
||||||
(void)net;
|
// Every field in the mapped struct is readable; a null accessor means the network has no T1S block.
|
||||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
std::optional<bool> isT1SPLCAEnabledFor(Network net) const;
|
||||||
return std::nullopt;
|
bool setT1SPLCAFor(Network net, bool enable);
|
||||||
}
|
std::optional<uint8_t> getT1SLocalIDFor(Network net) const;
|
||||||
|
bool setT1SLocalIDFor(Network net, uint8_t id);
|
||||||
virtual bool setT1SPLCAFor(Network net, bool enable) {
|
std::optional<uint8_t> getT1SMaxNodesFor(Network net) const;
|
||||||
(void)net; (void)enable;
|
bool setT1SMaxNodesFor(Network net, uint8_t nodes);
|
||||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
std::optional<uint8_t> getT1STxOppTimerFor(Network net) const;
|
||||||
return false;
|
bool setT1STxOppTimerFor(Network net, uint8_t timer);
|
||||||
}
|
std::optional<uint8_t> getT1SMaxBurstFor(Network net) const;
|
||||||
|
bool setT1SMaxBurstFor(Network net, uint8_t burst);
|
||||||
virtual std::optional<uint8_t> getT1SLocalIDFor(Network net) const {
|
std::optional<uint8_t> getT1SBurstTimerFor(Network net) const;
|
||||||
(void)net;
|
bool setT1SBurstTimerFor(Network net, uint8_t timer);
|
||||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
std::optional<uint8_t> getT1SLocalIDAlternateFor(Network net) const;
|
||||||
return std::nullopt;
|
bool setT1SLocalIDAlternateFor(Network net, uint8_t id);
|
||||||
}
|
std::optional<bool> isT1STerminationEnabledFor(Network net) const;
|
||||||
|
bool setT1STerminationFor(Network net, bool enable);
|
||||||
virtual bool setT1SLocalIDFor(Network net, uint8_t id) {
|
std::optional<bool> isT1SBusDecodingBeaconsEnabledFor(Network net) const;
|
||||||
(void)net; (void)id;
|
bool setT1SBusDecodingBeaconsFor(Network net, bool enable);
|
||||||
return false;
|
std::optional<bool> isT1SBusDecodingAllEnabledFor(Network net) const;
|
||||||
}
|
bool setT1SBusDecodingAllFor(Network net, bool enable);
|
||||||
|
std::optional<uint8_t> getT1SMultiIDEnableMaskFor(Network net) const;
|
||||||
virtual std::optional<uint8_t> getT1SMaxNodesFor(Network net) const {
|
bool setT1SMultiIDEnableMaskFor(Network net, uint8_t mask);
|
||||||
(void)net;
|
std::optional<uint8_t> getT1SMultiIDFor(Network net, uint8_t index) const;
|
||||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
bool setT1SMultiIDFor(Network net, uint8_t index, uint8_t id);
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool setT1SMaxNodesFor(Network net, uint8_t nodes) {
|
|
||||||
(void)net; (void)nodes;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual std::optional<uint8_t> getT1STxOppTimerFor(Network net) const {
|
|
||||||
(void)net;
|
|
||||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool setT1STxOppTimerFor(Network net, uint8_t timer) {
|
|
||||||
(void)net; (void)timer;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual std::optional<uint8_t> getT1SMaxBurstFor(Network net) const {
|
|
||||||
(void)net;
|
|
||||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool setT1SMaxBurstFor(Network net, uint8_t burst) {
|
|
||||||
(void)net; (void)burst;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual std::optional<uint8_t> getT1SBurstTimerFor(Network net) const {
|
|
||||||
(void)net;
|
|
||||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool setT1SBurstTimerFor(Network net, uint8_t timer) {
|
|
||||||
(void)net; (void)timer;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual std::optional<uint8_t> getT1SLocalIDAlternateFor(Network net) const {
|
|
||||||
(void)net;
|
|
||||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool setT1SLocalIDAlternateFor(Network net, uint8_t id) {
|
|
||||||
(void)net; (void)id;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual std::optional<bool> isT1STerminationEnabledFor(Network net) const {
|
|
||||||
(void)net;
|
|
||||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool setT1STerminationFor(Network net, bool enable) {
|
|
||||||
(void)net; (void)enable;
|
|
||||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual std::optional<bool> isT1SBusDecodingBeaconsEnabledFor(Network net) const {
|
|
||||||
(void)net;
|
|
||||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool setT1SBusDecodingBeaconsFor(Network net, bool enable) {
|
|
||||||
(void)net; (void)enable;
|
|
||||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual std::optional<bool> isT1SBusDecodingAllEnabledFor(Network net) const {
|
|
||||||
(void)net;
|
|
||||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool setT1SBusDecodingAllFor(Network net, bool enable) {
|
|
||||||
(void)net; (void)enable;
|
|
||||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual std::optional<uint8_t> getT1SMultiIDEnableMaskFor(Network net) const {
|
|
||||||
(void)net;
|
|
||||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool setT1SMultiIDEnableMaskFor(Network net, uint8_t mask) {
|
|
||||||
(void)net; (void)mask;
|
|
||||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual std::optional<uint8_t> getT1SMultiIDFor(Network net, uint8_t index) const {
|
|
||||||
(void)net; (void)index;
|
|
||||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool setT1SMultiIDFor(Network net, uint8_t index, uint8_t id) {
|
|
||||||
(void)net; (void)index; (void)id;
|
|
||||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual std::optional<bool> isPerfTestEnabled() const {
|
virtual std::optional<bool> isPerfTestEnabled() const {
|
||||||
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
report(APIEvent::Type::SettingNotAvaiableDevice, APIEvent::Severity::EventWarning);
|
||||||
@@ -1427,6 +1316,28 @@ protected:
|
|||||||
return reinterpret_cast<ICSNEO_UNALIGNED(uint64_t*)>((void*)(settings.data() + (offset - settingsInDeviceRAM.data())));
|
return reinterpret_cast<ICSNEO_UNALIGNED(uint64_t*)>((void*)(settings.data() + (offset - settingsInDeviceRAM.data())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pointer into the device RAM image. Override per device. Unknown networks return nullptr
|
||||||
|
// and do not report; the public T1S methods report SettingNotAvaiableDevice.
|
||||||
|
virtual const ETHERNET10T1S_SETTINGS* getT1SSettingsFor(Network net) const { (void)net; return nullptr; }
|
||||||
|
ETHERNET10T1S_SETTINGS* getMutableT1SSettingsFor(Network net) {
|
||||||
|
if(disabled || readonly)
|
||||||
|
return nullptr;
|
||||||
|
const uint8_t* offset = reinterpret_cast<const uint8_t*>(getT1SSettingsFor(net));
|
||||||
|
if(offset == nullptr)
|
||||||
|
return nullptr;
|
||||||
|
return reinterpret_cast<ETHERNET10T1S_SETTINGS*>(settings.data() + (offset - settingsInDeviceRAM.data()));
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual const ETHERNET10T1S_SETTINGS_EXT* getT1SSettingsExtFor(Network net) const { (void)net; return nullptr; }
|
||||||
|
ETHERNET10T1S_SETTINGS_EXT* getMutableT1SSettingsExtFor(Network net) {
|
||||||
|
if(disabled || readonly)
|
||||||
|
return nullptr;
|
||||||
|
const uint8_t* offset = reinterpret_cast<const uint8_t*>(getT1SSettingsExtFor(net));
|
||||||
|
if(offset == nullptr)
|
||||||
|
return nullptr;
|
||||||
|
return reinterpret_cast<ETHERNET10T1S_SETTINGS_EXT*>(settings.data() + (offset - settingsInDeviceRAM.data()));
|
||||||
|
}
|
||||||
|
|
||||||
static bool SetNetworkEnabled(uint64_t* bitfields, size_t count, uint64_t networkID) {
|
static bool SetNetworkEnabled(uint64_t* bitfields, size_t count, uint64_t networkID) {
|
||||||
const size_t index = networkID / 64;
|
const size_t index = networkID / 64;
|
||||||
const size_t offset = networkID & 0x3F;
|
const size_t offset = networkID & 0x3F;
|
||||||
|
|||||||
@@ -269,215 +269,6 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<bool> isT1SPLCAEnabledFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional((t1s->flags & ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SPLCAFor(Network net, bool enable) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(enable)
|
|
||||||
t1s->flags |= ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA;
|
|
||||||
else
|
|
||||||
t1s->flags &= ~ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SLocalIDFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->local_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SLocalIDFor(Network net, uint8_t id) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->local_id = id;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SMaxNodesFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->max_num_nodes);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SMaxNodesFor(Network net, uint8_t nodes) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->max_num_nodes = nodes;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1STxOppTimerFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->to_timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1STxOppTimerFor(Network net, uint8_t timer) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->to_timer = timer;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SMaxBurstFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->max_burst_count);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SMaxBurstFor(Network net, uint8_t burst) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->max_burst_count = burst;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SBurstTimerFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->burst_timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SBurstTimerFor(Network net, uint8_t timer) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->burst_timer = timer;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SLocalIDAlternateFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->local_id_alternate);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SLocalIDAlternateFor(Network net, uint8_t id) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->local_id_alternate = id;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<bool> isT1SBusDecodingBeaconsEnabledFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional<bool>((t1s->flags & ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_BEACONS) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SBusDecodingBeaconsFor(Network net, bool enable) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(enable)
|
|
||||||
t1s->flags |= ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_BEACONS;
|
|
||||||
else
|
|
||||||
t1s->flags &= ~ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_BEACONS;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<bool> isT1SBusDecodingAllEnabledFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional<bool>((t1s->flags & ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_ALL) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SBusDecodingAllFor(Network net, bool enable) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(enable)
|
|
||||||
t1s->flags |= ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_ALL;
|
|
||||||
else
|
|
||||||
t1s->flags &= ~ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_ALL;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SMultiIDEnableMaskFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS_EXT* t1sExt = getT1SSettingsExtFor(net);
|
|
||||||
if(t1sExt == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1sExt->enable_multi_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SMultiIDEnableMaskFor(Network net, uint8_t mask) override {
|
|
||||||
ETHERNET10T1S_SETTINGS_EXT* t1sExt = getMutableT1SSettingsExtFor(net);
|
|
||||||
if(t1sExt == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1sExt->enable_multi_id = mask;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SMultiIDFor(Network net, uint8_t index) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS_EXT* t1sExt = getT1SSettingsExtFor(net);
|
|
||||||
if(t1sExt == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
if(index >= 7) {
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
return std::make_optional(t1sExt->multi_id[index]);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SMultiIDFor(Network net, uint8_t index, uint8_t id) override {
|
|
||||||
ETHERNET10T1S_SETTINGS_EXT* t1sExt = getMutableT1SSettingsExtFor(net);
|
|
||||||
if(t1sExt == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(index >= 7) {
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
t1sExt->multi_id[index] = id;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<bool> isPerfTestEnabled() const override {
|
std::optional<bool> isPerfTestEnabled() const override {
|
||||||
auto cfg = getStructurePointer<neovifire3t1slin_settings_t>();
|
auto cfg = getStructurePointer<neovifire3t1slin_settings_t>();
|
||||||
if(cfg == nullptr)
|
if(cfg == nullptr)
|
||||||
@@ -496,11 +287,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const ETHERNET10T1S_SETTINGS* getT1SSettingsFor(Network net) const {
|
const ETHERNET10T1S_SETTINGS* getT1SSettingsFor(Network net) const override {
|
||||||
auto cfg = getStructurePointer<neovifire3t1slin_settings_t>();
|
auto cfg = getStructurePointer<neovifire3t1slin_settings_t>();
|
||||||
if(cfg == nullptr)
|
if(cfg == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
switch(net.getNetID()) {
|
switch(net.getNetID()) {
|
||||||
case Network::NetID::AE_01: return &(cfg->t1s1);
|
case Network::NetID::AE_01: return &(cfg->t1s1);
|
||||||
case Network::NetID::AE_02: return &(cfg->t1s2);
|
case Network::NetID::AE_02: return &(cfg->t1s2);
|
||||||
@@ -510,69 +300,24 @@ private:
|
|||||||
case Network::NetID::AE_06: return &(cfg->t1s6);
|
case Network::NetID::AE_06: return &(cfg->t1s6);
|
||||||
case Network::NetID::AE_07: return &(cfg->t1s7);
|
case Network::NetID::AE_07: return &(cfg->t1s7);
|
||||||
case Network::NetID::AE_08: return &(cfg->t1s8);
|
case Network::NetID::AE_08: return &(cfg->t1s8);
|
||||||
default:
|
default: return nullptr;
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ETHERNET10T1S_SETTINGS* getMutableT1SSettingsFor(Network net) {
|
const ETHERNET10T1S_SETTINGS_EXT* getT1SSettingsExtFor(Network net) const override {
|
||||||
auto cfg = getMutableStructurePointer<neovifire3t1slin_settings_t>();
|
|
||||||
if(cfg == nullptr)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
switch(net.getNetID()) {
|
|
||||||
case Network::NetID::AE_01: return &(cfg->t1s1);
|
|
||||||
case Network::NetID::AE_02: return &(cfg->t1s2);
|
|
||||||
case Network::NetID::AE_03: return &(cfg->t1s3);
|
|
||||||
case Network::NetID::AE_04: return &(cfg->t1s4);
|
|
||||||
case Network::NetID::AE_05: return &(cfg->t1s5);
|
|
||||||
case Network::NetID::AE_06: return &(cfg->t1s6);
|
|
||||||
case Network::NetID::AE_07: return &(cfg->t1s7);
|
|
||||||
case Network::NetID::AE_08: return &(cfg->t1s8);
|
|
||||||
default:
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const ETHERNET10T1S_SETTINGS_EXT* getT1SSettingsExtFor(Network net) const {
|
|
||||||
auto cfg = getStructurePointer<neovifire3t1slin_settings_t>();
|
auto cfg = getStructurePointer<neovifire3t1slin_settings_t>();
|
||||||
if(cfg == nullptr)
|
if(cfg == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
switch(net.getNetID()) {
|
switch(net.getNetID()) {
|
||||||
case Network::NetID::AE_03: return &(cfg->t1s1Ext);
|
case Network::NetID::AE_01: return &(cfg->t1s1Ext);
|
||||||
case Network::NetID::AE_04: return &(cfg->t1s2Ext);
|
case Network::NetID::AE_02: return &(cfg->t1s2Ext);
|
||||||
case Network::NetID::AE_05: return &(cfg->t1s3Ext);
|
case Network::NetID::AE_03: return &(cfg->t1s3Ext);
|
||||||
case Network::NetID::AE_06: return &(cfg->t1s4Ext);
|
case Network::NetID::AE_04: return &(cfg->t1s4Ext);
|
||||||
case Network::NetID::AE_07: return &(cfg->t1s5Ext);
|
case Network::NetID::AE_05: return &(cfg->t1s5Ext);
|
||||||
case Network::NetID::AE_08: return &(cfg->t1s6Ext);
|
case Network::NetID::AE_06: return &(cfg->t1s6Ext);
|
||||||
case Network::NetID::AE_09: return &(cfg->t1s7Ext);
|
case Network::NetID::AE_07: return &(cfg->t1s7Ext);
|
||||||
case Network::NetID::AE_10: return &(cfg->t1s8Ext);
|
case Network::NetID::AE_08: return &(cfg->t1s8Ext);
|
||||||
default:
|
default: return nullptr;
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ETHERNET10T1S_SETTINGS_EXT* getMutableT1SSettingsExtFor(Network net) {
|
|
||||||
auto cfg = getMutableStructurePointer<neovifire3t1slin_settings_t>();
|
|
||||||
if(cfg == nullptr)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
switch(net.getNetID()) {
|
|
||||||
case Network::NetID::AE_03: return &(cfg->t1s1Ext);
|
|
||||||
case Network::NetID::AE_04: return &(cfg->t1s2Ext);
|
|
||||||
case Network::NetID::AE_05: return &(cfg->t1s3Ext);
|
|
||||||
case Network::NetID::AE_06: return &(cfg->t1s4Ext);
|
|
||||||
case Network::NetID::AE_07: return &(cfg->t1s5Ext);
|
|
||||||
case Network::NetID::AE_08: return &(cfg->t1s6Ext);
|
|
||||||
case Network::NetID::AE_09: return &(cfg->t1s7Ext);
|
|
||||||
case Network::NetID::AE_10: return &(cfg->t1s8Ext);
|
|
||||||
default:
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -130,133 +130,6 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<bool> isT1SPLCAEnabledFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional((t1s->flags & ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SPLCAFor(Network net, bool enable) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(enable)
|
|
||||||
t1s->flags |= ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA;
|
|
||||||
else
|
|
||||||
t1s->flags &= ~ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SLocalIDFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->local_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SLocalIDFor(Network net, uint8_t id) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->local_id = id;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SMaxNodesFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->max_num_nodes);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SMaxNodesFor(Network net, uint8_t nodes) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->max_num_nodes = nodes;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1STxOppTimerFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->to_timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1STxOppTimerFor(Network net, uint8_t timer) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->to_timer = timer;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SMaxBurstFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->max_burst_count);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SMaxBurstFor(Network net, uint8_t burst) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->max_burst_count = burst;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SBurstTimerFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->burst_timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SBurstTimerFor(Network net, uint8_t timer) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->burst_timer = timer;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<bool> isT1STerminationEnabledFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional<bool>((t1s->flags & ETHERNET10T1S_SETTINGS_FLAG_TERMINATION) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1STerminationFor(Network net, bool enable) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(enable)
|
|
||||||
t1s->flags |= ETHERNET10T1S_SETTINGS_FLAG_TERMINATION;
|
|
||||||
else
|
|
||||||
t1s->flags &= ~ETHERNET10T1S_SETTINGS_FLAG_TERMINATION;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<bool> isPerfTestEnabled() const override {
|
std::optional<bool> isPerfTestEnabled() const override {
|
||||||
auto cfg = getStructurePointer<radcomet2_settings_t>();
|
auto cfg = getStructurePointer<radcomet2_settings_t>();
|
||||||
if(cfg == nullptr)
|
if(cfg == nullptr)
|
||||||
@@ -274,32 +147,41 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
std::vector<TerminationGroup> getTerminationGroups() const override {
|
||||||
const ETHERNET10T1S_SETTINGS* getT1SSettingsFor(Network net) const {
|
return {
|
||||||
|
{ Network(Network::NetID::DWCAN_01) },
|
||||||
|
{ Network(Network::NetID::DWCAN_02) }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
ICSNEO_UNALIGNED(const uint64_t*) getTerminationEnables() const override {
|
||||||
auto cfg = getStructurePointer<radcomet2_settings_t>();
|
auto cfg = getStructurePointer<radcomet2_settings_t>();
|
||||||
if(cfg == nullptr)
|
if(cfg == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
return &cfg->termination_enables;
|
||||||
switch(net.getNetID()) {
|
|
||||||
case Network::NetID::AE_02: return &(cfg->t1s1);
|
|
||||||
case Network::NetID::AE_03: return &(cfg->t1s2);
|
|
||||||
default:
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ETHERNET10T1S_SETTINGS* getMutableT1SSettingsFor(Network net) {
|
private:
|
||||||
auto cfg = getMutableStructurePointer<radcomet2_settings_t>();
|
const ETHERNET10T1S_SETTINGS* getT1SSettingsFor(Network net) const override {
|
||||||
|
auto cfg = getStructurePointer<radcomet2_settings_t>();
|
||||||
if(cfg == nullptr)
|
if(cfg == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
switch(net.getNetID()) {
|
switch(net.getNetID()) {
|
||||||
case Network::NetID::AE_02: return &(cfg->t1s1);
|
case Network::NetID::AE_02: return &(cfg->t1s1);
|
||||||
case Network::NetID::AE_03: return &(cfg->t1s2);
|
case Network::NetID::AE_03: return &(cfg->t1s2);
|
||||||
default:
|
default: return nullptr;
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const ETHERNET10T1S_SETTINGS_EXT* getT1SSettingsExtFor(Network net) const override {
|
||||||
|
auto cfg = getStructurePointer<radcomet2_settings_t>();
|
||||||
|
if(cfg == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
switch(net.getNetID()) {
|
||||||
|
case Network::NetID::AE_02: return &(cfg->t1s1Ext);
|
||||||
|
case Network::NetID::AE_03: return &(cfg->t1s2Ext);
|
||||||
|
default: return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -165,215 +165,6 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<bool> isT1SPLCAEnabledFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional((t1s->flags & ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SPLCAFor(Network net, bool enable) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(enable)
|
|
||||||
t1s->flags |= ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA;
|
|
||||||
else
|
|
||||||
t1s->flags &= ~ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SLocalIDFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->local_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SLocalIDFor(Network net, uint8_t id) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->local_id = id;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SMaxNodesFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->max_num_nodes);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SMaxNodesFor(Network net, uint8_t nodes) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->max_num_nodes = nodes;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1STxOppTimerFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->to_timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1STxOppTimerFor(Network net, uint8_t timer) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->to_timer = timer;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SMaxBurstFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->max_burst_count);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SMaxBurstFor(Network net, uint8_t burst) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->max_burst_count = burst;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SBurstTimerFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->burst_timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SBurstTimerFor(Network net, uint8_t timer) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->burst_timer = timer;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SLocalIDAlternateFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->local_id_alternate);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SLocalIDAlternateFor(Network net, uint8_t id) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->local_id_alternate = id;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<bool> isT1SBusDecodingBeaconsEnabledFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional<bool>((t1s->flags & ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_BEACONS) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SBusDecodingBeaconsFor(Network net, bool enable) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(enable)
|
|
||||||
t1s->flags |= ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_BEACONS;
|
|
||||||
else
|
|
||||||
t1s->flags &= ~ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_BEACONS;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<bool> isT1SBusDecodingAllEnabledFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional<bool>((t1s->flags & ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_ALL) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SBusDecodingAllFor(Network net, bool enable) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(enable)
|
|
||||||
t1s->flags |= ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_ALL;
|
|
||||||
else
|
|
||||||
t1s->flags &= ~ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_ALL;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SMultiIDEnableMaskFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS_EXT* t1sExt = getT1SSettingsExtFor(net);
|
|
||||||
if(t1sExt == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1sExt->enable_multi_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SMultiIDEnableMaskFor(Network net, uint8_t mask) override {
|
|
||||||
ETHERNET10T1S_SETTINGS_EXT* t1sExt = getMutableT1SSettingsExtFor(net);
|
|
||||||
if(t1sExt == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1sExt->enable_multi_id = mask;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SMultiIDFor(Network net, uint8_t index) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS_EXT* t1sExt = getT1SSettingsExtFor(net);
|
|
||||||
if(t1sExt == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
if(index >= 7) {
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
return std::make_optional(t1sExt->multi_id[index]);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SMultiIDFor(Network net, uint8_t index, uint8_t id) override {
|
|
||||||
ETHERNET10T1S_SETTINGS_EXT* t1sExt = getMutableT1SSettingsExtFor(net);
|
|
||||||
if(t1sExt == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(index >= 7) {
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
t1sExt->multi_id[index] = id;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setPhyRoleFor(Network net, AELinkMode mode) override {
|
bool setPhyRoleFor(Network net, AELinkMode mode) override {
|
||||||
if (mode != AE_LINK_AUTO && mode != AE_LINK_MASTER && mode != AE_LINK_SLAVE) {
|
if (mode != AE_LINK_AUTO && mode != AE_LINK_MASTER && mode != AE_LINK_SLAVE) {
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
||||||
@@ -668,12 +459,26 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<TerminationGroup> getTerminationGroups() const override {
|
||||||
|
return {
|
||||||
|
{ Network(Network::NetID::DWCAN_01) },
|
||||||
|
{ Network(Network::NetID::DWCAN_02) }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
ICSNEO_UNALIGNED(const uint64_t*) getTerminationEnables() const override {
|
||||||
|
auto cfg = getStructurePointer<radcomet3_settings_t>();
|
||||||
|
if(cfg == nullptr)
|
||||||
|
return nullptr;
|
||||||
|
return &cfg->termination_enables;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const ETHERNET10T1S_SETTINGS* getT1SSettingsFor(Network net) const {
|
const ETHERNET10T1S_SETTINGS* getT1SSettingsFor(Network net) const override {
|
||||||
auto cfg = getStructurePointer<radcomet3_settings_t>();
|
auto cfg = getStructurePointer<radcomet3_settings_t>();
|
||||||
if(cfg == nullptr)
|
if(cfg == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
switch(net.getNetID()) {
|
switch(net.getNetID()) {
|
||||||
case Network::NetID::AE_02: return &(cfg->t1s1);
|
case Network::NetID::AE_02: return &(cfg->t1s1);
|
||||||
case Network::NetID::AE_03: return &(cfg->t1s2);
|
case Network::NetID::AE_03: return &(cfg->t1s2);
|
||||||
@@ -681,35 +486,14 @@ private:
|
|||||||
case Network::NetID::AE_05: return &(cfg->t1s4);
|
case Network::NetID::AE_05: return &(cfg->t1s4);
|
||||||
case Network::NetID::AE_06: return &(cfg->t1s5);
|
case Network::NetID::AE_06: return &(cfg->t1s5);
|
||||||
case Network::NetID::AE_07: return &(cfg->t1s6);
|
case Network::NetID::AE_07: return &(cfg->t1s6);
|
||||||
default:
|
default: return nullptr;
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ETHERNET10T1S_SETTINGS* getMutableT1SSettingsFor(Network net) {
|
const ETHERNET10T1S_SETTINGS_EXT* getT1SSettingsExtFor(Network net) const override {
|
||||||
auto cfg = getMutableStructurePointer<radcomet3_settings_t>();
|
|
||||||
if(cfg == nullptr)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
switch(net.getNetID()) {
|
|
||||||
case Network::NetID::AE_02: return &(cfg->t1s1);
|
|
||||||
case Network::NetID::AE_03: return &(cfg->t1s2);
|
|
||||||
case Network::NetID::AE_04: return &(cfg->t1s3);
|
|
||||||
case Network::NetID::AE_05: return &(cfg->t1s4);
|
|
||||||
case Network::NetID::AE_06: return &(cfg->t1s5);
|
|
||||||
case Network::NetID::AE_07: return &(cfg->t1s6);
|
|
||||||
default:
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const ETHERNET10T1S_SETTINGS_EXT* getT1SSettingsExtFor(Network net) const {
|
|
||||||
auto cfg = getStructurePointer<radcomet3_settings_t>();
|
auto cfg = getStructurePointer<radcomet3_settings_t>();
|
||||||
if(cfg == nullptr)
|
if(cfg == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
switch(net.getNetID()) {
|
switch(net.getNetID()) {
|
||||||
case Network::NetID::AE_02: return &(cfg->t1s1Ext);
|
case Network::NetID::AE_02: return &(cfg->t1s1Ext);
|
||||||
case Network::NetID::AE_03: return &(cfg->t1s2Ext);
|
case Network::NetID::AE_03: return &(cfg->t1s2Ext);
|
||||||
@@ -717,27 +501,7 @@ private:
|
|||||||
case Network::NetID::AE_05: return &(cfg->t1s4Ext);
|
case Network::NetID::AE_05: return &(cfg->t1s4Ext);
|
||||||
case Network::NetID::AE_06: return &(cfg->t1s5Ext);
|
case Network::NetID::AE_06: return &(cfg->t1s5Ext);
|
||||||
case Network::NetID::AE_07: return &(cfg->t1s6Ext);
|
case Network::NetID::AE_07: return &(cfg->t1s6Ext);
|
||||||
default:
|
default: return nullptr;
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ETHERNET10T1S_SETTINGS_EXT* getMutableT1SSettingsExtFor(Network net) {
|
|
||||||
auto cfg = getMutableStructurePointer<radcomet3_settings_t>();
|
|
||||||
if(cfg == nullptr)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
switch(net.getNetID()) {
|
|
||||||
case Network::NetID::AE_02: return &(cfg->t1s1Ext);
|
|
||||||
case Network::NetID::AE_03: return &(cfg->t1s2Ext);
|
|
||||||
case Network::NetID::AE_04: return &(cfg->t1s3Ext);
|
|
||||||
case Network::NetID::AE_05: return &(cfg->t1s4Ext);
|
|
||||||
case Network::NetID::AE_06: return &(cfg->t1s5Ext);
|
|
||||||
case Network::NetID::AE_07: return &(cfg->t1s6Ext);
|
|
||||||
default:
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -250,222 +250,6 @@ namespace icsneo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<bool> isT1SPLCAEnabledFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional((t1s->flags & ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SPLCAFor(Network net, bool enable) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(enable)
|
|
||||||
t1s->flags |= ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA;
|
|
||||||
else
|
|
||||||
t1s->flags &= ~ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SLocalIDFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->local_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SLocalIDFor(Network net, uint8_t id) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->local_id = id;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SMaxNodesFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->max_num_nodes);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SMaxNodesFor(Network net, uint8_t nodes) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->max_num_nodes = nodes;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1STxOppTimerFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->to_timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1STxOppTimerFor(Network net, uint8_t timer) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->to_timer = timer;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SMaxBurstFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->max_burst_count);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SMaxBurstFor(Network net, uint8_t burst) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->max_burst_count = burst;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SBurstTimerFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->burst_timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SBurstTimerFor(Network net, uint8_t timer) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->burst_timer = timer;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SLocalIDAlternateFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->local_id_alternate);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SLocalIDAlternateFor(Network net, uint8_t id) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->local_id_alternate = id;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<bool> isT1STerminationEnabledFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional<bool>((t1s->flags & ETHERNET10T1S_SETTINGS_FLAG_TERMINATION) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1STerminationFor(Network net, bool enable) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(enable)
|
|
||||||
t1s->flags |= ETHERNET10T1S_SETTINGS_FLAG_TERMINATION;
|
|
||||||
else
|
|
||||||
t1s->flags &= ~ETHERNET10T1S_SETTINGS_FLAG_TERMINATION;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<bool> isT1SBusDecodingBeaconsEnabledFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional<bool>((t1s->flags & ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_BEACONS) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SBusDecodingBeaconsFor(Network net, bool enable) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(enable)
|
|
||||||
t1s->flags |= ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_BEACONS;
|
|
||||||
else
|
|
||||||
t1s->flags &= ~ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_BEACONS;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<bool> isT1SBusDecodingAllEnabledFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional<bool>((t1s->flags & ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_ALL) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SBusDecodingAllFor(Network net, bool enable) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(enable)
|
|
||||||
t1s->flags |= ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_ALL;
|
|
||||||
else
|
|
||||||
t1s->flags &= ~ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_ALL;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SMultiIDEnableMaskFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS_EXT* t1sExt = getT1SSettingsExtFor(net);
|
|
||||||
if(t1sExt == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1sExt->enable_multi_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SMultiIDEnableMaskFor(Network net, uint8_t mask) override {
|
|
||||||
ETHERNET10T1S_SETTINGS_EXT* t1sExt = getMutableT1SSettingsExtFor(net);
|
|
||||||
if(t1sExt == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1sExt->enable_multi_id = mask;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SMultiIDFor(Network net, uint8_t index) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS_EXT* t1sExt = getT1SSettingsExtFor(net);
|
|
||||||
if(t1sExt == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
if(index >= 7) {
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
return std::make_optional(t1sExt->multi_id[index]);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setPhyEnableFor(Network net, bool enable) override {
|
bool setPhyEnableFor(Network net, bool enable) override {
|
||||||
auto cfg = getMutableStructurePointer<radgigastar2_settings_t>();
|
auto cfg = getMutableStructurePointer<radgigastar2_settings_t>();
|
||||||
if(cfg == nullptr)
|
if(cfg == nullptr)
|
||||||
@@ -524,20 +308,6 @@ namespace icsneo
|
|||||||
return GetNetworkEnabled(bitfields, 2, networkID);
|
return GetNetworkEnabled(bitfields, 2, networkID);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool setT1SMultiIDFor(Network net, uint8_t index, uint8_t id) override {
|
|
||||||
ETHERNET10T1S_SETTINGS_EXT* t1sExt = getMutableT1SSettingsExtFor(net);
|
|
||||||
if(t1sExt == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(index >= 7) {
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
t1sExt->multi_id[index] = id;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<bool> isPerfTestEnabled() const override {
|
std::optional<bool> isPerfTestEnabled() const override {
|
||||||
auto cfg = getStructurePointer<radgigastar2_settings_t>();
|
auto cfg = getStructurePointer<radgigastar2_settings_t>();
|
||||||
if(cfg == nullptr)
|
if(cfg == nullptr)
|
||||||
@@ -556,11 +326,10 @@ namespace icsneo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const ETHERNET10T1S_SETTINGS* getT1SSettingsFor(Network net) const {
|
const ETHERNET10T1S_SETTINGS* getT1SSettingsFor(Network net) const override {
|
||||||
auto cfg = getStructurePointer<radgigastar2_settings_t>();
|
auto cfg = getStructurePointer<radgigastar2_settings_t>();
|
||||||
if(cfg == nullptr)
|
if(cfg == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
switch(net.getNetID()) {
|
switch(net.getNetID()) {
|
||||||
case Network::NetID::AE_03: return &(cfg->t1s1);
|
case Network::NetID::AE_03: return &(cfg->t1s1);
|
||||||
case Network::NetID::AE_04: return &(cfg->t1s2);
|
case Network::NetID::AE_04: return &(cfg->t1s2);
|
||||||
@@ -570,37 +339,14 @@ namespace icsneo
|
|||||||
case Network::NetID::AE_08: return &(cfg->t1s6);
|
case Network::NetID::AE_08: return &(cfg->t1s6);
|
||||||
case Network::NetID::AE_09: return &(cfg->t1s7);
|
case Network::NetID::AE_09: return &(cfg->t1s7);
|
||||||
case Network::NetID::AE_10: return &(cfg->t1s8);
|
case Network::NetID::AE_10: return &(cfg->t1s8);
|
||||||
default:
|
default: return nullptr;
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ETHERNET10T1S_SETTINGS* getMutableT1SSettingsFor(Network net) {
|
const ETHERNET10T1S_SETTINGS_EXT* getT1SSettingsExtFor(Network net) const override {
|
||||||
auto cfg = getMutableStructurePointer<radgigastar2_settings_t>();
|
|
||||||
if(cfg == nullptr)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
switch(net.getNetID()) {
|
|
||||||
case Network::NetID::AE_03: return &(cfg->t1s1);
|
|
||||||
case Network::NetID::AE_04: return &(cfg->t1s2);
|
|
||||||
case Network::NetID::AE_05: return &(cfg->t1s3);
|
|
||||||
case Network::NetID::AE_06: return &(cfg->t1s4);
|
|
||||||
case Network::NetID::AE_07: return &(cfg->t1s5);
|
|
||||||
case Network::NetID::AE_08: return &(cfg->t1s6);
|
|
||||||
case Network::NetID::AE_09: return &(cfg->t1s7);
|
|
||||||
case Network::NetID::AE_10: return &(cfg->t1s8);
|
|
||||||
default:
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const ETHERNET10T1S_SETTINGS_EXT* getT1SSettingsExtFor(Network net) const {
|
|
||||||
auto cfg = getStructurePointer<radgigastar2_settings_t>();
|
auto cfg = getStructurePointer<radgigastar2_settings_t>();
|
||||||
if(cfg == nullptr)
|
if(cfg == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
switch(net.getNetID()) {
|
switch(net.getNetID()) {
|
||||||
case Network::NetID::AE_03: return &(cfg->t1s1Ext);
|
case Network::NetID::AE_03: return &(cfg->t1s1Ext);
|
||||||
case Network::NetID::AE_04: return &(cfg->t1s2Ext);
|
case Network::NetID::AE_04: return &(cfg->t1s2Ext);
|
||||||
@@ -610,29 +356,7 @@ namespace icsneo
|
|||||||
case Network::NetID::AE_08: return &(cfg->t1s6Ext);
|
case Network::NetID::AE_08: return &(cfg->t1s6Ext);
|
||||||
case Network::NetID::AE_09: return &(cfg->t1s7Ext);
|
case Network::NetID::AE_09: return &(cfg->t1s7Ext);
|
||||||
case Network::NetID::AE_10: return &(cfg->t1s8Ext);
|
case Network::NetID::AE_10: return &(cfg->t1s8Ext);
|
||||||
default:
|
default: return nullptr;
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ETHERNET10T1S_SETTINGS_EXT* getMutableT1SSettingsExtFor(Network net) {
|
|
||||||
auto cfg = getMutableStructurePointer<radgigastar2_settings_t>();
|
|
||||||
if(cfg == nullptr)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
switch(net.getNetID()) {
|
|
||||||
case Network::NetID::AE_03: return &(cfg->t1s1Ext);
|
|
||||||
case Network::NetID::AE_04: return &(cfg->t1s2Ext);
|
|
||||||
case Network::NetID::AE_05: return &(cfg->t1s3Ext);
|
|
||||||
case Network::NetID::AE_06: return &(cfg->t1s4Ext);
|
|
||||||
case Network::NetID::AE_07: return &(cfg->t1s5Ext);
|
|
||||||
case Network::NetID::AE_08: return &(cfg->t1s6Ext);
|
|
||||||
case Network::NetID::AE_09: return &(cfg->t1s7Ext);
|
|
||||||
case Network::NetID::AE_10: return &(cfg->t1s8Ext);
|
|
||||||
default:
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,112 +48,6 @@ class RADMoonT1SSettings : public IDeviceSettings {
|
|||||||
public:
|
public:
|
||||||
RADMoonT1SSettings(Device* device) : IDeviceSettings(device, sizeof(radmoont1s_settings_t)) {}
|
RADMoonT1SSettings(Device* device) : IDeviceSettings(device, sizeof(radmoont1s_settings_t)) {}
|
||||||
|
|
||||||
std::optional<bool> isT1SPLCAEnabledFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional((t1s->flags & ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SPLCAFor(Network net, bool enable) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(enable)
|
|
||||||
t1s->flags |= ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA;
|
|
||||||
else
|
|
||||||
t1s->flags &= ~ETHERNET10T1S_SETTINGS_FLAG_ENABLE_PLCA;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SLocalIDFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->local_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SLocalIDFor(Network net, uint8_t id) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->local_id = id;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SMaxNodesFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->max_num_nodes);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SMaxNodesFor(Network net, uint8_t nodes) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->max_num_nodes = nodes;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1STxOppTimerFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->to_timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1STxOppTimerFor(Network net, uint8_t timer) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->to_timer = timer;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SMaxBurstFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->max_burst_count);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SMaxBurstFor(Network net, uint8_t burst) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->max_burst_count = burst;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SBurstTimerFor(Network net) const override {
|
|
||||||
const ETHERNET10T1S_SETTINGS* t1s = getT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
return std::make_optional(t1s->burst_timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SBurstTimerFor(Network net, uint8_t timer) override {
|
|
||||||
ETHERNET10T1S_SETTINGS* t1s = getMutableT1SSettingsFor(net);
|
|
||||||
if(t1s == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
t1s->burst_timer = timer;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<bool> isPerfTestEnabled() const override {
|
std::optional<bool> isPerfTestEnabled() const override {
|
||||||
auto cfg = getStructurePointer<radmoont1s_settings_t>();
|
auto cfg = getStructurePointer<radmoont1s_settings_t>();
|
||||||
if(cfg == nullptr)
|
if(cfg == nullptr)
|
||||||
@@ -172,215 +66,26 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const ETHERNET10T1S_SETTINGS* getT1SSettingsFor(Network net) const {
|
const ETHERNET10T1S_SETTINGS* getT1SSettingsFor(Network net) const override {
|
||||||
auto cfg = getStructurePointer<radmoont1s_settings_t>();
|
auto cfg = getStructurePointer<radmoont1s_settings_t>();
|
||||||
if(cfg == nullptr)
|
if(cfg == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
switch(net.getNetID()) {
|
switch(net.getNetID()) {
|
||||||
case Network::NetID::AE_01:
|
case Network::NetID::AE_01: return &(cfg->t1s);
|
||||||
return &(cfg->t1s);
|
default: return nullptr;
|
||||||
default:
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ETHERNET10T1S_SETTINGS* getMutableT1SSettingsFor(Network net) {
|
const ETHERNET10T1S_SETTINGS_EXT* getT1SSettingsExtFor(Network net) const override {
|
||||||
auto cfg = getMutableStructurePointer<radmoont1s_settings_t>();
|
auto cfg = getStructurePointer<radmoont1s_settings_t>();
|
||||||
if(cfg == nullptr)
|
if(cfg == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
switch(net.getNetID()) {
|
switch(net.getNetID()) {
|
||||||
case Network::NetID::AE_01:
|
case Network::NetID::AE_01: return &(cfg->t1sExt);
|
||||||
return &(cfg->t1s);
|
default: return nullptr;
|
||||||
default:
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const ETHERNET10T1S_SETTINGS_EXT* getT1SSettingsExtFor(Network net) const {
|
|
||||||
auto cfg = getStructurePointer<radmoont1s_settings_t>();
|
|
||||||
if(cfg == nullptr)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
switch(net.getNetID()) {
|
|
||||||
case Network::NetID::AE_01:
|
|
||||||
return &(cfg->t1sExt);
|
|
||||||
default:
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ETHERNET10T1S_SETTINGS_EXT* getMutableT1SSettingsExtFor(Network net) {
|
|
||||||
auto cfg = getMutableStructurePointer<radmoont1s_settings_t>();
|
|
||||||
if(cfg == nullptr)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
switch(net.getNetID()) {
|
|
||||||
case Network::NetID::AE_01:
|
|
||||||
return &(cfg->t1sExt);
|
|
||||||
default:
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SLocalIDAlternateFor(Network net) const override {
|
|
||||||
auto cfg = getStructurePointer<radmoont1s_settings_t>();
|
|
||||||
if(cfg == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
if(net.getNetID() != Network::NetID::AE_01) {
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
return std::make_optional(cfg->t1s.local_id_alternate);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SLocalIDAlternateFor(Network net, uint8_t id) override {
|
|
||||||
auto cfg = getMutableStructurePointer<radmoont1s_settings_t>();
|
|
||||||
if(cfg == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(net.getNetID() != Network::NetID::AE_01) {
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg->t1s.local_id_alternate = id;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<bool> isT1SBusDecodingBeaconsEnabledFor(Network net) const override {
|
|
||||||
auto cfg = getStructurePointer<radmoont1s_settings_t>();
|
|
||||||
if(cfg == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
if(net.getNetID() != Network::NetID::AE_01) {
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
return std::make_optional<bool>((cfg->t1s.flags & ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_BEACONS) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SBusDecodingBeaconsFor(Network net, bool enable) override {
|
|
||||||
auto cfg = getMutableStructurePointer<radmoont1s_settings_t>();
|
|
||||||
if(cfg == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(net.getNetID() != Network::NetID::AE_01) {
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(enable)
|
|
||||||
cfg->t1s.flags |= ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_BEACONS;
|
|
||||||
else
|
|
||||||
cfg->t1s.flags &= ~ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_BEACONS;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<bool> isT1SBusDecodingAllEnabledFor(Network net) const override {
|
|
||||||
auto cfg = getStructurePointer<radmoont1s_settings_t>();
|
|
||||||
if(cfg == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
if(net.getNetID() != Network::NetID::AE_01) {
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
return std::make_optional<bool>((cfg->t1s.flags & ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_ALL) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SBusDecodingAllFor(Network net, bool enable) override {
|
|
||||||
auto cfg = getMutableStructurePointer<radmoont1s_settings_t>();
|
|
||||||
if(cfg == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(net.getNetID() != Network::NetID::AE_01) {
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(enable)
|
|
||||||
cfg->t1s.flags |= ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_ALL;
|
|
||||||
else
|
|
||||||
cfg->t1s.flags &= ~ETHERNET10T1S_SETTINGS_FLAG_BUS_DECODING_ALL;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SMultiIDEnableMaskFor(Network net) const override {
|
|
||||||
auto cfg = getStructurePointer<radmoont1s_settings_t>();
|
|
||||||
if(cfg == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
if(net.getNetID() != Network::NetID::AE_01) {
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
return std::make_optional(cfg->t1sExt.enable_multi_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SMultiIDEnableMaskFor(Network net, uint8_t mask) override {
|
|
||||||
auto cfg = getMutableStructurePointer<radmoont1s_settings_t>();
|
|
||||||
if(cfg == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(net.getNetID() != Network::NetID::AE_01) {
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg->t1sExt.enable_multi_id = mask;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<uint8_t> getT1SMultiIDFor(Network net, uint8_t index) const override {
|
|
||||||
auto cfg = getStructurePointer<radmoont1s_settings_t>();
|
|
||||||
if(cfg == nullptr)
|
|
||||||
return std::nullopt;
|
|
||||||
|
|
||||||
if(net.getNetID() != Network::NetID::AE_01) {
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(index >= 7) {
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
|
|
||||||
return std::make_optional(cfg->t1sExt.multi_id[index]);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setT1SMultiIDFor(Network net, uint8_t index, uint8_t id) override {
|
|
||||||
auto cfg = getMutableStructurePointer<radmoont1s_settings_t>();
|
|
||||||
if(cfg == nullptr)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(net.getNetID() != Network::NetID::AE_01) {
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(index >= 7) {
|
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg->t1sExt.multi_id[index] = id;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const RAD_GPTP_SETTINGS* getGPTPSettings() const override {
|
const RAD_GPTP_SETTINGS* getGPTPSettings() const override {
|
||||||
auto cfg = getStructurePointer<radmoont1s_settings_t>();
|
auto cfg = getStructurePointer<radmoont1s_settings_t>();
|
||||||
return cfg ? &cfg->gPTP : nullptr;
|
return cfg ? &cfg->gPTP : nullptr;
|
||||||
|
|||||||
@@ -533,26 +533,26 @@ icsneoc2_error_t icsneoc2_settings_t1s_burst_timer_get(icsneoc2_device_t* device
|
|||||||
icsneoc2_error_t icsneoc2_settings_t1s_burst_timer_set(icsneoc2_device_t* device, icsneoc2_netid_t netid, uint8_t value);
|
icsneoc2_error_t icsneoc2_settings_t1s_burst_timer_set(icsneoc2_device_t* device, icsneoc2_netid_t netid, uint8_t value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Max burst timer for a network that supports 10BASE-T1S.
|
* Get the maximum PLCA burst count for a network that supports 10BASE-T1S.
|
||||||
*
|
*
|
||||||
* @param[in] device The device to check.
|
* @param[in] device The device to check.
|
||||||
* @param[in] netid The network ID to check.
|
* @param[in] netid The network ID to check.
|
||||||
* @param[out] value Pointer to store the Max burst timer value.
|
* @param[out] value Pointer to store the maximum burst count.
|
||||||
*
|
*
|
||||||
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters otherwise.
|
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters otherwise.
|
||||||
*/
|
*/
|
||||||
icsneoc2_error_t icsneoc2_settings_t1s_max_burst_timer_for_get(icsneoc2_device_t* device, icsneoc2_netid_t netid, uint8_t* value);
|
icsneoc2_error_t icsneoc2_settings_t1s_max_burst_get(icsneoc2_device_t* device, icsneoc2_netid_t netid, uint8_t* value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Max burst timer for a network that supports 10BASE-T1S.
|
* Set the maximum PLCA burst count for a network that supports 10BASE-T1S.
|
||||||
*
|
*
|
||||||
* @param[in] device The device to configure.
|
* @param[in] device The device to configure.
|
||||||
* @param[in] netid The network ID to configure.
|
* @param[in] netid The network ID to configure.
|
||||||
* @param[in] value The Max burst timer value to set.
|
* @param[in] value The maximum burst count to set.
|
||||||
*
|
*
|
||||||
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters otherwise.
|
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters otherwise.
|
||||||
*/
|
*/
|
||||||
icsneoc2_error_t icsneoc2_settings_t1s_max_burst_timer_for_set(icsneoc2_device_t* device, icsneoc2_netid_t netid, uint8_t value);
|
icsneoc2_error_t icsneoc2_settings_t1s_max_burst_set(icsneoc2_device_t* device, icsneoc2_netid_t netid, uint8_t value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the alternate local ID for a network that supports 10BASE-T1S.
|
* Get the alternate local ID for a network that supports 10BASE-T1S.
|
||||||
|
|||||||
@@ -317,8 +317,8 @@ TEST(icsneoc2, test_icsneoc2_error_invalid_parameters_and_invalid_device)
|
|||||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_t1s_max_nodes_set(NULL, 0, placeholderInteger8));
|
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_t1s_max_nodes_set(NULL, 0, placeholderInteger8));
|
||||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_t1s_tx_opp_timer_get(NULL, 0, &placeholderInteger8));
|
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_t1s_tx_opp_timer_get(NULL, 0, &placeholderInteger8));
|
||||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_t1s_tx_opp_timer_set(NULL, 0, placeholderInteger8));
|
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_t1s_tx_opp_timer_set(NULL, 0, placeholderInteger8));
|
||||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_t1s_max_burst_timer_for_get(NULL, 0, &placeholderInteger8));
|
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_t1s_max_burst_get(NULL, 0, &placeholderInteger8));
|
||||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_t1s_max_burst_timer_for_set(NULL, 0, placeholderInteger8));
|
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_t1s_max_burst_set(NULL, 0, placeholderInteger8));
|
||||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_t1s_burst_timer_get(NULL, 0, &placeholderInteger8));
|
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_t1s_burst_timer_get(NULL, 0, &placeholderInteger8));
|
||||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_t1s_burst_timer_set(NULL, 0, placeholderInteger8));
|
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_t1s_burst_timer_set(NULL, 0, placeholderInteger8));
|
||||||
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_t1s_local_id_alternate_get(NULL, 0, &placeholderInteger8));
|
ASSERT_EQ(icsneoc2_error_invalid_parameters, icsneoc2_settings_t1s_local_id_alternate_get(NULL, 0, &placeholderInteger8));
|
||||||
|
|||||||
Reference in New Issue
Block a user