From f9ff4049f22c84110f9c34d90369c317b8e7853f Mon Sep 17 00:00:00 2001 From: Kyle Schwarz Date: Fri, 7 Aug 2020 17:13:08 -0400 Subject: [PATCH] Add initial support for RADPluto settings --- .../icsneo/device/tree/radpluto/radpluto.h | 1 + .../device/tree/radpluto/radplutosettings.h | 109 ++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 include/icsneo/device/tree/radpluto/radplutosettings.h diff --git a/include/icsneo/device/tree/radpluto/radpluto.h b/include/icsneo/device/tree/radpluto/radpluto.h index f0fc330..088eb4d 100644 --- a/include/icsneo/device/tree/radpluto/radpluto.h +++ b/include/icsneo/device/tree/radpluto/radpluto.h @@ -5,6 +5,7 @@ #include "icsneo/device/devicetype.h" #include "icsneo/communication/packetizer.h" #include "icsneo/communication/decoder.h" +#include "icsneo/device/tree/radpluto/radplutosettings.h" namespace icsneo { diff --git a/include/icsneo/device/tree/radpluto/radplutosettings.h b/include/icsneo/device/tree/radpluto/radplutosettings.h new file mode 100644 index 0000000..93f8630 --- /dev/null +++ b/include/icsneo/device/tree/radpluto/radplutosettings.h @@ -0,0 +1,109 @@ +#ifndef __RADSTAR2SETTINGS_H_ +#define __RADSTAR2SETTINGS_H_ + +#include +#include "icsneo/device/idevicesettings.h" + +#ifdef __cplusplus + +namespace icsneo { + +#endif + +#define PLUTO_MAX_MAC_CONFIG_ENTRIES 5 + +#pragma pack(push, 2) +typedef struct { + /* Performance Test */ + uint16_t perf_en; + + CAN_SETTINGS can1; + CANFD_SETTINGS canfd1; + CAN_SETTINGS can2; + CANFD_SETTINGS canfd2; + LIN_SETTINGS lin1; + + uint16_t network_enables; + uint16_t network_enables_2; + uint16_t network_enables_3; + uint64_t termination_enables; + uint16_t misc_io_analog_enable; + + uint32_t pwr_man_timeout; + uint16_t pwr_man_enable; + + uint16_t network_enabled_on_boot; + + /* ISO15765-2 Transport Layer */ + int16_t iso15765_separation_time_offset; + uint16_t iso9141_kwp_enable_reserved; + uint16_t iso_tester_pullup_enable; + uint16_t iso_parity; + uint16_t iso_msg_termination; + ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings; + ETHERNET_SETTINGS ethernet; + + STextAPISettings text_api; + struct + { + uint32_t disableUsbCheckOnBoot : 1; + uint32_t enableLatencyTest : 1; + uint32_t enablePcEthernetComm : 1; + uint32_t reserved : 29; + } flags; + + struct + { + uint8_t mode[PLUTO_MAX_MAC_CONFIG_ENTRIES]; + uint8_t speed[PLUTO_MAX_MAC_CONFIG_ENTRIES]; + uint8_t enablePhy[PLUTO_MAX_MAC_CONFIG_ENTRIES]; + uint8_t ae1Select; + uint8_t usbSelect; + uint8_t pad; + } custom; +} radpluto_settings_t; +#pragma pack(pop) + +#ifdef __cplusplus + +#include + +class RADPlutoSettings : public IDeviceSettings { +public: + RADPlutoSettings(std::shared_ptr com) : IDeviceSettings(com, sizeof(radpluto_settings_t)) { + disableGSChecksumming = true; + } + + const CAN_SETTINGS* getCANSettingsFor(Network net) const override { + auto cfg = getStructurePointer(); + if(cfg == nullptr) + return nullptr; + switch(net.getNetID()) { + case Network::NetID::HSCAN: + return &(cfg->can1); + case Network::NetID::MSCAN: + return &(cfg->can2); + default: + return nullptr; + } + } + const CANFD_SETTINGS* getCANFDSettingsFor(Network net) const override { + auto cfg = getStructurePointer(); + if(cfg == nullptr) + return nullptr; + switch(net.getNetID()) { + case Network::NetID::HSCAN: + return &(cfg->canfd1); + case Network::NetID::MSCAN: + return &(cfg->canfd2); + default: + return nullptr; + } + } +}; + +} + +#endif // __cplusplus + +#endif \ No newline at end of file