diff --git a/include/icsneo/device/devicetype.h b/include/icsneo/device/devicetype.h index 14aba6c..038f75d 100644 --- a/include/icsneo/device/devicetype.h +++ b/include/icsneo/device/devicetype.h @@ -38,6 +38,7 @@ public: NEOECU12 = (0x0000000c), OBD2_LCBADGE = (0x0000000d), RADMoonDuo = (0x0000000e), + FIRE3 = (0x0000000f), VCAN3 = (0x00000010), RADJupiter = (0x00000011), VCAN4_IND = (0x00000012), @@ -113,6 +114,8 @@ public: return "neoOBD2 LC BADGE"; case RADMoonDuo: return "RAD-Moon Duo"; + case FIRE3: + return "neoVI FIRE 3"; case VCAN3: return "ValueCAN 3"; case RADJupiter: @@ -212,6 +215,7 @@ private: #define ICSNEO_DEVICETYPE_NEOECU12 ((devicetype_t)0x0000000c) #define ICSNEO_DEVICETYPE_OBD2_LCBADGE ((devicetype_t)0x0000000d) #define ICSNEO_DEVICETYPE_RADMOONDUO ((devicetype_t)0x0000000e) +#define ICSNEO_DEVICETYPE_FIRE3 ((devicetype_t)0x0000000f) #define ICSNEO_DEVICETYPE_VCAN3 ((devicetype_t)0x00000010) #define ICSNEO_DEVICETYPE_RADJUPITER ((devicetype_t)0x00000011) #define ICSNEO_DEVICETYPE_VCAN4_IND ((devicetype_t)0x00000012) diff --git a/include/icsneo/device/tree/neovifire3/neovifire3.h b/include/icsneo/device/tree/neovifire3/neovifire3.h new file mode 100644 index 0000000..3625287 --- /dev/null +++ b/include/icsneo/device/tree/neovifire3/neovifire3.h @@ -0,0 +1,63 @@ +#ifndef __NEOVIFIRE3_H_ +#define __NEOVIFIRE3_H_ + +#include "icsneo/device/device.h" +#include "icsneo/device/devicetype.h" +#include "icsneo/disk/extextractordiskreaddriver.h" +#include "icsneo/disk/neomemorydiskdriver.h" +#include "icsneo/device/tree/neovifire3/neovifire3settings.h" + +namespace icsneo { + +class NeoVIFIRE3 : public Device { +public: + // Serial numbers start with ON + // Ethernet MAC allocation is 0x0E, standard driver is Raw + ICSNEO_FINDABLE_DEVICE(NeoVIFIRE3, DeviceType::FIRE3, "ON"); + + static const std::vector& GetSupportedNetworks() { + static std::vector supportedNetworks = { + Network::NetID::HSCAN, + Network::NetID::MSCAN, + Network::NetID::HSCAN2, + Network::NetID::HSCAN3, + Network::NetID::HSCAN4, + Network::NetID::HSCAN5, + Network::NetID::HSCAN6, + Network::NetID::HSCAN7, + + Network::NetID::Ethernet, + + Network::NetID::LIN, + Network::NetID::LIN2 + }; + return supportedNetworks; + } + +protected: + NeoVIFIRE3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) { + initialize(makeDriver); + } + + virtual void setupEncoder(Encoder& encoder) override { + Device::setupEncoder(encoder); + encoder.supportCANFD = true; + } + + void setupPacketizer(Packetizer& packetizer) override { + Device::setupPacketizer(packetizer); + packetizer.align16bit = false; + } + + void setupSupportedRXNetworks(std::vector& 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& txNetworks) override { setupSupportedRXNetworks(txNetworks); } +}; + +} + +#endif \ No newline at end of file diff --git a/include/icsneo/device/tree/neovifire3/neovifire3settings.h b/include/icsneo/device/tree/neovifire3/neovifire3settings.h new file mode 100644 index 0000000..e4b109a --- /dev/null +++ b/include/icsneo/device/tree/neovifire3/neovifire3settings.h @@ -0,0 +1,186 @@ +#ifndef __NEOVIFIRE3SETTINGS_H_ +#define __NEOVIFIRE3SETTINGS_H_ + +#include +#include "icsneo/device/idevicesettings.h" + +#ifdef __cplusplus + +namespace icsneo { + +#endif + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4201) // nameless struct/union +#endif + +#pragma pack(push, 2) +typedef struct { + uint16_t perf_en; + uint16_t network_enabled_on_boot; + uint16_t misc_io_on_report_events; + uint16_t pwr_man_enable; + int16_t iso15765_separation_time_offset; + uint16_t slaveVnetA; + uint32_t reserved; + uint64_t termination_enables; + union { + uint64_t word; + struct + { + uint16_t network_enables; + uint16_t network_enables_2; + uint16_t network_enables_3; + }; + } network_enables; + uint32_t pwr_man_timeout; + 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; + LIN_SETTINGS lin1; + LIN_SETTINGS lin2; + ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings_1; + uint16_t iso_parity_1; + uint16_t iso_msg_termination_1; + ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings_2; + uint16_t iso_parity_2; + uint16_t iso_msg_termination_2; + ETHERNET_SETTINGS ethernet; + TIMESYNC_ICSHARDWARE_SETTINGS timeSync; + STextAPISettings text_api; + struct { + uint32_t disableUsbCheckOnBoot : 1; + uint32_t enableLatencyTest : 1; + uint32_t busMessagesToAndroid : 1; + uint32_t enablePcEthernetComm : 1; + uint32_t enableDefaultLogger : 1; + uint32_t enableDefaultUpload : 1; + uint32_t reserved : 26; + } flags; + DISK_SETTINGS disk; + uint16_t misc_io_report_period; + uint16_t ain_threshold; + uint16_t misc_io_analog_enable; + uint16_t digitalIoThresholdTicks; + uint16_t digitalIoThresholdEnable; + uint16_t misc_io_initial_ddr; + uint16_t misc_io_initial_latch; + ETHERNET_SETTINGS2 ethernet2; +} neovifire3_settings_t; + +typedef struct { + uint8_t backupPowerGood; + uint8_t backupPowerEnabled; + uint8_t usbHostPowerEnabled; + uint8_t ethernetActivationLineEnabled; + EthernetNetworkStatus ethernetStatus; +} neovifire3_status_t; +#pragma pack(pop) + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#ifdef __cplusplus + +#include + +class NeoVIFIRE3Settings : public IDeviceSettings { +public: + NeoVIFIRE3Settings(std::shared_ptr com) : IDeviceSettings(com, sizeof(neovifire3_settings_t)) {} + const CAN_SETTINGS* getCANSettingsFor(Network net) const override { + auto cfg = getStructurePointer(); + 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(); + 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; + } + } + + virtual std::vector getTerminationGroups() const override { + return { + { + Network(Network::NetID::HSCAN), + Network(Network::NetID::HSCAN3), + Network(Network::NetID::HSCAN5), + Network(Network::NetID::HSCAN7) + }, + { + Network(Network::NetID::MSCAN), + Network(Network::NetID::HSCAN2), + Network(Network::NetID::HSCAN4), + Network(Network::NetID::HSCAN6) + } + }; + } + +protected: + ICSNEO_UNALIGNED(const uint64_t*) getTerminationEnables() const override { + auto cfg = getStructurePointer(); + if(cfg == nullptr) + return nullptr; + return &cfg->termination_enables; + } +}; + +} + +#endif // __cplusplus + +#endif \ No newline at end of file diff --git a/include/icsneo/platform/posix/devices.h b/include/icsneo/platform/posix/devices.h index 244cfa9..3fa4013 100644 --- a/include/icsneo/platform/posix/devices.h +++ b/include/icsneo/platform/posix/devices.h @@ -6,6 +6,7 @@ #include "icsneo/device/tree/neoobd2sim/neoobd2sim.h" #include "icsneo/device/tree/neovifire/neovifire.h" #include "icsneo/device/tree/neovifire2/neovifire2.h" +#include "icsneo/device/tree/neovifire3/neovifire3.h" #include "icsneo/device/tree/neovired2/neovired2.h" #include "icsneo/device/tree/plasion/neoviion.h" #include "icsneo/device/tree/plasion/neoviplasma.h" diff --git a/include/icsneo/platform/windows/devices.h b/include/icsneo/platform/windows/devices.h index 29bf5a1..f4be621 100644 --- a/include/icsneo/platform/windows/devices.h +++ b/include/icsneo/platform/windows/devices.h @@ -6,6 +6,7 @@ #include "icsneo/device/tree/neoobd2sim/neoobd2sim.h" #include "icsneo/device/tree/neovifire/neovifire.h" #include "icsneo/device/tree/neovifire2/neovifire2.h" +#include "icsneo/device/tree/neovifire3/neovifire3.h" #include "icsneo/device/tree/neovired2/neovired2.h" #include "icsneo/device/tree/plasion/neoviion.h" #include "icsneo/device/tree/plasion/neoviplasma.h"