Device: Add RAD-EpsilonXL

pull/64/merge
Jonathan Schwartz 2025-03-25 20:43:18 +00:00 committed by Kyle Schwarz
parent e1a0ca056a
commit 52e98af9fd
9 changed files with 213 additions and 1 deletions

View File

@ -23,6 +23,8 @@ each of the respective APIs.
- RAD-A2B
- RAD-Comet 2
- RAD-Comet 3
- RAD-Epsilon
- RAD-EpsilonXL
- RAD-Galaxy
- RAD-Galaxy 2
- RAD-Gigastar

View File

@ -33,6 +33,7 @@ void init_devicetype(pybind11::module_& m) {
.value("EtherBADGE", DeviceType::Enum::EtherBADGE)
.value("RAD_A2B", DeviceType::Enum::RAD_A2B)
.value("RADEpsilon", DeviceType::Enum::RADEpsilon)
.value("RADEpsilonXL", DeviceType::Enum::RADEpsilonXL)
.value("RADGalaxy2", DeviceType::Enum::RADGalaxy2)
.value("RADMoon3", DeviceType::Enum::RADMoon3)
.value("RADComet", DeviceType::Enum::RADComet)

View File

@ -193,6 +193,10 @@ std::vector<std::shared_ptr<Device>> DeviceFinder::FindAll() {
makeIfSerialMatches<RADEpsilon>(dev, newFoundDevices);
#endif
#ifdef __RADEPSILONXL_H_
makeIfSerialMatches<RADEpsilonXL>(dev, newFoundDevices);
#endif
#ifdef __RADGALAXY_H_
makeIfSerialMatches<RADGalaxy>(dev, newFoundDevices);
#endif
@ -352,6 +356,10 @@ const std::vector<DeviceType>& DeviceFinder::GetSupportedDevices() {
RADEpsilon::DEVICE_TYPE,
#endif
#ifdef __RADEPSILONXL_H_
RADEpsilonXL::DEVICE_TYPE,
#endif
#ifdef __RADGALAXY_H_
RADGalaxy::DEVICE_TYPE,
#endif

View File

@ -47,6 +47,7 @@ public:
EtherBADGE = (0x00000016),
RAD_A2B = (0x00000017),
RADEpsilon = (0x00000018),
RADEpsilonXL = (0x0000001e),
RADGalaxy2 = (0x00000021),
RADMoon3 = (0x00000023),
RADComet = (0x00000024),
@ -141,6 +142,8 @@ public:
return "RAD-A2B";
case RADEpsilon:
return "RAD-Epsilon";
case RADEpsilonXL:
return "RAD-EpsilonXL";
case RADMoon3:
return "RAD-Moon 3";
case RADComet:
@ -251,6 +254,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_RADEPSILONXL ((devicetype_t)0x0000001e)
#define ICSNEO_DEVICETYPE_RADGALAXY2 ((devicetype_t)0x00000021)
#define ICSNEO_DEVICETYPE_RADMoon3 ((devicetype_t)0x00000023)
#define ICSNEO_DEVICETYPE_RADCOMET ((devicetype_t)0x00000024)

View File

@ -3,6 +3,7 @@
#include "icsneo/device/device.h"
#include "icsneo/device/devicetype.h"
#include "icsneo/device/tree/radepsilon/radepsilonsettings.h"
namespace icsneo {
@ -28,7 +29,7 @@ public:
protected:
RADEpsilon(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
initialize(makeDriver);
initialize<RADEpsilonSettings, Disk::NeoMemoryDiskDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
}
virtual void setupEncoder(Encoder& encoder) override {

View File

@ -0,0 +1,131 @@
#ifndef __RADEPSILONSETTINGS_H_
#define __RADEPSILONSETTINGS_H_
#include <stdint.h>
#include "icsneo/device/idevicesettings.h"
#include "icsneo/communication/network.h"
#ifdef __cplusplus
namespace icsneo {
#endif
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4201) // nameless struct/union
#endif
#pragma pack(push, 2)
#define RADEPSILON_MAX_PHY 18
typedef struct {
uint8_t phyMode[RADEPSILON_MAX_PHY];
uint8_t enablePhy[RADEPSILON_MAX_PHY];
uint8_t speed[RADEPSILON_MAX_PHY];
uint8_t legacy[RADEPSILON_MAX_PHY];
uint8_t spoofedMac[6];
uint8_t spoofMacFlag;
uint8_t pad;
} radepsilon_switch_settings_t;
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[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;
radepsilon_switch_settings_t switchSettings;
ETHERNET_SETTINGS2 ethernet2;
uint16_t misc_io_on_report_events;
DISK_SETTINGS disk;
} radepsilon_settings_t;
#pragma pack(pop)
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#ifdef __cplusplus
#include <iostream>
class RADEpsilonSettings : public IDeviceSettings {
public:
RADEpsilonSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radepsilon_settings_t)) {}
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
auto cfg = getStructurePointer<radepsilon_settings_t>();
if(cfg == nullptr)
return nullptr;
switch(net.getNetID()) {
case Network::NetID::HSCAN:
return &(cfg->can1);
case Network::NetID::HSCAN2:
return &(cfg->can2);
default:
return nullptr;
}
}
const CANFD_SETTINGS* getCANFDSettingsFor(Network net) const override {
auto cfg = getStructurePointer<radepsilon_settings_t>();
if(cfg == nullptr)
return nullptr;
switch(net.getNetID()) {
case Network::NetID::HSCAN:
return &(cfg->canfd1);
case Network::NetID::HSCAN2:
return &(cfg->canfd2);
default:
return nullptr;
}
}
const LIN_SETTINGS* getLINSettingsFor(Network net) const override {
auto cfg = getStructurePointer<radepsilon_settings_t>();
if(cfg == nullptr)
return nullptr;
switch(net.getNetID()) {
case Network::NetID::LIN:
return &(cfg->lin1);
default:
return nullptr;
}
}
};
}; // namespace icsneo
#endif // __cplusplus
#endif // __RADEPSILONSETTINGS_H_

View File

@ -0,0 +1,63 @@
#ifndef __RADEPSILONXL_H_
#define __RADEPSILONXL_H_
#include "icsneo/device/device.h"
#include "icsneo/device/devicetype.h"
#include "icsneo/device/tree/radepsilon/radepsilonsettings.h" // Shared settings with RADEpsilon
namespace icsneo {
class RADEpsilonXL : public Device {
public:
// Serial numbers start with PX
// USB PID is 0x1109, standard driver is CDCACM
ICSNEO_FINDABLE_DEVICE(RADEpsilonXL, DeviceType::RADEpsilonXL, "PX");
static const std::vector<Network>& GetSupportedNetworks() {
static std::vector<Network> supportedNetworks = {
Network::NetID::HSCAN,
Network::NetID::HSCAN2,
Network::NetID::Ethernet, // Connected to port 6 on the switch
Network::NetID::LIN
};
return supportedNetworks;
}
bool supportsComponentVersions() const override { return true; }
protected:
RADEpsilonXL(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
initialize<RADEpsilonSettings, Disk::NeoMemoryDiskDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
}
virtual void setupEncoder(Encoder& encoder) override {
Device::setupEncoder(encoder);
encoder.supportCANFD = 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); }
std::optional<MemoryAddress> getCoreminiStartAddressFlash() const override {
return 14*1024*1024;
}
std::optional<MemoryAddress> getCoreminiStartAddressSD() const override {
return 0;
}
bool supportsEraseMemory() const override {
return true;
}
};
}; // namespace icsneo
#endif // __RADEPSILONXL_H_

View File

@ -18,6 +18,7 @@
#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/radepsilonxl/radepsilonxl.h"
#include "icsneo/device/tree/radgalaxy/radgalaxy.h"
#include "icsneo/device/tree/radgalaxy2/radgalaxy2.h"
#include "icsneo/device/tree/radgigastar/radgigastar.h"

View File

@ -18,6 +18,7 @@
#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/radepsilonxl/radepsilonxl.h"
#include "icsneo/device/tree/radgalaxy/radgalaxy.h"
#include "icsneo/device/tree/radgalaxy2/radgalaxy2.h"
#include "icsneo/device/tree/radgigastar/radgigastar.h"