diff --git a/HARDWARE.md b/HARDWARE.md index e5a1c33..ee0d5bf 100644 --- a/HARDWARE.md +++ b/HARDWARE.md @@ -58,3 +58,5 @@ - RADComet3 - CAN works - Ethernet works + - RADMoonT1S + - Ethernet works diff --git a/device/devicefinder.cpp b/device/devicefinder.cpp index bb11b46..c02dc85 100644 --- a/device/devicefinder.cpp +++ b/device/devicefinder.cpp @@ -185,6 +185,10 @@ std::vector> DeviceFinder::FindAll() { makeIfSerialMatches(dev, newFoundDevices); #endif + #ifdef __RADMOONT1S_H_ + makeIfSerialMatches(dev, newFoundDevices); + #endif + #ifdef __RADEPSILON_H_ makeIfSerialMatches(dev, newFoundDevices); #endif @@ -332,6 +336,10 @@ const std::vector& DeviceFinder::GetSupportedDevices() { RADComet3::DEVICE_TYPE, #endif + #ifdef __RADMOONT1S_H_ + RADMoonT1S::DEVICE_TYPE, + #endif + #ifdef __RADEPSILON_H_ RADEpsilon::DEVICE_TYPE, #endif diff --git a/include/icsneo/device/devicetype.h b/include/icsneo/device/devicetype.h index a02cdc8..3e68df9 100644 --- a/include/icsneo/device/devicetype.h +++ b/include/icsneo/device/devicetype.h @@ -52,6 +52,7 @@ public: FIRE3_FlexRay = (0x00000025), Connect = (0x00000026), RADComet3 = (0x00000027), + RADMoonT1S = (0x00000028), RED = (0x00000040), ECU = (0x00000080), IEVB = (0x00000100), @@ -190,6 +191,8 @@ public: return "neoVI FIRE3 FlexRay"; case RADComet3: return "RAD-Comet 3"; + case RADMoonT1S: + return "RAD-Moon T1S"; case Connect: return "neoVI Connect"; case DONT_REUSE0: @@ -247,6 +250,7 @@ private: #define ICSNEO_DEVICETYPE_FIRE3FLEXRAY ((devicetype_t)0x00000025) #define ICSNEO_DEVICETYPE_CONNECT ((devicetype_t)0x00000026) #define ICSNEO_DEVICETYPE_RADCOMET3 ((devicetype_t)0x00000027) +#define ICSNEO_DEVICETYPE_RADMOONT1S ((devicetype_t)0x00000028) #define ICSNEO_DEVICETYPE_RED ((devicetype_t)0x00000040) #define ICSNEO_DEVICETYPE_ECU ((devicetype_t)0x00000080) #define ICSNEO_DEVICETYPE_IEVB ((devicetype_t)0x00000100) diff --git a/include/icsneo/device/tree/radmoont1s/radmoont1s.h b/include/icsneo/device/tree/radmoont1s/radmoont1s.h new file mode 100644 index 0000000..cf17294 --- /dev/null +++ b/include/icsneo/device/tree/radmoont1s/radmoont1s.h @@ -0,0 +1,73 @@ +#ifndef __RADMOONT1S_H_ +#define __RADMOONT1S_H_ + +#ifdef __cplusplus + +#include "icsneo/device/device.h" +#include "icsneo/device/tree/radmoont1s/radmoont1ssettings.h" + +namespace icsneo { + +class RADMoonT1S : public Device { +public: + + // Serial numbers start with MS + // USB PID is 0x1209, standard driver is FTDI3 + // Ethernet MAC allocation is 0x21, standard driver is Raw + ICSNEO_FINDABLE_DEVICE(RADMoonT1S, DeviceType::RADMoonT1S, "MS"); + + static const std::vector& GetSupportedNetworks() { + static std::vector supportedNetworks = { + Network::NetID::Ethernet, + + Network::NetID::OP_Ethernet1, + + Network::NetID::MDIO1, + + Network::NetID::SPI1, + }; + return supportedNetworks; + } + + + bool getEthPhyRegControlSupported() const override { return true; } + + bool supportsTC10() const override { return true; } + +protected: + RADMoonT1S(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) { + initialize(makeDriver); + } + + void setupPacketizer(Packetizer& packetizer) override { + Device::setupPacketizer(packetizer); + packetizer.disableChecksum = true; + packetizer.align16bit = false; + } + + void setupEncoder(Encoder& encoder) override { + Device::setupEncoder(encoder); + encoder.supportEthPhy = true; + } + + void setupDecoder(Decoder& decoder) override { + Device::setupDecoder(decoder); + decoder.timestampResolution = 10; // Timestamps are in 10ns increments instead of the usual 25ns + } + + void setupSupportedRXNetworks(std::vector& rxNetworks) override { + for(auto& netid : GetSupportedNetworks()) + rxNetworks.emplace_back(netid); + } + + // The supported TX networks are the same as the supported RX networks for this device + void setupSupportedTXNetworks(std::vector& txNetworks) override { + setupSupportedRXNetworks(txNetworks); + } +}; + +} + +#endif // __cplusplus + +#endif // __RADMOONT1S_H_ diff --git a/include/icsneo/device/tree/radmoont1s/radmoont1ssettings.h b/include/icsneo/device/tree/radmoont1s/radmoont1ssettings.h new file mode 100644 index 0000000..455b2af --- /dev/null +++ b/include/icsneo/device/tree/radmoont1s/radmoont1ssettings.h @@ -0,0 +1,51 @@ +#ifndef __RADMOONT1SSETTINGS_H_ +#define __RADMOONT1SSETTINGS_H_ + +#include +#include "icsneo/device/idevicesettings.h" + +#ifdef __cplusplus + +namespace icsneo { + +#endif + +#pragma pack(push, 2) +typedef struct { + uint16_t perf_en; + struct + { + uint16_t hwComLatencyTestEn : 1; + uint16_t disableUsbCheckOnBoot : 1; + uint16_t reserved : 14; + } flags; + uint16_t network_enabled_on_boot; + uint64_t network_enables; + uint64_t network_enables_2; + RAD_REPORTING_SETTINGS reporting; + uint32_t pwr_man_timeout; + uint16_t pwr_man_enable; + // Ethernet 10/100/1000 + ETHERNET_SETTINGS2 ethernet; + // Ethernet General + OP_ETH_GENERAL_SETTINGS opEthGen; + // 10T1S + ETHERNET_SETTINGS2 ethT1s; + ETHERNET10T1S_SETTINGS t1s; +} radmoont1s_settings_t; +#pragma pack(pop) + +#ifdef __cplusplus + +#include + +class RADMoonT1SSettings : public IDeviceSettings { +public: + RADMoonT1SSettings(std::shared_ptr com) : IDeviceSettings(com, sizeof(radmoont1s_settings_t)) {} +}; + +} + +#endif // __cplusplus + +#endif // __RADMOONT1SSETTINGS_H_ diff --git a/include/icsneo/platform/posix/devices.h b/include/icsneo/platform/posix/devices.h index 54ec9bf..20fae50 100644 --- a/include/icsneo/platform/posix/devices.h +++ b/include/icsneo/platform/posix/devices.h @@ -16,6 +16,7 @@ #include "icsneo/device/tree/radcomet/radcomet.h" #include "icsneo/device/tree/radcomet/radcomet2.h" #include "icsneo/device/tree/radcomet3/radcomet3.h" +#include "icsneo/device/tree/radmoont1s/radmoont1s.h" #include "icsneo/device/tree/radepsilon/radepsilon.h" #include "icsneo/device/tree/radgalaxy/radgalaxy.h" #include "icsneo/device/tree/radgigastar/radgigastar.h" diff --git a/include/icsneo/platform/windows/devices.h b/include/icsneo/platform/windows/devices.h index a00ee3c..2542db2 100644 --- a/include/icsneo/platform/windows/devices.h +++ b/include/icsneo/platform/windows/devices.h @@ -16,6 +16,7 @@ #include "icsneo/device/tree/radcomet/radcomet.h" #include "icsneo/device/tree/radcomet/radcomet2.h" #include "icsneo/device/tree/radcomet3/radcomet3.h" +#include "icsneo/device/tree/radmoont1s/radmoont1s.h" #include "icsneo/device/tree/radepsilon/radepsilon.h" #include "icsneo/device/tree/radgalaxy/radgalaxy.h" #include "icsneo/device/tree/radgigastar/radgigastar.h"