Add support for RADStar2 settings
parent
e124ad28f4
commit
603d532d2d
|
|
@ -134,6 +134,9 @@ bool IDeviceSettings::refresh(bool ignoreChecksum) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(disableGSChecksumming)
|
||||||
|
ignoreChecksum = true;
|
||||||
|
|
||||||
std::vector<uint8_t> rxSettings;
|
std::vector<uint8_t> rxSettings;
|
||||||
bool ret = com->getSettingsSync(rxSettings);
|
bool ret = com->getSettingsSync(rxSettings);
|
||||||
if(!ret) {
|
if(!ret) {
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,55 @@ typedef struct ETHERNET_SETTINGS_t
|
||||||
} ETHERNET_SETTINGS;
|
} ETHERNET_SETTINGS;
|
||||||
#define ETHERNET_SETTINGS_SIZE 8
|
#define ETHERNET_SETTINGS_SIZE 8
|
||||||
|
|
||||||
|
typedef struct OP_ETH_GENERAL_SETTINGS_t
|
||||||
|
{
|
||||||
|
uint8_t ucInterfaceType;
|
||||||
|
uint8_t reserved0[3];
|
||||||
|
uint16_t tapPair0;
|
||||||
|
uint16_t tapPair1;
|
||||||
|
uint16_t tapPair2;
|
||||||
|
uint16_t tapPair3;
|
||||||
|
uint16_t tapPair4;
|
||||||
|
uint16_t tapPair5;
|
||||||
|
union {
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
unsigned bTapEnSwitch : 1;
|
||||||
|
unsigned bTapEnPtp : 1;
|
||||||
|
unsigned bEnReportLinkQuality : 1;
|
||||||
|
} flags;
|
||||||
|
unsigned uFlags;
|
||||||
|
};
|
||||||
|
} OP_ETH_GENERAL_SETTINGS;
|
||||||
|
#define OP_ETH_GENERAL_SETTINGS_SIZE 20
|
||||||
|
static_assert(sizeof(OP_ETH_GENERAL_SETTINGS) == OP_ETH_GENERAL_SETTINGS_SIZE, "OP_ETH_GENERAL_SETTINGS is the wrong size!");
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4201) // nameless struct/union
|
||||||
|
#endif
|
||||||
|
typedef struct OP_ETH_SETTINGS_t
|
||||||
|
{
|
||||||
|
uint8_t ucConfigMode;
|
||||||
|
unsigned char preemption_en;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
// Reuse the mac_addr for switch mode if required!
|
||||||
|
unsigned char mac_addr1[6];// Original Addr for spoofing
|
||||||
|
unsigned char mac_addr2[6];// Target Addr for spoofing
|
||||||
|
unsigned short mac_spoofing_en : 1;
|
||||||
|
unsigned short mac_spoofing_isDstOrSrc : 1;
|
||||||
|
unsigned short reserved : 14;
|
||||||
|
};
|
||||||
|
unsigned char reserved0[14];
|
||||||
|
};
|
||||||
|
} OP_ETH_SETTINGS;
|
||||||
|
#define OP_ETH_SETTINGS_SIZE 16
|
||||||
|
static_assert(sizeof(OP_ETH_SETTINGS) == OP_ETH_SETTINGS_SIZE, "OP_ETH_SETTINGS is the wrong size!");
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint8_t MasterEnable;
|
uint8_t MasterEnable;
|
||||||
|
|
@ -332,6 +381,7 @@ public:
|
||||||
|
|
||||||
bool disabled = false;
|
bool disabled = false;
|
||||||
bool readonly = false;
|
bool readonly = false;
|
||||||
|
bool disableGSChecksumming = false;
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<Communication> com;
|
std::shared_ptr<Communication> com;
|
||||||
device_errorhandler_t err;
|
device_errorhandler_t err;
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,31 @@
|
||||||
#ifndef __RADSTAR2_H_
|
#ifndef __RADSTAR2_H_
|
||||||
#define __RADSTAR2_H_
|
#define __RADSTAR2_H_
|
||||||
|
|
||||||
#include "icsneo/device/device.h"
|
#include "icsneo/device/device.h"
|
||||||
#include "icsneo/device/devicetype.h"
|
#include "icsneo/device/devicetype.h"
|
||||||
|
#include "icsneo/device/radstar2/radstar2settings.h"
|
||||||
namespace icsneo {
|
|
||||||
|
namespace icsneo {
|
||||||
class RADStar2 : public Device {
|
|
||||||
public:
|
class RADStar2 : public Device {
|
||||||
// Serial numbers start with RS
|
public:
|
||||||
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::RADStar2;
|
// Serial numbers start with RS
|
||||||
static constexpr const uint16_t PRODUCT_ID = 0x0005;
|
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::RADStar2;
|
||||||
static constexpr const char* SERIAL_START = "RS";
|
static constexpr const uint16_t PRODUCT_ID = 0x0005;
|
||||||
|
static constexpr const char* SERIAL_START = "RS";
|
||||||
protected:
|
|
||||||
virtual void setupPacketizer(Packetizer* packetizer) override {
|
protected:
|
||||||
packetizer->disableChecksum = true;
|
virtual void setupPacketizer(Packetizer* packetizer) override {
|
||||||
packetizer->align16bit = false;
|
packetizer->disableChecksum = true;
|
||||||
}
|
packetizer->align16bit = false;
|
||||||
|
}
|
||||||
RADStar2(neodevice_t neodevice) : Device(neodevice) {
|
|
||||||
getWritableNeoDevice().type = DEVICE_TYPE;
|
RADStar2(neodevice_t neodevice) : Device(neodevice) {
|
||||||
productId = PRODUCT_ID;
|
getWritableNeoDevice().type = DEVICE_TYPE;
|
||||||
}
|
productId = PRODUCT_ID;
|
||||||
};
|
}
|
||||||
|
};
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -44,7 +44,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
RADStar2ETH(neodevice_t neodevice) : RADStar2(neodevice) {
|
RADStar2ETH(neodevice_t neodevice) : RADStar2(neodevice) {
|
||||||
initialize<PCAP>();
|
initialize<PCAP, RADStar2Settings>();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,107 @@
|
||||||
|
#ifndef __RADSTAR2SETTINGS_H_
|
||||||
|
#define __RADSTAR2SETTINGS_H_
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "icsneo/device/idevicesettings.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
namespace icsneo {
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#pragma pack(push, 2)
|
||||||
|
typedef struct {
|
||||||
|
uint16_t perf_en;
|
||||||
|
|
||||||
|
OP_ETH_GENERAL_SETTINGS opEthGen;
|
||||||
|
OP_ETH_SETTINGS opEth1;
|
||||||
|
OP_ETH_SETTINGS opEth2;
|
||||||
|
|
||||||
|
CAN_SETTINGS can1;
|
||||||
|
CANFD_SETTINGS canfd1;
|
||||||
|
CAN_SETTINGS can2;
|
||||||
|
CANFD_SETTINGS canfd2;
|
||||||
|
|
||||||
|
uint16_t network_enables;
|
||||||
|
uint16_t network_enables_2;
|
||||||
|
|
||||||
|
LIN_SETTINGS lin1;
|
||||||
|
uint16_t misc_io_initial_ddr;
|
||||||
|
uint16_t misc_io_initial_latch;
|
||||||
|
uint16_t misc_io_report_period;
|
||||||
|
uint16_t misc_io_on_report_events;
|
||||||
|
uint16_t misc_io_analog_enable;
|
||||||
|
uint16_t ain_sample_period;
|
||||||
|
uint16_t ain_threshold;
|
||||||
|
|
||||||
|
uint32_t pwr_man_timeout;
|
||||||
|
uint16_t pwr_man_enable;
|
||||||
|
|
||||||
|
uint16_t network_enabled_on_boot;
|
||||||
|
|
||||||
|
uint16_t iso15765_separation_time_offset;
|
||||||
|
|
||||||
|
uint16_t iso_9141_kwp_enable_reserved;
|
||||||
|
ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings_1;
|
||||||
|
uint16_t iso_parity_1;
|
||||||
|
|
||||||
|
uint16_t iso_msg_termination_1;
|
||||||
|
|
||||||
|
uint16_t idle_wakeup_network_enables_1;
|
||||||
|
uint16_t idle_wakeup_network_enables_2;
|
||||||
|
|
||||||
|
uint16_t network_enables_3;
|
||||||
|
uint16_t idle_wakeup_network_enables_3;
|
||||||
|
|
||||||
|
uint16_t can_switch_mode;
|
||||||
|
STextAPISettings text_api;
|
||||||
|
uint16_t pc_com_mode;
|
||||||
|
TIMESYNC_ICSHARDWARE_SETTINGS timeSyncSettings;
|
||||||
|
uint16_t hwComLatencyTestEn;
|
||||||
|
} radstar2_settings_t;
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
class RADStar2Settings : public IDeviceSettings {
|
||||||
|
public:
|
||||||
|
RADStar2Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radstar2_settings_t)) {
|
||||||
|
disableGSChecksumming = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||||
|
auto cfg = getStructurePointer<radstar2_settings_t>();
|
||||||
|
if(cfg == nullptr)
|
||||||
|
return nullptr;
|
||||||
|
switch(net.getNetID()) {
|
||||||
|
case Network::NetID::HSCAN:
|
||||||
|
return &(cfg->can1);
|
||||||
|
case Network::NetID::MSCAN:
|
||||||
|
return &(cfg->can2);
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const CANFD_SETTINGS* getCANFDSettingsFor(Network net) const override {
|
||||||
|
auto cfg = getStructurePointer<radstar2_settings_t>();
|
||||||
|
if(cfg == nullptr)
|
||||||
|
return nullptr;
|
||||||
|
switch(net.getNetID()) {
|
||||||
|
case Network::NetID::HSCAN:
|
||||||
|
return &(cfg->canfd1);
|
||||||
|
case Network::NetID::MSCAN:
|
||||||
|
return &(cfg->canfd2);
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -20,7 +20,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RADStar2USB(neodevice_t neodevice) : RADStar2(neodevice) {
|
RADStar2USB(neodevice_t neodevice) : RADStar2(neodevice) {
|
||||||
initialize<FTDI>();
|
initialize<FTDI, RADStar2Settings>();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue