Update/add settings structures for several devices

pull/32/head
Paul Hollinsky 2020-09-08 17:41:47 -04:00
parent de0c16a461
commit eaa1409af0
10 changed files with 465 additions and 9 deletions

View File

@ -154,6 +154,96 @@ typedef struct
} TIMESYNC_ICSHARDWARE_SETTINGS;
#define TIMESYNC_ICSHARDWARE_SETTINGS_SIZE 4
typedef struct DISK_SETTINGS_t
{
uint8_t disk_layout;// RAID0, spanned, etc
uint8_t disk_format;// FAT32
uint32_t disk_enables;// mask of enabled disks in this layout
uint8_t rsvd[8];
} DISK_SETTINGS;
#define DISK_SETTINGS_SIZE 14
#define ETHERNET_SETTINGS2_FLAG_FULL_DUPLEX 0x01
#define ETHERNET_SETTINGS2_FLAG_AUTO_NEG 0x02
#define ETHERNET_SETTINGS2_FLAG_TCPIP_ENABLE 0x04
#define ETHERNET_SETTINGS2_FLAG_RTSP_ENABLE 0x08
#define ETHERNET_SETTINGS2_FLAG_DEVICE_HOSTING_ENABLE 0x10
#define ETHERNET_SETTINGS2_FLAG_COMM_IN_USE 0x80
typedef struct ETHERNET_SETTINGS2_t
{
/* bit0: 0=half duplex, 1=full duplex
* bit1: auto negot
* bit2: enable tcp/ip stack
* bit3: enable rtsp server
* bit4: enable intepid device hosting (go online and log other devices)
*/
uint8_t flags;
uint8_t link_speed;//0=10, 1=100, 2=1000
uint32_t ip_addr;
uint32_t netmask;
uint32_t gateway;
uint8_t rsvd[2];
} ETHERNET_SETTINGS2;
#define ETHERNET_SETTINGS2_SIZE 16
#define ETHERNET_SETTINGS10G_FLAG_FULL_DUPLEX 0x01
#define ETHERNET_SETTINGS10G_FLAG_AUTO_NEG 0x02
#define ETHERNET_SETTINGS10G_FLAG_TCPIP_ENABLE 0x04
#define ETHERNET_SETTINGS10G_FLAG_RTSP_ENABLE 0x08
#define ETHERNET_SETTINGS10G_FLAG_DEVICE_HOSTING_ENABLE 0x10
#define ETHERNET_SETTINGS10G_FLAG_COMM_IN_USE 0x80000000
typedef struct ETHERNET10G_SETTINGS_t
{
/* bit0: 0=half duplex, 1=full duplex
* bit1: auto negot
* bit2: enable tcp/ip stack
* bit3: enable rtsp server
* bit4: enable intepid device hosting (go online and log other devices)
* bit31: comm in use
*/
uint32_t flags;
uint32_t ip_addr;
uint32_t netmask;
uint32_t gateway;
uint8_t link_speed;//0=10, 1=100, 2=1000, 3=2500, 4=5000, 5=10000
uint8_t rsvd2[7];
} ETHERNET10G_SETTINGS;
#define ETHERNET10G_SETTINGS_SIZE 24
typedef struct LOGGER_SETTINGS_t
{
/* bit6-0: timeout in seconds
* bit7: 1=disable coremini/logging during extraction for timeout
*/
uint8_t extraction_timeout;
uint8_t rsvd[3];
} LOGGER_SETTINGS;
#define LOGGER_SETTINGS_SIZE 4
#define RAD_REPORTING_SETTINGS_FLAG_TEMP_ENABLE 0x00000001
#define RAD_REPORTING_SETTINGS_FLAG_MIC2_GPS_ENABLE 0x00000002 // USB port 1
#define RAD_REPORTING_SETTINGS_FLAG_INT_GPS_ENABLE 0x00000004
#define RAD_REPORTING_SETTINGS_FLAG_MIC2_GPS_ENABLE2 0x00000008 // USB port 2
#define RAD_REPORTING_SETTINGS_FLAG_MISC1_DIN 0x00000010
#define RAD_REPORTING_SETTINGS_FLAG_MISC2_DIN 0x00000020
#define RAD_REPORTING_SETTINGS_FLAG_MISC1_PWMIN 0x00000040
#define RAD_REPORTING_SETTINGS_FLAG_MISC2_PWMIN 0x00000080
#define RAD_REPORTING_SETTINGS_FLAG_AIN1 0x00000100
#define RAD_REPORTING_SETTINGS_FLAG_AIN2 0x00000200
typedef struct RAD_REPORTING_SETTINGS_t
{
uint32_t flags;
uint16_t temp_interval_ms;
uint16_t gps_interval_ms;
uint16_t serdes_interval_ms;
uint16_t io_interval_ms;
uint8_t rsvd[4];
} RAD_REPORTING_SETTINGS;
#define RAD_REPORTING_SETTINGS_SIZE 16
typedef struct _STextAPISettings
{
uint32_t can1_tx_id;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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