mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 09:28:40 +02:00
Device: Add RAD-Comet2 support
This commit is contained in:
@@ -59,6 +59,13 @@
|
||||
#define ICSNEO_FINDABLE_DEVICE_BY_PID(className, type, pid) \
|
||||
static constexpr const uint16_t PRODUCT_ID = pid; \
|
||||
ICSNEO_FINDABLE_DEVICE_BASE(className, type)
|
||||
|
||||
// Devices which are discernable by a serial range
|
||||
#define ICSNEO_FINDABLE_DEVICE_BY_SERIAL_RANGE(className, type, serialLow, serialHigh) \
|
||||
static constexpr const char* SERIAL_RANGE_LOW = serialLow; \
|
||||
static constexpr const char* SERIAL_RANGE_HIGH = serialHigh; \
|
||||
ICSNEO_FINDABLE_DEVICE_BASE(className, type)
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class DeviceExtension;
|
||||
|
||||
@@ -3,70 +3,32 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include "icsneo/communication/packetizer.h"
|
||||
#include "icsneo/communication/decoder.h"
|
||||
#include "icsneo/device/tree/radcomet/radcometbase.h"
|
||||
#include "icsneo/device/tree/radcomet/radcometsettings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class RADCOMET : public Device {
|
||||
class RADComet : public RADCometBase {
|
||||
public:
|
||||
|
||||
// Serial numbers start with RC
|
||||
// USB PID is 0x1207, standard driver is FTDI3
|
||||
// Ethernet MAC allocation is 0x1D, standard driver is Raw
|
||||
ICSNEO_FINDABLE_DEVICE(RADCOMET, DeviceType::RADComet, "RC");
|
||||
ICSNEO_FINDABLE_DEVICE_BY_SERIAL_RANGE(RADComet, DeviceType::RADComet, "RC0000", "RC0299");
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::HSCAN2,
|
||||
|
||||
Network::NetID::Ethernet,
|
||||
|
||||
Network::NetID::OP_Ethernet1,
|
||||
Network::NetID::OP_Ethernet2,
|
||||
|
||||
};
|
||||
return supportedNetworks;
|
||||
std::string getProductName() const override {
|
||||
return "RAD-Comet";
|
||||
}
|
||||
|
||||
bool getEthPhyRegControlSupported() const override { return true; }
|
||||
|
||||
protected:
|
||||
RADCOMET(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADCOMETSettings>(makeDriver);
|
||||
RADComet(neodevice_t neodevice, const driver_factory_t& makeDriver) : RADCometBase(neodevice) {
|
||||
initialize<RADCometSettings>(makeDriver);
|
||||
}
|
||||
|
||||
void setupPacketizer(Packetizer& packetizer) override {
|
||||
Device::setupPacketizer(packetizer);
|
||||
packetizer.disableChecksum = true;
|
||||
packetizer.align16bit = false;
|
||||
}
|
||||
|
||||
void setupEncoder(Encoder& encoder) override {
|
||||
Device::setupEncoder(encoder);
|
||||
encoder.supportCANFD = true;
|
||||
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<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
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
#ifndef __RADCOMET2_H_
|
||||
#define __RADCOMET2_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/tree/radcomet/radcometbase.h"
|
||||
#include "icsneo/device/tree/radcomet/radcometsettings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class RADComet2 : public RADCometBase {
|
||||
public:
|
||||
|
||||
// Serial numbers start with RC, Comet2 starts at RC0300
|
||||
// USB PID is 0x1207, standard driver is FTDI3
|
||||
// Ethernet MAC allocation is 0x1D, standard driver is Raw
|
||||
ICSNEO_FINDABLE_DEVICE_BY_SERIAL_RANGE(RADComet2, DeviceType::RADComet, "RC0300", "RCZZZZ");
|
||||
|
||||
std::string getProductName() const override {
|
||||
return "RAD-Comet 2";
|
||||
}
|
||||
|
||||
virtual const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = RADCometBase::GetSupportedNetworks();
|
||||
supportedNetworks.push_back(Network::NetID::OP_Ethernet3);
|
||||
supportedNetworks.push_back(Network::NetID::MDIO4);
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
protected:
|
||||
RADComet2(neodevice_t neodevice, const driver_factory_t& makeDriver) : RADCometBase(neodevice) {
|
||||
initialize<RADCometSettings>(makeDriver);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,73 @@
|
||||
#ifndef __RADCOMETBASE_H_
|
||||
#define __RADCOMETBASE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class RADCometBase : public Device {
|
||||
public:
|
||||
virtual const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::HSCAN2,
|
||||
|
||||
Network::NetID::Ethernet,
|
||||
|
||||
Network::NetID::OP_Ethernet1,
|
||||
Network::NetID::OP_Ethernet2,
|
||||
|
||||
Network::NetID::LIN,
|
||||
Network::NetID::ISO9141,
|
||||
|
||||
Network::NetID::MDIO1,
|
||||
Network::NetID::MDIO2,
|
||||
Network::NetID::MDIO3,
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
bool getEthPhyRegControlSupported() const override { return true; }
|
||||
|
||||
protected:
|
||||
using Device::Device;
|
||||
|
||||
void setupPacketizer(Packetizer& packetizer) override {
|
||||
Device::setupPacketizer(packetizer);
|
||||
packetizer.disableChecksum = true;
|
||||
packetizer.align16bit = false;
|
||||
}
|
||||
|
||||
void setupEncoder(Encoder& encoder) override {
|
||||
Device::setupEncoder(encoder);
|
||||
encoder.supportCANFD = true;
|
||||
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<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 32*1024*1024;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -54,6 +54,8 @@ typedef struct {
|
||||
// 10T1S
|
||||
ETHERNET_SETTINGS2 ethT1s2;
|
||||
ETHERNET10T1S_SETTINGS t1s2;
|
||||
uint64_t network_enables_5;
|
||||
LIN_SETTINGS lin1;
|
||||
} radcomet_settings_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
@@ -61,9 +63,9 @@ typedef struct {
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class RADCOMETSettings : public IDeviceSettings {
|
||||
class RADCometSettings : public IDeviceSettings {
|
||||
public:
|
||||
RADCOMETSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radcomet_settings_t)) {}
|
||||
RADCometSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radcomet_settings_t)) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<radcomet_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "icsneo/device/tree/plasion/neoviplasma.h"
|
||||
#include "icsneo/device/tree/rada2b/rada2b.h"
|
||||
#include "icsneo/device/tree/radcomet/radcomet.h"
|
||||
#include "icsneo/device/tree/radcomet/radcomet2.h"
|
||||
#include "icsneo/device/tree/radepsilon/radepsilon.h"
|
||||
#include "icsneo/device/tree/radgalaxy/radgalaxy.h"
|
||||
#include "icsneo/device/tree/radgigastar/radgigastar.h"
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "icsneo/device/tree/plasion/neoviplasma.h"
|
||||
#include "icsneo/device/tree/rada2b/rada2b.h"
|
||||
#include "icsneo/device/tree/radcomet/radcomet.h"
|
||||
#include "icsneo/device/tree/radcomet/radcomet2.h"
|
||||
#include "icsneo/device/tree/radepsilon/radepsilon.h"
|
||||
#include "icsneo/device/tree/radgalaxy/radgalaxy.h"
|
||||
#include "icsneo/device/tree/radgigastar/radgigastar.h"
|
||||
|
||||
Reference in New Issue
Block a user