RAD-Moon3: Add initial support

pull/56/head
Bryant Jones 2023-04-20 17:14:22 +00:00
parent 83f6c611fe
commit af31aa23ad
9 changed files with 124 additions and 1 deletions

View File

@ -47,3 +47,4 @@
- RADA2B
- CAN works
- Ethernet works
- RADMoon3

View File

@ -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;
}

View File

@ -177,6 +177,10 @@ std::vector<std::shared_ptr<Device>> DeviceFinder::FindAll() {
makeIfSerialMatches<RADMoon2>(dev, newFoundDevices);
#endif
#ifdef __RADMOON3_H_
makeIfSerialMatches<RADMoon3>(dev, newFoundDevices);
#endif
#ifdef __RADMOONDUO_H_
makeIfSerialMatches<RADMoonDuo>(dev, newFoundDevices);
#endif
@ -304,6 +308,10 @@ const std::vector<DeviceType>& DeviceFinder::GetSupportedDevices() {
RADMoon2::DEVICE_TYPE,
#endif
#ifdef __RADMOON3_H_
RADMoon3::DEVICE_TYPE,
#endif
#ifdef __RADMOONDUO_H_
RADMoonDuo::DEVICE_TYPE,
#endif

View File

@ -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)

View File

@ -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<Network>& GetSupportedNetworks() {
static std::vector<Network> 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<RADMoon3Settings>(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<Network>& 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<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
};
}
#endif // __cplusplus
#endif

View File

@ -0,0 +1,46 @@
#ifndef __RADMOON3SETTINGS_H_
#define __RADMOON3SETTINGS_H_
#include <stdint.h>
#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 <iostream>
class RADMoon3Settings : public IDeviceSettings {
public:
RADMoon3Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radmoon3_settings_t)) {}
};
}
#endif // __cplusplus
#endif

View File

@ -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
// ...

View File

@ -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"

View File

@ -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"