mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Update/add settings structures for several devices
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "icsneo/communication/packetizer.h"
|
||||
#include "icsneo/communication/decoder.h"
|
||||
#include "icsneo/platform/stm32.h"
|
||||
#include "icsneo/device/tree/etherbadge/etherbadgesettings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
@@ -30,6 +31,7 @@ public:
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::HSCAN2,
|
||||
|
||||
Network::NetID::LIN,
|
||||
|
||||
@@ -41,7 +43,7 @@ public:
|
||||
EtherBADGE(neodevice_t neodevice) : Device(neodevice) {
|
||||
getWritableNeoDevice().type = DEVICE_TYPE;
|
||||
productId = PRODUCT_ID;
|
||||
initialize<STM32>();
|
||||
initialize<STM32, EtherBADGESettings>();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
#ifndef __ETHERBADGESETTINGS_H_
|
||||
#define __ETHERBADGESETTINGS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "icsneo/device/idevicesettings.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
#endif
|
||||
|
||||
#pragma pack(push, 2)
|
||||
typedef struct {
|
||||
uint16_t perf_en;//2
|
||||
|
||||
CAN_SETTINGS can1;//12
|
||||
CANFD_SETTINGS canfd1;//10
|
||||
CAN_SETTINGS can2;//12
|
||||
CANFD_SETTINGS canfd2;//10
|
||||
LIN_SETTINGS lin1;//10
|
||||
|
||||
uint16_t network_enables;//2
|
||||
uint16_t network_enables_2;//2
|
||||
uint16_t network_enables_3;//2
|
||||
uint64_t termination_enables;//8
|
||||
|
||||
uint32_t pwr_man_timeout;//4
|
||||
uint16_t pwr_man_enable;//2
|
||||
|
||||
uint16_t network_enabled_on_boot;//2
|
||||
|
||||
/* ISO15765-2 Transport Layer */
|
||||
int16_t iso15765_separation_time_offset;//2
|
||||
uint16_t iso9141_kwp_enable_reserved;//2
|
||||
uint16_t iso_tester_pullup_enable;//2
|
||||
uint16_t iso_parity;//2
|
||||
uint16_t iso_msg_termination;//2
|
||||
ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings;//114
|
||||
ETHERNET_SETTINGS ethernet;//8
|
||||
|
||||
uint16_t misc_io_initial_ddr;//2
|
||||
uint16_t misc_io_initial_latch;//2
|
||||
uint16_t misc_io_report_period;//2
|
||||
uint16_t misc_io_on_report_events;//2
|
||||
uint16_t misc_io_analog_enable;//2
|
||||
uint16_t ain_sample_period;//2
|
||||
uint16_t ain_threshold;//2
|
||||
|
||||
STextAPISettings text_api;//72
|
||||
|
||||
struct
|
||||
{
|
||||
uint32_t disableUsbCheckOnBoot : 1;
|
||||
uint32_t enableLatencyTest : 1;
|
||||
uint32_t enablePcEthernetComm : 1;
|
||||
uint32_t reserved : 29;
|
||||
} flags;//4
|
||||
} etherbadge_settings_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class EtherBADGESettings : public IDeviceSettings {
|
||||
public:
|
||||
EtherBADGESettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(etherbadge_settings_t)) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<etherbadge_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<etherbadge_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;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -52,9 +52,9 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void setupSettings(IDeviceSettings* ssettings) {
|
||||
void setupSettings(IDeviceSettings& ssettings) override {
|
||||
// TODO Check firmware version, old firmwares will reset Ethernet settings on settings send
|
||||
ssettings->readonly = true;
|
||||
ssettings.readonly = true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -104,6 +104,7 @@ typedef struct {
|
||||
uint16_t digitalIoThresholdTicks;
|
||||
uint16_t digitalIoThresholdEnable;
|
||||
TIMESYNC_ICSHARDWARE_SETTINGS timeSync;
|
||||
DISK_SETTINGS disk;
|
||||
} neovifire2_settings_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "icsneo/platform/pcap.h"
|
||||
#include "icsneo/communication/packetizer.h"
|
||||
#include "icsneo/communication/decoder.h"
|
||||
#include "icsneo/device/tree/radgalaxy/radgalaxysettings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
@@ -83,7 +84,7 @@ public:
|
||||
}
|
||||
|
||||
RADGalaxy(neodevice_t neodevice) : Device(neodevice) {
|
||||
initialize<PCAP>();
|
||||
initialize<PCAP, RADGalaxySettings>();
|
||||
getWritableNeoDevice().type = DEVICE_TYPE;
|
||||
productId = PRODUCT_ID;
|
||||
}
|
||||
@@ -95,23 +96,23 @@ protected:
|
||||
packetizer.align16bit = false;
|
||||
}
|
||||
|
||||
virtual void setupEncoder(Encoder& encoder) override {
|
||||
void setupEncoder(Encoder& encoder) override {
|
||||
Device::setupEncoder(encoder);
|
||||
encoder.supportCANFD = true;
|
||||
}
|
||||
|
||||
virtual void setupDecoder(Decoder& decoder) override {
|
||||
void setupDecoder(Decoder& decoder) override {
|
||||
Device::setupDecoder(decoder);
|
||||
decoder.timestampResolution = 10; // Timestamps are in 10ns increments instead of the usual 25ns
|
||||
}
|
||||
|
||||
virtual void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
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
|
||||
virtual void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
#ifndef __RADGALAXYSETTINGS_H_
|
||||
#define __RADGALAXYSETTINGS_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;
|
||||
OP_ETH_SETTINGS opEth3;
|
||||
OP_ETH_SETTINGS opEth4;
|
||||
OP_ETH_SETTINGS opEth5;
|
||||
OP_ETH_SETTINGS opEth6;
|
||||
OP_ETH_SETTINGS opEth7;
|
||||
OP_ETH_SETTINGS opEth8;
|
||||
OP_ETH_SETTINGS opEth9;
|
||||
OP_ETH_SETTINGS opEth10;
|
||||
OP_ETH_SETTINGS opEth11;
|
||||
OP_ETH_SETTINGS opEth12;
|
||||
|
||||
CAN_SETTINGS can1;
|
||||
CANFD_SETTINGS canfd1;
|
||||
CAN_SETTINGS can2;
|
||||
CANFD_SETTINGS canfd2;
|
||||
CAN_SETTINGS can3;
|
||||
CANFD_SETTINGS canfd3;
|
||||
CAN_SETTINGS can4;
|
||||
CANFD_SETTINGS canfd4;
|
||||
CAN_SETTINGS can5;
|
||||
CANFD_SETTINGS canfd5;
|
||||
CAN_SETTINGS can6;
|
||||
CANFD_SETTINGS canfd6;
|
||||
CAN_SETTINGS can7;
|
||||
CANFD_SETTINGS canfd7;
|
||||
CAN_SETTINGS can8;
|
||||
CANFD_SETTINGS canfd8;
|
||||
|
||||
/* Native CAN are either LS1/LS2 or SW1/SW2 */
|
||||
SWCAN_SETTINGS swcan1;
|
||||
uint16_t network_enables;
|
||||
SWCAN_SETTINGS swcan2;
|
||||
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;
|
||||
TIMESYNC_ICSHARDWARE_SETTINGS timeSyncSettings;
|
||||
uint16_t hwComLatencyTestEn;
|
||||
RAD_REPORTING_SETTINGS reporting;
|
||||
DISK_SETTINGS disk;
|
||||
LOGGER_SETTINGS logger;
|
||||
} radgalaxy_settings_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class RADGalaxySettings : public IDeviceSettings {
|
||||
public:
|
||||
RADGalaxySettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radgalaxy_settings_t)) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<radgalaxy_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
switch(net.getNetID()) {
|
||||
case Network::NetID::HSCAN:
|
||||
return &(cfg->can1);
|
||||
case Network::NetID::MSCAN:
|
||||
return &(cfg->can2);
|
||||
case Network::NetID::HSCAN2:
|
||||
return &(cfg->can3);
|
||||
case Network::NetID::HSCAN3:
|
||||
return &(cfg->can4);
|
||||
case Network::NetID::HSCAN4:
|
||||
return &(cfg->can5);
|
||||
case Network::NetID::HSCAN5:
|
||||
return &(cfg->can6);
|
||||
case Network::NetID::HSCAN6:
|
||||
return &(cfg->can7);
|
||||
case Network::NetID::HSCAN7:
|
||||
return &(cfg->can8);
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
const CANFD_SETTINGS* getCANFDSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<radgalaxy_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
switch(net.getNetID()) {
|
||||
case Network::NetID::HSCAN:
|
||||
return &(cfg->canfd1);
|
||||
case Network::NetID::MSCAN:
|
||||
return &(cfg->canfd2);
|
||||
case Network::NetID::HSCAN2:
|
||||
return &(cfg->canfd3);
|
||||
case Network::NetID::HSCAN3:
|
||||
return &(cfg->canfd4);
|
||||
case Network::NetID::HSCAN4:
|
||||
return &(cfg->canfd5);
|
||||
case Network::NetID::HSCAN5:
|
||||
return &(cfg->canfd6);
|
||||
case Network::NetID::HSCAN6:
|
||||
return &(cfg->canfd7);
|
||||
case Network::NetID::HSCAN7:
|
||||
return &(cfg->canfd8);
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
const SWCAN_SETTINGS* getSWCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<radgalaxy_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
switch(net.getNetID()) {
|
||||
case Network::NetID::SWCAN:
|
||||
return &(cfg->swcan1);
|
||||
case Network::NetID::SWCAN2:
|
||||
return &(cfg->swcan2);
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -59,6 +59,7 @@ typedef struct {
|
||||
uint16_t pc_com_mode;
|
||||
TIMESYNC_ICSHARDWARE_SETTINGS timeSyncSettings;
|
||||
uint16_t hwComLatencyTestEn;
|
||||
RAD_REPORTING_SETTINGS reporting;
|
||||
} radstar2_settings_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include "icsneo/platform/stm32.h"
|
||||
#include "icsneo/device/tree/vividcan/vividcansettings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
@@ -36,7 +37,7 @@ public:
|
||||
|
||||
private:
|
||||
VividCAN(neodevice_t neodevice) : Device(neodevice) {
|
||||
initialize<STM32>();
|
||||
initialize<STM32, VividCANSettings>();
|
||||
getWritableNeoDevice().type = DEVICE_TYPE;
|
||||
productId = PRODUCT_ID;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
#ifndef __VIVIDCANSETTINGS_H_
|
||||
#define __VIVIDCANSETTINGS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "icsneo/device/idevicesettings.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
#endif
|
||||
|
||||
#pragma pack(push, 2)
|
||||
typedef struct {
|
||||
uint32_t ecu_id;
|
||||
|
||||
CAN_SETTINGS can1;// 12 bytes
|
||||
SWCAN_SETTINGS swcan1;// 14 bytes
|
||||
CAN_SETTINGS lsftcan1;// 12 bytes
|
||||
|
||||
uint16_t network_enables;
|
||||
uint16_t network_enabled_on_boot;
|
||||
|
||||
uint16_t iso15765_separation_time_offset;
|
||||
|
||||
uint16_t perf_en;
|
||||
|
||||
uint32_t pwr_man_timeout;
|
||||
uint16_t pwr_man_enable;
|
||||
|
||||
uint16_t can_switch_mode;
|
||||
uint16_t termination_enables;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32_t disableUsbCheckOnBoot : 1;
|
||||
uint32_t enableLatencyTest : 1;
|
||||
uint32_t reserved : 30;
|
||||
} flags;
|
||||
} vividcan_settings_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class VividCANSettings : public IDeviceSettings {
|
||||
public:
|
||||
VividCANSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(vividcan_settings_t)) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<vividcan_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
switch(net.getNetID()) {
|
||||
case Network::NetID::HSCAN:
|
||||
return &(cfg->can1);
|
||||
case Network::NetID::LSFTCAN:
|
||||
return &(cfg->lsftcan1);
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
const CAN_SETTINGS* getLSFTCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<vividcan_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
switch(net.getNetID()) {
|
||||
case Network::NetID::LSFTCAN:
|
||||
return &(cfg->lsftcan1);
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
const SWCAN_SETTINGS* getSWCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<vividcan_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
switch(net.getNetID()) {
|
||||
case Network::NetID::SWCAN:
|
||||
return &(cfg->swcan1);
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user