diff --git a/HARDWARE.md b/HARDWARE.md index b447df9..e5a1c33 100644 --- a/HARDWARE.md +++ b/HARDWARE.md @@ -24,6 +24,10 @@ - RADComet3 - CAN works - Ethernet works + - neoVI Connect + - CAN works + - CAN FD works + - Ethernet works - Connecting over USB - ValueCAN 4 series @@ -53,4 +57,4 @@ - RADMoon3 - RADComet3 - CAN works - - Ethernet works \ No newline at end of file + - Ethernet works diff --git a/device/devicefinder.cpp b/device/devicefinder.cpp index a79f9b6..bb11b46 100644 --- a/device/devicefinder.cpp +++ b/device/devicefinder.cpp @@ -137,6 +137,10 @@ std::vector> DeviceFinder::FindAll() { makeIfSerialMatches(dev, newFoundDevices); #endif + #ifdef __NEOVICONNECT_H_ + makeIfSerialMatches(dev, newFoundDevices); + #endif + #ifdef __NEOVIFIRE_H_ makeIfPIDMatches(dev, newFoundDevices); #endif @@ -288,6 +292,10 @@ const std::vector& DeviceFinder::GetSupportedDevices() { NeoVIRED2::DEVICE_TYPE, #endif + #ifdef __NEOVICONNECT_H_ + NeoVIConnect::DEVICE_TYPE, + #endif + #ifdef __NEOVIFIRE_H_ NeoVIFIRE::DEVICE_TYPE, #endif diff --git a/include/icsneo/device/devicetype.h b/include/icsneo/device/devicetype.h index 730ea11..a02cdc8 100644 --- a/include/icsneo/device/devicetype.h +++ b/include/icsneo/device/devicetype.h @@ -50,6 +50,7 @@ public: RADMoon3 = (0x00000023), RADComet = (0x00000024), FIRE3_FlexRay = (0x00000025), + Connect = (0x00000026), RADComet3 = (0x00000027), RED = (0x00000040), ECU = (0x00000080), @@ -189,6 +190,8 @@ public: return "neoVI FIRE3 FlexRay"; case RADComet3: return "RAD-Comet 3"; + case Connect: + return "neoVI Connect"; case DONT_REUSE0: case DONT_REUSE1: case DONT_REUSE2: @@ -242,6 +245,7 @@ private: #define ICSNEO_DEVICETYPE_RADMoon3 ((devicetype_t)0x00000023) #define ICSNEO_DEVICETYPE_RADCOMET ((devicetype_t)0x00000024) #define ICSNEO_DEVICETYPE_FIRE3FLEXRAY ((devicetype_t)0x00000025) +#define ICSNEO_DEVICETYPE_CONNECT ((devicetype_t)0x00000026) #define ICSNEO_DEVICETYPE_RADCOMET3 ((devicetype_t)0x00000027) #define ICSNEO_DEVICETYPE_RED ((devicetype_t)0x00000040) #define ICSNEO_DEVICETYPE_ECU ((devicetype_t)0x00000080) diff --git a/include/icsneo/device/tree/neoviconnect/neoviconnect.h b/include/icsneo/device/tree/neoviconnect/neoviconnect.h new file mode 100644 index 0000000..eeae143 --- /dev/null +++ b/include/icsneo/device/tree/neoviconnect/neoviconnect.h @@ -0,0 +1,75 @@ +#ifndef __NEOVICONNECT_H_ +#define __NEOVICONNECT_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/neoviconnect/neoviconnectsettings.h" + +namespace icsneo { + +class NeoVIConnect : public Device { +public: + // Serial numbers start with DM + // Ethernet MAC allocation is 0x1F, standard driver is Raw + ICSNEO_FINDABLE_DEVICE(NeoVIConnect, DeviceType::Connect, "DM"); + + 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: + NeoVIConnect(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 = true; + } + + 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); } + + bool supportsWiVI() const override { return true; } + + bool supportsLiveData() const override { return true; } + + std::optional getCoreminiStartAddressFlash() const override { + return 33*1024*1024; + } + + std::optional getCoreminiStartAddressSD() const override { + return 0; + } +}; + +} + +#endif \ No newline at end of file diff --git a/include/icsneo/device/tree/neoviconnect/neoviconnectsettings.h b/include/icsneo/device/tree/neoviconnect/neoviconnectsettings.h new file mode 100644 index 0000000..0c3e537 --- /dev/null +++ b/include/icsneo/device/tree/neoviconnect/neoviconnectsettings.h @@ -0,0 +1,161 @@ +#ifndef __NEOVICONNECTSETTINGS_H_ +#define __NEOVICONNECTSETTINGS_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 reservedA; + uint32_t pwr_man_timeout; + uint64_t network_enables; + 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; + uint16_t iso_parity; + uint16_t iso_msg_termination; + ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings_2; + uint16_t iso_parity_2; + uint16_t iso_msg_termination_2; + ETHERNET_SETTINGS ethernet_1; + ETHERNET_SETTINGS2 ethernet2_1; + ETHERNET_SETTINGS ethernet_2; + ETHERNET_SETTINGS2 ethernet2_2; + STextAPISettings text_api; + 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; + Fire3LinuxSettings os_settings; + RAD_GPTP_SETTINGS gPTP; + struct + { + uint32_t disableUsbCheckOnBoot : 1; + uint32_t enableLatencyTest : 1; + uint32_t enableDefaultLogger : 1; + uint32_t enableDefaultUpload : 1; + uint32_t reserved3 : 28; + } flags; +} neoviconnect_settings_t; + +typedef struct { +} neoviconnect_status_t; +#pragma pack(pop) + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#ifdef __cplusplus + +#include + +class NeoVIConnectSettings : public IDeviceSettings { +public: + NeoVIConnectSettings(std::shared_ptr com) : IDeviceSettings(com, sizeof(neoviconnect_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::HSCAN2: + return &(cfg->can2); + case Network::NetID::HSCAN3: + return &(cfg->can3); + case Network::NetID::HSCAN4: + return &(cfg->can4); + case Network::NetID::HSCAN5: + return &(cfg->can5); + case Network::NetID::HSCAN6: + return &(cfg->can6); + case Network::NetID::HSCAN7: + return &(cfg->can7); + case Network::NetID::MSCAN: + 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::HSCAN2: + return &(cfg->canfd2); + case Network::NetID::HSCAN3: + return &(cfg->canfd3); + case Network::NetID::HSCAN4: + return &(cfg->canfd4); + case Network::NetID::HSCAN5: + return &(cfg->canfd5); + case Network::NetID::HSCAN6: + return &(cfg->canfd6); + case Network::NetID::HSCAN7: + return &(cfg->canfd7); + case Network::NetID::MSCAN: + return &(cfg->canfd8); + default: + return nullptr; + } + } + const LIN_SETTINGS* getLINSettingsFor(Network net) const override { + auto cfg = getStructurePointer(); + if(cfg == nullptr) + return nullptr; + switch(net.getNetID()) { + case Network::NetID::LIN: + return &(cfg->lin1); + case Network::NetID::LIN2: + return &(cfg->lin2); + default: + return nullptr; + } + } +}; + +} + +#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 96b602a..54ec9bf 100644 --- a/include/icsneo/platform/posix/devices.h +++ b/include/icsneo/platform/posix/devices.h @@ -4,6 +4,7 @@ #include "icsneo/device/tree/etherbadge/etherbadge.h" #include "icsneo/device/tree/neoobd2pro/neoobd2pro.h" #include "icsneo/device/tree/neoobd2sim/neoobd2sim.h" +#include "icsneo/device/tree/neoviconnect/neoviconnect.h" #include "icsneo/device/tree/neovifire/neovifire.h" #include "icsneo/device/tree/neovifire2/neovifire2.h" #include "icsneo/device/tree/neovifire3/neovifire3.h" diff --git a/include/icsneo/platform/windows/devices.h b/include/icsneo/platform/windows/devices.h index cf50919..a00ee3c 100644 --- a/include/icsneo/platform/windows/devices.h +++ b/include/icsneo/platform/windows/devices.h @@ -4,6 +4,7 @@ #include "icsneo/device/tree/etherbadge/etherbadge.h" #include "icsneo/device/tree/neoobd2pro/neoobd2pro.h" #include "icsneo/device/tree/neoobd2sim/neoobd2sim.h" +#include "icsneo/device/tree/neoviconnect/neoviconnect.h" #include "icsneo/device/tree/neovifire/neovifire.h" #include "icsneo/device/tree/neovifire2/neovifire2.h" #include "icsneo/device/tree/neovifire3/neovifire3.h"