diff --git a/HARDWARE.md b/HARDWARE.md index b5bd8c4..6777f66 100644 --- a/HARDWARE.md +++ b/HARDWARE.md @@ -46,4 +46,5 @@ - CAN works - RADA2B - CAN works - - Ethernet works \ No newline at end of file + - Ethernet works + - RADMoon3 \ No newline at end of file diff --git a/api/icsneolegacy/icsneolegacy.cpp b/api/icsneolegacy/icsneolegacy.cpp index e3d3f0f..eabcaaa 100644 --- a/api/icsneolegacy/icsneolegacy.cpp +++ b/api/icsneolegacy/icsneolegacy.cpp @@ -1042,6 +1042,9 @@ int LegacyDLLExport icsneoGetDeviceSettingsType(void* hObject, EPlasmaIonVnetCha case NEODEVICE_RADGIGALOG: *pDeviceSettingsType = DeviceRADGigalogSettingsType; break; + case NEODEVICE_RADMOON3: + *pDeviceSettingsType = DeviceRADMoon3SettingsType; + break; default: return 0; } diff --git a/device/devicefinder.cpp b/device/devicefinder.cpp index 97278f1..6031c54 100644 --- a/device/devicefinder.cpp +++ b/device/devicefinder.cpp @@ -177,6 +177,10 @@ std::vector> DeviceFinder::FindAll() { makeIfSerialMatches(dev, newFoundDevices); #endif + #ifdef __RADMOON3_H_ + makeIfSerialMatches(dev, newFoundDevices); + #endif + #ifdef __RADMOONDUO_H_ makeIfSerialMatches(dev, newFoundDevices); #endif @@ -304,6 +308,10 @@ const std::vector& DeviceFinder::GetSupportedDevices() { RADMoon2::DEVICE_TYPE, #endif + #ifdef __RADMOON3_H_ + RADMoon3::DEVICE_TYPE, + #endif + #ifdef __RADMOONDUO_H_ RADMoonDuo::DEVICE_TYPE, #endif diff --git a/include/icsneo/device/devicetype.h b/include/icsneo/device/devicetype.h index ad1a34f..898e506 100644 --- a/include/icsneo/device/devicetype.h +++ b/include/icsneo/device/devicetype.h @@ -47,6 +47,7 @@ public: EtherBADGE = (0x00000016), RAD_A2B = (0x00000017), RADEpsilon = (0x00000018), + RADMoon3 = (0x00000023), RADComet = (0x00000024), FIRE3_FlexRay = (0x00000025), RED = (0x00000040), @@ -135,6 +136,8 @@ public: return "RAD-A2B"; case RADEpsilon: return "RAD-Epsilon"; + case RADMoon3: + return "RAD-Moon 3"; case RADComet: return "RAD-Comet"; case RED: @@ -233,6 +236,7 @@ private: #define ICSNEO_DEVICETYPE_ETHERBADGE ((devicetype_t)0x00000016) #define ICSNEO_DEVICETYPE_RAD_A2B ((devicetype_t)0x00000017) #define ICSNEO_DEVICETYPE_RADEPSILON ((devicetype_t)0x00000018) +#define ICSNEO_DEVICETYPE_RADMoon3 ((devicetype_t)0x00000023) #define ICSNEO_DEVICETYPE_RADCOMET ((devicetype_t)0x00000024) #define ICSNEO_DEVICETYPE_FIRE3FLEXRAY ((devicetype_t)0x00000025) #define ICSNEO_DEVICETYPE_RED ((devicetype_t)0x00000040) diff --git a/include/icsneo/device/tree/radmoon3/radmoon3.h b/include/icsneo/device/tree/radmoon3/radmoon3.h new file mode 100644 index 0000000..e56e3ad --- /dev/null +++ b/include/icsneo/device/tree/radmoon3/radmoon3.h @@ -0,0 +1,57 @@ +#ifndef __RADMOON3_H_ +#define __RADMOON3_H_ + +#ifdef __cplusplus + +#include "icsneo/device/device.h" +#include "icsneo/device/devicetype.h" +#include "icsneo/device/tree/radmoon3/radmoon3settings.h" + +namespace icsneo { + +class RADMoon3 : public Device { +public: + // Serial numbers start with R3 + // USB PID is 0x110D, standard driver is CDCACM + ICSNEO_FINDABLE_DEVICE(RADMoon3, DeviceType::RADMoon3, "R3"); + + static const std::vector& GetSupportedNetworks() { + static std::vector supportedNetworks = { + Network::NetID::Ethernet, + Network::NetID::OP_Ethernet1, + }; + return supportedNetworks; + } + + bool getEthPhyRegControlSupported() const override { return true; } + +protected: + RADMoon3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) { + initialize(makeDriver); + } + + void setupPacketizer(Packetizer& packetizer) override { + Device::setupPacketizer(packetizer); + packetizer.align16bit = true; + } + + virtual void setupEncoder(Encoder& encoder) override { + Device::setupEncoder(encoder); + encoder.supportEthPhy = true; + } + + 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 \ No newline at end of file diff --git a/include/icsneo/device/tree/radmoon3/radmoon3settings.h b/include/icsneo/device/tree/radmoon3/radmoon3settings.h new file mode 100644 index 0000000..54c4f8b --- /dev/null +++ b/include/icsneo/device/tree/radmoon3/radmoon3settings.h @@ -0,0 +1,46 @@ +#ifndef __RADMOON3SETTINGS_H_ +#define __RADMOON3SETTINGS_H_ + +#include +#include "icsneo/device/idevicesettings.h" + +#ifdef __cplusplus + +namespace icsneo { + +#endif // __cplusplus + +#pragma pack(push, 2) +typedef struct { + uint16_t perf_en; // 2 + + ETHERNET10G_SETTINGS autoEth10g; // 24 + ETHERNET10G_SETTINGS eth10g; // 24 + + uint16_t network_enables; // 2 + uint16_t network_enables_2; // 2 + uint16_t network_enabled_on_boot; // 2 + uint16_t network_enables_3; // 2 + + struct + { + uint16_t enableLatencyTest : 1; + uint16_t reserved : 15; + } flags; // 2 +} radmoon3_settings_t; +#pragma pack(pop) + +#ifdef __cplusplus + +#include + +class RADMoon3Settings : public IDeviceSettings { +public: + RADMoon3Settings(std::shared_ptr com) : IDeviceSettings(com, sizeof(radmoon3_settings_t)) {} +}; + +} + +#endif // __cplusplus + +#endif \ No newline at end of file diff --git a/include/icsneo/icsnVC40.h b/include/icsneo/icsnVC40.h index cf71821..36fe3b0 100644 --- a/include/icsneo/icsnVC40.h +++ b/include/icsneo/icsnVC40.h @@ -163,6 +163,7 @@ typedef unsigned __int64 uint64_t; //#define NEODEVICE_RADPLUTO (0x00000009) #define NEODEVICE_VCAN42_EL (0x0000000a) #define NEODEVICE_VCAN3 (0x00000010) +#define NEODEVICE_RADMOON3 (0x00000023) #define NEODEVICE_RED (0x00000040) #define NEODEVICE_ECU (0x00000080) #define NEODEVICE_IEVB (0x00000100) @@ -1971,6 +1972,7 @@ typedef enum _EDeviceSettingsType DeviceRADSuperMoonSettingsType, DeviceRADMoon2SettingsType, DeviceRADGigalogSettingsType, + DeviceRADMoon3SettingsType, // // add new settings type here // ... diff --git a/include/icsneo/platform/posix/devices.h b/include/icsneo/platform/posix/devices.h index 5ec6b74..ba278a6 100644 --- a/include/icsneo/platform/posix/devices.h +++ b/include/icsneo/platform/posix/devices.h @@ -19,6 +19,7 @@ #include "icsneo/device/tree/radjupiter/radjupiter.h" #include "icsneo/device/tree/radmars/radmars.h" #include "icsneo/device/tree/radmoon2/radmoon2.h" +#include "icsneo/device/tree/radmoon3/radmoon3.h" #include "icsneo/device/tree/radmoonduo/radmoonduo.h" #include "icsneo/device/tree/radpluto/radpluto.h" #include "icsneo/device/tree/radstar2/radstar2.h" diff --git a/include/icsneo/platform/windows/devices.h b/include/icsneo/platform/windows/devices.h index eac2653..a6cd5b7 100644 --- a/include/icsneo/platform/windows/devices.h +++ b/include/icsneo/platform/windows/devices.h @@ -19,6 +19,7 @@ #include "icsneo/device/tree/radjupiter/radjupiter.h" #include "icsneo/device/tree/radmars/radmars.h" #include "icsneo/device/tree/radmoon2/radmoon2.h" +#include "icsneo/device/tree/radmoon3/radmoon3.h" #include "icsneo/device/tree/radmoonduo/radmoonduo.h" #include "icsneo/device/tree/radpluto/radpluto.h" #include "icsneo/device/tree/radstar2/radstar2.h"