mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 09:28:40 +02:00
Settings: Add Linux options
This commit is contained in:
committed by
Kyle Schwarz
parent
299766403f
commit
54fb89b675
@@ -773,6 +773,13 @@ enum class MiscIOAnalogVoltage : uint8_t
|
||||
V5 = icsneoc2_misc_io_analog_voltage_v5
|
||||
};
|
||||
|
||||
// Selects which Ethernet port(s) are reserved for the Linux configuration interface.
|
||||
enum class LinuxConfigurationPort : icsneoc2_linux_configuration_port_t
|
||||
{
|
||||
USB = icsneoc2_linux_configuration_port_usb, // Linux configuration interface accessed over USB (default)
|
||||
ETH01 = icsneoc2_linux_configuration_port_eth01 // ETH 01 reserved for Linux configuration
|
||||
};
|
||||
|
||||
class IDeviceSettings {
|
||||
public:
|
||||
using TerminationGroup = std::vector<Network>;
|
||||
@@ -1302,6 +1309,20 @@ public:
|
||||
virtual const RAD_GPTP_SETTINGS* getGPTPSettings() const { return nullptr; }
|
||||
virtual RAD_GPTP_SETTINGS* getMutableGPTPSettings() { return nullptr; }
|
||||
|
||||
/* Linux operating-system settings (Fire3 family devices) */
|
||||
|
||||
// Whether the device is allowed to boot its Linux operating system.
|
||||
std::optional<bool> getLinuxBootEnabled();
|
||||
bool setLinuxBootEnabled(bool enabled);
|
||||
|
||||
// Whether the external WiFi antenna is used (true) instead of the internal antenna (false).
|
||||
std::optional<bool> getExternalWifiAntennaEnabled();
|
||||
bool setExternalWifiAntennaEnabled(bool enabled);
|
||||
|
||||
// Which Ethernet port(s) are reserved for the Linux configuration interface.
|
||||
std::optional<LinuxConfigurationPort> getLinuxConfigurationPort();
|
||||
bool setLinuxConfigurationPort(LinuxConfigurationPort port);
|
||||
|
||||
const void* getRawStructurePointer() const { return settingsInDeviceRAM.data(); }
|
||||
void* getMutableRawStructurePointer() { return settings.data(); }
|
||||
template<typename T> const T* getStructurePointer() const { return reinterpret_cast<const T*>(getRawStructurePointer()); }
|
||||
@@ -1334,6 +1355,12 @@ protected:
|
||||
IDeviceSettings(warn_t createInoperableSettings, std::shared_ptr<Communication> com)
|
||||
: disabled(true), readonly(true), report(com->report), structSize(0) { (void)createInoperableSettings; }
|
||||
|
||||
// Devices that embed a Fire3LinuxSettings block in their settings structure override these to
|
||||
// expose it; all other devices report not-available (nullptr / nullopt) and the Linux accessors
|
||||
// report not-available in turn.
|
||||
virtual const Fire3LinuxSettings* getLinuxSettings() const { return nullptr; }
|
||||
virtual std::optional<Fire3LinuxSettings*> getMutableLinuxSettings() { return std::nullopt; }
|
||||
|
||||
virtual ICSNEO_UNALIGNED(const uint64_t*) getTerminationEnables() const { return nullptr; }
|
||||
virtual ICSNEO_UNALIGNED(uint64_t*) getMutableTerminationEnables() {
|
||||
if(disabled || readonly)
|
||||
|
||||
@@ -89,6 +89,16 @@ static_assert(sizeof(neoviconnect_settings_t) == 628, "NeoVIConnect settings siz
|
||||
class NeoVIConnectSettings : public IDeviceSettings {
|
||||
public:
|
||||
NeoVIConnectSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(neoviconnect_settings_t)) {}
|
||||
const Fire3LinuxSettings* getLinuxSettings() const override {
|
||||
auto cfg = getStructurePointer<neoviconnect_settings_t>();
|
||||
return cfg ? &cfg->os_settings : nullptr;
|
||||
}
|
||||
std::optional<Fire3LinuxSettings*> getMutableLinuxSettings() override {
|
||||
auto cfg = getMutableStructurePointer<neoviconnect_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return std::nullopt;
|
||||
return &cfg->os_settings;
|
||||
}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<neoviconnect_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -167,6 +167,16 @@ static_assert(sizeof(neovifire3_settings_t) == 1722, "NeoVIFire3 settings size m
|
||||
class NeoVIFIRE3Settings : public IDeviceSettings {
|
||||
public:
|
||||
NeoVIFIRE3Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(neovifire3_settings_t)) {}
|
||||
const Fire3LinuxSettings* getLinuxSettings() const override {
|
||||
auto cfg = getStructurePointer<neovifire3_settings_t>();
|
||||
return cfg ? &cfg->os_settings : nullptr;
|
||||
}
|
||||
std::optional<Fire3LinuxSettings*> getMutableLinuxSettings() override {
|
||||
auto cfg = getMutableStructurePointer<neovifire3_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return std::nullopt;
|
||||
return &cfg->os_settings;
|
||||
}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<neovifire3_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -150,6 +150,16 @@ static_assert(sizeof(neovifire3flexray_settings_t) == 1372, "NeoVIFire3Flexray s
|
||||
class NeoVIFIRE3FlexRaySettings : public IDeviceSettings {
|
||||
public:
|
||||
NeoVIFIRE3FlexRaySettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(neovifire3flexray_settings_t)) {}
|
||||
const Fire3LinuxSettings* getLinuxSettings() const override {
|
||||
auto cfg = getStructurePointer<neovifire3flexray_settings_t>();
|
||||
return cfg ? &cfg->os_settings : nullptr;
|
||||
}
|
||||
std::optional<Fire3LinuxSettings*> getMutableLinuxSettings() override {
|
||||
auto cfg = getMutableStructurePointer<neovifire3flexray_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return std::nullopt;
|
||||
return &cfg->os_settings;
|
||||
}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<neovifire3flexray_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -159,6 +159,16 @@ static_assert(sizeof(neovifire3t1slin_settings_t) == 1594, "NeoVIFire3T1SLIN set
|
||||
class NeoVIFIRE3T1SLINSettings : public IDeviceSettings {
|
||||
public:
|
||||
NeoVIFIRE3T1SLINSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(neovifire3t1slin_settings_t)) {}
|
||||
const Fire3LinuxSettings* getLinuxSettings() const override {
|
||||
auto cfg = getStructurePointer<neovifire3t1slin_settings_t>();
|
||||
return cfg ? &cfg->os_settings : nullptr;
|
||||
}
|
||||
std::optional<Fire3LinuxSettings*> getMutableLinuxSettings() override {
|
||||
auto cfg = getMutableStructurePointer<neovifire3t1slin_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return std::nullopt;
|
||||
return &cfg->os_settings;
|
||||
}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<neovifire3t1slin_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -112,6 +112,16 @@ static_assert(sizeof(neovired2_settings_t) == 918, "NeoVIRED2 settings size mism
|
||||
class NeoVIRED2Settings : public IDeviceSettings {
|
||||
public:
|
||||
NeoVIRED2Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(neovired2_settings_t)) {}
|
||||
const Fire3LinuxSettings* getLinuxSettings() const override {
|
||||
auto cfg = getStructurePointer<neovired2_settings_t>();
|
||||
return cfg ? &cfg->os_settings : nullptr;
|
||||
}
|
||||
std::optional<Fire3LinuxSettings*> getMutableLinuxSettings() override {
|
||||
auto cfg = getMutableStructurePointer<neovired2_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return std::nullopt;
|
||||
return &cfg->os_settings;
|
||||
}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<neovired2_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -656,6 +656,66 @@ icsneoc2_error_t icsneoc2_settings_misc_io_analog_output_enabled_set(icsneoc2_de
|
||||
*/
|
||||
icsneoc2_error_t icsneoc2_settings_misc_io_analog_output_set(icsneoc2_device_t* device, uint8_t pin, icsneoc2_misc_io_analog_voltage_t value);
|
||||
|
||||
/**
|
||||
* Get whether the device is allowed to boot its Linux operating system (Fire3 family devices).
|
||||
*
|
||||
* @param[in] device The device to query.
|
||||
* @param[out] value Pointer to a bool to copy the value into.
|
||||
*
|
||||
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters or icsneoc2_error_get_settings_failure otherwise.
|
||||
*/
|
||||
icsneoc2_error_t icsneoc2_settings_linux_boot_enabled_get(icsneoc2_device_t* device, bool* value);
|
||||
|
||||
/**
|
||||
* Set whether the device is allowed to boot its Linux operating system (Fire3 family devices).
|
||||
*
|
||||
* @param[in] device The device to configure.
|
||||
* @param[in] value true to allow Linux to boot, false to prevent it.
|
||||
*
|
||||
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters or icsneoc2_error_set_settings_failure otherwise.
|
||||
*/
|
||||
icsneoc2_error_t icsneoc2_settings_linux_boot_enabled_set(icsneoc2_device_t* device, bool value);
|
||||
|
||||
/**
|
||||
* Get whether the external WiFi antenna is used instead of the internal antenna (Fire3 family devices).
|
||||
*
|
||||
* @param[in] device The device to query.
|
||||
* @param[out] value Pointer to a bool to copy the value into (true for external, false for internal).
|
||||
*
|
||||
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters or icsneoc2_error_get_settings_failure otherwise.
|
||||
*/
|
||||
icsneoc2_error_t icsneoc2_settings_external_wifi_antenna_enabled_get(icsneoc2_device_t* device, bool* value);
|
||||
|
||||
/**
|
||||
* Set whether the external WiFi antenna is used instead of the internal antenna (Fire3 family devices).
|
||||
*
|
||||
* @param[in] device The device to configure.
|
||||
* @param[in] value true to use the external antenna, false to use the internal antenna.
|
||||
*
|
||||
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters or icsneoc2_error_set_settings_failure otherwise.
|
||||
*/
|
||||
icsneoc2_error_t icsneoc2_settings_external_wifi_antenna_enabled_set(icsneoc2_device_t* device, bool value);
|
||||
|
||||
/**
|
||||
* Get which Ethernet port(s) are reserved for the Linux configuration interface (Fire3 family devices).
|
||||
*
|
||||
* @param[in] device The device to query.
|
||||
* @param[out] value Pointer to a icsneoc2_linux_configuration_port_t to copy the value into.
|
||||
*
|
||||
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters or icsneoc2_error_get_settings_failure otherwise.
|
||||
*/
|
||||
icsneoc2_error_t icsneoc2_settings_linux_configuration_port_get(icsneoc2_device_t* device, icsneoc2_linux_configuration_port_t* value);
|
||||
|
||||
/**
|
||||
* Set which Ethernet port(s) are reserved for the Linux configuration interface (Fire3 family devices).
|
||||
*
|
||||
* @param[in] device The device to configure.
|
||||
* @param[in] value The configuration port selection to set.
|
||||
*
|
||||
* @return icsneoc2_error_t icsneoc2_error_success if successful, icsneoc2_error_invalid_parameters or icsneoc2_error_set_settings_failure otherwise.
|
||||
*/
|
||||
icsneoc2_error_t icsneoc2_settings_linux_configuration_port_set(icsneoc2_device_t* device, icsneoc2_linux_configuration_port_t value);
|
||||
|
||||
/**
|
||||
* Check if settings are disabled.
|
||||
*
|
||||
|
||||
@@ -387,6 +387,16 @@ typedef struct icsneoc2_gptp_status_t {
|
||||
uint8_t short_format; // Non-zero if firmware returned a partial response
|
||||
} icsneoc2_gptp_status_t;
|
||||
|
||||
typedef enum _icsneoc2_linux_configuration_port_t {
|
||||
icsneoc2_linux_configuration_port_usb = 0, // Linux configuration interface accessed over USB (default)
|
||||
icsneoc2_linux_configuration_port_eth01 = 1, // ETH 01 reserved for the Linux configuration interface
|
||||
|
||||
// Must be last entry. Don't use as a configuration port.
|
||||
icsneoc2_linux_configuration_port_maxsize
|
||||
} _icsneoc2_linux_configuration_port_t;
|
||||
|
||||
typedef uint32_t icsneoc2_linux_configuration_port_t;
|
||||
|
||||
typedef struct icsneoc2_disk_details_t icsneoc2_disk_details_t;
|
||||
|
||||
typedef enum _icsneoc2_disk_layout_t {
|
||||
|
||||
Reference in New Issue
Block a user