Compare commits
21 Commits
4ed615d3be
...
22a78da74c
| Author | SHA1 | Date |
|---|---|---|
|
|
22a78da74c | |
|
|
deabc2cff4 | |
|
|
b48160286b | |
|
|
5d672d48d4 | |
|
|
495632ddb7 | |
|
|
3668b86f37 | |
|
|
0bd733bc5d | |
|
|
99a2ca4f0d | |
|
|
ec350b522a | |
|
|
895cd0792c | |
|
|
a5ec9a2d20 | |
|
|
b9d3dde8d5 | |
|
|
11643e2281 | |
|
|
f22d666f94 | |
|
|
58b22da09b | |
|
|
88d32128c9 | |
|
|
6d82289864 | |
|
|
674e905340 | |
|
|
8b7e2556a0 | |
|
|
fbdab1e998 | |
|
|
31d4a750d8 |
|
|
@ -3,24 +3,5 @@ SUBSYSTEM=="usb", ATTRS{idVendor}=="093c", GROUP="users", MODE="0666"
|
|||
KERNEL=="ttyUSB?", ATTRS{idVendor}=="093c", GROUP="users", MODE="0666"
|
||||
KERNEL=="ttyACM?", ATTRS{idVendor}=="093c", GROUP="users", MODE="0666"
|
||||
|
||||
# neoVI ION/PLASMA PIDs are not in the latest ftdi_sio driver so lets make a
|
||||
# rule to add it when we see a new unclaimed device.
|
||||
# PLASMA = 0x0801, ION = 0x0901
|
||||
ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_interface", \
|
||||
ATTRS{idVendor}=="093c", ATTRS{idProduct}=="0801", \
|
||||
DRIVER=="", \
|
||||
RUN+="/sbin/modprobe -b ftdi_sio"
|
||||
ACTION=="add", SUBSYSTEM=="drivers", \
|
||||
ENV{DEVPATH}=="/bus/usb-serial/drivers/ftdi_sio", \
|
||||
ATTR{new_id}="093c 0801"
|
||||
ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_interface", \
|
||||
ATTRS{idVendor}=="093c", ATTRS{idProduct}=="0901", \
|
||||
DRIVER=="", \
|
||||
RUN+="/sbin/modprobe -b ftdi_sio"
|
||||
ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_interface", \
|
||||
ATTRS{idVendor}=="093c", ATTRS{idProduct}=="1000", \
|
||||
DRIVER=="", \
|
||||
RUN+="/sbin/modprobe -b ftdi_sio"
|
||||
ACTION=="add", SUBSYSTEM=="drivers", \
|
||||
ENV{DEVPATH}=="/bus/usb-serial/drivers/ftdi_sio", \
|
||||
ATTR{new_id}="093c 0901"
|
||||
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="093c", KERNEL=="ttyUSB*", \
|
||||
RUN+="/bin/sh -c 'echo $id:1.0>/sys/bus/usb/drivers/ftdi_sio/unbind'"
|
||||
|
|
|
|||
|
|
@ -204,6 +204,7 @@ set(SRC_FILES
|
|||
communication/packet/flexraypacket.cpp
|
||||
communication/packet/canpacket.cpp
|
||||
communication/packet/a2bpacket.cpp
|
||||
communication/packet/spipacket.cpp
|
||||
communication/packet/ethernetpacket.cpp
|
||||
communication/packet/versionpacket.cpp
|
||||
communication/packet/iso9141packet.cpp
|
||||
|
|
@ -333,6 +334,11 @@ if(LIBICSNEO_ENABLE_RAW_ETHERNET)
|
|||
endif()
|
||||
if(LIBICSNEO_ENABLE_CDCACM)
|
||||
target_compile_definitions(icsneocpp PRIVATE ICSNEO_ENABLE_CDCACM)
|
||||
if(APPLE)
|
||||
find_library(CORE_FOUNDATION_FRAMEWORK CoreFoundation REQUIRED)
|
||||
find_library(IO_KIT_FRAMEWORK IOKit REQUIRED)
|
||||
target_link_libraries(icsneocpp PRIVATE ${CORE_FOUNDATION_FRAMEWORK} ${IO_KIT_FRAMEWORK})
|
||||
endif()
|
||||
endif()
|
||||
if(LIBICSNEO_ENABLE_DXX)
|
||||
target_compile_definitions(icsneocpp PRIVATE ICSNEO_ENABLE_DXX)
|
||||
|
|
@ -355,7 +361,7 @@ if(LIBICSNEO_ENABLE_DXX)
|
|||
include(FetchContent)
|
||||
FetchContent_Declare(libredxx
|
||||
GIT_REPOSITORY https://github.com/Zeranoe/libredxx.git
|
||||
GIT_TAG 3acc754d0af4fe529f05dbc2488b2da77ad9729c
|
||||
GIT_TAG e1fe2bd6ba6079b17037379d78f3f18024b389d7
|
||||
)
|
||||
set(LIBREDXX_DISABLE_INSTALL ON)
|
||||
FetchContent_MakeAvailable(libredxx)
|
||||
|
|
|
|||
|
|
@ -31,12 +31,16 @@ pybind11_add_module(icsneopy
|
|||
icsneopy/communication/message/mdiomessage.cpp
|
||||
icsneopy/communication/message/gptpstatusmessage.cpp
|
||||
icsneopy/communication/message/ethernetstatusmessage.cpp
|
||||
icsneopy/communication/message/spimessage.cpp
|
||||
icsneopy/communication/message/macsecmessage.cpp
|
||||
icsneopy/communication/message/scriptstatusmessage.cpp
|
||||
icsneopy/communication/message/ethphymessage.cpp
|
||||
icsneopy/communication/message/callback/messagecallback.cpp
|
||||
icsneopy/communication/message/filter/messagefilter.cpp
|
||||
icsneopy/flexray/flexray.cpp
|
||||
icsneopy/disk/diskdriver.cpp
|
||||
icsneopy/device/chipid.cpp
|
||||
icsneopy/device/versionreport.cpp
|
||||
icsneopy/device/device.cpp
|
||||
icsneopy/device/extensions/deviceextension.cpp
|
||||
icsneopy/device/idevicesettings.cpp
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/stl.h>
|
||||
#include <pybind11/functional.h>
|
||||
|
||||
#include "icsneo/communication/message/ethphymessage.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
void init_ethphymessage(pybind11::module_& m) {
|
||||
pybind11::class_<PhyMessage, std::shared_ptr<PhyMessage>>(m, "PhyMessage")
|
||||
.def(pybind11::init())
|
||||
.def_readwrite("Enabled", &PhyMessage::Enabled)
|
||||
.def_readwrite("WriteEnable", &PhyMessage::WriteEnable)
|
||||
.def_readwrite("Clause45Enable", &PhyMessage::Clause45Enable)
|
||||
.def_readwrite("Version", &PhyMessage::Version)
|
||||
.def_readwrite("BusIndex", &PhyMessage::BusIndex)
|
||||
.def_readwrite("Clause22", &PhyMessage::Clause22)
|
||||
.def_readwrite("Clause45", &PhyMessage::Clause45);
|
||||
pybind11::class_<Clause22Message>(m, "Clause22Message")
|
||||
.def(pybind11::init())
|
||||
.def_readwrite("phyAddr", &Clause22Message::phyAddr)
|
||||
.def_readwrite("page", &Clause22Message::page)
|
||||
.def_readwrite("regAddr", &Clause22Message::regAddr)
|
||||
.def_readwrite("regVal", &Clause22Message::regVal);
|
||||
pybind11::class_<Clause45Message>(m, "Clause45Message")
|
||||
.def(pybind11::init())
|
||||
.def_readwrite("port", &Clause45Message::port)
|
||||
.def_readwrite("device", &Clause45Message::device)
|
||||
.def_readwrite("regAddr", &Clause45Message::regAddr)
|
||||
.def_readwrite("regVal", &Clause45Message::regVal);
|
||||
pybind11::class_<EthPhyMessage, std::shared_ptr<EthPhyMessage>, Message>(m, "EthPhyMessage")
|
||||
.def(pybind11::init())
|
||||
.def_readwrite("messages", &EthPhyMessage::messages);
|
||||
}
|
||||
|
||||
} // namespace icsneo
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/stl.h>
|
||||
#include <pybind11/functional.h>
|
||||
|
||||
#include "icsneo/communication/message/spimessage.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
void init_spimessage(pybind11::module_& m) {
|
||||
pybind11::class_<SPIMessage, std::shared_ptr<SPIMessage>, Frame> spiMessage(m, "SPIMessage");
|
||||
pybind11::enum_<SPIMessage::Direction>(spiMessage, "Direction")
|
||||
.value("Write", SPIMessage::Direction::Write)
|
||||
.value("Read", SPIMessage::Direction::Read);
|
||||
spiMessage
|
||||
.def(pybind11::init())
|
||||
.def_readwrite("direction", &SPIMessage::direction)
|
||||
.def_readwrite("address", &SPIMessage::address)
|
||||
.def_readwrite("mms", &SPIMessage::mms)
|
||||
.def_readwrite("stats", &SPIMessage::stats)
|
||||
.def_readwrite("payload", &SPIMessage::payload);
|
||||
}
|
||||
|
||||
} // namespace icsneo
|
||||
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/stl.h>
|
||||
#include <pybind11/functional.h>
|
||||
|
||||
#include "icsneo/device/chipid.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
void init_chipid(pybind11::module_& m) {
|
||||
pybind11::enum_<ChipID>(m, "ChipID")
|
||||
.value("neoVIFIRE_MCHIP", ChipID::neoVIFIRE_MCHIP)
|
||||
.value("neoVIFIRE_LCHIP", ChipID::neoVIFIRE_LCHIP)
|
||||
.value("neoVIFIRE_UCHIP", ChipID::neoVIFIRE_UCHIP)
|
||||
.value("neoVIFIRE_JCHIP", ChipID::neoVIFIRE_JCHIP)
|
||||
.value("ValueCAN3_MCHIP", ChipID::ValueCAN3_MCHIP)
|
||||
.value("neoVIECU_MPIC", ChipID::neoVIECU_MPIC)
|
||||
.value("neoVIIEVB_MPIC", ChipID::neoVIIEVB_MPIC)
|
||||
.value("neoVIPENDANT_MPIC", ChipID::neoVIPENDANT_MPIC)
|
||||
.value("neoVIFIRE_VNET_MCHIP", ChipID::neoVIFIRE_VNET_MCHIP)
|
||||
.value("neoVIFIRE_VNET_LCHIP", ChipID::neoVIFIRE_VNET_LCHIP)
|
||||
.value("neoVIPLASMA_Core", ChipID::neoVIPLASMA_Core)
|
||||
.value("neoVIPLASMA_HID", ChipID::neoVIPLASMA_HID)
|
||||
.value("neoVIANALOG_MPIC", ChipID::neoVIANALOG_MPIC)
|
||||
.value("neoVIPLASMA_ANALOG_Core", ChipID::neoVIPLASMA_ANALOG_Core)
|
||||
.value("neoVIPLASMA_FlexRay_Core", ChipID::neoVIPLASMA_FlexRay_Core)
|
||||
.value("neoVIPLASMA_Core_1_12", ChipID::neoVIPLASMA_Core_1_12)
|
||||
.value("neoVIFIRE_Slave_VNET_MCHIP", ChipID::neoVIFIRE_Slave_VNET_MCHIP)
|
||||
.value("neoVIFIRE_Slave_VNET_LCHIP", ChipID::neoVIFIRE_Slave_VNET_LCHIP)
|
||||
.value("neoVIION_Core", ChipID::neoVIION_Core)
|
||||
.value("neoVIION_HID", ChipID::neoVIION_HID)
|
||||
.value("neoVIION_Core_Loader", ChipID::neoVIION_Core_Loader)
|
||||
.value("neoVIION_HID_Loader", ChipID::neoVIION_HID_Loader)
|
||||
.value("neoVIION_FPGA_BIT", ChipID::neoVIION_FPGA_BIT)
|
||||
.value("neoVIFIRE_VNET_EP_MCHIP", ChipID::neoVIFIRE_VNET_EP_MCHIP)
|
||||
.value("neoVIFIRE_VNET_EP_LCHIP", ChipID::neoVIFIRE_VNET_EP_LCHIP)
|
||||
.value("neoVIAnalogOut_MCHIP", ChipID::neoVIAnalogOut_MCHIP)
|
||||
.value("neoVIMOST25_MCHIP", ChipID::neoVIMOST25_MCHIP)
|
||||
.value("neoVIMOST50_MCHIP", ChipID::neoVIMOST50_MCHIP)
|
||||
.value("neoVIMOST150_MCHIP", ChipID::neoVIMOST150_MCHIP)
|
||||
.value("ValueCAN4_4_MCHIP", ChipID::ValueCAN4_4_MCHIP)
|
||||
.value("ValueCAN4_4_SCHIP", ChipID::ValueCAN4_4_SCHIP)
|
||||
.value("cmProbe_ZYNQ", ChipID::cmProbe_ZYNQ)
|
||||
.value("EEVB_STM32", ChipID::EEVB_STM32)
|
||||
.value("neoVIFIRE_Slave_VNET_EP_MCHIP", ChipID::neoVIFIRE_Slave_VNET_EP_MCHIP)
|
||||
.value("neoVIFIRE_Slave_VNET_EP_LCHIP", ChipID::neoVIFIRE_Slave_VNET_EP_LCHIP)
|
||||
.value("RADStar_MCHIP", ChipID::RADStar_MCHIP)
|
||||
.value("ValueCANrf_MCHIP", ChipID::ValueCANrf_MCHIP)
|
||||
.value("neoVIFIRE2_MCHIP", ChipID::neoVIFIRE2_MCHIP)
|
||||
.value("neoVIFIRE2_CCHIP", ChipID::neoVIFIRE2_CCHIP)
|
||||
.value("neoVIFIRE2_Core", ChipID::neoVIFIRE2_Core)
|
||||
.value("neoVIFIRE2_BLECHIP", ChipID::neoVIFIRE2_BLECHIP)
|
||||
.value("neoVIFIRE2_ZYNQ", ChipID::neoVIFIRE2_ZYNQ)
|
||||
.value("neoVIFIRE2_SECURITYCHIP", ChipID::neoVIFIRE2_SECURITYCHIP)
|
||||
.value("RADGalaxy_ZYNQ", ChipID::RADGalaxy_ZYNQ)
|
||||
.value("neoVIFIRE2_VNET_MCHIP", ChipID::neoVIFIRE2_VNET_MCHIP)
|
||||
.value("neoVIFIRE2_Slave_VNET_A_MCHIP", ChipID::neoVIFIRE2_Slave_VNET_A_MCHIP)
|
||||
.value("neoVIFIRE2_Slave_VNET_A_CCHIP", ChipID::neoVIFIRE2_Slave_VNET_A_CCHIP)
|
||||
.value("neoVIFIRE2_VNET_CCHIP", ChipID::neoVIFIRE2_VNET_CCHIP)
|
||||
.value("neoVIFIRE2_VNET_Core", ChipID::neoVIFIRE2_VNET_Core)
|
||||
.value("RADStar2_ZYNQ", ChipID::RADStar2_ZYNQ)
|
||||
.value("VividCAN_MCHIP", ChipID::VividCAN_MCHIP)
|
||||
.value("neoOBD2SIM_MCHIP", ChipID::neoOBD2SIM_MCHIP)
|
||||
.value("neoVIFIRE2_VNETZ_MCHIP", ChipID::neoVIFIRE2_VNETZ_MCHIP)
|
||||
.value("neoVIFIRE2_VNETZ_ZYNQ", ChipID::neoVIFIRE2_VNETZ_ZYNQ)
|
||||
.value("neoVIFIRE2_Slave_VNETZ_A_MCHIP", ChipID::neoVIFIRE2_Slave_VNETZ_A_MCHIP)
|
||||
.value("neoVIFIRE2_Slave_VNETZ_A_ZYNQ", ChipID::neoVIFIRE2_Slave_VNETZ_A_ZYNQ)
|
||||
.value("VividCAN_EXT_FLASH", ChipID::VividCAN_EXT_FLASH)
|
||||
.value("VividCAN_NRF52", ChipID::VividCAN_NRF52)
|
||||
.value("cmProbe_ZYNQ_Unused", ChipID::cmProbe_ZYNQ_Unused)
|
||||
.value("neoOBD2PRO_MCHIP", ChipID::neoOBD2PRO_MCHIP)
|
||||
.value("ValueCAN4_1_MCHIP", ChipID::ValueCAN4_1_MCHIP)
|
||||
.value("ValueCAN4_2_MCHIP", ChipID::ValueCAN4_2_MCHIP)
|
||||
.value("ValueCAN4_4_2EL_Core", ChipID::ValueCAN4_4_2EL_Core)
|
||||
.value("neoOBD2PRO_SCHIP", ChipID::neoOBD2PRO_SCHIP)
|
||||
.value("ValueCAN4_2EL_MCHIP", ChipID::ValueCAN4_2EL_MCHIP)
|
||||
.value("neoECUAVBTSN_MCHIP", ChipID::neoECUAVBTSN_MCHIP)
|
||||
.value("neoOBD2PRO_Core", ChipID::neoOBD2PRO_Core)
|
||||
.value("RADSupermoon_ZYNQ", ChipID::RADSupermoon_ZYNQ)
|
||||
.value("RADMoon2_ZYNQ", ChipID::RADMoon2_ZYNQ)
|
||||
.value("VividCANPRO_MCHIP", ChipID::VividCANPRO_MCHIP)
|
||||
.value("VividCANPRO_EXT_FLASH", ChipID::VividCANPRO_EXT_FLASH)
|
||||
.value("RADPluto_MCHIP", ChipID::RADPluto_MCHIP)
|
||||
.value("RADMars_ZYNQ", ChipID::RADMars_ZYNQ)
|
||||
.value("neoECU12_MCHIP", ChipID::neoECU12_MCHIP)
|
||||
.value("RADIOCANHUB_MCHIP", ChipID::RADIOCANHUB_MCHIP)
|
||||
.value("FlexRay_VNETZ_ZCHIP", ChipID::FlexRay_VNETZ_ZCHIP)
|
||||
.value("neoOBD2_LCBADGE_MCHIP", ChipID::neoOBD2_LCBADGE_MCHIP)
|
||||
.value("neoOBD2_LCBADGE_SCHIP", ChipID::neoOBD2_LCBADGE_SCHIP)
|
||||
.value("RADMoonDuo_MCHIP", ChipID::RADMoonDuo_MCHIP)
|
||||
.value("neoVIFIRE3_ZCHIP", ChipID::neoVIFIRE3_ZCHIP)
|
||||
.value("FlexRay_VNETZ_FCHIP", ChipID::FlexRay_VNETZ_FCHIP)
|
||||
.value("RADJupiter_MCHIP", ChipID::RADJupiter_MCHIP)
|
||||
.value("ValueCAN4Industrial_MCHIP", ChipID::ValueCAN4Industrial_MCHIP)
|
||||
.value("EtherBADGE_MCHIP", ChipID::EtherBADGE_MCHIP)
|
||||
.value("RADMars_3_ZYNQ", ChipID::RADMars_3_ZYNQ)
|
||||
.value("RADGigastar_USBZ_ZYNQ", ChipID::RADGigastar_USBZ_ZYNQ)
|
||||
.value("RADGigastar_ZYNQ", ChipID::RADGigastar_ZYNQ)
|
||||
.value("RAD4G_MCHIP", ChipID::RAD4G_MCHIP)
|
||||
.value("neoVIFIRE3_SCHIP", ChipID::neoVIFIRE3_SCHIP)
|
||||
.value("RADEpsilon_MCHIP", ChipID::RADEpsilon_MCHIP)
|
||||
.value("RADA2B_ZCHIP", ChipID::RADA2B_ZCHIP)
|
||||
.value("neoOBD2Dev_MCHIP", ChipID::neoOBD2Dev_MCHIP)
|
||||
.value("neoOBD2Dev_SCHIP", ChipID::neoOBD2Dev_SCHIP)
|
||||
.value("neoOBD2SIMDoIP_MCHIP", ChipID::neoOBD2SIMDoIP_MCHIP)
|
||||
.value("SFPModule_MCHIP", ChipID::SFPModule_MCHIP)
|
||||
.value("RADEpsilonT_MCHIP", ChipID::RADEpsilonT_MCHIP)
|
||||
.value("RADEpsilonExpress_MCHIP", ChipID::RADEpsilonExpress_MCHIP)
|
||||
.value("RADProxima_MCHIP", ChipID::RADProxima_MCHIP)
|
||||
.value("NewDevice57_ZCHIP", ChipID::NewDevice57_ZCHIP)
|
||||
.value("RAD_GALAXY_2_ZMPCHIP_ID", ChipID::RAD_GALAXY_2_ZMPCHIP_ID)
|
||||
.value("NewDevice59_MCHIP", ChipID::NewDevice59_MCHIP)
|
||||
.value("RADMoon2_Z7010_ZYNQ", ChipID::RADMoon2_Z7010_ZYNQ)
|
||||
.value("neoVIFIRE2_CORE_SG4", ChipID::neoVIFIRE2_CORE_SG4)
|
||||
.value("RADBMS_MCHIP", ChipID::RADBMS_MCHIP)
|
||||
.value("RADMoon2_ZL_MCHIP", ChipID::RADMoon2_ZL_MCHIP)
|
||||
.value("RADGigastar_USBZ_Z7010_ZYNQ", ChipID::RADGigastar_USBZ_Z7010_ZYNQ)
|
||||
.value("neoVIFIRE3_LINUX", ChipID::neoVIFIRE3_LINUX)
|
||||
.value("RADGigastar_USBZ_Z7007S_ZYNQ", ChipID::RADGigastar_USBZ_Z7007S_ZYNQ)
|
||||
.value("VEM_01_8DW_ZCHIP", ChipID::VEM_01_8DW_ZCHIP)
|
||||
.value("RADGalaxy_FFG_Zynq", ChipID::RADGalaxy_FFG_Zynq)
|
||||
.value("RADMoon3_MCHIP", ChipID::RADMoon3_MCHIP)
|
||||
.value("RADComet_ZYNQ", ChipID::RADComet_ZYNQ)
|
||||
.value("VEM_02_FR_ZCHIP", ChipID::VEM_02_FR_ZCHIP)
|
||||
.value("RADA2B_REVB_ZCHIP", ChipID::RADA2B_REVB_ZCHIP)
|
||||
.value("RADGigastar_FFG_ZYNQ", ChipID::RADGigastar_FFG_ZYNQ)
|
||||
.value("VEM_02_FR_FCHIP", ChipID::VEM_02_FR_FCHIP)
|
||||
.value("Connect_ZCHIP", ChipID::Connect_ZCHIP)
|
||||
.value("RADGALAXY2_SYSMON_CHIP", ChipID::RADGALAXY2_SYSMON_CHIP)
|
||||
.value("RADCOMET3_ZCHIP", ChipID::RADCOMET3_ZCHIP)
|
||||
.value("Connect_LINUX", ChipID::Connect_LINUX)
|
||||
.value("RADGigastar2_ZYNQ", ChipID::RADGigastar2_ZYNQ)
|
||||
.value("Invalid", ChipID::Invalid);
|
||||
}
|
||||
|
||||
} // namespace icsneo
|
||||
|
|
@ -55,6 +55,8 @@ void init_device(pybind11::module_& m) {
|
|||
.def("transmit", pybind11::overload_cast<std::shared_ptr<Frame>>(&Device::transmit), pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("upload_coremini", [](Device& device, std::string& path, Disk::MemoryType memType) { std::ifstream ifs(path, std::ios::binary); return device.uploadCoremini(ifs, memType); }, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("write_macsec_config", &Device::writeMACsecConfig, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("send_eth_phy_msg", &Device::sendEthPhyMsg, pybind11::arg("message"), pybind11::arg("timeout") = std::chrono::milliseconds(50), pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("get_chip_versions", &Device::getChipVersions, pybind11::arg("refreshComponents") = true, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def_readonly("settings", &Device::settings);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ void init_devicetype(pybind11::module_& m) {
|
|||
.value("RADMoon3", DeviceType::Enum::RADMoon3)
|
||||
.value("RADComet", DeviceType::Enum::RADComet)
|
||||
.value("FIRE3_FlexRay", DeviceType::Enum::FIRE3_FlexRay)
|
||||
.value("FIRE3_T1S_LIN", DeviceType::Enum::FIRE3_T1S_LIN)
|
||||
.value("FIRE3_T1S_SENT", DeviceType::Enum::FIRE3_T1S_SENT)
|
||||
.value("Connect", DeviceType::Enum::Connect)
|
||||
.value("RADComet3", DeviceType::Enum::RADComet3)
|
||||
.value("RADMoonT1S", DeviceType::Enum::RADMoonT1S)
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ void init_idevicesettings(pybind11::module_& m) {
|
|||
.def("set_phy_enable", &IDeviceSettings::setPhyEnable, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("set_phy_mode", &IDeviceSettings::setPhyMode, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("set_phy_speed", &IDeviceSettings::setPhySpeed, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("refresh", &IDeviceSettings::refresh, pybind11::arg("ignoreChecksum") = 0, pybind11::call_guard<pybind11::gil_scoped_release>());
|
||||
.def("refresh", &IDeviceSettings::refresh, pybind11::call_guard<pybind11::gil_scoped_release>());
|
||||
}
|
||||
|
||||
} // namespace icsneo
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/stl.h>
|
||||
#include <pybind11/functional.h>
|
||||
|
||||
#include "icsneo/device/versionreport.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
void init_versionreport(pybind11::module_& m) {
|
||||
pybind11::class_<VersionReport>(m, "VersionReport")
|
||||
.def_readonly("id", &VersionReport::id)
|
||||
.def_readonly("name", &VersionReport::name)
|
||||
.def_readonly("major", &VersionReport::major)
|
||||
.def_readonly("minor", &VersionReport::minor)
|
||||
.def_readonly("maintenance", &VersionReport::maintenance)
|
||||
.def_readonly("build", &VersionReport::build);
|
||||
}
|
||||
|
||||
} // namespace icsneo
|
||||
|
|
@ -20,17 +20,21 @@ void init_linmessage(pybind11::module_&);
|
|||
void init_tc10statusmessage(pybind11::module_&);
|
||||
void init_gptpstatusmessage(pybind11::module_&);
|
||||
void init_mdiomessage(pybind11::module_&);
|
||||
void init_spimessage(pybind11::module_&);
|
||||
void init_ethernetstatusmessage(pybind11::module_&);
|
||||
void init_macsecmessage(pybind11::module_&);
|
||||
void init_scriptstatusmessage(pybind11::module_&);
|
||||
void init_diskdriver(pybind11::module_&);
|
||||
void init_deviceextension(pybind11::module_&);
|
||||
void init_chipid(pybind11::module_&);
|
||||
void init_versionreport(pybind11::module_&);
|
||||
void init_device(pybind11::module_&);
|
||||
void init_messagefilter(pybind11::module_&);
|
||||
void init_messagecallback(pybind11::module_&);
|
||||
void init_version(pybind11::module_&);
|
||||
void init_flexray(pybind11::module_& m);
|
||||
void init_idevicesettings(pybind11::module_&);
|
||||
void init_ethphymessage(pybind11::module_&);
|
||||
|
||||
PYBIND11_MODULE(icsneopy, m) {
|
||||
pybind11::options options;
|
||||
|
|
@ -55,10 +59,14 @@ PYBIND11_MODULE(icsneopy, m) {
|
|||
init_ethernetstatusmessage(m);
|
||||
init_macsecmessage(m);
|
||||
init_scriptstatusmessage(m);
|
||||
init_spimessage(m);
|
||||
init_messagefilter(m);
|
||||
init_messagecallback(m);
|
||||
init_diskdriver(m);
|
||||
init_flexray(m);
|
||||
init_ethphymessage(m);
|
||||
init_chipid(m);
|
||||
init_versionreport(m);
|
||||
init_device(m);
|
||||
init_deviceextension(m);
|
||||
init_idevicesettings(m);
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
#include "icsneo/communication/packet/genericbinarystatuspacket.h"
|
||||
#include "icsneo/communication/packet/livedatapacket.h"
|
||||
#include "icsneo/communication/packet/hardwareinfopacket.h"
|
||||
#include "icsneo/communication/packet/spipacket.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
|
@ -58,7 +59,7 @@ uint64_t Decoder::GetUInt64FromLEBytes(const uint8_t* bytes) {
|
|||
bool Decoder::decode(std::shared_ptr<Message>& result, const std::shared_ptr<Packet>& packet) {
|
||||
switch(packet->network.getType()) {
|
||||
case Network::Type::Ethernet: {
|
||||
result = HardwareEthernetPacket::DecodeToMessage(packet->data, report);
|
||||
result = HardwareEthernetPacket::DecodeToMessage(packet->data);
|
||||
if(!result) {
|
||||
report(APIEvent::Type::PacketDecodingError, APIEvent::Severity::Error);
|
||||
return false; // A nullptr was returned, the packet was not long enough to decode
|
||||
|
|
@ -184,6 +185,19 @@ bool Decoder::decode(std::shared_ptr<Message>& result, const std::shared_ptr<Pac
|
|||
msg.timestamp *= timestampResolution;
|
||||
return true;
|
||||
}
|
||||
case Network::Type::SPI: {
|
||||
result = HardwareSPIPacket::DecodeToMessage(packet->data);
|
||||
|
||||
if(!result) {
|
||||
report(APIEvent::Type::PacketDecodingError, APIEvent::Severity::Error);
|
||||
return false; // A nullptr was returned, the packet was not long enough to decode
|
||||
}
|
||||
|
||||
SPIMessage& msg = *static_cast<SPIMessage*>(result.get());
|
||||
msg.network = packet->network;
|
||||
msg.timestamp *= timestampResolution;
|
||||
return true;
|
||||
}
|
||||
case Network::Type::MDIO: {
|
||||
result = HardwareMDIOPacket::DecodeToMessage(packet->data);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,18 +38,10 @@ bool Driver::waitForRx(std::function<bool()> predicate, std::chrono::millisecond
|
|||
}
|
||||
|
||||
bool Driver::readWait(std::vector<uint8_t>& bytes, std::chrono::milliseconds timeout, size_t limit) {
|
||||
// A limit of zero indicates no limit
|
||||
if(limit == 0)
|
||||
limit = (size_t)-1;
|
||||
|
||||
if(limit > (readBuffer.size() + 4))
|
||||
limit = (readBuffer.size() + 4);
|
||||
|
||||
|
||||
// wait until we have enough data, or the timout occurs
|
||||
// wait until we have enough data, or the timeout occurs
|
||||
waitForRx(limit, timeout);
|
||||
|
||||
size_t actuallyRead = std::min(readBuffer.size(), limit);
|
||||
size_t actuallyRead = readBuffer.size();
|
||||
bytes.resize(actuallyRead);
|
||||
|
||||
readBuffer.read(bytes.data(), 0, actuallyRead);
|
||||
|
|
@ -79,8 +71,12 @@ bool Driver::write(const std::vector<uint8_t>& bytes) {
|
|||
|
||||
if(writeBlocks) {
|
||||
if(writeQueueFull()) {
|
||||
while(writeQueueAlmostFull()) // Wait until we have some decent amount of space
|
||||
while(writeQueueAlmostFull() && !isDisconnected() && !isClosing()) // Wait until we have some decent amount of space
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
|
||||
if(isDisconnected() || isClosing()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(writeQueueFull()) {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include "icsneo/communication/packet/a2bpacket.h"
|
||||
#include "icsneo/communication/packet/linpacket.h"
|
||||
#include "icsneo/communication/packet/mdiopacket.h"
|
||||
#include "icsneo/communication/packet/spipacket.h"
|
||||
|
||||
using namespace icsneo;
|
||||
|
||||
|
|
@ -133,6 +134,17 @@ bool Encoder::encode(const Packetizer& packetizer, std::vector<uint8_t>& result,
|
|||
}
|
||||
break;
|
||||
} // End of Network::Type::MDIO
|
||||
case Network::Type::SPI: {
|
||||
auto msg = std::dynamic_pointer_cast<SPIMessage>(message);
|
||||
if(!msg) {
|
||||
report(APIEvent::Type::MessageFormattingError, APIEvent::Severity::Error);
|
||||
return false; // The message was not a properly formed LiveDataMessage
|
||||
}
|
||||
if(!HardwareSPIPacket::EncodeFromMessage(*msg, result, report))
|
||||
return false;
|
||||
result = packetizer.packetWrap(result, false);
|
||||
return true;
|
||||
} // End of Network::Type::SPI
|
||||
default:
|
||||
report(APIEvent::Type::UnexpectedNetworkType, APIEvent::Severity::Error);
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -133,6 +133,10 @@ EthernetPacketizer::EthernetPacket::EthernetPacket(const uint8_t* data, size_t s
|
|||
|
||||
int EthernetPacketizer::EthernetPacket::loadBytestream(const std::vector<uint8_t>& bytestream) {
|
||||
errorWhileDecodingFromBytestream = 0;
|
||||
if (bytestream.size() < 24) {
|
||||
errorWhileDecodingFromBytestream = 1;
|
||||
return errorWhileDecodingFromBytestream;
|
||||
}
|
||||
for(size_t i = 0; i < 6; i++)
|
||||
destMAC[i] = bytestream[i];
|
||||
for(size_t i = 0; i < 6; i++)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ bool EthPhyMessage::appendPhyMessage(bool writeEnable, bool clause45, uint8_t ph
|
|||
msg->Clause45Enable = clause45;
|
||||
msg->Enabled = enabled;
|
||||
msg->WriteEnable = writeEnable;
|
||||
msg->version = 1u;
|
||||
msg->Version = 1u;
|
||||
if( (FiveBits < phyAddrOrPort) ||
|
||||
(clause45 && (FiveBits < pageOrDevice)) ||
|
||||
(!clause45 && (FiveBits < regAddr)) )
|
||||
|
|
@ -18,17 +18,17 @@ bool EthPhyMessage::appendPhyMessage(bool writeEnable, bool clause45, uint8_t ph
|
|||
|
||||
if(clause45)
|
||||
{
|
||||
msg->clause45.port = phyAddrOrPort;
|
||||
msg->clause45.device = pageOrDevice;
|
||||
msg->clause45.regAddr = regAddr;
|
||||
msg->clause45.regVal = regVal;
|
||||
msg->Clause45.port = phyAddrOrPort;
|
||||
msg->Clause45.device = pageOrDevice;
|
||||
msg->Clause45.regAddr = regAddr;
|
||||
msg->Clause45.regVal = regVal;
|
||||
}
|
||||
else
|
||||
{
|
||||
msg->clause22.phyAddr = phyAddrOrPort;
|
||||
msg->clause22.page = pageOrDevice;
|
||||
msg->clause22.regAddr = regAddr;
|
||||
msg->clause22.regVal = regVal;
|
||||
msg->Clause22.phyAddr = phyAddrOrPort;
|
||||
msg->Clause22.page = pageOrDevice;
|
||||
msg->Clause22.regAddr = regAddr;
|
||||
msg->Clause22.regVal = regVal;
|
||||
}
|
||||
return appendPhyMessage(msg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ using namespace icsneo;
|
|||
MultiChannelCommunication::MultiChannelCommunication(device_eventhandler_t err, std::unique_ptr<Driver> com,
|
||||
std::function<std::unique_ptr<Packetizer>()> makeConfiguredPacketizer, std::unique_ptr<Encoder> e,
|
||||
std::unique_ptr<Decoder> md, size_t vnetCount) :
|
||||
Communication(err, std::move(com), makeConfiguredPacketizer, std::move(e), std::move(md)), numVnets(vnetCount) {
|
||||
Communication(err, std::move(com), makeConfiguredPacketizer, std::move(e), std::move(md)), numVnets(vnetCount), packetRB(2048) {
|
||||
vnetThreads.resize(numVnets);
|
||||
vnetQueues.resize(numVnets);
|
||||
}
|
||||
|
|
@ -24,6 +24,7 @@ void MultiChannelCommunication::spawnThreads() {
|
|||
|
||||
void MultiChannelCommunication::joinThreads() {
|
||||
closing = true;
|
||||
ringBufCV.notify_all();
|
||||
if(hidReadThread.joinable())
|
||||
hidReadThread.join();
|
||||
for(auto& thread : vnetThreads) {
|
||||
|
|
@ -148,9 +149,13 @@ void MultiChannelCommunication::hidReadTask() {
|
|||
break;
|
||||
}
|
||||
|
||||
if(!currentQueue->enqueue(std::move(payloadBytes)) && gotPacket)
|
||||
EventManager::GetInstance().add(APIEvent(APIEvent::Type::FailedToRead, APIEvent::Severity::Error));
|
||||
payloadBytes.clear();
|
||||
{
|
||||
std::unique_lock lk(ringBufMutex);
|
||||
if(!packetRB.write(std::move(payloadBytes)) && gotPacket)
|
||||
EventManager::GetInstance().add(APIEvent(APIEvent::Type::FailedToRead, APIEvent::Severity::Error));
|
||||
payloadBytes.clear();
|
||||
}
|
||||
ringBufCV.notify_all();
|
||||
gotPacket = true;
|
||||
state = PreprocessState::SearchForCommand;
|
||||
break;
|
||||
|
|
@ -160,7 +165,6 @@ void MultiChannelCommunication::hidReadTask() {
|
|||
}
|
||||
|
||||
void MultiChannelCommunication::vnetReadTask(size_t vnetIndex) {
|
||||
moodycamel::BlockingReaderWriterQueue< std::vector<uint8_t> >& queue = vnetQueues[vnetIndex];
|
||||
std::vector<uint8_t> payloadBytes;
|
||||
std::unique_ptr<Packetizer> packetizerLifetime;
|
||||
Packetizer* vnetPacketizer;
|
||||
|
|
@ -174,14 +178,19 @@ void MultiChannelCommunication::vnetReadTask(size_t vnetIndex) {
|
|||
EventManager::GetInstance().downgradeErrorsOnCurrentThread();
|
||||
|
||||
while(!closing) {
|
||||
if(queue.wait_dequeue_timed(payloadBytes, std::chrono::milliseconds(250))) {
|
||||
if(closing)
|
||||
break;
|
||||
|
||||
auto& ringBuffer = driver->getReadBuffer();
|
||||
ringBuffer.write(payloadBytes);
|
||||
|
||||
handleInput(*vnetPacketizer);
|
||||
std::unique_lock lk(ringBufMutex);
|
||||
ringBufCV.wait(lk);
|
||||
if(closing) {
|
||||
break;
|
||||
}
|
||||
if(vnetPacketizer->input(packetRB)) {
|
||||
for(const auto& packet : vnetPacketizer->output()) {
|
||||
std::shared_ptr<Message> msg;
|
||||
if(!decoder->decode(msg, packet))
|
||||
continue;
|
||||
|
||||
dispatchMessage(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
using namespace icsneo;
|
||||
|
||||
std::shared_ptr<EthernetMessage> HardwareEthernetPacket::DecodeToMessage(const std::vector<uint8_t>& bytestream, const device_eventhandler_t& report) {
|
||||
std::shared_ptr<EthernetMessage> HardwareEthernetPacket::DecodeToMessage(const std::vector<uint8_t>& bytestream) {
|
||||
const HardwareEthernetPacket* packet = (const HardwareEthernetPacket*)((const void*)bytestream.data());
|
||||
const uint16_t* rawWords = (const uint16_t*)bytestream.data();
|
||||
// Make sure we have enough to read the packet length first
|
||||
|
|
@ -18,9 +18,6 @@ std::shared_ptr<EthernetMessage> HardwareEthernetPacket::DecodeToMessage(const s
|
|||
const size_t bytestreamActualSize = bytestream.size();
|
||||
if(bytestreamActualSize < bytestreamExpectedSize)
|
||||
return nullptr;
|
||||
// Check for oversized packets, noting that some devices will send an extra byte to have an even number of bytes
|
||||
if(bytestreamActualSize > bytestreamExpectedSize + 1)
|
||||
report(APIEvent::Type::PacketDecodingError, APIEvent::Severity::EventWarning);
|
||||
auto messagePtr = std::make_shared<EthernetMessage>();
|
||||
EthernetMessage& message = *messagePtr;
|
||||
message.transmitted = packet->eid.TXMSG;
|
||||
|
|
|
|||
|
|
@ -34,11 +34,12 @@ std::shared_ptr<EthPhyMessage> HardwareEthernetPhyRegisterPacket::DecodeToMessag
|
|||
phyMessage->Enabled = (pEntry->Enabled != 0u);
|
||||
phyMessage->WriteEnable = (pEntry->WriteEnable != 0u);
|
||||
phyMessage->Clause45Enable = (pEntry->Clause45Enable != 0u);
|
||||
phyMessage->version = static_cast<uint8_t>(pEntry->version);
|
||||
phyMessage->BusIndex = static_cast<uint8_t>(pEntry->BusIndex);
|
||||
phyMessage->Version = static_cast<uint8_t>(pEntry->version);
|
||||
if(phyMessage->Clause45Enable)
|
||||
phyMessage->clause45 = pEntry->clause45;
|
||||
phyMessage->Clause45 = pEntry->clause45;
|
||||
else
|
||||
phyMessage->clause22 = pEntry->clause22;
|
||||
phyMessage->Clause22 = pEntry->clause22;
|
||||
msg->messages.push_back(phyMessage);
|
||||
}
|
||||
}
|
||||
|
|
@ -69,34 +70,35 @@ bool HardwareEthernetPhyRegisterPacket::EncodeFromMessage(const EthPhyMessage& m
|
|||
PhyRegisterPacket_t tempPacket;
|
||||
tempPacket.Enabled = phyMessage->Enabled ? 0x1u : 0x0u;
|
||||
tempPacket.WriteEnable = phyMessage->WriteEnable ? 0x1u : 0x0u;
|
||||
tempPacket.version = (phyMessage->version & 0xF);
|
||||
tempPacket.BusIndex = (phyMessage->BusIndex & 0xF);
|
||||
tempPacket.version = (phyMessage->Version & 0xF);
|
||||
if(phyMessage->Clause45Enable)
|
||||
{
|
||||
if( (FiveBits < phyMessage->clause45.port) ||
|
||||
(FiveBits < phyMessage->clause45.device) )
|
||||
if( (FiveBits < phyMessage->Clause45.port) ||
|
||||
(FiveBits < phyMessage->Clause45.device) )
|
||||
{
|
||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
tempPacket.Clause45Enable = 0x1u;
|
||||
tempPacket.clause45.port = phyMessage->clause45.port;
|
||||
tempPacket.clause45.device = phyMessage->clause45.device;
|
||||
tempPacket.clause45.regAddr = phyMessage->clause45.regAddr;
|
||||
tempPacket.clause45.regVal = phyMessage->clause45.regVal;
|
||||
tempPacket.clause45.port = phyMessage->Clause45.port;
|
||||
tempPacket.clause45.device = phyMessage->Clause45.device;
|
||||
tempPacket.clause45.regAddr = phyMessage->Clause45.regAddr;
|
||||
tempPacket.clause45.regVal = phyMessage->Clause45.regVal;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( (FiveBits < phyMessage->clause22.phyAddr) ||
|
||||
(FiveBits < phyMessage->clause22.regAddr) )
|
||||
if( (FiveBits < phyMessage->Clause22.phyAddr) ||
|
||||
(FiveBits < phyMessage->Clause22.regAddr) )
|
||||
{
|
||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
tempPacket.Clause45Enable = 0x0u;
|
||||
tempPacket.clause22.phyAddr = phyMessage->clause22.phyAddr;
|
||||
tempPacket.clause22.page = phyMessage->clause22.page;
|
||||
tempPacket.clause22.regAddr = phyMessage->clause22.regAddr;
|
||||
tempPacket.clause22.regVal = phyMessage->clause22.regVal;
|
||||
tempPacket.clause22.phyAddr = phyMessage->Clause22.phyAddr;
|
||||
tempPacket.clause22.page = phyMessage->Clause22.page;
|
||||
tempPacket.clause22.regAddr = phyMessage->Clause22.regAddr;
|
||||
tempPacket.clause22.regVal = phyMessage->Clause22.regVal;
|
||||
}
|
||||
uint8_t* pktPtr = reinterpret_cast<uint8_t*>(&tempPacket);
|
||||
bytestream.insert(bytestream.end(), pktPtr, pktPtr + sizeof(PhyRegisterPacket_t));
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ namespace icsneo
|
|||
report(APIEvent::Type::I2CMessageExceedsMaxLength, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
if(message.controlBytes.empty() || message.dataBytes.empty())
|
||||
if(message.controlBytes.empty() && message.dataBytes.empty())
|
||||
{
|
||||
//You'll need to provide a target R/W register in controlBytes
|
||||
//alternatively, you're expecting to read without providing a dataBytes payload
|
||||
|
|
|
|||
|
|
@ -0,0 +1,82 @@
|
|||
#include "icsneo/communication/packet/spipacket.h"
|
||||
#include "icsneo/communication/command.h"
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
|
||||
using namespace icsneo;
|
||||
|
||||
static size_t SPISubHeaderLength = 5u;
|
||||
|
||||
std::shared_ptr<Message> HardwareSPIPacket::DecodeToMessage(const std::vector<uint8_t>& bytestream) {
|
||||
if(bytestream.size() < sizeof(HardwareSPIPacket)) {
|
||||
return nullptr;
|
||||
}
|
||||
const HardwareSPIPacket* packet = (const HardwareSPIPacket*)bytestream.data();
|
||||
size_t totalPackedLength = static_cast<size_t>(bytestream.size()) - sizeof(HardwareSPIPacket); // First 28 bytes are message header.
|
||||
if(totalPackedLength < SPISubHeaderLength) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const uint8_t* bytes = bytestream.data() + sizeof(HardwareSPIPacket);
|
||||
std::shared_ptr<SPIMessage> msg = std::make_shared<SPIMessage>();
|
||||
msg->direction = static_cast<SPIMessage::Direction>(bytes[0]);
|
||||
msg->address = *reinterpret_cast<const uint16_t*>(&bytes[1]);
|
||||
msg->mms = bytes[3];
|
||||
msg->stats = packet->stats;
|
||||
msg->timestamp = packet->timestamp.TS;
|
||||
|
||||
size_t numWords = (totalPackedLength - SPISubHeaderLength) / 4;
|
||||
msg->payload.reserve(numWords);
|
||||
for(size_t offset = SPISubHeaderLength; offset < totalPackedLength; offset += 4) {
|
||||
msg->payload.push_back(*reinterpret_cast<const uint32_t*>(bytes + offset));
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
bool HardwareSPIPacket::EncodeFromMessage(const SPIMessage& message, std::vector<uint8_t>& bytestream, const device_eventhandler_t& /*report*/) {
|
||||
// Payload length is everything excluding cmdHeader (note at the beginning there is an offset of 2)
|
||||
uint16_t payloadLength = static_cast<uint16_t>(
|
||||
2 +
|
||||
sizeof(HardwareSPIPacket) +
|
||||
SPISubHeaderLength +
|
||||
message.payload.size() * sizeof(uint32_t)
|
||||
);
|
||||
if(payloadLength % 2) {
|
||||
// Pad payload to even number
|
||||
payloadLength++;
|
||||
}
|
||||
// +1 for AA, another +1 for firmware nuance
|
||||
uint16_t fullSize = 1 + sizeof(ExtendedCommandHeader) + payloadLength + 1;
|
||||
uint16_t unwrappedSize = sizeof(ExtendedCommandHeader) + payloadLength; // fullSize without AA and firmware nuance
|
||||
|
||||
bytestream.resize(unwrappedSize, 0);
|
||||
uint32_t offset = 0;
|
||||
auto* cmdHeader = reinterpret_cast<ExtendedCommandHeader*>(bytestream.data() + offset);
|
||||
cmdHeader->netid = static_cast<uint8_t>(Network::NetID::Main51);
|
||||
cmdHeader->fullLength = fullSize;
|
||||
cmdHeader->command = static_cast<uint8_t>(Command::Extended);
|
||||
cmdHeader->extendedCommand = static_cast<uint16_t>(ExtendedCommand::TransmitCoreminiMessage);
|
||||
cmdHeader->payloadLength = payloadLength;
|
||||
|
||||
offset += sizeof(ExtendedCommandHeader) + 2; // Offset of 2 between header and packet
|
||||
auto* packet = reinterpret_cast<HardwareSPIPacket*>(bytestream.data() + offset);
|
||||
packet->header.frameLength = static_cast<uint16_t>(SPISubHeaderLength + message.payload.size() * sizeof(uint32_t));
|
||||
packet->networkID = static_cast<uint16_t>(message.network.getNetID());
|
||||
packet->length = packet->header.frameLength;
|
||||
packet->timestamp.IsExtended = 1;
|
||||
|
||||
offset += sizeof(HardwareSPIPacket);
|
||||
// Write the sub header details
|
||||
bytestream[offset++] = static_cast<uint8_t>(message.direction);
|
||||
bytestream[offset++] = static_cast<uint8_t>(message.address & 0xFF);
|
||||
bytestream[offset++] = static_cast<uint8_t>((message.address >> 8) & 0xFF);
|
||||
bytestream[offset++] = static_cast<uint8_t>(message.mms);
|
||||
bytestream[offset++] = static_cast<uint8_t>(message.payload.size());
|
||||
|
||||
// Write the words
|
||||
for(uint32_t word : message.payload) {
|
||||
*reinterpret_cast<uint32_t*>(bytestream.data() + offset) = word;
|
||||
offset += sizeof(uint32_t);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -31,24 +31,46 @@ std::shared_ptr<WiVI::ResponseMessage> WiVI::CommandPacket::DecodeToMessage(cons
|
|||
break;
|
||||
}
|
||||
case WiVI::Command::GetAll: {
|
||||
if(bytestream.size() < sizeof(WiVI::CommandPacket::GetAll))
|
||||
if(bytestream.size() < sizeof(WiVI::CommandPacket::GetAllHeader))
|
||||
return {};
|
||||
|
||||
const auto& getAll = *reinterpret_cast<const WiVI::CommandPacket::GetAll*>(bytestream.data());
|
||||
const auto& getAll = *reinterpret_cast<const WiVI::CommandPacket::GetAllHeader*>(bytestream.data());
|
||||
msg->responseTo = WiVI::Command::GetAll;
|
||||
msg->info.emplace();
|
||||
msg->info->sleepRequest = getAll.sleepRequest;
|
||||
msg->info->connectionTimeoutMinutes = getAll.connectionTimeoutMinutes;
|
||||
|
||||
// Check that we have enough data for the capture infos
|
||||
if(bytestream.size() < sizeof(WiVI::CommandPacket::GetAll) + (sizeof(WiVI::CaptureInfo) * getAll.numCaptureInfos))
|
||||
size_t captureInfosSize = sizeof(WiVI::CaptureInfo) * getAll.numCaptureInfos;
|
||||
if(bytestream.size() < sizeof(WiVI::CommandPacket::GetAllHeader) + captureInfosSize)
|
||||
return {};
|
||||
|
||||
const WiVI::CaptureInfo* const captureInfos = (const WiVI::CaptureInfo*)(bytestream.data() + sizeof(WiVI::CommandPacket::GetAllHeader));
|
||||
msg->info->captures.resize(getAll.numCaptureInfos);
|
||||
for(uint16_t i = 0; i < getAll.numCaptureInfos; i++)
|
||||
msg->info->captures[i] = getAll.captureInfos[i];
|
||||
msg->info->captures[i] = captureInfos[i];
|
||||
|
||||
|
||||
// New field vinAvail was added - check if it is present:
|
||||
if(bytestream.size() >= sizeof(WiVI::CommandPacket::GetAllHeader) + captureInfosSize + 2) {
|
||||
msg->info->vinAvailable = *(bytestream.data() + sizeof(WiVI::CommandPacket::GetAllHeader) + captureInfosSize);
|
||||
} else {
|
||||
msg->info->vinAvailable = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case WiVI::Command::GetVIN: {
|
||||
if (bytestream.size() < sizeof(WiVI::CommandPacket::GetVIN))
|
||||
return {};
|
||||
|
||||
const auto& getVIN = *reinterpret_cast<const WiVI::CommandPacket::GetVIN*>(bytestream.data());
|
||||
msg->responseTo = WiVI::Command::GetVIN;
|
||||
msg->vin = getVIN.VIN;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default: // Unknown command response
|
||||
return {};
|
||||
}
|
||||
|
|
@ -78,9 +100,9 @@ std::vector<uint8_t> WiVI::CommandPacket::SetSignal::Encode(WiVI::SignalType typ
|
|||
return ret;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> WiVI::CommandPacket::GetAll::Encode() {
|
||||
std::vector<uint8_t> ret(sizeof(WiVI::CommandPacket::GetAll));
|
||||
auto& frame = *reinterpret_cast<WiVI::CommandPacket::GetAll*>(ret.data());
|
||||
std::vector<uint8_t> WiVI::CommandPacket::GetAllHeader::Encode() {
|
||||
std::vector<uint8_t> ret(sizeof(WiVI::CommandPacket::GetAllHeader));
|
||||
auto& frame = *reinterpret_cast<WiVI::CommandPacket::GetAllHeader*>(ret.data());
|
||||
|
||||
frame.header.cmd = WiVI::Command::GetAll;
|
||||
frame.header.length = sizeof(frame) - sizeof(frame.header);
|
||||
|
|
@ -98,3 +120,15 @@ std::vector<uint8_t> WiVI::CommandPacket::ClearUploads::Encode(const std::vector
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> WiVI::CommandPacket::GetVIN::Encode()
|
||||
{
|
||||
std::vector<uint8_t> ret(sizeof(WiVI::CommandPacket::GetVIN));
|
||||
auto& frame = *reinterpret_cast<WiVI::CommandPacket::GetVIN*>(ret.data());
|
||||
|
||||
frame.header.cmd = WiVI::Command::GetVIN;
|
||||
frame.header.length = sizeof(frame) - sizeof(frame.header);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -207,6 +207,75 @@ bool Device::refreshComponentVersions() {
|
|||
return false;
|
||||
}
|
||||
|
||||
std::vector<VersionReport> Device::getChipVersions(bool refreshComponents) {
|
||||
if(refreshComponents) {
|
||||
refreshComponentVersions();
|
||||
}
|
||||
std::vector<VersionReport> chipVersions;
|
||||
|
||||
if (supportsComponentVersions()) {
|
||||
const auto& compVersions = getComponentVersions();
|
||||
auto disectVersion = [](uint32_t dotVersion) {
|
||||
std::array<uint8_t, 4> result = {0,0,0,0};
|
||||
size_t i = 0;
|
||||
|
||||
if(dotVersion & 0xFF000000ul) {
|
||||
result[i++] = (uint8_t)((dotVersion & 0xFF000000ul) >> 24);
|
||||
result[i++] = (uint8_t)((dotVersion & 0x00FF0000ul) >> 16);
|
||||
} else if(dotVersion & 0x00FF0000ul) {
|
||||
result[i++] = (uint8_t)((dotVersion & 0x00FF0000ul) >> 16);
|
||||
}
|
||||
result[i++] = (uint8_t)((dotVersion & 0x0000FF00ul) >> 8);
|
||||
result[i] = (uint8_t)((dotVersion & 0x000000FFul) >> 0);
|
||||
return result;
|
||||
};
|
||||
|
||||
for(const auto& chipInfo : getChipInfo()) {
|
||||
for(const auto& component : compVersions) {
|
||||
if(!component.valid) {
|
||||
continue;
|
||||
}
|
||||
if(component.identifier == (uint32_t)chipInfo.id) {
|
||||
chipVersions.emplace_back();
|
||||
auto& version = chipVersions.back();
|
||||
|
||||
auto disectedVersion = disectVersion(component.dotVersion);
|
||||
version.id = chipInfo.id;
|
||||
version.name = chipInfo.name;
|
||||
version.major = disectedVersion[0];
|
||||
version.minor = disectedVersion[1];
|
||||
version.maintenance = disectedVersion[2];
|
||||
version.build = disectedVersion[3];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const auto& appVersions = getVersions();
|
||||
for(const auto& chipInfo : getChipInfo()) {
|
||||
if(!chipInfo.defaultEnabled) {
|
||||
continue;
|
||||
}
|
||||
if(appVersions.size() <= chipInfo.versionIndex) {
|
||||
continue;
|
||||
}
|
||||
const auto& appVer = appVersions[chipInfo.versionIndex];
|
||||
if(!appVer) {
|
||||
continue;
|
||||
}
|
||||
chipVersions.emplace_back();
|
||||
auto& version = chipVersions.back();
|
||||
|
||||
version.id = chipInfo.id;
|
||||
version.name = chipInfo.name;
|
||||
version.major = appVer->major;
|
||||
version.minor = appVer->minor;
|
||||
version.maintenance = 0;
|
||||
version.build = 0;
|
||||
}
|
||||
}
|
||||
return chipVersions;
|
||||
}
|
||||
|
||||
bool Device::open(OpenFlags flags, OpenStatusHandler handler) {
|
||||
if(!com) {
|
||||
report(APIEvent::Type::Unknown, APIEvent::Severity::Error);
|
||||
|
|
@ -342,6 +411,38 @@ bool Device::open(OpenFlags flags, OpenStatusHandler handler) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Device::reconnect(std::chrono::milliseconds timeout, std::chrono::milliseconds interval) {
|
||||
if(isOnline()) {
|
||||
goOffline();
|
||||
}
|
||||
bool readsArePaused = com->readsArePaused();
|
||||
if(!com->close()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<FoundDevice> foundDevices;
|
||||
auto findAll = com->driver->getFinder();
|
||||
auto start = std::chrono::system_clock::now();
|
||||
while((std::chrono::system_clock::now() - start) < timeout) {
|
||||
foundDevices.clear();
|
||||
findAll(foundDevices);
|
||||
for(auto& fd : foundDevices) {
|
||||
if(!memcmp(fd.serial, data.serial, 6)) {
|
||||
com->driver = fd.makeDriver(report, getWritableNeoDevice());
|
||||
if(readsArePaused) {
|
||||
// Pause reads again
|
||||
com->pauseReads();
|
||||
}
|
||||
return com->open();
|
||||
}
|
||||
}
|
||||
std::this_thread::sleep_for(interval);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
APIEvent::Type Device::attemptToBeginCommunication() {
|
||||
versions.clear();
|
||||
|
||||
|
|
@ -1178,7 +1279,7 @@ void Device::wiviThreadBody() {
|
|||
|
||||
// Use the command GetAll to get a WiVI::Info structure from the device
|
||||
const auto generic = com->waitForMessageSync([this]() {
|
||||
return com->sendCommand(Command::WiVICommand, WiVI::CommandPacket::GetAll::Encode());
|
||||
return com->sendCommand(Command::WiVICommand, WiVI::CommandPacket::GetAllHeader::Encode());
|
||||
}, filter, std::chrono::milliseconds(1000));
|
||||
|
||||
if(!generic || generic->type != Message::Type::WiVICommandResponse) {
|
||||
|
|
@ -1290,6 +1391,22 @@ void Device::wiviThreadBody() {
|
|||
for(auto& cb : sleepRequestedCallbacks)
|
||||
cb.second = false;
|
||||
}
|
||||
|
||||
// Process vin available callbacks
|
||||
if (resp->info->vinAvailable & 1) {
|
||||
for (auto& cb : vinAvailableCallbacks) {
|
||||
if (!cb.second && cb.first) {
|
||||
cb.second = true;
|
||||
lk.unlock();
|
||||
try {
|
||||
cb.first();
|
||||
} catch(...) {
|
||||
report(APIEvent::Type::Unknown, APIEvent::Severity::Error);
|
||||
}
|
||||
lk.lock();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1464,6 +1581,110 @@ bool Device::allowSleep(bool remoteWakeup) {
|
|||
return true;
|
||||
}
|
||||
|
||||
Lifetime Device::addVINAvailableCallback(VINAvailableCallback cb)
|
||||
{
|
||||
if(!isOpen()) {
|
||||
report(APIEvent::Type::DeviceCurrentlyClosed, APIEvent::Severity::Error);
|
||||
return {};
|
||||
}
|
||||
|
||||
if(!supportsWiVI()) {
|
||||
report(APIEvent::Type::WiVINotSupported, APIEvent::Severity::Error);
|
||||
return {};
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lk(wiviMutex);
|
||||
if(!wiviThread.joinable()) {
|
||||
// Start the thread
|
||||
stopWiVIThread = false;
|
||||
wiviThread = std::thread([this]() { wiviThreadBody(); });
|
||||
}
|
||||
|
||||
size_t idx = 0;
|
||||
for(; idx < vinAvailableCallbacks.size(); idx++) {
|
||||
if(!vinAvailableCallbacks[idx].first) // Empty space (previously erased callback)
|
||||
break;
|
||||
}
|
||||
|
||||
if(idx == vinAvailableCallbacks.size()) // Create a new space
|
||||
vinAvailableCallbacks.emplace_back(std::move(cb), false);
|
||||
else
|
||||
vinAvailableCallbacks[idx] = { std::move(cb), false };
|
||||
|
||||
// Cleanup function to remove this sleep requested callback
|
||||
return Lifetime([this, idx]() {
|
||||
// TODO: Hold a weak ptr to the `this` instead of relying on the user to keep `this` valid
|
||||
std::unique_lock<std::mutex> lk2(wiviMutex);
|
||||
vinAvailableCallbacks[idx].first = VINAvailableCallback();
|
||||
stopWiVIThreadIfNecessary(std::move(lk2));
|
||||
});
|
||||
}
|
||||
|
||||
std::optional<bool> Device::isVINEnabled() const
|
||||
{
|
||||
if(!isOpen()) {
|
||||
report(APIEvent::Type::DeviceCurrentlyClosed, APIEvent::Severity::Error);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if(!supportsWiVI()) {
|
||||
report(APIEvent::Type::WiVINotSupported, APIEvent::Severity::Error);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static std::shared_ptr<MessageFilter> filter = std::make_shared<MessageFilter>(Message::Type::WiVICommandResponse);
|
||||
// Hold this lock so the WiVI stack doesn't issue a WiVICommand at the same time as us
|
||||
std::lock_guard<std::mutex> lk(wiviMutex);
|
||||
const auto generic = com->waitForMessageSync([this]() {
|
||||
return com->sendCommand(Command::WiVICommand, WiVI::CommandPacket::GetSignal::Encode(WiVI::SignalType::VINEnabled));
|
||||
}, filter, std::chrono::milliseconds(1000));
|
||||
|
||||
if(!generic || generic->type != Message::Type::WiVICommandResponse) {
|
||||
report(APIEvent::Type::NoDeviceResponse, APIEvent::Severity::Error);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
const auto resp = std::static_pointer_cast<WiVI::ResponseMessage>(generic);
|
||||
if(!resp->success || !resp->value.has_value()) {
|
||||
report(APIEvent::Type::ValueNotYetPresent, APIEvent::Severity::Error);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return *resp->value;
|
||||
}
|
||||
|
||||
std::optional<std::string> Device::getVIN() const
|
||||
{
|
||||
if(!isOpen()) {
|
||||
report(APIEvent::Type::DeviceCurrentlyClosed, APIEvent::Severity::Error);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if(!supportsWiVI()) {
|
||||
report(APIEvent::Type::WiVINotSupported, APIEvent::Severity::Error);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static std::shared_ptr<MessageFilter> filter = std::make_shared<MessageFilter>(Message::Type::WiVICommandResponse);
|
||||
std::lock_guard<std::mutex> lk(wiviMutex);
|
||||
const auto generic = com->waitForMessageSync([this]() {
|
||||
return com->sendCommand(Command::WiVICommand, WiVI::CommandPacket::GetVIN::Encode());
|
||||
}, filter, std::chrono::milliseconds(1000));
|
||||
|
||||
if(!generic || generic->type != Message::Type::WiVICommandResponse) {
|
||||
report(APIEvent::Type::NoDeviceResponse, APIEvent::Severity::Error);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
const auto resp = std::static_pointer_cast<WiVI::ResponseMessage>(generic);
|
||||
if(!resp->success || !resp->vin.has_value()) {
|
||||
report(APIEvent::Type::ValueNotYetPresent, APIEvent::Severity::Error);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return *resp->vin;
|
||||
}
|
||||
|
||||
void Device::scriptStatusThreadBody()
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(scriptStatusMutex);
|
||||
|
|
@ -1846,7 +2067,7 @@ std::optional<EthPhyMessage> Device::sendEthPhyMsg(const EthPhyMessage& message,
|
|||
HardwareEthernetPhyRegisterPacket::EncodeFromMessage(message, bytes, report);
|
||||
std::shared_ptr<Message> response = com->waitForMessageSync(
|
||||
[this, bytes](){ return com->sendCommand(Command::PHYControlRegisters, bytes); },
|
||||
std::make_shared<MessageFilter>(Network::NetID::EthPHYControl), timeout);
|
||||
std::make_shared<MessageFilter>(Message::Type::EthernetPhyRegister), timeout);
|
||||
|
||||
if(!response) {
|
||||
report(APIEvent::Type::NoDeviceResponse, APIEvent::Severity::Error);
|
||||
|
|
@ -3315,10 +3536,18 @@ std::optional<uint64_t> Device::vsaReadLogicalDisk(uint64_t pos, uint8_t* into,
|
|||
return readLogicalDisk(pos, into, amount);
|
||||
}
|
||||
uint64_t firstReadAmount = diskSize - pos;
|
||||
if(!readLogicalDisk(pos, into, firstReadAmount)) {
|
||||
uint64_t bytesRead = 0;
|
||||
if(auto optBytesReadFirst = readLogicalDisk(pos, into, firstReadAmount)) {
|
||||
bytesRead = *optBytesReadFirst;
|
||||
} else {
|
||||
return std::nullopt;
|
||||
}
|
||||
return readLogicalDisk(VSA::RecordStartOffset, into + firstReadAmount, amount - firstReadAmount);
|
||||
if(auto optBytesReadSecond = readLogicalDisk(VSA::RecordStartOffset, into + firstReadAmount, amount - firstReadAmount)) {
|
||||
bytesRead += *optBytesReadSecond;
|
||||
} else {
|
||||
return std::nullopt;
|
||||
}
|
||||
return bytesRead;
|
||||
}
|
||||
|
||||
bool Device::dispatchVSAMessages(VSAParser& parser) {
|
||||
|
|
|
|||
|
|
@ -35,15 +35,6 @@ static void makeIfSerialMatches(const FoundDevice& dev, std::vector<std::shared_
|
|||
into.push_back(std::make_shared<T>(dev));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static void makeIfPIDMatches(const FoundDevice& dev, std::vector<std::shared_ptr<Device>>& into) {
|
||||
// Relies on the subclass to have a `static constexpr uint16_t PRODUCT_ID = 0x1111`
|
||||
// and also a public constructor `T(const FoundDevice& dev)`
|
||||
// Use macro ICSNEO_FINDABLE_DEVICE_BY_PID() to create these
|
||||
if(dev.productId == T::PRODUCT_ID)
|
||||
into.push_back(std::make_shared<T>(dev));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static void makeIfSerialRangeMatches(const FoundDevice& dev, std::vector<std::shared_ptr<Device>>& into) {
|
||||
// Relies on the subclass to have
|
||||
|
|
@ -139,7 +130,7 @@ std::vector<std::shared_ptr<Device>> DeviceFinder::FindAll() {
|
|||
#endif
|
||||
|
||||
#ifdef __NEOVIFIRE_H_
|
||||
makeIfPIDMatches<NeoVIFIRE>(dev, newFoundDevices);
|
||||
makeIfSerialRangeMatches<NeoVIFIRE>(dev, newFoundDevices);
|
||||
#endif
|
||||
|
||||
#ifdef __NEOVIFIRE2_H_
|
||||
|
|
@ -154,16 +145,20 @@ std::vector<std::shared_ptr<Device>> DeviceFinder::FindAll() {
|
|||
makeIfSerialMatches<NeoVIFIRE3FlexRay>(dev, newFoundDevices);
|
||||
#endif
|
||||
|
||||
#ifdef __NEOVIFIRE3T1SLIN_H_
|
||||
makeIfSerialMatches<NeoVIFIRE3T1SLIN>(dev, newFoundDevices);
|
||||
#endif
|
||||
|
||||
#ifdef __NEOVIRED2_H_
|
||||
makeIfSerialMatches<NeoVIRED2>(dev, newFoundDevices);
|
||||
#endif
|
||||
|
||||
#ifdef __NEOVIION_H_
|
||||
makeIfPIDMatches<NeoVIION>(dev, newFoundDevices);
|
||||
makeIfSerialMatches<NeoVIION>(dev, newFoundDevices);
|
||||
#endif
|
||||
|
||||
#ifdef __NEOVIPLASMA_H_
|
||||
makeIfPIDMatches<NeoVIPLASMA>(dev, newFoundDevices);
|
||||
makeIfSerialMatches<NeoVIPLASMA>(dev, newFoundDevices);
|
||||
#endif
|
||||
|
||||
#ifdef __RADA2B_H_
|
||||
|
|
@ -247,7 +242,7 @@ std::vector<std::shared_ptr<Device>> DeviceFinder::FindAll() {
|
|||
#endif
|
||||
|
||||
#ifdef __VALUECAN3_H_
|
||||
makeIfPIDMatches<ValueCAN3>(dev, newFoundDevices);
|
||||
makeIfSerialRangeMatches<ValueCAN3>(dev, newFoundDevices);
|
||||
#endif
|
||||
|
||||
#ifdef __VALUECAN4_1_H_
|
||||
|
|
@ -325,6 +320,10 @@ const std::vector<DeviceType>& DeviceFinder::GetSupportedDevices() {
|
|||
NeoVIFIRE3FlexRay::DEVICE_TYPE,
|
||||
#endif
|
||||
|
||||
#ifdef __NEOVIFIRE3T1SLIN_H_
|
||||
NeoVIFIRE3T1SLIN::DEVICE_TYPE,
|
||||
#endif
|
||||
|
||||
#ifdef __NEOVIION_H_
|
||||
NeoVIION::DEVICE_TYPE,
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
using namespace icsneo;
|
||||
|
||||
std::optional<uint16_t> IDeviceSettings::CalculateGSChecksum(const std::vector<uint8_t>& settings, std::optional<size_t> knownSize) {
|
||||
std::optional<uint16_t> IDeviceSettings::CalculateGSChecksum(const std::vector<uint8_t>& settings) {
|
||||
const uint16_t* p = reinterpret_cast<const uint16_t*>(settings.data());
|
||||
size_t words = std::min(knownSize.value_or(0), settings.size());
|
||||
size_t words = settings.size();
|
||||
if(words % 2 == 1)
|
||||
return std::nullopt; // Somehow settings is not word aligned
|
||||
words /= 2;
|
||||
|
|
@ -159,15 +159,12 @@ bool IDeviceSettings::ValidateLINBaudrate(int64_t baudrate) {
|
|||
}
|
||||
}
|
||||
|
||||
bool IDeviceSettings::refresh(bool ignoreChecksum) {
|
||||
bool IDeviceSettings::refresh() {
|
||||
if(disabled) {
|
||||
report(APIEvent::Type::SettingsNotAvailable, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(disableGSChecksumming)
|
||||
ignoreChecksum = true;
|
||||
|
||||
std::vector<uint8_t> rxSettings;
|
||||
bool ret = com->getSettingsSync(rxSettings);
|
||||
if(!ret) {
|
||||
|
|
@ -175,24 +172,14 @@ bool IDeviceSettings::refresh(bool ignoreChecksum) {
|
|||
return false;
|
||||
}
|
||||
|
||||
constexpr size_t GsSize = 3 * sizeof(uint16_t);
|
||||
constexpr size_t GsSize = 3 * sizeof(uint16_t); // <version> <length> <checksum>
|
||||
if(rxSettings.size() < GsSize) { // We need to at least have the header of GLOBAL_SETTINGS
|
||||
report(APIEvent::Type::SettingsReadError, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
// The length of the settings structure sent to us
|
||||
// This is the length the firmware thinks the current version of the structure is
|
||||
const size_t rxLen = rxSettings.size() - GsSize;
|
||||
|
||||
const uint16_t gsVersion = rxSettings[0] | (rxSettings[1] << 8);
|
||||
|
||||
// The length of the settings last saved
|
||||
// If the firmware is updated, it will have either extended (with zeros) or truncated
|
||||
// the structure, but this value will continue to be set to the last saved value
|
||||
const uint16_t gsLen = rxSettings[2] | (rxSettings[3] << 8);
|
||||
|
||||
const uint16_t gsChecksum = rxSettings[4] | (rxSettings[5] << 8);
|
||||
rxSettings.erase(rxSettings.begin(), rxSettings.begin() + GsSize);
|
||||
|
||||
if(gsVersion != GS_VERSION) {
|
||||
|
|
@ -200,19 +187,6 @@ bool IDeviceSettings::refresh(bool ignoreChecksum) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if(rxLen < gsLen) {
|
||||
// We got less data, i.e. the firmware thinks the strucure is smaller than what
|
||||
// was last saved. Usually this is due to a firmware downgrade. We'll ignore the
|
||||
// checksum for now, because it will definitely be wrong.
|
||||
ignoreChecksum = true;
|
||||
}
|
||||
|
||||
// We check the checksum against the data last saved
|
||||
if(!ignoreChecksum && gsChecksum != CalculateGSChecksum(rxSettings, gsLen)) {
|
||||
report(APIEvent::Type::SettingsChecksumError, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
settings = std::move(rxSettings);
|
||||
settingsInDeviceRAM = settings;
|
||||
settingsLoaded = true;
|
||||
|
|
@ -261,7 +235,7 @@ bool IDeviceSettings::apply(bool temporary) {
|
|||
|
||||
std::shared_ptr<Main51Message> msg = std::dynamic_pointer_cast<Main51Message>(com->waitForMessageSync([this, &bytestream]() {
|
||||
return com->sendCommand(Command::SetSettings, bytestream);
|
||||
}, std::make_shared<Main51MessageFilter>(Command::SetSettings), std::chrono::milliseconds(1000)));
|
||||
}, std::make_shared<Main51MessageFilter>(Command::SetSettings), std::chrono::milliseconds(2000)));
|
||||
|
||||
if(!msg || msg->data[0] != 1) { // We did not receive a response
|
||||
// Attempt to get the settings from the device so we're up to date if possible
|
||||
|
|
@ -272,7 +246,7 @@ bool IDeviceSettings::apply(bool temporary) {
|
|||
return false;
|
||||
}
|
||||
|
||||
refresh(true); // Refresh ignoring checksum
|
||||
refresh();
|
||||
// The device might modify the settings once they are applied, however in this case it does not update the checksum
|
||||
// We refresh to get these updates, update the checksum, and send it back so it's all in sync
|
||||
gsChecksum = CalculateGSChecksum(settings);
|
||||
|
|
@ -287,7 +261,7 @@ bool IDeviceSettings::apply(bool temporary) {
|
|||
|
||||
msg = std::dynamic_pointer_cast<Main51Message>(com->waitForMessageSync([this, &bytestream]() {
|
||||
return com->sendCommand(Command::SetSettings, bytestream);
|
||||
}, std::make_shared<Main51MessageFilter>(Command::SetSettings), std::chrono::milliseconds(1000)));
|
||||
}, std::make_shared<Main51MessageFilter>(Command::SetSettings), std::chrono::milliseconds(2000)));
|
||||
if(!msg || msg->data[0] != 1) {
|
||||
// Attempt to get the settings from the device so we're up to date if possible
|
||||
if(refresh()) {
|
||||
|
|
@ -342,7 +316,7 @@ bool IDeviceSettings::applyDefaults(bool temporary) {
|
|||
// This short wait helps on FIRE devices, otherwise the checksum might be wrong!
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(3));
|
||||
|
||||
refresh(true); // Refresh ignoring checksum
|
||||
refresh();
|
||||
// The device might modify the settings once they are applied, however in this case it does not update the checksum
|
||||
// We refresh to get these updates, update the checksum, and send it back so it's all in sync
|
||||
std::vector<uint8_t> bytestream;
|
||||
|
|
@ -364,7 +338,7 @@ bool IDeviceSettings::applyDefaults(bool temporary) {
|
|||
|
||||
msg = std::dynamic_pointer_cast<Main51Message>(com->waitForMessageSync([this, &bytestream]() {
|
||||
return com->sendCommand(Command::SetSettings, bytestream);
|
||||
}, std::make_shared<Main51MessageFilter>(Command::SetSettings), std::chrono::milliseconds(1000)));
|
||||
}, std::make_shared<Main51MessageFilter>(Command::SetSettings), std::chrono::milliseconds(2000)));
|
||||
if(!msg || msg->data[0] != 1) {
|
||||
// Attempt to get the settings from the device so we're up to date if possible
|
||||
if(refresh()) {
|
||||
|
|
|
|||
|
|
@ -25,19 +25,4 @@ void VSAExtendedMessage::appendPacket(std::shared_ptr<Packet> packet) const
|
|||
if(packet->network.getNetID() == Network::NetID::Invalid) {
|
||||
packet->network = network;
|
||||
}
|
||||
}
|
||||
|
||||
void VSAExtendedMessage::truncatePacket(std::shared_ptr<Packet> packet)
|
||||
{
|
||||
static constexpr auto EthernetLengthOffset = 26u;
|
||||
switch(packet->network.getType()) {
|
||||
case Network::Type::Ethernet:
|
||||
{
|
||||
const auto& packetLength = *reinterpret_cast<uint16_t*>(packet->data.data() + EthernetLengthOffset);
|
||||
const size_t ethernetFrameSize = packetLength - (sizeof(uint16_t) * 2);
|
||||
const size_t bytestreamExpectedSize = sizeof(HardwareEthernetPacket) + ethernetFrameSize;
|
||||
packet->data.resize(bytestreamExpectedSize);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ VSA02::VSA02(uint8_t* const recordBytes)
|
|||
constantIndex = *reinterpret_cast<uint16_t*>(recordBytes + 2);
|
||||
flags = *reinterpret_cast<Flags*>(recordBytes + 4);
|
||||
pieceCount = recordBytes[5];
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 6) & UINT63_MAX;
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 6);
|
||||
samples.insert(samples.end(), recordBytes + 14, recordBytes + 30);
|
||||
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 30);
|
||||
doChecksum(recordBytes);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ VSA03::VSA03(uint8_t* const recordBytes)
|
|||
setType(VSA::Type::AA03);
|
||||
eventType = static_cast<EventType>(*reinterpret_cast<uint16_t*>(recordBytes + 2));
|
||||
eventData = *reinterpret_cast<uint16_t*>(recordBytes + 4);
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 6) & UINT63_MAX;
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 6);
|
||||
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 14);
|
||||
doChecksum(recordBytes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ VSA04::VSA04(uint8_t* const recordBytes)
|
|||
setType(VSA::Type::AA04);
|
||||
flags = *reinterpret_cast<Flags*>(recordBytes + 2);
|
||||
partitionIndex = *reinterpret_cast<uint16_t*>(recordBytes + 4);
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 6) & UINT63_MAX;
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 6);
|
||||
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 14);
|
||||
doChecksum(recordBytes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ VSA05::VSA05(uint8_t* const recordBytes)
|
|||
setType(VSA::Type::AA05);
|
||||
errorType = static_cast<ErrorType>(*reinterpret_cast<uint16_t*>(recordBytes + 2));
|
||||
errorNetwork = *reinterpret_cast<uint16_t*>(recordBytes + 4);
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 6) & UINT63_MAX;
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 6);
|
||||
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 14);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ VSA06::VSA06(uint8_t* const recordBytes)
|
|||
savedSectors.insert(savedSectors.end(), reinterpret_cast<uint32_t*>(recordBytes + 2), reinterpret_cast<uint32_t*>(recordBytes + 18));
|
||||
error = *reinterpret_cast<uint16_t*>(recordBytes + 18);
|
||||
savedSectorsHigh = *reinterpret_cast<uint16_t*>(recordBytes + 20);
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 22) & UINT63_MAX;
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 22);
|
||||
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 30);
|
||||
doChecksum(recordBytes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ VSA07::VSA07(uint8_t* const recordBytes)
|
|||
lastSector = *reinterpret_cast<uint32_t*>(recordBytes + 2);
|
||||
currentSector = *reinterpret_cast<uint32_t*>(recordBytes + 6);
|
||||
reserved.insert(reserved.end(), recordBytes + 10, recordBytes + 22);
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 22) & UINT63_MAX;
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 22);
|
||||
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 30);
|
||||
doChecksum(recordBytes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ VSA08::VSA08(uint8_t* const recordBytes)
|
|||
setType(VSA::Type::AA08);
|
||||
troubleSramCount.insert(troubleSramCount.end(), recordBytes + 2, recordBytes + 6);
|
||||
troubleSectors.insert(troubleSectors.end(), reinterpret_cast<uint32_t*>(recordBytes + 6), reinterpret_cast<uint32_t*>(recordBytes + 22));
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 22) & UINT63_MAX;
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 22);
|
||||
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 30);
|
||||
doChecksum(recordBytes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ VSA09::VSA09(uint8_t* const recordBytes)
|
|||
reserved0.insert(reserved0.end(), recordBytes + 12, recordBytes + 18);
|
||||
hardwareID = static_cast<HardwareID>(recordBytes[18]);
|
||||
reserved1.insert(reserved1.end(), recordBytes + 19, recordBytes + 22);
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 22) & UINT63_MAX;
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 22);
|
||||
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 30);
|
||||
doChecksum(recordBytes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ VSA0B::VSA0B(uint8_t* const recordBytes)
|
|||
{
|
||||
setType(VSA::Type::AA0B);
|
||||
captureBitfield = reinterpret_cast<uint16_t*>(recordBytes)[1];
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 20) & UINT63_MAX;
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 20);
|
||||
reserved = recordBytes[28];
|
||||
checksum = reinterpret_cast<uint16_t*>(recordBytes)[15];
|
||||
doChecksum(recordBytes);
|
||||
|
|
@ -30,8 +30,8 @@ void VSA0B::doChecksum(uint8_t* recordBytes)
|
|||
bool VSA0B::filter(const std::shared_ptr<VSAMessageReadFilter> filter)
|
||||
{
|
||||
if((filter->captureBitfield != captureBitfield && filter->captureBitfield != UINT16_MAX) ||
|
||||
getICSTimestampFromTimepoint(filter->readRange.first) > timestamp ||
|
||||
getICSTimestampFromTimepoint(filter->readRange.second) < timestamp) {
|
||||
getICSTimestampFromTimepoint(filter->readRange.first) > getTimestamp() ||
|
||||
getICSTimestampFromTimepoint(filter->readRange.second) < getTimestamp()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ VSA0C::VSA0C(uint8_t* const recordBytes)
|
|||
audioPreamble = recordBytes[4];
|
||||
audioHeader = recordBytes[5];
|
||||
pcmData.insert(pcmData.end(), recordBytes + 6, recordBytes + 20);
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 20) & UINT63_MAX;
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 20);
|
||||
vNetBitfield = *reinterpret_cast<VSA0C::VNet*>(recordBytes + 28);
|
||||
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 30);
|
||||
doChecksum(recordBytes);
|
||||
|
|
|
|||
|
|
@ -76,8 +76,8 @@ void VSA0DFirst::reorderPayload(std::vector<uint8_t>& secondPayload)
|
|||
bool VSA0DFirst::filter(const std::shared_ptr<VSAMessageReadFilter> filter)
|
||||
{
|
||||
if((filter->captureBitfield != captureBitfield && filter->captureBitfield != UINT16_MAX) ||
|
||||
getICSTimestampFromTimepoint(filter->readRange.first) > timestamp ||
|
||||
getICSTimestampFromTimepoint(filter->readRange.second) < timestamp) {
|
||||
getICSTimestampFromTimepoint(filter->readRange.first) > getTimestamp() ||
|
||||
getICSTimestampFromTimepoint(filter->readRange.second) < getTimestamp()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -66,8 +66,8 @@ void VSA0EFirst::reservePacketData(std::shared_ptr<Packet>& packet) const
|
|||
bool VSA0EFirst::filter(const std::shared_ptr<VSAMessageReadFilter> filter)
|
||||
{
|
||||
if((filter->captureBitfield != captureBitfield && filter->captureBitfield != UINT16_MAX) ||
|
||||
getICSTimestampFromTimepoint(filter->readRange.first) > timestamp ||
|
||||
getICSTimestampFromTimepoint(filter->readRange.second) < timestamp) {
|
||||
getICSTimestampFromTimepoint(filter->readRange.first) > getTimestamp() ||
|
||||
getICSTimestampFromTimepoint(filter->readRange.second) < getTimestamp()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -78,8 +78,8 @@ void VSA0FFirst::reservePacketData(std::shared_ptr<Packet>& packet) const
|
|||
bool VSA0FFirst::filter(const std::shared_ptr<VSAMessageReadFilter> filter)
|
||||
{
|
||||
if(filter->captureBitfield != captureBitfield ||
|
||||
getICSTimestampFromTimepoint(filter->readRange.first) > timestamp ||
|
||||
getICSTimestampFromTimepoint(filter->readRange.second) < timestamp) {
|
||||
getICSTimestampFromTimepoint(filter->readRange.first) > getTimestamp() ||
|
||||
getICSTimestampFromTimepoint(filter->readRange.second) < getTimestamp()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ VSA6A::VSA6A(uint8_t* const recordBytes)
|
|||
sequenceNum = *reinterpret_cast<uint32_t*>(recordBytes + 34);
|
||||
totalSectors = *reinterpret_cast<uint32_t*>(recordBytes + 38);
|
||||
reserved = *reinterpret_cast<uint32_t*>(recordBytes + 42);
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 46) & UINT63_MAX;
|
||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 46);
|
||||
timestampSum = *reinterpret_cast<uint16_t*>(recordBytes + 54);
|
||||
data.insert(data.end(), recordBytes + 56, recordBytes + 508);
|
||||
checksum = *reinterpret_cast<uint32_t*>(recordBytes + 508);
|
||||
|
|
|
|||
|
|
@ -430,7 +430,6 @@ bool VSAParser::extractMessagePackets(std::vector<std::shared_ptr<Packet>>& pack
|
|||
extendedMessageRecord->appendPacket(packet);
|
||||
if(extendedMessageRecord->getRecordCount() == static_cast<uint32_t>(extendedMessageRecord->getIndex() + 1)) { // Last record in sequence
|
||||
if(!settings.messageFilter || extendedMessageRecord->filter(settings.messageFilter)) {
|
||||
VSAExtendedMessage::truncatePacket(packet);
|
||||
packets.push_back(packet);
|
||||
}
|
||||
activeExtendedMessage = false;
|
||||
|
|
|
|||
|
|
@ -66,3 +66,11 @@ Complete Ethernet Example
|
|||
|
||||
.. literalinclude:: ../../examples/python/ethernet/ethernet_complete_example.py
|
||||
:language: python
|
||||
|
||||
Device Firmware/Chip Versions
|
||||
=============================
|
||||
|
||||
:download:`Download example <../../examples/python/device/chip_versions.py>`
|
||||
|
||||
.. literalinclude:: ../../examples/python/device/chip_versions.py
|
||||
:language: python
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ option(LIBICSNEO_BUILD_CPP_MDIO_EXAMPLE "Build the MDIO example." ON)
|
|||
option(LIBICSNEO_BUILD_CPP_VSA_EXAMPLE "Build the VSA example." ON)
|
||||
option(LIBICSNEO_BUILD_CPP_APP_ERROR_EXAMPLE "Build the app error example." ON)
|
||||
option(LIBICSNEO_BUILD_CPP_FLEXRAY_EXAMPLE "Build the FlexRay example." ON)
|
||||
option(LIBICSNEO_BUILD_CPP_SPI_EXAMPLE "Build the SPI example." ON)
|
||||
|
||||
if(LIBICSNEO_BUILD_C_INTERACTIVE_EXAMPLE)
|
||||
add_subdirectory(c/interactive)
|
||||
|
|
@ -63,3 +64,7 @@ endif()
|
|||
if(LIBICSNEO_BUILD_CPP_FLEXRAY_EXAMPLE)
|
||||
add_subdirectory(cpp/flexray)
|
||||
endif()
|
||||
|
||||
if(LIBICSNEO_BUILD_CPP_SPI_EXAMPLE)
|
||||
add_subdirectory(cpp/spi)
|
||||
endif()
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
add_executable(libicsneocpp-spi src/spi.cpp)
|
||||
target_link_libraries(libicsneocpp-spi icsneocpp)
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
/**
|
||||
* libicsneo SPI message example
|
||||
*
|
||||
* Read a register on NetID::SPI_01 and display the result to stdout
|
||||
*
|
||||
* Usage: libicsneo-spi [deviceSerial] [address] [numWords]
|
||||
*
|
||||
* Arguments:
|
||||
* deviceSerial: 6 character string for device serial
|
||||
* address: 16 bit register address
|
||||
* numWords: number of words to read
|
||||
*/
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <tuple>
|
||||
|
||||
#include "icsneo/icsneocpp.h"
|
||||
#include "icsneo/communication/message/spimessage.h"
|
||||
|
||||
static const std::string usage = "Usage: libicsneo-spi [deviceSerial] [address] [numWords]\n\n"
|
||||
"Arguments:\n"
|
||||
"deviceSerial: 6 character string for device serial\n"
|
||||
"address: hex number representing 16 bit register number\n"
|
||||
"numWords: number of words to read\n";
|
||||
|
||||
static std::tuple<std::string_view, uint16_t, uint16_t> parseArgs(std::vector<std::string_view>& args, bool& fail) {
|
||||
|
||||
if(args.size() != 4) {
|
||||
std::cerr << "Invalid argument count" << std::endl;
|
||||
std::cerr << usage;
|
||||
fail = true;
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string_view serial = args[1];
|
||||
if(serial.size() != 6) {
|
||||
std::cerr << "Invalid serial length" << std::endl;
|
||||
std::cerr << usage;
|
||||
fail = true;
|
||||
return {};
|
||||
}
|
||||
|
||||
char* endPtr;
|
||||
uint16_t address = static_cast<uint16_t>(std::strtoul(args[2].data(), &endPtr, 16));
|
||||
if(endPtr != (args[2].data() + args[2].size())) {
|
||||
std::cerr << "Failed to convert address to hex" << std::endl;
|
||||
std::cerr << usage;
|
||||
fail = true;
|
||||
return {};
|
||||
}
|
||||
|
||||
uint16_t numWords = static_cast<uint16_t>(std::strtoul(args[3].data(), &endPtr, 16));
|
||||
if(endPtr != (args[3].data() + args[3].size())) {
|
||||
std::cerr << "Failed to convert numWords to decimal integer" << std::endl;
|
||||
std::cerr << usage;
|
||||
fail = true;
|
||||
return {};
|
||||
}
|
||||
fail = false;
|
||||
return {serial, address, numWords};
|
||||
}
|
||||
|
||||
int main(int argc, const char** argv) {
|
||||
std::vector<std::string_view> args(argv, argv + argc);
|
||||
bool fail;
|
||||
auto tup = parseArgs(args, fail);
|
||||
if(fail) {
|
||||
return -1;
|
||||
}
|
||||
auto serial = std::get<0>(tup);
|
||||
auto address = std::get<1>(tup);
|
||||
auto numWords = std::get<2>(tup);
|
||||
|
||||
std::shared_ptr<icsneo::Device> device = nullptr;
|
||||
for(const auto& dev : icsneo::FindAllDevices()) {
|
||||
if(dev->getSerial() == serial) {
|
||||
device = dev;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!device) {
|
||||
std::cerr << "Failed to find device" << std::endl;
|
||||
std::cerr << usage;
|
||||
return -1;
|
||||
}
|
||||
if(!device->open()) {
|
||||
std::cerr << "Failed to open device" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
if(!device->goOnline()) {
|
||||
std::cerr << "Failed to go online" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::cout << "Reading register " << std::setfill('0') << std::setw(4) << std::right << std::hex << address << std::endl;
|
||||
|
||||
// Make message
|
||||
std::shared_ptr<icsneo::SPIMessage> msg = std::make_shared<icsneo::SPIMessage>();
|
||||
msg->network = icsneo::Network::NetID::SPI_01;
|
||||
msg->direction = icsneo::SPIMessage::Direction::Read;
|
||||
msg->address = address;
|
||||
msg->payload.resize(numWords, 0); // Resize payload to desired length
|
||||
|
||||
// Add callback
|
||||
bool receivedMessage = false;
|
||||
auto handle = device->addMessageCallback(std::make_shared<icsneo::MessageCallback>([&](std::shared_ptr<icsneo::Message> msg) {
|
||||
if(receivedMessage) {
|
||||
return;
|
||||
}
|
||||
if(msg->type == icsneo::Message::Type::Frame) {
|
||||
auto frame = std::dynamic_pointer_cast<icsneo::Frame>(msg);
|
||||
if(!frame) {
|
||||
return;
|
||||
}
|
||||
if(frame->network == icsneo::Network::NetID::SPI_01) {
|
||||
auto spiMsg = std::dynamic_pointer_cast<icsneo::SPIMessage>(frame);
|
||||
if(spiMsg->address == address) {
|
||||
std::cout << "Received " << spiMsg->payload.size() << " words" << std::endl;
|
||||
for(uint32_t word : spiMsg->payload) {
|
||||
std::cout << std::setfill('0') << std::setw(8) << std::right << std::hex << word << ' ';
|
||||
}
|
||||
std::cout << std::endl;
|
||||
receivedMessage = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
device->transmit(msg);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
||||
|
||||
if(!receivedMessage) {
|
||||
std::cout << "Did not receive response from device." << std::endl;
|
||||
}
|
||||
device->removeMessageCallback(handle);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -239,6 +239,9 @@ int main(int argc, char* argv[]) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
std::cout << "Waiting for 5 seconds..." << std::endl;
|
||||
std::this_thread::sleep_for(std::chrono::seconds(5));
|
||||
|
||||
std::cout << "info: " << currentMessage << " transmitted frames found" << std::endl;
|
||||
resetScriptStatus(rxDevice, txDevice, rxInitialCoreminiStatus, txInitialCoreminiStatus);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
import icsneopy
|
||||
|
||||
def chip_versions():
|
||||
devices = icsneopy.find_all_devices()
|
||||
|
||||
if len(devices) == 0:
|
||||
print("no devices found")
|
||||
return False
|
||||
|
||||
device = devices[0]
|
||||
print(f"selected {device}")
|
||||
|
||||
if not device.open():
|
||||
print("unable to open device")
|
||||
return False
|
||||
|
||||
chip_versions = device.get_chip_versions()
|
||||
if not chip_versions:
|
||||
print("no chip versions")
|
||||
return False
|
||||
|
||||
print("chip versions:")
|
||||
for i in chip_versions:
|
||||
version = f"{i.major}.{i.minor}.{i.maintenance}.{i.build}"
|
||||
print(f" id: {i.id}, name: {i.name}, version: {version}")
|
||||
|
||||
return True
|
||||
|
||||
if __name__ == "__main__":
|
||||
chip_versions()
|
||||
|
|
@ -56,6 +56,7 @@ enum class ExtendedCommand : uint16_t {
|
|||
GetComponentVersions = 0x001A,
|
||||
Reboot = 0x001C,
|
||||
SetRootFSEntryFlags = 0x0027,
|
||||
TransmitCoreminiMessage = 0x0028,
|
||||
GenericBinaryInfo = 0x0030,
|
||||
LiveData = 0x0035,
|
||||
RequestTC10Wake = 0x003D,
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ public:
|
|||
bool close();
|
||||
bool isOpen();
|
||||
bool isDisconnected();
|
||||
|
||||
virtual void spawnThreads();
|
||||
virtual void joinThreads();
|
||||
void modeChangeIncoming() { driver->modeChangeIncoming(); }
|
||||
|
|
|
|||
|
|
@ -12,9 +12,12 @@
|
|||
#include "icsneo/api/eventmanager.h"
|
||||
#include "icsneo/third-party/concurrentqueue/blockingconcurrentqueue.h"
|
||||
#include "icsneo/communication/ringbuffer.h"
|
||||
#include "icsneo/device/founddevice.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
typedef std::function<void(std::vector<FoundDevice>&)> driver_finder_t;
|
||||
|
||||
#define ICSNEO_DRIVER_RINGBUFFER_SIZE (512 * 1024)
|
||||
class Driver {
|
||||
public:
|
||||
|
|
@ -25,18 +28,20 @@ public:
|
|||
virtual void modeChangeIncoming() {}
|
||||
virtual void awaitModeChangeComplete() {}
|
||||
virtual bool close() = 0;
|
||||
virtual driver_finder_t getFinder() = 0;
|
||||
|
||||
inline bool isDisconnected() const { return disconnected; };
|
||||
inline bool isClosing() const { return closing; }
|
||||
|
||||
bool waitForRx(size_t limit, std::chrono::milliseconds timeout);
|
||||
bool waitForRx(std::function<bool()> predicate, std::chrono::milliseconds timeout);
|
||||
bool readWait(std::vector<uint8_t>& bytes, std::chrono::milliseconds timeout = std::chrono::milliseconds(100), size_t limit = 0);
|
||||
bool readWait(std::vector<uint8_t>& bytes, std::chrono::milliseconds timeout = std::chrono::milliseconds(100), size_t limit = 1);
|
||||
bool write(const std::vector<uint8_t>& bytes);
|
||||
virtual bool isEthernet() const { return false; }
|
||||
bool readAvailable() { return readBuffer.size() > 0; }
|
||||
RingBuffer& getReadBuffer() { return readBuffer; }
|
||||
|
||||
|
||||
virtual bool enableCommunication(bool /* enable */, bool& sendMsg) { sendMsg = true; return true; }
|
||||
|
||||
device_eventhandler_t report;
|
||||
|
|
|
|||
|
|
@ -21,10 +21,11 @@ struct PhyMessage {
|
|||
bool Enabled;
|
||||
bool WriteEnable;
|
||||
bool Clause45Enable;
|
||||
uint8_t version;
|
||||
uint8_t BusIndex;
|
||||
uint8_t Version;
|
||||
union {
|
||||
Clause22Message clause22;
|
||||
Clause45Message clause45;
|
||||
Clause22Message Clause22;
|
||||
Clause45Message Clause45;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef __SPIMESSAGE_H_
|
||||
#define __SPIMESSAGE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/communication/message/message.h"
|
||||
#include <vector>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class SPIMessage : public Frame {
|
||||
public:
|
||||
enum class Direction : uint8_t {
|
||||
Read = 0,
|
||||
Write = 1
|
||||
};
|
||||
|
||||
Direction direction = Direction::Read;
|
||||
uint16_t address = static_cast<uint16_t>(0x0000u);
|
||||
uint8_t mms = static_cast<uint16_t>(0x0000u); // Memory Map Selector for ADI MAC Phy
|
||||
uint16_t stats = static_cast<uint16_t>(0x0000u);
|
||||
|
||||
std::vector<uint32_t> payload;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
|
|
@ -17,6 +17,7 @@ struct Info {
|
|||
uint8_t sleepRequest;
|
||||
uint16_t connectionTimeoutMinutes;
|
||||
std::vector<CaptureInfo> captures;
|
||||
uint8_t vinAvailable;
|
||||
};
|
||||
|
||||
// The response for Command::WiVICommand
|
||||
|
|
@ -27,6 +28,7 @@ public:
|
|||
std::optional<Command> responseTo;
|
||||
std::optional<int32_t> value;
|
||||
std::optional<Info> info;
|
||||
std::optional<std::string> vin;
|
||||
};
|
||||
|
||||
} // namespace WiVI
|
||||
|
|
|
|||
|
|
@ -113,6 +113,10 @@ private:
|
|||
std::vector< moodycamel::BlockingReaderWriterQueue< std::vector<uint8_t> > > vnetQueues;
|
||||
void hidReadTask();
|
||||
void vnetReadTask(size_t vnetIndex);
|
||||
|
||||
RingBuffer packetRB;
|
||||
std::mutex ringBufMutex;
|
||||
std::condition_variable ringBufCV;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace icsneo {
|
|||
typedef uint16_t icscm_bitfield;
|
||||
|
||||
struct HardwareEthernetPacket {
|
||||
static std::shared_ptr<EthernetMessage> DecodeToMessage(const std::vector<uint8_t>& bytestream, const device_eventhandler_t& report);
|
||||
static std::shared_ptr<EthernetMessage> DecodeToMessage(const std::vector<uint8_t>& bytestream);
|
||||
static bool EncodeFromMessage(const EthernetMessage& message, std::vector<uint8_t>& bytestream, const device_eventhandler_t& report);
|
||||
|
||||
// Word 0 - Header flags (offset 0)
|
||||
|
|
@ -57,8 +57,9 @@ struct HardwareEthernetPacket {
|
|||
struct {
|
||||
icscm_bitfield T1S_BURST_COUNT : 8;
|
||||
icscm_bitfield T1S_NODE_ID : 8;
|
||||
uint8_t RESERVED[6];
|
||||
} t1s_node;
|
||||
|
||||
uint8_t RESERVED[6];
|
||||
|
||||
// Words 4-7 - Reserved/Padding
|
||||
uint16_t stats;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,9 @@ struct PhyRegisterPacket_t {
|
|||
uint16_t Enabled : 1;
|
||||
uint16_t WriteEnable : 1;
|
||||
uint16_t Clause45Enable : 1;
|
||||
uint16_t reserved : 9;
|
||||
uint16_t status : 3;
|
||||
uint16_t reserved : 2;
|
||||
uint16_t BusIndex : 4;
|
||||
uint16_t version : 4;
|
||||
};
|
||||
uint16_t flags;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
#ifndef __SPIPACKET_H__
|
||||
#define __SPIPACKET_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/api/eventmanager.h"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include "icsneo/communication/message/spimessage.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
typedef uint16_t icscm_bitfield;
|
||||
|
||||
#pragma pack(push, 2)
|
||||
struct HardwareSPIPacket {
|
||||
|
||||
static std::shared_ptr<Message> DecodeToMessage(const std::vector<uint8_t>& bytestream);
|
||||
static bool EncodeFromMessage(const SPIMessage& message, std::vector<uint8_t>& bytestream, const device_eventhandler_t& report);
|
||||
|
||||
struct {
|
||||
uint16_t frameLength;
|
||||
} header;
|
||||
uint8_t offset[12];
|
||||
uint16_t stats;
|
||||
struct {
|
||||
uint64_t TS : 60;
|
||||
uint64_t : 3; // Reserved for future status bits
|
||||
uint64_t IsExtended : 1;
|
||||
} timestamp;
|
||||
uint16_t networkID;
|
||||
uint16_t length;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
|
|
@ -56,6 +56,7 @@ enum class Command : uint16_t {
|
|||
GetSignal = 0x0013,
|
||||
Result = 0x0014,
|
||||
GetPhysicalSignal = 0x0015,
|
||||
GetVIN = 0x0016,
|
||||
};
|
||||
|
||||
enum class SignalType : uint16_t { // enumCoreMiniValueMiscValueType
|
||||
|
|
@ -66,6 +67,7 @@ enum class SignalType : uint16_t { // enumCoreMiniValueMiscValueType
|
|||
ConnectionTimeout = 0x006e,
|
||||
TimeSinceLastMessageMs = 0x006f,
|
||||
UploadsPending = 0x0077,
|
||||
VINEnabled = 0x007D,
|
||||
};
|
||||
|
||||
struct Upload {
|
||||
|
|
@ -125,7 +127,7 @@ struct CommandPacket {
|
|||
CoreMiniFixedPointValue value;
|
||||
};
|
||||
|
||||
struct GetAll {
|
||||
struct GetAllHeader {
|
||||
static std::vector<uint8_t> Encode();
|
||||
|
||||
Header header;
|
||||
|
|
@ -133,7 +135,6 @@ struct CommandPacket {
|
|||
uint8_t sleepRequest;
|
||||
uint16_t connectionTimeoutMinutes;
|
||||
uint16_t numCaptureInfos;
|
||||
CaptureInfo captureInfos[0];
|
||||
};
|
||||
|
||||
struct ClearUploads {
|
||||
|
|
@ -142,6 +143,13 @@ struct CommandPacket {
|
|||
Header header;
|
||||
uint8_t bitmask[0];
|
||||
};
|
||||
|
||||
struct GetVIN {
|
||||
static std::vector<uint8_t> Encode();
|
||||
|
||||
Header header;
|
||||
char VIN[17];
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace WiVI
|
||||
|
|
|
|||
|
|
@ -0,0 +1,117 @@
|
|||
#ifndef __BOOTLOADER_PIPELINE_H_
|
||||
#define __BOOTLOADER_PIPELINE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/chipid.h"
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <variant>
|
||||
#include <utility>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
enum class BootloaderCommunication {
|
||||
RAD,
|
||||
RED,
|
||||
REDCore,
|
||||
RADGalaxy2Peripheral,
|
||||
RADMultiChip,
|
||||
Application,
|
||||
Invalid
|
||||
};
|
||||
|
||||
struct BootloaderPhase {
|
||||
enum class Type {
|
||||
Flash,
|
||||
Finalize,
|
||||
Reconnect,
|
||||
EnterBootloader,
|
||||
Wait
|
||||
};
|
||||
|
||||
virtual Type getType() const = 0;
|
||||
virtual ~BootloaderPhase() = default;
|
||||
};
|
||||
|
||||
struct ReconnectPhase : public BootloaderPhase {
|
||||
Type getType() const override {
|
||||
return Type::Reconnect;
|
||||
}
|
||||
|
||||
ReconnectPhase() = default;
|
||||
};
|
||||
|
||||
struct FinalizePhase : public BootloaderPhase {
|
||||
Type getType() const override {
|
||||
return Type::Finalize;
|
||||
}
|
||||
|
||||
ChipID chip;
|
||||
BootloaderCommunication comm;
|
||||
|
||||
FinalizePhase(ChipID chip, BootloaderCommunication comm) : chip(chip), comm(comm) {}
|
||||
};
|
||||
|
||||
struct WaitPhase : public BootloaderPhase {
|
||||
Type getType() const override {
|
||||
return Type::Wait;
|
||||
}
|
||||
|
||||
std::chrono::milliseconds timeout;
|
||||
|
||||
WaitPhase(std::chrono::milliseconds timeout) : timeout(timeout) {}
|
||||
};
|
||||
|
||||
struct EnterBootloaderPhase : public BootloaderPhase {
|
||||
Type getType() const override {
|
||||
return Type::EnterBootloader;
|
||||
}
|
||||
};
|
||||
|
||||
struct FlashPhase : public BootloaderPhase {
|
||||
Type getType() const override {
|
||||
return Type::Flash;
|
||||
}
|
||||
|
||||
ChipID chip;
|
||||
BootloaderCommunication comm;
|
||||
bool authenticate = true;
|
||||
bool encrypt = true;
|
||||
bool checkOutOfDate = true;
|
||||
|
||||
FlashPhase(ChipID chip, BootloaderCommunication comm, bool authenticate = true, bool encrypt = true, bool checkOutOfDate = true)
|
||||
: chip(chip), comm(comm), authenticate(authenticate), encrypt(encrypt), checkOutOfDate(checkOutOfDate) {}
|
||||
};
|
||||
|
||||
enum class BootloaderSetting {
|
||||
UpdateAll
|
||||
};
|
||||
|
||||
struct BootloaderPipeline {
|
||||
std::vector<std::shared_ptr<BootloaderPhase>> phases;
|
||||
std::unordered_map<BootloaderSetting, std::variant<int, bool>> settings;
|
||||
|
||||
template<typename Phase, typename... Args>
|
||||
BootloaderPipeline& add(Args... args) {
|
||||
phases.emplace_back(std::make_shared<Phase>(std::forward<Args>(args)...));
|
||||
return *this;
|
||||
}
|
||||
|
||||
BootloaderPipeline& addSetting(BootloaderSetting type, const std::variant<int, bool>& setting) {
|
||||
settings.insert({type, setting});
|
||||
return *this;
|
||||
}
|
||||
|
||||
operator bool() const {
|
||||
return !phases.empty();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
#ifndef __CHIP_ID_H_
|
||||
#define __CHIP_ID_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
enum class ChipID : uint8_t {
|
||||
neoVIFIRE_MCHIP = 0,
|
||||
neoVIFIRE_LCHIP = 1,
|
||||
neoVIFIRE_UCHIP = 2,
|
||||
neoVIFIRE_JCHIP = 3,
|
||||
ValueCAN3_MCHIP = 4,
|
||||
neoVIECU_MPIC = 6,
|
||||
neoVIIEVB_MPIC = 7,
|
||||
neoVIPENDANT_MPIC = 8,
|
||||
neoVIFIRE_VNET_MCHIP = 9,
|
||||
neoVIFIRE_VNET_LCHIP = 10,
|
||||
neoVIPLASMA_Core = 11,
|
||||
neoVIPLASMA_HID = 12,
|
||||
neoVIANALOG_MPIC = 13,
|
||||
neoVIPLASMA_ANALOG_Core = 14,
|
||||
neoVIPLASMA_FlexRay_Core = 15,
|
||||
neoVIPLASMA_Core_1_12 = 16,
|
||||
neoVIFIRE_Slave_VNET_MCHIP = 17,
|
||||
neoVIFIRE_Slave_VNET_LCHIP = 18,
|
||||
neoVIION_Core = 19,
|
||||
neoVIION_HID = 20,
|
||||
neoVIION_Core_Loader = 21,
|
||||
neoVIION_HID_Loader = 22,
|
||||
neoVIION_FPGA_BIT = 23,
|
||||
neoVIFIRE_VNET_EP_MCHIP = 24,
|
||||
neoVIFIRE_VNET_EP_LCHIP = 25,
|
||||
neoVIAnalogOut_MCHIP = 26,
|
||||
neoVIMOST25_MCHIP = 27,
|
||||
neoVIMOST50_MCHIP = 28,
|
||||
neoVIMOST150_MCHIP = 29,
|
||||
ValueCAN4_4_MCHIP = 30,
|
||||
ValueCAN4_4_SCHIP = 31,
|
||||
cmProbe_ZYNQ = 33,
|
||||
EEVB_STM32 = 34,
|
||||
neoVIFIRE_Slave_VNET_EP_MCHIP = 35,
|
||||
neoVIFIRE_Slave_VNET_EP_LCHIP = 36,
|
||||
RADStar_MCHIP = 37,
|
||||
ValueCANrf_MCHIP = 38,
|
||||
neoVIFIRE2_MCHIP = 39,
|
||||
neoVIFIRE2_CCHIP = 40,
|
||||
neoVIFIRE2_Core = 41,
|
||||
neoVIFIRE2_BLECHIP = 42,
|
||||
neoVIFIRE2_ZYNQ = 43, // FIRE2 MVNET Z - Zynq
|
||||
neoVIFIRE2_SECURITYCHIP = 44,
|
||||
RADGalaxy_ZYNQ = 45,
|
||||
neoVIFIRE2_VNET_MCHIP = 46,
|
||||
neoVIFIRE2_Slave_VNET_A_MCHIP = 47,
|
||||
neoVIFIRE2_Slave_VNET_A_CCHIP = 48,
|
||||
neoVIFIRE2_VNET_CCHIP = 49,
|
||||
neoVIFIRE2_VNET_Core = 50,
|
||||
RADStar2_ZYNQ = 51,
|
||||
VividCAN_MCHIP = 52,
|
||||
neoOBD2SIM_MCHIP = 53,
|
||||
neoVIFIRE2_VNETZ_MCHIP = 54,
|
||||
neoVIFIRE2_VNETZ_ZYNQ = 55,
|
||||
neoVIFIRE2_Slave_VNETZ_A_MCHIP = 56,
|
||||
neoVIFIRE2_Slave_VNETZ_A_ZYNQ = 57,
|
||||
VividCAN_EXT_FLASH = 58,
|
||||
VividCAN_NRF52 = 59,
|
||||
cmProbe_ZYNQ_Unused = 60, // Double defined
|
||||
neoOBD2PRO_MCHIP = 61,
|
||||
ValueCAN4_1_MCHIP = 62,
|
||||
ValueCAN4_2_MCHIP = 63,
|
||||
ValueCAN4_4_2EL_Core = 64,
|
||||
neoOBD2PRO_SCHIP = 65,
|
||||
ValueCAN4_2EL_MCHIP = 67,
|
||||
neoECUAVBTSN_MCHIP = 68,
|
||||
neoOBD2PRO_Core = 69,
|
||||
RADSupermoon_ZYNQ = 70,
|
||||
RADMoon2_ZYNQ = 71,
|
||||
VividCANPRO_MCHIP = 72,
|
||||
VividCANPRO_EXT_FLASH = 73,
|
||||
RADPluto_MCHIP = 74,
|
||||
RADMars_ZYNQ = 75,
|
||||
neoECU12_MCHIP = 76,
|
||||
RADIOCANHUB_MCHIP = 77,
|
||||
FlexRay_VNETZ_ZCHIP = 78,
|
||||
neoOBD2_LCBADGE_MCHIP = 79,
|
||||
neoOBD2_LCBADGE_SCHIP = 80,
|
||||
RADMoonDuo_MCHIP = 81,
|
||||
neoVIFIRE3_ZCHIP = 82,
|
||||
FlexRay_VNETZ_FCHIP = 83,
|
||||
RADJupiter_MCHIP = 84,
|
||||
ValueCAN4Industrial_MCHIP = 85,
|
||||
EtherBADGE_MCHIP = 86,
|
||||
RADMars_3_ZYNQ = 87,
|
||||
RADGigastar_USBZ_ZYNQ = 88,
|
||||
RADGigastar_ZYNQ = 89,
|
||||
RAD4G_MCHIP = 90,
|
||||
neoVIFIRE3_SCHIP = 91,
|
||||
RADEpsilon_MCHIP = 92,
|
||||
RADA2B_ZCHIP = 93,
|
||||
neoOBD2Dev_MCHIP = 94,
|
||||
neoOBD2Dev_SCHIP = 95,
|
||||
neoOBD2SIMDoIP_MCHIP = 96,
|
||||
SFPModule_MCHIP = 97,
|
||||
RADEpsilonT_MCHIP = 98,
|
||||
RADEpsilonExpress_MCHIP = 99,
|
||||
RADProxima_MCHIP = 100,
|
||||
NewDevice57_ZCHIP = 101,
|
||||
RAD_GALAXY_2_ZMPCHIP_ID = 102,
|
||||
NewDevice59_MCHIP = 103,
|
||||
RADMoon2_Z7010_ZYNQ = 104,
|
||||
neoVIFIRE2_CORE_SG4 = 105,
|
||||
RADBMS_MCHIP = 106,
|
||||
RADMoon2_ZL_MCHIP = 107,
|
||||
RADGigastar_USBZ_Z7010_ZYNQ = 108,
|
||||
neoVIFIRE3_LINUX = 109,
|
||||
RADGigastar_USBZ_Z7007S_ZYNQ = 110,
|
||||
VEM_01_8DW_ZCHIP = 111,
|
||||
RADGalaxy_FFG_Zynq = 112,
|
||||
RADMoon3_MCHIP = 113,
|
||||
RADComet_ZYNQ = 114,
|
||||
VEM_02_FR_ZCHIP = 115,
|
||||
RADA2B_REVB_ZCHIP = 116,
|
||||
RADGigastar_FFG_ZYNQ = 117,
|
||||
VEM_02_FR_FCHIP = 118,
|
||||
Connect_ZCHIP = 121,
|
||||
RADGALAXY2_SYSMON_CHIP = 123,
|
||||
RADCOMET3_ZCHIP = 125,
|
||||
Connect_LINUX = 126,
|
||||
RADGigastar2_ZYNQ = 131,
|
||||
Invalid = 255
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
#ifndef __CHIP_INFO_H_
|
||||
#define __CHIP_INFO_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/chipid.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
enum class FirmwareType {
|
||||
IEF,
|
||||
Zip
|
||||
};
|
||||
|
||||
struct ChipInfo {
|
||||
/**
|
||||
* The default enabled field is for devices which can't deduce the specific ChipID of a device
|
||||
* until entering the bootloader.
|
||||
*
|
||||
* If defaultEnabled is set to true, the bootloader and version retrieval functions assume that
|
||||
* the chip is enabled, so it will perform version deduction based on the default enabled chip. If
|
||||
* defaultEnabled is set to false, then this chip info may or may not apply to this device
|
||||
*
|
||||
* Example: RADA2B RevA and RevB chips
|
||||
*
|
||||
* Sometimes we can't deduce whether we have a RevA or RevB chip before entering the bootloader if the
|
||||
* device does not support component versions. These chips track the same version, so we assume that the
|
||||
* chip is RevA (RevA defaultEnabled=true, RevB defaultEnabled=false) and check during the bootloader
|
||||
* if this chip is RevA or RevB.
|
||||
*/
|
||||
ChipID id;
|
||||
bool defaultEnabled = false;
|
||||
const char* name = nullptr; // Chip user displayable name
|
||||
const char* iefName = nullptr; // IEF name for a single segment chip (example RADA2B ZCHIP)
|
||||
size_t versionIndex = 0; // Main and Secondary version index
|
||||
FirmwareType fwType; // Firmwaare storagae type
|
||||
std::vector<const char*> iefSegments; // IEF names for a multi segment chip (example RADGalaxy2 ZCHIP)
|
||||
|
||||
ChipInfo() = default;
|
||||
|
||||
ChipInfo(ChipID id, bool defaultEnabled, const char* name, const char* iefName, size_t versionIndex, FirmwareType fwType)
|
||||
: id(id), defaultEnabled(defaultEnabled), name(name), iefName(iefName), versionIndex(versionIndex), fwType(fwType) {}
|
||||
|
||||
ChipInfo(ChipID id, bool defaultEnabled, const char* name, const char* iefName, const std::vector<const char*>& iefSegments, size_t versionIndex, FirmwareType fwType)
|
||||
: id(id), defaultEnabled(defaultEnabled), name(name), iefName(iefName), versionIndex(versionIndex), fwType(fwType), iefSegments(iefSegments) {}
|
||||
|
||||
bool isMultiIEF() const {
|
||||
return !iefSegments.empty();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
|
|
@ -24,6 +24,9 @@
|
|||
#include "icsneo/device/deviceversion.h"
|
||||
#include "icsneo/device/founddevice.h"
|
||||
#include "icsneo/device/coremini.h"
|
||||
#include "icsneo/device/bootloaderpipeline.h"
|
||||
#include "icsneo/device/chipinfo.h"
|
||||
#include "icsneo/device/versionreport.h"
|
||||
#include "icsneo/disk/diskreaddriver.h"
|
||||
#include "icsneo/disk/diskwritedriver.h"
|
||||
#include "icsneo/disk/nulldiskdriver.h"
|
||||
|
|
@ -86,6 +89,77 @@ class Device {
|
|||
public:
|
||||
virtual ~Device();
|
||||
|
||||
enum class ProductID : uint8_t {
|
||||
neoVIRED = 0,
|
||||
neoVIFIRE = 1,
|
||||
ValueCAN3 = 2,
|
||||
VividCANPro = 3, // Previously neoVI Yellow
|
||||
neoECU = 4,
|
||||
IEVB = 5,
|
||||
Pendant = 6,
|
||||
neoAnalog = 7,
|
||||
neoECU12 = 8,
|
||||
neoVIPLASMA = 10,
|
||||
neoVIION = 11,
|
||||
ValueCAN4_2EL_4 = 12,
|
||||
cmProbe = 14,
|
||||
EEVB = 15,
|
||||
RADStar = 16,
|
||||
ValueCANrf = 17,
|
||||
neoVIFIRE2 = 18,
|
||||
RADGalaxy = 19,
|
||||
RADStar2 = 20,
|
||||
VividCAN = 21,
|
||||
neoOBD2Sim = 22,
|
||||
neoOBD2Pro = 23,
|
||||
ValueCAN4_1_2 = 24,
|
||||
neoECUAVBTSN = 25,
|
||||
RADSupermoon = 26,
|
||||
RADMoon2 = 27,
|
||||
RADPluto = 28,
|
||||
RADMars = 29,
|
||||
RADIOCANHUB = 30,
|
||||
neoOBD2LCBadge = 31,
|
||||
RADMoonDuo = 32,
|
||||
neoVIFIRE3 = 33,
|
||||
RADJupiter = 34,
|
||||
ValueCAN4Industrial = 35,
|
||||
RADGigastar = 36,
|
||||
VividCANProUnused = 37, // The VividCAN Pro was double allocated
|
||||
EtherBADGE = 38,
|
||||
RADEpsilon = 39,
|
||||
RADA2B = 40,
|
||||
SFPModule = 41,
|
||||
RADGalaxy2 = 47,
|
||||
RADMoon3 = 49,
|
||||
RADComet = 50,
|
||||
Connect = 51,
|
||||
RADComet3 = 54,
|
||||
RADMoonT1S = 56,
|
||||
RADGigastar2 = 57
|
||||
};
|
||||
|
||||
virtual ProductID getProductID() const = 0;
|
||||
|
||||
/**
|
||||
* Returns information for all potential chips, note some chips
|
||||
* might not apply to a specific device depending on different
|
||||
* hardware versions
|
||||
*/
|
||||
virtual const std::vector<ChipInfo>& getChipInfo() const {
|
||||
static std::vector<ChipInfo> placeHolder;
|
||||
return placeHolder; // TODO: Make pure virtual maybe?
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns bootloader instructions
|
||||
*/
|
||||
virtual BootloaderPipeline getBootloader() {
|
||||
return {};
|
||||
}
|
||||
|
||||
bool hasBootloader() { return !!getBootloader(); }
|
||||
|
||||
static std::string SerialNumToString(uint32_t serial);
|
||||
static uint32_t SerialStringToNum(const std::string& serial);
|
||||
static bool SerialStringIsNumeric(const std::string& serial);
|
||||
|
|
@ -155,6 +229,7 @@ public:
|
|||
virtual bool goOffline();
|
||||
virtual bool enableLogData();
|
||||
virtual bool disableLogData();
|
||||
virtual bool reconnect(std::chrono::milliseconds timeout, std::chrono::milliseconds interval = std::chrono::milliseconds(100));
|
||||
|
||||
enum class PreloadReturn : uint8_t
|
||||
{
|
||||
|
|
@ -568,6 +643,12 @@ public:
|
|||
NODISCARD("If the Lifetime is not held, the callback will be immediately removed")
|
||||
Lifetime addLoggingCallback(ScriptStatusCallback cb) { return addScriptStatusCallback(ScriptStatus::Logging, std::move(cb)); }
|
||||
|
||||
typedef std::function<void(void)> VINAvailableCallback;
|
||||
NODISCARD("If the Lifetime is not held, the callback will be immediately removed")
|
||||
Lifetime addVINAvailableCallback(VINAvailableCallback cb);
|
||||
std::optional<bool> isVINEnabled() const;
|
||||
std::optional<std::string> getVIN() const;
|
||||
|
||||
virtual std::vector<std::shared_ptr<FlexRay::Controller>> getFlexRayControllers() const { return {}; }
|
||||
|
||||
void addExtension(std::shared_ptr<DeviceExtension>&& extension);
|
||||
|
|
@ -580,10 +661,13 @@ public:
|
|||
|
||||
bool refreshComponentVersions();
|
||||
/**
|
||||
* For use by extensions only. A more stable API will be provided in the future.
|
||||
* For use by extensions only.
|
||||
*/
|
||||
const std::vector<std::optional<DeviceAppVersion>>& getVersions() const { return versions; }
|
||||
const std::vector<ComponentVersion>& getComponentVersions() const { return componentVersions; }
|
||||
|
||||
virtual std::vector<VersionReport> getChipVersions(bool refreshComponents = true);
|
||||
|
||||
|
||||
/**
|
||||
* Some alternate communication protocols do not support DFU
|
||||
|
|
@ -931,6 +1015,7 @@ private:
|
|||
std::atomic<bool> wiviSleepRequested{false};
|
||||
std::vector<NewCaptureCallback> newCaptureCallbacks;
|
||||
std::vector< std::pair<SleepRequestedCallback, bool /* notified */> > sleepRequestedCallbacks;
|
||||
std::vector<std::pair<VINAvailableCallback, bool /* notified */>> vinAvailableCallbacks;
|
||||
void wiviThreadBody();
|
||||
void stopWiVIThreadIfNecessary(std::unique_lock<std::mutex> lk);
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ public:
|
|||
RADComet3 = (0x00000027),
|
||||
RADMoonT1S = (0x00000028),
|
||||
RADGigastar2 = (0x00000029),
|
||||
FIRE3_T1S_LIN = (0x0000002A),
|
||||
FIRE3_T1S_SENT = (0x0000002B),
|
||||
RED = (0x00000040),
|
||||
ECU = (0x00000080),
|
||||
IEVB = (0x00000100),
|
||||
|
|
@ -196,6 +198,10 @@ public:
|
|||
return "neoOBD2 SIM";
|
||||
case FIRE3_FlexRay:
|
||||
return "neoVI FIRE3 FlexRay";
|
||||
case FIRE3_T1S_LIN:
|
||||
return "neoVI FIRE3 T1S/LIN";
|
||||
case FIRE3_T1S_SENT:
|
||||
return "neoVI FIRE3 T1S/SENT";
|
||||
case RADComet3:
|
||||
return "RAD-Comet 3";
|
||||
case RADMoonT1S:
|
||||
|
|
@ -263,6 +269,8 @@ private:
|
|||
#define ICSNEO_DEVICETYPE_RADCOMET3 ((devicetype_t)0x00000027)
|
||||
#define ICSNEO_DEVICETYPE_RADMOONT1S ((devicetype_t)0x00000028)
|
||||
#define ICSNEO_DEVICETYPE_RADGIGASTAR2 ((devicetype_t)0x00000029)
|
||||
#define ICSNEO_DEVICETYPE_FIRE3_T1S_LIN ((devicetype_t)0x0000002A)
|
||||
#define ICSNEO_DEVICETYPE_FIRE3_T1S_SENT ((devicetype_t)0x0000002B)
|
||||
#define ICSNEO_DEVICETYPE_RED ((devicetype_t)0x00000040)
|
||||
#define ICSNEO_DEVICETYPE_ECU ((devicetype_t)0x00000080)
|
||||
#define ICSNEO_DEVICETYPE_IEVB ((devicetype_t)0x00000100)
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
#ifndef __FOUNDDEVICE_H_
|
||||
#define __FOUNDDEVICE_H_
|
||||
|
||||
#include "icsneo/communication/driver.h"
|
||||
#include "icsneo/device/neodevice.h"
|
||||
#include "icsneo/api/eventmanager.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class Driver;
|
||||
typedef std::function< std::unique_ptr<Driver>(device_eventhandler_t err, neodevice_t& forDevice) > driver_factory_t;
|
||||
|
||||
class FoundDevice {
|
||||
|
|
|
|||
|
|
@ -669,10 +669,15 @@ typedef struct
|
|||
#define FIRE3LINUXSETTINGS_SIZE 8
|
||||
static_assert(sizeof(Fire3LinuxSettings) == FIRE3LINUXSETTINGS_SIZE, "Fire3LinuxSettings is the wrong size!");
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201) // nameless struct/union
|
||||
#endif
|
||||
|
||||
/* Define number of CMP streams per device*/
|
||||
#define CMP_STREAMS_FIRE3 (10)
|
||||
#define CMP_STREAMS_FIRE3FR (10)
|
||||
#define CMP_STREAMS_FIRE3T1SLIN (10)
|
||||
#define CMP_STREAMS_RED2 (10)
|
||||
#define CMP_STREAMS_A2B (3)
|
||||
#define CMP_STREAMS_GIGASTAR (10)
|
||||
|
|
@ -686,7 +691,17 @@ typedef struct
|
|||
uint8_t spare : 4;
|
||||
uint8_t streamId;
|
||||
uint8_t dstMac[6];
|
||||
uint64_t network_enables_1;
|
||||
union
|
||||
{
|
||||
uint64_t word;
|
||||
struct
|
||||
{
|
||||
uint16_t network_enables;
|
||||
uint16_t network_enables_2;
|
||||
uint16_t network_enables_3;
|
||||
uint16_t network_enables_4;
|
||||
};
|
||||
} network_enables;
|
||||
uint64_t network_enables_2;
|
||||
} CMP_NETWORK_DATA;
|
||||
|
||||
|
|
@ -714,7 +729,7 @@ public:
|
|||
using TerminationGroup = std::vector<Network>;
|
||||
|
||||
static constexpr uint16_t GS_VERSION = 5;
|
||||
static std::optional<uint16_t> CalculateGSChecksum(const std::vector<uint8_t>& settings, std::optional<size_t> knownSize = std::nullopt);
|
||||
static std::optional<uint16_t> CalculateGSChecksum(const std::vector<uint8_t>& settings);
|
||||
static CANBaudrate GetEnumValueForBaudrate(int64_t baudrate);
|
||||
static int64_t GetBaudrateValueForEnum(CANBaudrate enumValue);
|
||||
static bool ValidateLINBaudrate(int64_t baudrate);
|
||||
|
|
@ -723,7 +738,7 @@ public:
|
|||
virtual ~IDeviceSettings() {}
|
||||
bool ok() const { return !disabled && settingsLoaded; }
|
||||
|
||||
virtual bool refresh(bool ignoreChecksum = false); // Get from device
|
||||
virtual bool refresh(); // Get from device
|
||||
|
||||
// Send to device, if temporary device keeps settings in volatile RAM until power cycle, otherwise saved to EEPROM
|
||||
virtual bool apply(bool temporary = false);
|
||||
|
|
@ -931,7 +946,6 @@ public:
|
|||
bool disabled = false;
|
||||
|
||||
bool readonly = false;
|
||||
bool disableGSChecksumming = false;
|
||||
|
||||
std::atomic<bool> applyingSettings{false};
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -26,6 +26,10 @@ public:
|
|||
return supportedNetworks;
|
||||
}
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::EtherBADGE;
|
||||
}
|
||||
|
||||
protected:
|
||||
EtherBADGE(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<EtherBADGESettings>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,10 @@ public:
|
|||
return supportedNetworks;
|
||||
}
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::neoOBD2Pro;
|
||||
}
|
||||
|
||||
private:
|
||||
NeoOBD2PRO(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize(makeDriver);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,10 @@ public:
|
|||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::neoOBD2Sim;
|
||||
}
|
||||
private:
|
||||
NeoOBD2SIM(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize(makeDriver);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,28 @@ public:
|
|||
return supportedNetworks;
|
||||
}
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::Connect;
|
||||
}
|
||||
|
||||
const std::vector<ChipInfo>& getChipInfo() const override {
|
||||
static std::vector<ChipInfo> chips = {
|
||||
{ChipID::Connect_ZCHIP, true, "ZCHIP", "neovi_connect_zchip_ief", 0, FirmwareType::IEF},
|
||||
{ChipID::Connect_LINUX, true, "Linux Flash", "neovi_connect_lnx_flash_ief", 1, FirmwareType::IEF},
|
||||
};
|
||||
return chips;
|
||||
}
|
||||
|
||||
BootloaderPipeline getBootloader() override {
|
||||
return BootloaderPipeline()
|
||||
.add<FlashPhase>(ChipID::Connect_ZCHIP, BootloaderCommunication::Application, true, false, false)
|
||||
.add<FlashPhase>(ChipID::Connect_LINUX, BootloaderCommunication::Application, false, false, false)
|
||||
.add<FinalizePhase>(ChipID::Connect_ZCHIP, BootloaderCommunication::Application)
|
||||
.add<FinalizePhase>(ChipID::Connect_LINUX, BootloaderCommunication::Application)
|
||||
.add<ReconnectPhase>()
|
||||
.addSetting(BootloaderSetting::UpdateAll, true);
|
||||
}
|
||||
|
||||
protected:
|
||||
NeoVIConnect(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<NeoVIConnectSettings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace icsneo {
|
|||
class NeoVIFIRE : public Device {
|
||||
public:
|
||||
// USB PID is 0x0701, standard driver is DXX
|
||||
ICSNEO_FINDABLE_DEVICE_BY_PID(NeoVIFIRE, DeviceType::FIRE, 0x0701);
|
||||
ICSNEO_FINDABLE_DEVICE_BY_SERIAL_RANGE(NeoVIFIRE, DeviceType::FIRE, "50000", "79999");
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
|
|
@ -57,6 +57,9 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::neoVIFIRE;
|
||||
}
|
||||
private:
|
||||
NeoVIFIRE(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<NeoVIFIRESettings>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -87,6 +87,28 @@ public:
|
|||
};
|
||||
}
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::neoVIFIRE2;
|
||||
}
|
||||
|
||||
const std::vector<ChipInfo>& getChipInfo() const override {
|
||||
static std::vector<ChipInfo> chips = {
|
||||
{ChipID::neoVIFIRE2_MCHIP, true, "MCHIP", "fire2_mchip_ief", 0, FirmwareType::IEF},
|
||||
{ChipID::neoVIFIRE2_ZYNQ, true, "ZCHIP", "fire2_zchip_ief", 1, FirmwareType::IEF},
|
||||
{ChipID::neoVIFIRE2_Core, true, "Core", "fire2_core", 2, FirmwareType::IEF},
|
||||
};
|
||||
return chips;
|
||||
}
|
||||
|
||||
BootloaderPipeline getBootloader() override {
|
||||
return BootloaderPipeline()
|
||||
.add<EnterBootloaderPhase>()
|
||||
.add<FlashPhase>(ChipID::neoVIFIRE2_MCHIP, BootloaderCommunication::RED)
|
||||
.add<FlashPhase>(ChipID::neoVIFIRE2_ZYNQ, BootloaderCommunication::RED, false, true)
|
||||
.add<FlashPhase>(ChipID::neoVIFIRE2_Core, BootloaderCommunication::REDCore, false, false)
|
||||
.add<ReconnectPhase>();
|
||||
}
|
||||
|
||||
protected:
|
||||
NeoVIFIRE2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<NeoVIFIRE2Settings, Disk::NeoMemoryDiskDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -50,6 +50,34 @@ public:
|
|||
return supportedNetworks;
|
||||
}
|
||||
size_t getEthernetActivationLineCount() const override { return 2; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::neoVIFIRE3;
|
||||
}
|
||||
|
||||
const std::vector<ChipInfo>& getChipInfo() const override {
|
||||
static std::vector<ChipInfo> chips = {
|
||||
{ChipID::neoVIFIRE3_ZCHIP, true, "ZCHIP", "fire3_zchip_ief", 0, FirmwareType::IEF},
|
||||
{ChipID::neoVIFIRE3_SCHIP, true, "SCHIP", "fire3_schip_ief", 1, FirmwareType::IEF},
|
||||
{ChipID::neoVIFIRE3_LINUX, true, "Linux Flash", "fire3_lnx_flash_ief", 2, FirmwareType::IEF},
|
||||
{ChipID::VEM_01_8DW_ZCHIP, true, "VEM-01-Z", "vem_01_8dw_zchip_ief", 3, FirmwareType::IEF}
|
||||
};
|
||||
return chips;
|
||||
}
|
||||
|
||||
BootloaderPipeline getBootloader() override {
|
||||
return BootloaderPipeline()
|
||||
.add<FlashPhase>(ChipID::neoVIFIRE3_ZCHIP, BootloaderCommunication::Application, true, false)
|
||||
.add<FlashPhase>(ChipID::neoVIFIRE3_SCHIP, BootloaderCommunication::Application, false, true)
|
||||
.add<FlashPhase>(ChipID::neoVIFIRE3_LINUX, BootloaderCommunication::Application, false, false, false)
|
||||
.add<FlashPhase>(ChipID::VEM_01_8DW_ZCHIP, BootloaderCommunication::Application, false, false)
|
||||
.add<FinalizePhase>(ChipID::neoVIFIRE3_ZCHIP, BootloaderCommunication::Application)
|
||||
.add<FinalizePhase>(ChipID::neoVIFIRE3_SCHIP, BootloaderCommunication::Application)
|
||||
.add<FinalizePhase>(ChipID::neoVIFIRE3_LINUX, BootloaderCommunication::Application)
|
||||
.add<FinalizePhase>(ChipID::VEM_01_8DW_ZCHIP, BootloaderCommunication::Application)
|
||||
.add<ReconnectPhase>()
|
||||
.addSetting(BootloaderSetting::UpdateAll, true);
|
||||
}
|
||||
protected:
|
||||
NeoVIFIRE3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<NeoVIFIRE3Settings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||
|
|
@ -80,7 +108,7 @@ protected:
|
|||
bool supportsGPTP() const override { return true; }
|
||||
|
||||
std::optional<MemoryAddress> getCoreminiStartAddressFlash() const override {
|
||||
return 33*1024*1024;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<MemoryAddress> getCoreminiStartAddressSD() const override {
|
||||
|
|
|
|||
|
|
@ -139,6 +139,10 @@ typedef struct {
|
|||
|
||||
uint64_t network_enables_2;
|
||||
uint64_t termination_enables_2;
|
||||
uint16_t iso_tester_pullup_enable;
|
||||
CMP_GLOBAL_DATA cmp_global_data;
|
||||
CMP_NETWORK_DATA cmp_stream_data[CMP_STREAMS_FIRE3];
|
||||
uint32_t networkTimeSync;
|
||||
} neovifire3_settings_t;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace icsneo {
|
|||
class NeoVIFIRE3FlexRay : public Device {
|
||||
public:
|
||||
// Serial numbers start with FF
|
||||
// Ethernet MAC allocation is 1F, standard driver is Raw
|
||||
// Ethernet MAC allocation is 0x1E, standard driver is Raw
|
||||
ICSNEO_FINDABLE_DEVICE(NeoVIFIRE3FlexRay, DeviceType::FIRE3_FlexRay, "FF");
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
|
|
@ -53,6 +53,36 @@ public:
|
|||
return supportedNetworks;
|
||||
}
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::neoVIFIRE3;
|
||||
}
|
||||
|
||||
const std::vector<ChipInfo>& getChipInfo() const override {
|
||||
static std::vector<ChipInfo> chips = {
|
||||
{ChipID::neoVIFIRE3_ZCHIP, true, "ZCHIP", "fire3_zchip_ief", 0, FirmwareType::IEF},
|
||||
{ChipID::neoVIFIRE3_SCHIP, true, "SCHIP", "fire3_schip_ief", 1, FirmwareType::IEF},
|
||||
{ChipID::neoVIFIRE3_LINUX, true, "Linux Flash", "fire3_lnx_flash_ief", 2, FirmwareType::IEF},
|
||||
{ChipID::VEM_02_FR_ZCHIP, true, "VEM-02-Z", "vem_02_fr_zchip_ief", 3, FirmwareType::IEF},
|
||||
{ChipID::VEM_02_FR_FCHIP, true, "VEM-02-F", "vem_02_fr_fchip_ief", 4, FirmwareType::IEF},
|
||||
};
|
||||
return chips;
|
||||
}
|
||||
|
||||
BootloaderPipeline getBootloader() override {
|
||||
return BootloaderPipeline()
|
||||
.add<FlashPhase>(ChipID::neoVIFIRE3_ZCHIP, BootloaderCommunication::Application, true, false)
|
||||
.add<FlashPhase>(ChipID::neoVIFIRE3_SCHIP, BootloaderCommunication::Application, false, true)
|
||||
.add<FlashPhase>(ChipID::neoVIFIRE3_LINUX, BootloaderCommunication::Application, false, false, false)
|
||||
.add<FlashPhase>(ChipID::VEM_02_FR_FCHIP, BootloaderCommunication::Application, false, false)
|
||||
.add<FlashPhase>(ChipID::VEM_02_FR_ZCHIP, BootloaderCommunication::Application, false, false)
|
||||
.add<FinalizePhase>(ChipID::neoVIFIRE3_ZCHIP, BootloaderCommunication::Application)
|
||||
.add<FinalizePhase>(ChipID::neoVIFIRE3_SCHIP, BootloaderCommunication::Application)
|
||||
.add<FinalizePhase>(ChipID::neoVIFIRE3_LINUX, BootloaderCommunication::Application)
|
||||
.add<FinalizePhase>(ChipID::VEM_02_FR_FCHIP, BootloaderCommunication::Application)
|
||||
.add<FinalizePhase>(ChipID::VEM_02_FR_ZCHIP, BootloaderCommunication::Application)
|
||||
.add<ReconnectPhase>()
|
||||
.addSetting(BootloaderSetting::UpdateAll, true);
|
||||
}
|
||||
protected:
|
||||
NeoVIFIRE3FlexRay(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<NeoVIFIRE3FlexRaySettings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||
|
|
@ -81,7 +111,7 @@ protected:
|
|||
bool supportsLiveData() const override { return true; }
|
||||
|
||||
std::optional<MemoryAddress> getCoreminiStartAddressFlash() const override {
|
||||
return 512*4;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<MemoryAddress> getCoreminiStartAddressSD() const override {
|
||||
|
|
|
|||
|
|
@ -122,6 +122,10 @@ typedef struct {
|
|||
|
||||
uint16_t flex_mode;
|
||||
uint16_t flex_termination;
|
||||
uint16_t iso_tester_pullup_enable;
|
||||
CMP_GLOBAL_DATA cmp_global_data;
|
||||
CMP_NETWORK_DATA cmp_stream_data[CMP_STREAMS_FIRE3FR];
|
||||
uint32_t networkTimeSync;
|
||||
} neovifire3flexray_settings_t;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,109 @@
|
|||
#ifndef __NEOVIFIRE3T1SLIN_H_
|
||||
#define __NEOVIFIRE3T1SLIN_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/neovifire3t1slin/neovifire3t1slinsettings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class NeoVIFIRE3T1SLIN : public Device {
|
||||
public:
|
||||
// Serial numbers start with FT
|
||||
// Ethernet MAC allocation is 0x1E, standard driver is Raw
|
||||
ICSNEO_FINDABLE_DEVICE(NeoVIFIRE3T1SLIN, DeviceType::FIRE3_T1S_LIN, "FT");
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::DWCAN_01,
|
||||
Network::NetID::DWCAN_08,
|
||||
Network::NetID::DWCAN_02,
|
||||
Network::NetID::DWCAN_03,
|
||||
Network::NetID::DWCAN_04,
|
||||
Network::NetID::DWCAN_05,
|
||||
Network::NetID::DWCAN_06,
|
||||
Network::NetID::DWCAN_07,
|
||||
|
||||
Network::NetID::LIN_01,
|
||||
Network::NetID::LIN_02,
|
||||
Network::NetID::LIN_03,
|
||||
Network::NetID::LIN_04,
|
||||
Network::NetID::LIN_05,
|
||||
Network::NetID::LIN_06,
|
||||
Network::NetID::LIN_07,
|
||||
Network::NetID::LIN_08,
|
||||
Network::NetID::LIN_09,
|
||||
Network::NetID::LIN_10,
|
||||
|
||||
Network::NetID::ISO9141_01,
|
||||
Network::NetID::ISO9141_02,
|
||||
Network::NetID::ISO9141_03,
|
||||
Network::NetID::ISO9141_04,
|
||||
|
||||
Network::NetID::ETHERNET_01,
|
||||
Network::NetID::ETHERNET_02,
|
||||
|
||||
Network::NetID::AE_01,
|
||||
Network::NetID::AE_02,
|
||||
Network::NetID::AE_03,
|
||||
Network::NetID::AE_04,
|
||||
Network::NetID::AE_05,
|
||||
Network::NetID::AE_06,
|
||||
Network::NetID::AE_07,
|
||||
Network::NetID::AE_08,
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
bool supportsTC10() const override { return true; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::neoVIFIRE3;
|
||||
}
|
||||
protected:
|
||||
NeoVIFIRE3T1SLIN(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<NeoVIFIRE3T1SLINSettings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(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<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
|
||||
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
|
||||
bool supportsWiVI() const override { return true; }
|
||||
|
||||
bool supportsLiveData() const override { return true; }
|
||||
|
||||
bool supportsGPTP() const override { return true; }
|
||||
|
||||
std::optional<MemoryAddress> getCoreminiStartAddressFlash() const override {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<MemoryAddress> getCoreminiStartAddressSD() const override {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool supportsEraseMemory() const override {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,271 @@
|
|||
#ifndef __NEOVIFIRE3T1SLINSETTINGS_H_
|
||||
#define __NEOVIFIRE3T1SLINSETTINGS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#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;
|
||||
uint64_t 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_1;
|
||||
TIMESYNC_ICSHARDWARE_SETTINGS timeSync;
|
||||
STextAPISettings text_api;
|
||||
struct
|
||||
{
|
||||
uint32_t disableUsbCheckOnBoot : 1;
|
||||
uint32_t enableLatencyTest : 1;
|
||||
uint32_t busMessagesToAndroid : 1;
|
||||
uint32_t reserved1 : 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_1;
|
||||
ETHERNET_SETTINGS ethernet_2;
|
||||
ETHERNET_SETTINGS2 ethernet2_2;
|
||||
Fire3LinuxSettings os_settings;
|
||||
RAD_GPTP_SETTINGS gPTP;
|
||||
|
||||
/* VEM */
|
||||
// 10T1S
|
||||
ETHERNET_SETTINGS2 ethT1s1;
|
||||
ETHERNET10T1S_SETTINGS t1s1;
|
||||
ETHERNET10T1S_SETTINGS_EXT t1s1Ext;
|
||||
// 10T1S
|
||||
ETHERNET_SETTINGS2 ethT1s2;
|
||||
ETHERNET10T1S_SETTINGS t1s2;
|
||||
ETHERNET10T1S_SETTINGS_EXT t1s2Ext;
|
||||
// 10T1S
|
||||
ETHERNET_SETTINGS2 ethT1s3;
|
||||
ETHERNET10T1S_SETTINGS t1s3;
|
||||
ETHERNET10T1S_SETTINGS_EXT t1s3Ext;
|
||||
// 10T1S
|
||||
ETHERNET_SETTINGS2 ethT1s4;
|
||||
ETHERNET10T1S_SETTINGS t1s4;
|
||||
ETHERNET10T1S_SETTINGS_EXT t1s4Ext;
|
||||
// 10T1S
|
||||
ETHERNET_SETTINGS2 ethT1s5;
|
||||
ETHERNET10T1S_SETTINGS t1s5;
|
||||
ETHERNET10T1S_SETTINGS_EXT t1s5Ext;
|
||||
// 10T1S
|
||||
ETHERNET_SETTINGS2 ethT1s6;
|
||||
ETHERNET10T1S_SETTINGS t1s6;
|
||||
ETHERNET10T1S_SETTINGS_EXT t1s6Ext;
|
||||
// 10T1S
|
||||
ETHERNET_SETTINGS2 ethT1s7;
|
||||
ETHERNET10T1S_SETTINGS t1s7;
|
||||
ETHERNET10T1S_SETTINGS_EXT t1s7Ext;
|
||||
// 10T1S
|
||||
ETHERNET_SETTINGS2 ethT1s8;
|
||||
ETHERNET10T1S_SETTINGS t1s8;
|
||||
ETHERNET10T1S_SETTINGS_EXT t1s8Ext;
|
||||
|
||||
LIN_SETTINGS lin3;
|
||||
LIN_SETTINGS lin4;
|
||||
LIN_SETTINGS lin5;
|
||||
LIN_SETTINGS lin6;
|
||||
LIN_SETTINGS lin7;
|
||||
LIN_SETTINGS lin8;
|
||||
LIN_SETTINGS lin9;
|
||||
LIN_SETTINGS lin10;
|
||||
|
||||
ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings_3;
|
||||
uint16_t iso_parity_3;
|
||||
uint16_t iso_msg_termination_3;
|
||||
ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings_4;
|
||||
uint16_t iso_parity_4;
|
||||
uint16_t iso_msg_termination_4;
|
||||
|
||||
uint16_t iso_tester_pullup_enable;
|
||||
|
||||
uint64_t network_enables_5;
|
||||
|
||||
CMP_GLOBAL_DATA cmp_global_data;
|
||||
CMP_NETWORK_DATA cmp_stream_data[CMP_STREAMS_FIRE3T1SLIN];
|
||||
uint32_t networkTimeSync;
|
||||
} neovifire3t1slin_settings_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t backupPowerGood;
|
||||
uint8_t backupPowerEnabled;
|
||||
uint8_t usbHostPowerEnabled;
|
||||
uint8_t ethernetActivationLineEnabled;
|
||||
EthernetNetworkStatus ethernetStatus;
|
||||
} neovifire3t1slin_status_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class NeoVIFIRE3T1SLINSettings : public IDeviceSettings {
|
||||
public:
|
||||
NeoVIFIRE3T1SLINSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(neovifire3t1slin_settings_t)) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<neovifire3t1slin_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
switch(net.getNetID()) {
|
||||
case Network::NetID::DWCAN_01:
|
||||
return &(cfg->can1);
|
||||
case Network::NetID::DWCAN_08:
|
||||
return &(cfg->can2);
|
||||
case Network::NetID::DWCAN_02:
|
||||
return &(cfg->can3);
|
||||
case Network::NetID::DWCAN_03:
|
||||
return &(cfg->can4);
|
||||
case Network::NetID::DWCAN_04:
|
||||
return &(cfg->can5);
|
||||
case Network::NetID::DWCAN_05:
|
||||
return &(cfg->can6);
|
||||
case Network::NetID::DWCAN_06:
|
||||
return &(cfg->can7);
|
||||
case Network::NetID::DWCAN_07:
|
||||
return &(cfg->can8);
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
const CANFD_SETTINGS* getCANFDSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<neovifire3t1slin_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
switch(net.getNetID()) {
|
||||
case Network::NetID::DWCAN_01:
|
||||
return &(cfg->canfd1);
|
||||
case Network::NetID::DWCAN_08:
|
||||
return &(cfg->canfd2);
|
||||
case Network::NetID::DWCAN_02:
|
||||
return &(cfg->canfd3);
|
||||
case Network::NetID::DWCAN_03:
|
||||
return &(cfg->canfd4);
|
||||
case Network::NetID::DWCAN_04:
|
||||
return &(cfg->canfd5);
|
||||
case Network::NetID::DWCAN_05:
|
||||
return &(cfg->canfd6);
|
||||
case Network::NetID::DWCAN_06:
|
||||
return &(cfg->canfd7);
|
||||
case Network::NetID::DWCAN_07:
|
||||
return &(cfg->canfd8);
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
virtual std::vector<TerminationGroup> getTerminationGroups() const override {
|
||||
return {
|
||||
{
|
||||
Network(Network::NetID::DWCAN_01),
|
||||
Network(Network::NetID::DWCAN_03),
|
||||
Network(Network::NetID::DWCAN_05),
|
||||
Network(Network::NetID::DWCAN_07)
|
||||
},
|
||||
{
|
||||
Network(Network::NetID::DWCAN_08),
|
||||
Network(Network::NetID::DWCAN_02),
|
||||
Network(Network::NetID::DWCAN_04),
|
||||
Network(Network::NetID::DWCAN_06)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const LIN_SETTINGS* getLINSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<neovifire3t1slin_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
switch(net.getNetID()) {
|
||||
case Network::NetID::LIN_01:
|
||||
return &(cfg->lin1);
|
||||
case Network::NetID::LIN_02:
|
||||
return &(cfg->lin2);
|
||||
case Network::NetID::LIN_03:
|
||||
return &(cfg->lin3);
|
||||
case Network::NetID::LIN_04:
|
||||
return &(cfg->lin4);
|
||||
case Network::NetID::LIN_05:
|
||||
return &(cfg->lin5);
|
||||
case Network::NetID::LIN_06:
|
||||
return &(cfg->lin6);
|
||||
case Network::NetID::LIN_07:
|
||||
return &(cfg->lin7);
|
||||
case Network::NetID::LIN_08:
|
||||
return &(cfg->lin8);
|
||||
case Network::NetID::LIN_09:
|
||||
return &(cfg->lin9);
|
||||
case Network::NetID::LIN_10:
|
||||
return &(cfg->lin10);
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
ICSNEO_UNALIGNED(const uint64_t*) getTerminationEnables() const override {
|
||||
auto cfg = getStructurePointer<neovifire3t1slin_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
return &cfg->termination_enables;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
|
|
@ -37,6 +37,30 @@ public:
|
|||
|
||||
bool supportsGPTP() const override { return true; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::neoVIFIRE3;
|
||||
}
|
||||
|
||||
const std::vector<ChipInfo>& getChipInfo() const override {
|
||||
static std::vector<ChipInfo> chips = {
|
||||
{ChipID::neoVIFIRE3_ZCHIP, true, "ZCHIP", "fire3_zchip_ief", 0, FirmwareType::IEF},
|
||||
{ChipID::neoVIFIRE3_SCHIP, true, "SCHIP", "fire3_schip_ief", 1, FirmwareType::IEF},
|
||||
{ChipID::neoVIFIRE3_LINUX, true, "Linux Flash", "fire3_lnx_flash_ief", 2, FirmwareType::IEF}
|
||||
};
|
||||
return chips;
|
||||
}
|
||||
|
||||
BootloaderPipeline getBootloader() override {
|
||||
return BootloaderPipeline()
|
||||
.add<FlashPhase>(ChipID::neoVIFIRE3_ZCHIP, BootloaderCommunication::Application, true, false)
|
||||
.add<FlashPhase>(ChipID::neoVIFIRE3_SCHIP, BootloaderCommunication::Application, false, true)
|
||||
.add<FlashPhase>(ChipID::neoVIFIRE3_LINUX, BootloaderCommunication::Application, false, false, false)
|
||||
.add<FinalizePhase>(ChipID::neoVIFIRE3_ZCHIP, BootloaderCommunication::Application)
|
||||
.add<FinalizePhase>(ChipID::neoVIFIRE3_SCHIP, BootloaderCommunication::Application)
|
||||
.add<FinalizePhase>(ChipID::neoVIFIRE3_LINUX, BootloaderCommunication::Application)
|
||||
.add<ReconnectPhase>()
|
||||
.addSetting(BootloaderSetting::UpdateAll, true);
|
||||
}
|
||||
protected:
|
||||
NeoVIRED2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<NeoVIRED2Settings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -13,8 +13,11 @@ namespace icsneo {
|
|||
class NeoVIION : public Plasion {
|
||||
public:
|
||||
// USB PID is 0x0901, standard driver is DXX
|
||||
ICSNEO_FINDABLE_DEVICE_BY_PID(NeoVIION, DeviceType::ION, 0x0901);
|
||||
ICSNEO_FINDABLE_DEVICE(NeoVIION, DeviceType::ION, "40");
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::neoVIION;
|
||||
}
|
||||
private:
|
||||
NeoVIION(neodevice_t neodevice, const driver_factory_t& makeDriver) : Plasion(neodevice) {
|
||||
initialize<NullSettings, Disk::PlasionDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -11,8 +11,11 @@ namespace icsneo {
|
|||
class NeoVIPLASMA : public Plasion {
|
||||
public:
|
||||
// USB PID is 0x0801, standard driver is DXX
|
||||
ICSNEO_FINDABLE_DEVICE_BY_PID(NeoVIPLASMA, DeviceType::PLASMA, 0x0801);
|
||||
ICSNEO_FINDABLE_DEVICE(NeoVIPLASMA, DeviceType::PLASMA, "30");
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::neoVIPLASMA;
|
||||
}
|
||||
private:
|
||||
NeoVIPLASMA(neodevice_t neodevice, const driver_factory_t& makeDriver) : Plasion(neodevice) {
|
||||
initialize<NullSettings, Disk::PlasionDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ public:
|
|||
// Until VNET support is added, assume we have one FIRE 2 VNET or FlexRay VNETZ as the main
|
||||
size_t getEthernetActivationLineCount() const override { return 1; }
|
||||
|
||||
bool supportsComponentVersions() const override { return true; }
|
||||
|
||||
protected:
|
||||
using Device::Device;
|
||||
|
||||
|
|
|
|||
|
|
@ -42,11 +42,32 @@ public:
|
|||
size_t getEthernetActivationLineCount() const override { return 1; }
|
||||
bool supportsGPTP() const override { return true; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::RADA2B;
|
||||
}
|
||||
|
||||
const std::vector<ChipInfo>& getChipInfo() const override {
|
||||
static std::vector<ChipInfo> chips = {
|
||||
{ChipID::RADA2B_ZCHIP, true, "ZCHIP", "RADA2B_SW_bin", 0, FirmwareType::Zip},
|
||||
{ChipID::RADA2B_REVB_ZCHIP, false, "ZCHIP", "RADA2B_REVB_SW_bin", 0, FirmwareType::Zip}
|
||||
};
|
||||
return chips;
|
||||
}
|
||||
|
||||
BootloaderPipeline getBootloader() override {
|
||||
return BootloaderPipeline()
|
||||
.add<EnterBootloaderPhase>()
|
||||
.add<FlashPhase>(ChipID::RADA2B_ZCHIP, BootloaderCommunication::RAD)
|
||||
.add<ReconnectPhase>()
|
||||
.add<WaitPhase>(std::chrono::milliseconds(3000));
|
||||
}
|
||||
protected:
|
||||
RADA2B(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADA2BSettings, Disk::NeoMemoryDiskDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void setupPacketizer(Packetizer& packetizer) override {
|
||||
Device::setupPacketizer(packetizer);
|
||||
packetizer.disableChecksum = true;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,25 @@ public:
|
|||
bool getEthPhyRegControlSupported() const override { return true; }
|
||||
bool supportsGPTP() const override { return true; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::RADComet;
|
||||
}
|
||||
|
||||
const std::vector<ChipInfo>& getChipInfo() const override {
|
||||
static std::vector<ChipInfo> chips = {
|
||||
{ChipID::RADComet_ZYNQ, true, "ZCHIP", "RADComet_SW_bin", 0, FirmwareType::Zip},
|
||||
};
|
||||
return chips;
|
||||
}
|
||||
|
||||
BootloaderPipeline getBootloader() override {
|
||||
return BootloaderPipeline()
|
||||
.add<EnterBootloaderPhase>()
|
||||
.add<FlashPhase>(ChipID::RADComet_ZYNQ, BootloaderCommunication::RAD)
|
||||
.add<ReconnectPhase>()
|
||||
.add<WaitPhase>(std::chrono::milliseconds(3000));
|
||||
}
|
||||
|
||||
protected:
|
||||
using Device::Device;
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,25 @@ public:
|
|||
bool supportsTC10() const override { return true; }
|
||||
bool supportsGPTP() const override { return true; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::RADComet3;
|
||||
}
|
||||
|
||||
const std::vector<ChipInfo>& getChipInfo() const override {
|
||||
static std::vector<ChipInfo> chips = {
|
||||
{ChipID::RADCOMET3_ZCHIP, true, "ZCHIP", "RADComet3_SW_bin", 0, FirmwareType::Zip},
|
||||
};
|
||||
return chips;
|
||||
}
|
||||
|
||||
BootloaderPipeline getBootloader() override {
|
||||
return BootloaderPipeline()
|
||||
.add<EnterBootloaderPhase>()
|
||||
.add<FlashPhase>(ChipID::RADCOMET3_ZCHIP, BootloaderCommunication::RAD)
|
||||
.add<ReconnectPhase>()
|
||||
.add<WaitPhase>(std::chrono::milliseconds(3000));
|
||||
}
|
||||
|
||||
protected:
|
||||
RADComet3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADComet3Settings>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,26 @@ public:
|
|||
return supportedNetworks;
|
||||
}
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::RADEpsilon;
|
||||
}
|
||||
|
||||
const std::vector<ChipInfo>& getChipInfo() const override {
|
||||
static std::vector<ChipInfo> chips = {
|
||||
{ChipID::RADEpsilon_MCHIP, true, "MCHIP", "epsilon_mchip_ief", 0, FirmwareType::IEF},
|
||||
};
|
||||
return chips;
|
||||
}
|
||||
|
||||
BootloaderPipeline getBootloader() override {
|
||||
return BootloaderPipeline()
|
||||
.add<EnterBootloaderPhase>()
|
||||
.add<FlashPhase>(ChipID::RADEpsilon_MCHIP, BootloaderCommunication::RED)
|
||||
.add<ReconnectPhase>();
|
||||
}
|
||||
bool supportsComponentVersions() const override { return true; }
|
||||
|
||||
bool getEthPhyRegControlSupported() const override { return true; }
|
||||
protected:
|
||||
RADEpsilon(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADEpsilonSettings, Disk::NeoMemoryDiskDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,27 @@ public:
|
|||
}
|
||||
|
||||
bool supportsComponentVersions() const override { return true; }
|
||||
|
||||
|
||||
bool getEthPhyRegControlSupported() const override { return true; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::RADEpsilon;
|
||||
}
|
||||
|
||||
const std::vector<ChipInfo>& getChipInfo() const override {
|
||||
static std::vector<ChipInfo> chips = {
|
||||
{ChipID::RADProxima_MCHIP, true, "MCHIP", "epsilon_mchip_ief", 0, FirmwareType::IEF},
|
||||
};
|
||||
return chips;
|
||||
}
|
||||
|
||||
BootloaderPipeline getBootloader() override {
|
||||
return BootloaderPipeline()
|
||||
.add<EnterBootloaderPhase>()
|
||||
.add<FlashPhase>(ChipID::RADProxima_MCHIP, BootloaderCommunication::RED)
|
||||
.add<ReconnectPhase>();
|
||||
}
|
||||
|
||||
protected:
|
||||
RADEpsilonXL(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADEpsilonSettings, Disk::NeoMemoryDiskDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||
|
|
@ -56,6 +76,10 @@ protected:
|
|||
bool supportsEraseMemory() const override {
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t getDiskCount() const override {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
}; // namespace icsneo
|
||||
|
|
|
|||
|
|
@ -63,6 +63,26 @@ public:
|
|||
size_t getEthernetActivationLineCount() const override { return 1; }
|
||||
bool supportsGPTP() const override { return true; }
|
||||
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::RADGalaxy;
|
||||
}
|
||||
|
||||
const std::vector<ChipInfo>& getChipInfo() const override {
|
||||
static std::vector<ChipInfo> chips = {
|
||||
{ChipID::RADGalaxy_ZYNQ, true, "ZCHIP", "RADGalaxy_SG2_SW_bin", 0, FirmwareType::Zip},
|
||||
{ChipID::RADGalaxy_FFG_Zynq, false, "ZCHIP", "RADGalaxy_SG2_FFG_SW_bin", 0, FirmwareType::Zip}
|
||||
};
|
||||
return chips;
|
||||
}
|
||||
|
||||
BootloaderPipeline getBootloader() override {
|
||||
return BootloaderPipeline()
|
||||
.add<EnterBootloaderPhase>()
|
||||
.add<FlashPhase>(ChipID::RADGalaxy_ZYNQ, BootloaderCommunication::RAD)
|
||||
.add<ReconnectPhase>()
|
||||
.add<WaitPhase>(std::chrono::milliseconds(3000));
|
||||
}
|
||||
protected:
|
||||
RADGalaxy(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADGalaxySettings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -67,6 +67,28 @@ public:
|
|||
bool supportsTC10() const override { return true; }
|
||||
bool supportsGPTP() const override { return true; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::RADGalaxy2;
|
||||
}
|
||||
|
||||
const std::vector<ChipInfo>& getChipInfo() const override {
|
||||
static std::vector<ChipInfo> chips = {
|
||||
{ChipID::RAD_GALAXY_2_ZMPCHIP_ID, true, "ZCHIP", "RADGalaxy2_SW_bin_p1", {"RADGalaxy2_SW_bin_p1", "RADGalaxy2_SW_bin_p2"}, 0, FirmwareType::Zip},
|
||||
{ChipID::RADGALAXY2_SYSMON_CHIP, true, "MCHIP", "galaxy2_sysmon_ief", 1, FirmwareType::IEF}
|
||||
};
|
||||
return chips;
|
||||
}
|
||||
|
||||
BootloaderPipeline getBootloader() override {
|
||||
return BootloaderPipeline()
|
||||
.add<EnterBootloaderPhase>()
|
||||
.add<FlashPhase>(ChipID::RAD_GALAXY_2_ZMPCHIP_ID, BootloaderCommunication::RAD)
|
||||
.add<ReconnectPhase>()
|
||||
.add<FlashPhase>(ChipID::RADGALAXY2_SYSMON_CHIP, BootloaderCommunication::RADGalaxy2Peripheral)
|
||||
.add<ReconnectPhase>()
|
||||
.add<WaitPhase>(std::chrono::milliseconds(3000));
|
||||
}
|
||||
|
||||
protected:
|
||||
RADGalaxy2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADGalaxy2Settings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,103 @@ public:
|
|||
bool supportsTC10() const override { return true; }
|
||||
bool supportsGPTP() const override { return true; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::RADGigastar;
|
||||
}
|
||||
|
||||
const std::vector<ChipInfo>& getChipInfo() const override {
|
||||
static std::vector<ChipInfo> chips = {
|
||||
{ChipID::RADGigastar_ZYNQ, true, "ZCHIP", "RADGigastar_SW_bin", 1, FirmwareType::Zip},
|
||||
{ChipID::RADGigastar_FFG_ZYNQ, false, "ZCHIP", "RADGigastar_FFG_SW_bin", 1, FirmwareType::Zip},
|
||||
{ChipID::RADGigastar_USBZ_ZYNQ, true, "USB ZCHIP", "RADGigastar_USBz_SW_bin", 2, FirmwareType::Zip},
|
||||
{ChipID::RADGigastar_USBZ_Z7010_ZYNQ, false, "USB ZCHIP", "RADGigastar_USBz_Z7010_SW_bin", 2, FirmwareType::Zip},
|
||||
{ChipID::RADGigastar_USBZ_Z7007S_ZYNQ, false, "USB ZCHIP", "RADGigastar_USBz_Z7007s_SW_bin", 2, FirmwareType::Zip},
|
||||
};
|
||||
return chips;
|
||||
}
|
||||
|
||||
BootloaderPipeline getBootloader() override {
|
||||
if(supportsComponentVersions()) {
|
||||
// main: 16.1, usb: 14.0
|
||||
auto chipVersions = getChipVersions();
|
||||
auto mainVersion = std::find_if(chipVersions.begin(), chipVersions.end(), [](const auto& ver) { return ver.name == "ZCHIP"; });
|
||||
auto usbVersion = std::find_if(chipVersions.begin(), chipVersions.end(), [](const auto& ver) { return ver.name == "USB ZCHIP"; });
|
||||
|
||||
bool useNewBootloader = false;
|
||||
if(mainVersion != chipVersions.end()) {
|
||||
static constexpr uint8_t NewBootloaderMajor = 16;
|
||||
static constexpr uint8_t NewBootloaderMinor = 1;
|
||||
if(
|
||||
mainVersion->major > NewBootloaderMajor ||
|
||||
(mainVersion->major == NewBootloaderMajor && mainVersion->minor >= NewBootloaderMinor)
|
||||
) {
|
||||
useNewBootloader = true;
|
||||
}
|
||||
} else if(usbVersion != chipVersions.end()) {
|
||||
static constexpr uint8_t NewBootloaderMajorUSB = 14;
|
||||
static constexpr uint8_t NewBootloaderMinorUSB= 0;
|
||||
if(
|
||||
usbVersion->major > NewBootloaderMajorUSB ||
|
||||
(usbVersion->major == NewBootloaderMajorUSB && usbVersion->minor >= NewBootloaderMinorUSB)
|
||||
) {
|
||||
useNewBootloader = true;
|
||||
}
|
||||
}
|
||||
if(useNewBootloader) {
|
||||
BootloaderPipeline pipeline;
|
||||
for(const auto& version : chipVersions) {
|
||||
pipeline.add<FlashPhase>(version.id, BootloaderCommunication::RADMultiChip);
|
||||
}
|
||||
pipeline.add<ReconnectPhase>();
|
||||
pipeline.add<WaitPhase>(std::chrono::milliseconds(3000));
|
||||
return pipeline;
|
||||
}
|
||||
}
|
||||
// If we've reached this point, then we use the legacy flashing
|
||||
if(com->driver->isEthernet()) {
|
||||
return BootloaderPipeline()
|
||||
.add<FlashPhase>(ChipID::RADGigastar_ZYNQ, BootloaderCommunication::RAD)
|
||||
.add<ReconnectPhase>()
|
||||
.add<WaitPhase>(std::chrono::milliseconds(3000));
|
||||
}
|
||||
return BootloaderPipeline()
|
||||
.add<FlashPhase>(ChipID::RADGigastar_USBZ_ZYNQ, BootloaderCommunication::RAD)
|
||||
.add<ReconnectPhase>()
|
||||
.add<WaitPhase>(std::chrono::milliseconds(3000));
|
||||
}
|
||||
|
||||
std::vector<VersionReport> getChipVersions(bool refreshComponents = true) override {
|
||||
if(refreshComponents) {
|
||||
refreshComponentVersions();
|
||||
}
|
||||
if(supportsComponentVersions()) {
|
||||
return Device::getChipVersions(false);
|
||||
}
|
||||
static constexpr size_t MainPeriphIndex = 1;
|
||||
static constexpr size_t USBPeriphIndex = 2;
|
||||
|
||||
std::vector<VersionReport> chipVersions;
|
||||
auto& appVersions = getVersions();
|
||||
|
||||
if(appVersions.size() < 3 && !appVersions.empty()) {
|
||||
if(appVersions[0]) {
|
||||
chipVersions.push_back({ChipID::RADGigastar_ZYNQ, "ZCHIP", appVersions[0]->major, appVersions[0]->minor, 0, 0});
|
||||
}
|
||||
} else {
|
||||
if(MainPeriphIndex < appVersions.size()) {
|
||||
if(appVersions[MainPeriphIndex]) {
|
||||
chipVersions.push_back({ChipID::RADGigastar_ZYNQ, "ZCHIP", appVersions[MainPeriphIndex]->major, appVersions[MainPeriphIndex]->minor, 0, 0});
|
||||
}
|
||||
}
|
||||
if(USBPeriphIndex < appVersions.size()) {
|
||||
if(appVersions[USBPeriphIndex]) {
|
||||
chipVersions.push_back({ChipID::RADGigastar_USBZ_ZYNQ, "USB ZCHIP", appVersions[USBPeriphIndex]->major, appVersions[USBPeriphIndex]->minor, 0, 0});
|
||||
}
|
||||
}
|
||||
}
|
||||
return chipVersions;
|
||||
}
|
||||
|
||||
protected:
|
||||
RADGigastar(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADGigastarSettings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -12,137 +12,243 @@
|
|||
namespace icsneo
|
||||
{
|
||||
|
||||
class RADGigastar2 : public Device
|
||||
class RADGigastar2 : public Device {
|
||||
public:
|
||||
enum class FirmwareVariant {
|
||||
T1Sx6_CANx1_LINx16 = 0,
|
||||
T1Sx8_CANx4_LINx6 = 1,
|
||||
Invalid = 2
|
||||
};
|
||||
|
||||
// Serial numbers start with GT
|
||||
// USB PID is 0x1210, standard driver is DXX
|
||||
// Ethernet MAC allocation is 0x22, standard driver is Raw
|
||||
ICSNEO_FINDABLE_DEVICE(RADGigastar2, DeviceType::RADGigastar2, "GT");
|
||||
|
||||
static const std::vector<Network> &GetSupportedNetworks()
|
||||
{
|
||||
public:
|
||||
// Serial numbers start with GT
|
||||
// USB PID is 0x1210, standard driver is DXX
|
||||
// Ethernet MAC allocation is 0x22, standard driver is Raw
|
||||
ICSNEO_FINDABLE_DEVICE(RADGigastar2, DeviceType::RADGigastar2, "GT");
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::DWCAN_01,
|
||||
Network::NetID::DWCAN_02,
|
||||
Network::NetID::DWCAN_03,
|
||||
Network::NetID::DWCAN_04,
|
||||
|
||||
static const std::vector<Network> &GetSupportedNetworks()
|
||||
{
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::DWCAN_01,
|
||||
Network::NetID::DWCAN_02,
|
||||
Network::NetID::DWCAN_03,
|
||||
Network::NetID::DWCAN_04,
|
||||
Network::NetID::ETHERNET_01,
|
||||
Network::NetID::ETHERNET_02,
|
||||
|
||||
Network::NetID::ETHERNET_01,
|
||||
Network::NetID::ETHERNET_02,
|
||||
Network::NetID::AE_01,
|
||||
Network::NetID::AE_02,
|
||||
Network::NetID::AE_03,
|
||||
Network::NetID::AE_04,
|
||||
Network::NetID::AE_05,
|
||||
Network::NetID::AE_06,
|
||||
Network::NetID::AE_07,
|
||||
Network::NetID::AE_08,
|
||||
Network::NetID::AE_09,
|
||||
Network::NetID::AE_10,
|
||||
|
||||
Network::NetID::AE_01,
|
||||
Network::NetID::AE_02,
|
||||
Network::NetID::AE_03,
|
||||
Network::NetID::AE_04,
|
||||
Network::NetID::AE_05,
|
||||
Network::NetID::AE_06,
|
||||
Network::NetID::AE_07,
|
||||
Network::NetID::AE_08,
|
||||
Network::NetID::AE_09,
|
||||
Network::NetID::AE_10,
|
||||
Network::NetID::LIN_01,
|
||||
Network::NetID::LIN_02,
|
||||
Network::NetID::LIN_03,
|
||||
Network::NetID::LIN_04,
|
||||
Network::NetID::LIN_05,
|
||||
Network::NetID::LIN_06,
|
||||
Network::NetID::LIN_07,
|
||||
Network::NetID::LIN_08,
|
||||
Network::NetID::LIN_09,
|
||||
Network::NetID::LIN_10,
|
||||
Network::NetID::LIN_11,
|
||||
Network::NetID::LIN_12,
|
||||
Network::NetID::LIN_13,
|
||||
Network::NetID::LIN_14,
|
||||
Network::NetID::LIN_15,
|
||||
Network::NetID::LIN_16,
|
||||
|
||||
Network::NetID::LIN_01,
|
||||
Network::NetID::LIN_02,
|
||||
Network::NetID::LIN_03,
|
||||
Network::NetID::LIN_04,
|
||||
Network::NetID::LIN_05,
|
||||
Network::NetID::LIN_06,
|
||||
Network::NetID::LIN_07,
|
||||
Network::NetID::LIN_08,
|
||||
Network::NetID::LIN_09,
|
||||
Network::NetID::LIN_10,
|
||||
Network::NetID::LIN_11,
|
||||
Network::NetID::LIN_12,
|
||||
Network::NetID::LIN_13,
|
||||
Network::NetID::LIN_14,
|
||||
Network::NetID::LIN_15,
|
||||
Network::NetID::LIN_16,
|
||||
Network::NetID::I2C_01,
|
||||
Network::NetID::I2C_02,
|
||||
|
||||
Network::NetID::I2C_01,
|
||||
Network::NetID::I2C_02,
|
||||
Network::NetID::MDIO_01,
|
||||
Network::NetID::MDIO_02,
|
||||
|
||||
Network::NetID::MDIO_01,
|
||||
Network::NetID::MDIO_02,
|
||||
Network::NetID::SPI_01,
|
||||
Network::NetID::SPI_02,
|
||||
Network::NetID::SPI_03,
|
||||
Network::NetID::SPI_04,
|
||||
Network::NetID::SPI_05,
|
||||
Network::NetID::SPI_06,
|
||||
Network::NetID::SPI_07,
|
||||
Network::NetID::SPI_08,
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
Network::NetID::SPI_01,
|
||||
Network::NetID::SPI_02,
|
||||
Network::NetID::SPI_03,
|
||||
Network::NetID::SPI_04,
|
||||
Network::NetID::SPI_05,
|
||||
Network::NetID::SPI_06,
|
||||
Network::NetID::SPI_07,
|
||||
Network::NetID::SPI_08,
|
||||
};
|
||||
return supportedNetworks;
|
||||
size_t getEthernetActivationLineCount() const override { return 1; }
|
||||
|
||||
bool getEthPhyRegControlSupported() const override { return true; }
|
||||
|
||||
bool supportsTC10() const override { return true; }
|
||||
bool supportsGPTP() const override { return true; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::RADGigastar2;
|
||||
}
|
||||
|
||||
FirmwareVariant variantToFlash = FirmwareVariant::Invalid;
|
||||
void setVariantToFlash(FirmwareVariant variant) {
|
||||
variantToFlash = variant;
|
||||
}
|
||||
|
||||
FirmwareVariant getCurrentVariant() {
|
||||
if(supportsComponentVersions()) {
|
||||
refreshComponentVersions();
|
||||
|
||||
const auto& components = getComponentVersions();
|
||||
for(const auto& component : components) {
|
||||
if(!component.valid) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(component.identifier == static_cast<uint32_t>(ChipID::RADGigastar2_ZYNQ)) {
|
||||
if(component.componentInfo > 2) {
|
||||
return FirmwareVariant::Invalid;
|
||||
}
|
||||
auto res = static_cast<FirmwareVariant>(component.componentInfo);
|
||||
if(variantToFlash == FirmwareVariant::Invalid) {
|
||||
variantToFlash = res; // Set the variantToFlash if it hasn't been set yet, we always flash the same firmware variant as the current if it is unspecified
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FirmwareVariant::Invalid;
|
||||
}
|
||||
|
||||
size_t getEthernetActivationLineCount() const override { return 1; }
|
||||
const std::vector<ChipInfo>& getChipInfo() const override {
|
||||
static std::vector<ChipInfo> linChips = {
|
||||
{ChipID::RADGigastar2_ZYNQ, true, "ZCHIP", "RADGigastar2_T1S_LIN_SW_bin", 1, FirmwareType::Zip},
|
||||
{ChipID::RADGigastar_USBZ_ZYNQ, true, "USB ZCHIP", "RADGigastar_USBz_SW_bin", 2, FirmwareType::Zip},
|
||||
{ChipID::RADGigastar_USBZ_Z7010_ZYNQ, false, "USB ZCHIP", "RADGigastar_USBz_Z7010_SW_bin", 2, FirmwareType::Zip},
|
||||
{ChipID::RADGigastar_USBZ_Z7007S_ZYNQ, false, "USB ZCHIP", "RADGigastar_USBz_Z7007s_SW_bin", 2, FirmwareType::Zip},
|
||||
};
|
||||
|
||||
bool getEthPhyRegControlSupported() const override { return true; }
|
||||
|
||||
bool supportsTC10() const override { return true; }
|
||||
bool supportsGPTP() const override { return true; }
|
||||
|
||||
protected:
|
||||
RADGigastar2(neodevice_t neodevice, const driver_factory_t &makeDriver) : Device(neodevice)
|
||||
{
|
||||
initialize<RADGigastar2Settings>(makeDriver);
|
||||
static std::vector<ChipInfo> t1sChips = {
|
||||
{ChipID::RADGigastar2_ZYNQ, true, "ZCHIP", "RADGigastar2_T1S_CAN_SW_bin", 1, FirmwareType::Zip},
|
||||
{ChipID::RADGigastar_USBZ_ZYNQ, true, "USB ZCHIP", "RADGigastar_USBz_SW_bin", 2, FirmwareType::Zip},
|
||||
{ChipID::RADGigastar_USBZ_Z7010_ZYNQ, false, "USB ZCHIP", "RADGigastar_USBz_Z7010_SW_bin", 2, FirmwareType::Zip},
|
||||
{ChipID::RADGigastar_USBZ_Z7007S_ZYNQ, false, "USB ZCHIP", "RADGigastar_USBz_Z7007s_SW_bin", 2, FirmwareType::Zip},
|
||||
};
|
||||
|
||||
if(variantToFlash == FirmwareVariant::T1Sx8_CANx4_LINx6) {
|
||||
return t1sChips;
|
||||
}
|
||||
return linChips; // Assume linChips even if variantToFlash is invalid
|
||||
}
|
||||
|
||||
void setupPacketizer(Packetizer &packetizer) override
|
||||
{
|
||||
Device::setupPacketizer(packetizer);
|
||||
packetizer.disableChecksum = true;
|
||||
packetizer.align16bit = false;
|
||||
BootloaderPipeline getBootloader() override {
|
||||
auto chipVersions = getChipVersions();
|
||||
BootloaderPipeline pipeline;
|
||||
for(const auto& version : chipVersions) {
|
||||
pipeline.add<FlashPhase>(version.id, BootloaderCommunication::RADMultiChip);
|
||||
}
|
||||
pipeline.add<ReconnectPhase>();
|
||||
pipeline.add<WaitPhase>(std::chrono::milliseconds(3000));
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
void setupDecoder(Decoder &decoder) override
|
||||
{
|
||||
Device::setupDecoder(decoder);
|
||||
decoder.timestampResolution = 10; // Timestamps are in 10ns increments instead of the usual 25ns
|
||||
}
|
||||
|
||||
void setupEncoder(Encoder &encoder) override
|
||||
{
|
||||
Device::setupEncoder(encoder);
|
||||
encoder.supportCANFD = true;
|
||||
encoder.supportEthPhy = true;
|
||||
}
|
||||
|
||||
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
|
||||
void setupSupportedTXNetworks(std::vector<Network> &txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
|
||||
void handleDeviceStatus(const std::shared_ptr<RawMessage> &message) override
|
||||
{
|
||||
if (message->data.size() < sizeof(radgigastar2_status_t))
|
||||
return;
|
||||
std::lock_guard<std::mutex> lk(ioMutex);
|
||||
const radgigastar2_status_t *status = reinterpret_cast<const radgigastar2_status_t *>(message->data.data());
|
||||
ethActivationStatus = status->ethernetActivationLineEnabled;
|
||||
}
|
||||
|
||||
std::optional<MemoryAddress> getCoreminiStartAddressFlash() const override
|
||||
{
|
||||
return 512 * 4;
|
||||
}
|
||||
|
||||
std::optional<MemoryAddress> getCoreminiStartAddressSD() const override
|
||||
{
|
||||
return 0;
|
||||
std::vector<VersionReport> getChipVersions(bool refreshComponents = true) override {
|
||||
if(variantToFlash == FirmwareVariant::Invalid) {
|
||||
getCurrentVariant();
|
||||
}
|
||||
|
||||
size_t getDiskCount() const override
|
||||
{
|
||||
return 1;
|
||||
if(refreshComponents) {
|
||||
refreshComponentVersions();
|
||||
}
|
||||
};
|
||||
if(supportsComponentVersions()) {
|
||||
return Device::getChipVersions(false);
|
||||
}
|
||||
static constexpr size_t MainPeriphIndex = 1;
|
||||
static constexpr size_t USBPeriphIndex = 2;
|
||||
|
||||
std::vector<VersionReport> chipVersions;
|
||||
auto& appVersions = getVersions();
|
||||
|
||||
if(appVersions.size() < 3 && !appVersions.empty()) {
|
||||
if(appVersions[0]) {
|
||||
chipVersions.push_back({ChipID::RADGigastar2_ZYNQ, "ZCHIP", appVersions[0]->major, appVersions[0]->minor, 0, 0});
|
||||
}
|
||||
} else {
|
||||
if(MainPeriphIndex < appVersions.size()) {
|
||||
if(appVersions[MainPeriphIndex]) {
|
||||
chipVersions.push_back({ChipID::RADGigastar2_ZYNQ, "ZCHIP", appVersions[MainPeriphIndex]->major, appVersions[MainPeriphIndex]->minor, 0, 0});
|
||||
}
|
||||
}
|
||||
if(USBPeriphIndex < appVersions.size()) {
|
||||
if(appVersions[USBPeriphIndex]) {
|
||||
chipVersions.push_back({ChipID::RADGigastar_USBZ_ZYNQ, "USB ZCHIP", appVersions[USBPeriphIndex]->major, appVersions[USBPeriphIndex]->minor, 0, 0});
|
||||
}
|
||||
}
|
||||
}
|
||||
return chipVersions;
|
||||
}
|
||||
protected:
|
||||
RADGigastar2(neodevice_t neodevice, const driver_factory_t &makeDriver) : Device(neodevice)
|
||||
{
|
||||
initialize<RADGigastar2Settings>(makeDriver);
|
||||
}
|
||||
|
||||
void setupPacketizer(Packetizer &packetizer) override
|
||||
{
|
||||
Device::setupPacketizer(packetizer);
|
||||
packetizer.disableChecksum = true;
|
||||
packetizer.align16bit = false;
|
||||
}
|
||||
|
||||
void setupDecoder(Decoder &decoder) override
|
||||
{
|
||||
Device::setupDecoder(decoder);
|
||||
decoder.timestampResolution = 10; // Timestamps are in 10ns increments instead of the usual 25ns
|
||||
}
|
||||
|
||||
void setupEncoder(Encoder &encoder) override
|
||||
{
|
||||
Device::setupEncoder(encoder);
|
||||
encoder.supportCANFD = true;
|
||||
encoder.supportEthPhy = true;
|
||||
}
|
||||
|
||||
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
|
||||
void setupSupportedTXNetworks(std::vector<Network> &txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
|
||||
void handleDeviceStatus(const std::shared_ptr<RawMessage> &message) override
|
||||
{
|
||||
if (message->data.size() < sizeof(radgigastar2_status_t))
|
||||
return;
|
||||
std::lock_guard<std::mutex> lk(ioMutex);
|
||||
const radgigastar2_status_t *status = reinterpret_cast<const radgigastar2_status_t *>(message->data.data());
|
||||
ethActivationStatus = status->ethernetActivationLineEnabled;
|
||||
}
|
||||
|
||||
std::optional<MemoryAddress> getCoreminiStartAddressFlash() const override
|
||||
{
|
||||
return 512 * 4;
|
||||
}
|
||||
|
||||
std::optional<MemoryAddress> getCoreminiStartAddressSD() const override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t getDiskCount() const override
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@ public:
|
|||
|
||||
bool getEthPhyRegControlSupported() const override { return true; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::RADJupiter;
|
||||
}
|
||||
|
||||
protected:
|
||||
RADJupiter(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADJupiterSettings>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ public:
|
|||
size_t getEthernetActivationLineCount() const override { return 1; }
|
||||
bool supportsGPTP() const override { return true; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::RADMars;
|
||||
}
|
||||
protected:
|
||||
RADMars(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADMarsSettings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,26 @@ public:
|
|||
|
||||
uint8_t getPhyAddrOrPort() const override { return 6; };
|
||||
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::RADMoon2;
|
||||
}
|
||||
|
||||
const std::vector<ChipInfo>& getChipInfo() const override {
|
||||
static std::vector<ChipInfo> chips = {
|
||||
{ChipID::RADMoon2_ZYNQ, true, "ZCHIP", "RADMoon2_SW_bin", 0, FirmwareType::Zip},
|
||||
{ChipID::RADMoon2_Z7010_ZYNQ, false, "ZCHIP", "RADMoon2_Z7010_SW_bin", 0, FirmwareType::Zip}
|
||||
};
|
||||
return chips;
|
||||
}
|
||||
|
||||
BootloaderPipeline getBootloader() override {
|
||||
return BootloaderPipeline()
|
||||
.add<EnterBootloaderPhase>()
|
||||
.add<FlashPhase>(ChipID::RADMoon2_ZYNQ, BootloaderCommunication::RAD)
|
||||
.add<ReconnectPhase>()
|
||||
.add<WaitPhase>(std::chrono::milliseconds(3000));
|
||||
}
|
||||
protected:
|
||||
RADMoon2(neodevice_t neodevice, const driver_factory_t& makeDriver) : RADMoon2Base(neodevice) {
|
||||
initialize<RADMoon2Settings>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,23 @@ public:
|
|||
|
||||
bool supportsTC10() const override { return true; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::RADMoon2;
|
||||
}
|
||||
|
||||
const std::vector<ChipInfo>& getChipInfo() const override {
|
||||
static std::vector<ChipInfo> chips = {
|
||||
{ChipID::RADMoon2_ZL_MCHIP, true, "MCHIP", "radmoon2_zl_mchip_ief", 0, FirmwareType::IEF}
|
||||
};
|
||||
return chips;
|
||||
}
|
||||
|
||||
BootloaderPipeline getBootloader() override {
|
||||
return BootloaderPipeline()
|
||||
.add<EnterBootloaderPhase>()
|
||||
.add<FlashPhase>(ChipID::RADMoon2_ZL_MCHIP, BootloaderCommunication::RED)
|
||||
.add<ReconnectPhase>();
|
||||
}
|
||||
protected:
|
||||
RADMoon2ZL(neodevice_t neodevice, const driver_factory_t& makeDriver) : RADMoon2Base(neodevice) {
|
||||
initialize<RADMoon2Settings>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,24 @@ public:
|
|||
|
||||
bool supportsTC10() const override { return true; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::RADMoon3;
|
||||
}
|
||||
|
||||
const std::vector<ChipInfo>& getChipInfo() const override {
|
||||
static std::vector<ChipInfo> chips = {
|
||||
{ChipID::RADMoon3_MCHIP, true, "MCHIP", "radmoon3_mchip_ief", 0, FirmwareType::IEF},
|
||||
};
|
||||
return chips;
|
||||
}
|
||||
|
||||
BootloaderPipeline getBootloader() override {
|
||||
return BootloaderPipeline()
|
||||
.add<EnterBootloaderPhase>()
|
||||
.add<FlashPhase>(ChipID::RADMoon3_MCHIP, BootloaderCommunication::RED)
|
||||
.add<ReconnectPhase>()
|
||||
.add<WaitPhase>(std::chrono::milliseconds(3000));
|
||||
}
|
||||
protected:
|
||||
RADMoon3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADMoon3Settings>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@ public:
|
|||
|
||||
bool getEthPhyRegControlSupported() const override { return true; }
|
||||
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::RADMoonDuo;
|
||||
}
|
||||
protected:
|
||||
RADMoonDuo(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADMoonDuoSettings>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ public:
|
|||
|
||||
bool supportsTC10() const override { return true; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::RADMoonT1S;
|
||||
}
|
||||
protected:
|
||||
RADMoonT1S(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADMoonT1SSettings>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ public:
|
|||
|
||||
bool getEthPhyRegControlSupported() const override { return true; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::RADPluto;
|
||||
}
|
||||
protected:
|
||||
RADPluto(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADPlutoSettings>(makeDriver);
|
||||
|
|
|
|||
|
|
@ -75,7 +75,6 @@ static_assert(sizeof(radpluto_settings_t) == 322, "RAD-Pluto Settings are not pa
|
|||
class RADPlutoSettings : public IDeviceSettings {
|
||||
public:
|
||||
RADPlutoSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radpluto_settings_t)) {
|
||||
disableGSChecksumming = true;
|
||||
}
|
||||
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ public:
|
|||
return supportedNetworks;
|
||||
}
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::RADStar2;
|
||||
}
|
||||
protected:
|
||||
RADStar2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADStar2Settings>(makeDriver);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue