Add ValueCAN 4 Industrial

This commit is contained in:
Paul Hollinsky
2020-09-14 12:45:32 -04:00
parent 211f844f77
commit eda4a30dcd
8 changed files with 267 additions and 1 deletions
@@ -0,0 +1,46 @@
#ifndef __VALUECAN4_INDUSTRIAL_SETTINGS_H_
#define __VALUECAN4_INDUSTRIAL_SETTINGS_H_
#include "icsneo/device/idevicesettings.h"
#include "icsneo/device/tree/valuecan4/settings/valuecan4settings.h"
#ifdef __cplusplus
namespace icsneo {
class ValueCAN4IndustrialSettings : public IDeviceSettings {
public:
ValueCAN4IndustrialSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(valuecan4_industrial_settings_t)) {}
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
auto cfg = getStructurePointer<valuecan4_1_2_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<valuecan4_1_2_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
@@ -11,7 +11,7 @@ namespace icsneo {
#endif
// This is where the actual settings structures for all the ValueCAN 4 line live
// ValueCAN 4-1 and 4-2 share a structure, and 4-4 shares with 4-2EL
// ValueCAN 4-1 and 4-2 share a structure, and 4-4 shares with 4-2EL, Industrial has its own
#pragma pack(push, 2)
typedef struct {
@@ -75,10 +75,51 @@ typedef struct {
uint16_t pwr_man_enable;
uint16_t pwr_man_timeout;
} valuecan4_4_2el_settings_t, valuecan4_4_settings_t, valuecan4_2el_settings_t;
typedef struct {
CAN_SETTINGS can1;
CANFD_SETTINGS canfd1;
CAN_SETTINGS can2;
CANFD_SETTINGS canfd2;
ETHERNET_SETTINGS ethernet;
LIN_SETTINGS lin1;
ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings;
uint16_t iso_parity;
uint16_t iso_msg_termination;
uint32_t pwr_man_timeout;
uint16_t pwr_man_enable;
uint16_t perf_en;
int16_t iso15765_separation_time_offset;
uint16_t network_enabled_on_boot;
union {
uint64_t word;
struct
{
uint16_t network_enables;
uint16_t network_enables_2;
uint16_t network_enables_3;
};
} network_enables;
uint64_t termination_enables;
struct
{
uint32_t disableUsbCheckOnBoot : 1;
uint32_t enableLatencyTest : 1;
uint32_t busMessagesToAndroid : 1;
uint32_t enablePcEthernetComm : 1;
uint32_t reserved : 28;
} flags;
} valuecan4_industrial_settings_t;
#pragma pack(pop)
#ifdef __cplusplus
static_assert(sizeof(valuecan4_1_2_settings_t) == 148, "ValueCAN 4-1 / 4-2 Settings are not packed correctly!");
static_assert(sizeof(valuecan4_4_2el_settings_t) == 326, "ValueCAN 4-4 / 4-2EL Settings are not packed correctly!");
static_assert(sizeof(valuecan4_industrial_settings_t) == 212, "ValueCAN 4 Industrial Settings are not packed correctly!");
} // End of namespace
#endif // __cplusplus