Compare commits
1 Commits
22a78da74c
...
4ed615d3be
| Author | SHA1 | Date |
|---|---|---|
|
|
4ed615d3be |
|
|
@ -3,5 +3,24 @@ SUBSYSTEM=="usb", ATTRS{idVendor}=="093c", GROUP="users", MODE="0666"
|
||||||
KERNEL=="ttyUSB?", 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"
|
KERNEL=="ttyACM?", ATTRS{idVendor}=="093c", GROUP="users", MODE="0666"
|
||||||
|
|
||||||
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="093c", KERNEL=="ttyUSB*", \
|
# neoVI ION/PLASMA PIDs are not in the latest ftdi_sio driver so lets make a
|
||||||
RUN+="/bin/sh -c 'echo $id:1.0>/sys/bus/usb/drivers/ftdi_sio/unbind'"
|
# 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"
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,6 @@ set(SRC_FILES
|
||||||
communication/packet/flexraypacket.cpp
|
communication/packet/flexraypacket.cpp
|
||||||
communication/packet/canpacket.cpp
|
communication/packet/canpacket.cpp
|
||||||
communication/packet/a2bpacket.cpp
|
communication/packet/a2bpacket.cpp
|
||||||
communication/packet/spipacket.cpp
|
|
||||||
communication/packet/ethernetpacket.cpp
|
communication/packet/ethernetpacket.cpp
|
||||||
communication/packet/versionpacket.cpp
|
communication/packet/versionpacket.cpp
|
||||||
communication/packet/iso9141packet.cpp
|
communication/packet/iso9141packet.cpp
|
||||||
|
|
@ -334,11 +333,6 @@ if(LIBICSNEO_ENABLE_RAW_ETHERNET)
|
||||||
endif()
|
endif()
|
||||||
if(LIBICSNEO_ENABLE_CDCACM)
|
if(LIBICSNEO_ENABLE_CDCACM)
|
||||||
target_compile_definitions(icsneocpp PRIVATE ICSNEO_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()
|
endif()
|
||||||
if(LIBICSNEO_ENABLE_DXX)
|
if(LIBICSNEO_ENABLE_DXX)
|
||||||
target_compile_definitions(icsneocpp PRIVATE ICSNEO_ENABLE_DXX)
|
target_compile_definitions(icsneocpp PRIVATE ICSNEO_ENABLE_DXX)
|
||||||
|
|
@ -361,7 +355,7 @@ if(LIBICSNEO_ENABLE_DXX)
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
FetchContent_Declare(libredxx
|
FetchContent_Declare(libredxx
|
||||||
GIT_REPOSITORY https://github.com/Zeranoe/libredxx.git
|
GIT_REPOSITORY https://github.com/Zeranoe/libredxx.git
|
||||||
GIT_TAG e1fe2bd6ba6079b17037379d78f3f18024b389d7
|
GIT_TAG 3acc754d0af4fe529f05dbc2488b2da77ad9729c
|
||||||
)
|
)
|
||||||
set(LIBREDXX_DISABLE_INSTALL ON)
|
set(LIBREDXX_DISABLE_INSTALL ON)
|
||||||
FetchContent_MakeAvailable(libredxx)
|
FetchContent_MakeAvailable(libredxx)
|
||||||
|
|
|
||||||
|
|
@ -31,16 +31,12 @@ pybind11_add_module(icsneopy
|
||||||
icsneopy/communication/message/mdiomessage.cpp
|
icsneopy/communication/message/mdiomessage.cpp
|
||||||
icsneopy/communication/message/gptpstatusmessage.cpp
|
icsneopy/communication/message/gptpstatusmessage.cpp
|
||||||
icsneopy/communication/message/ethernetstatusmessage.cpp
|
icsneopy/communication/message/ethernetstatusmessage.cpp
|
||||||
icsneopy/communication/message/spimessage.cpp
|
|
||||||
icsneopy/communication/message/macsecmessage.cpp
|
icsneopy/communication/message/macsecmessage.cpp
|
||||||
icsneopy/communication/message/scriptstatusmessage.cpp
|
icsneopy/communication/message/scriptstatusmessage.cpp
|
||||||
icsneopy/communication/message/ethphymessage.cpp
|
|
||||||
icsneopy/communication/message/callback/messagecallback.cpp
|
icsneopy/communication/message/callback/messagecallback.cpp
|
||||||
icsneopy/communication/message/filter/messagefilter.cpp
|
icsneopy/communication/message/filter/messagefilter.cpp
|
||||||
icsneopy/flexray/flexray.cpp
|
icsneopy/flexray/flexray.cpp
|
||||||
icsneopy/disk/diskdriver.cpp
|
icsneopy/disk/diskdriver.cpp
|
||||||
icsneopy/device/chipid.cpp
|
|
||||||
icsneopy/device/versionreport.cpp
|
|
||||||
icsneopy/device/device.cpp
|
icsneopy/device/device.cpp
|
||||||
icsneopy/device/extensions/deviceextension.cpp
|
icsneopy/device/extensions/deviceextension.cpp
|
||||||
icsneopy/device/idevicesettings.cpp
|
icsneopy/device/idevicesettings.cpp
|
||||||
|
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
#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
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
#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
|
|
||||||
|
|
||||||
|
|
@ -1,135 +0,0 @@
|
||||||
#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,8 +55,6 @@ 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("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("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("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);
|
.def_readonly("settings", &Device::settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,6 @@ void init_devicetype(pybind11::module_& m) {
|
||||||
.value("RADMoon3", DeviceType::Enum::RADMoon3)
|
.value("RADMoon3", DeviceType::Enum::RADMoon3)
|
||||||
.value("RADComet", DeviceType::Enum::RADComet)
|
.value("RADComet", DeviceType::Enum::RADComet)
|
||||||
.value("FIRE3_FlexRay", DeviceType::Enum::FIRE3_FlexRay)
|
.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("Connect", DeviceType::Enum::Connect)
|
||||||
.value("RADComet3", DeviceType::Enum::RADComet3)
|
.value("RADComet3", DeviceType::Enum::RADComet3)
|
||||||
.value("RADMoonT1S", DeviceType::Enum::RADMoonT1S)
|
.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_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_mode", &IDeviceSettings::setPhyMode, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||||
.def("set_phy_speed", &IDeviceSettings::setPhySpeed, 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::call_guard<pybind11::gil_scoped_release>());
|
.def("refresh", &IDeviceSettings::refresh, pybind11::arg("ignoreChecksum") = 0, pybind11::call_guard<pybind11::gil_scoped_release>());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace icsneo
|
} // namespace icsneo
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
#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,21 +20,17 @@ void init_linmessage(pybind11::module_&);
|
||||||
void init_tc10statusmessage(pybind11::module_&);
|
void init_tc10statusmessage(pybind11::module_&);
|
||||||
void init_gptpstatusmessage(pybind11::module_&);
|
void init_gptpstatusmessage(pybind11::module_&);
|
||||||
void init_mdiomessage(pybind11::module_&);
|
void init_mdiomessage(pybind11::module_&);
|
||||||
void init_spimessage(pybind11::module_&);
|
|
||||||
void init_ethernetstatusmessage(pybind11::module_&);
|
void init_ethernetstatusmessage(pybind11::module_&);
|
||||||
void init_macsecmessage(pybind11::module_&);
|
void init_macsecmessage(pybind11::module_&);
|
||||||
void init_scriptstatusmessage(pybind11::module_&);
|
void init_scriptstatusmessage(pybind11::module_&);
|
||||||
void init_diskdriver(pybind11::module_&);
|
void init_diskdriver(pybind11::module_&);
|
||||||
void init_deviceextension(pybind11::module_&);
|
void init_deviceextension(pybind11::module_&);
|
||||||
void init_chipid(pybind11::module_&);
|
|
||||||
void init_versionreport(pybind11::module_&);
|
|
||||||
void init_device(pybind11::module_&);
|
void init_device(pybind11::module_&);
|
||||||
void init_messagefilter(pybind11::module_&);
|
void init_messagefilter(pybind11::module_&);
|
||||||
void init_messagecallback(pybind11::module_&);
|
void init_messagecallback(pybind11::module_&);
|
||||||
void init_version(pybind11::module_&);
|
void init_version(pybind11::module_&);
|
||||||
void init_flexray(pybind11::module_& m);
|
void init_flexray(pybind11::module_& m);
|
||||||
void init_idevicesettings(pybind11::module_&);
|
void init_idevicesettings(pybind11::module_&);
|
||||||
void init_ethphymessage(pybind11::module_&);
|
|
||||||
|
|
||||||
PYBIND11_MODULE(icsneopy, m) {
|
PYBIND11_MODULE(icsneopy, m) {
|
||||||
pybind11::options options;
|
pybind11::options options;
|
||||||
|
|
@ -59,14 +55,10 @@ PYBIND11_MODULE(icsneopy, m) {
|
||||||
init_ethernetstatusmessage(m);
|
init_ethernetstatusmessage(m);
|
||||||
init_macsecmessage(m);
|
init_macsecmessage(m);
|
||||||
init_scriptstatusmessage(m);
|
init_scriptstatusmessage(m);
|
||||||
init_spimessage(m);
|
|
||||||
init_messagefilter(m);
|
init_messagefilter(m);
|
||||||
init_messagecallback(m);
|
init_messagecallback(m);
|
||||||
init_diskdriver(m);
|
init_diskdriver(m);
|
||||||
init_flexray(m);
|
init_flexray(m);
|
||||||
init_ethphymessage(m);
|
|
||||||
init_chipid(m);
|
|
||||||
init_versionreport(m);
|
|
||||||
init_device(m);
|
init_device(m);
|
||||||
init_deviceextension(m);
|
init_deviceextension(m);
|
||||||
init_idevicesettings(m);
|
init_idevicesettings(m);
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,6 @@
|
||||||
#include "icsneo/communication/packet/genericbinarystatuspacket.h"
|
#include "icsneo/communication/packet/genericbinarystatuspacket.h"
|
||||||
#include "icsneo/communication/packet/livedatapacket.h"
|
#include "icsneo/communication/packet/livedatapacket.h"
|
||||||
#include "icsneo/communication/packet/hardwareinfopacket.h"
|
#include "icsneo/communication/packet/hardwareinfopacket.h"
|
||||||
#include "icsneo/communication/packet/spipacket.h"
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
@ -59,7 +58,7 @@ uint64_t Decoder::GetUInt64FromLEBytes(const uint8_t* bytes) {
|
||||||
bool Decoder::decode(std::shared_ptr<Message>& result, const std::shared_ptr<Packet>& packet) {
|
bool Decoder::decode(std::shared_ptr<Message>& result, const std::shared_ptr<Packet>& packet) {
|
||||||
switch(packet->network.getType()) {
|
switch(packet->network.getType()) {
|
||||||
case Network::Type::Ethernet: {
|
case Network::Type::Ethernet: {
|
||||||
result = HardwareEthernetPacket::DecodeToMessage(packet->data);
|
result = HardwareEthernetPacket::DecodeToMessage(packet->data, report);
|
||||||
if(!result) {
|
if(!result) {
|
||||||
report(APIEvent::Type::PacketDecodingError, APIEvent::Severity::Error);
|
report(APIEvent::Type::PacketDecodingError, APIEvent::Severity::Error);
|
||||||
return false; // A nullptr was returned, the packet was not long enough to decode
|
return false; // A nullptr was returned, the packet was not long enough to decode
|
||||||
|
|
@ -185,19 +184,6 @@ bool Decoder::decode(std::shared_ptr<Message>& result, const std::shared_ptr<Pac
|
||||||
msg.timestamp *= timestampResolution;
|
msg.timestamp *= timestampResolution;
|
||||||
return true;
|
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: {
|
case Network::Type::MDIO: {
|
||||||
result = HardwareMDIOPacket::DecodeToMessage(packet->data);
|
result = HardwareMDIOPacket::DecodeToMessage(packet->data);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,18 @@ 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) {
|
bool Driver::readWait(std::vector<uint8_t>& bytes, std::chrono::milliseconds timeout, size_t limit) {
|
||||||
// wait until we have enough data, or the timeout occurs
|
// 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
|
||||||
waitForRx(limit, timeout);
|
waitForRx(limit, timeout);
|
||||||
|
|
||||||
size_t actuallyRead = readBuffer.size();
|
size_t actuallyRead = std::min(readBuffer.size(), limit);
|
||||||
bytes.resize(actuallyRead);
|
bytes.resize(actuallyRead);
|
||||||
|
|
||||||
readBuffer.read(bytes.data(), 0, actuallyRead);
|
readBuffer.read(bytes.data(), 0, actuallyRead);
|
||||||
|
|
@ -71,12 +79,8 @@ bool Driver::write(const std::vector<uint8_t>& bytes) {
|
||||||
|
|
||||||
if(writeBlocks) {
|
if(writeBlocks) {
|
||||||
if(writeQueueFull()) {
|
if(writeQueueFull()) {
|
||||||
while(writeQueueAlmostFull() && !isDisconnected() && !isClosing()) // Wait until we have some decent amount of space
|
while(writeQueueAlmostFull()) // Wait until we have some decent amount of space
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
|
|
||||||
if(isDisconnected() || isClosing()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(writeQueueFull()) {
|
if(writeQueueFull()) {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
#include "icsneo/communication/packet/a2bpacket.h"
|
#include "icsneo/communication/packet/a2bpacket.h"
|
||||||
#include "icsneo/communication/packet/linpacket.h"
|
#include "icsneo/communication/packet/linpacket.h"
|
||||||
#include "icsneo/communication/packet/mdiopacket.h"
|
#include "icsneo/communication/packet/mdiopacket.h"
|
||||||
#include "icsneo/communication/packet/spipacket.h"
|
|
||||||
|
|
||||||
using namespace icsneo;
|
using namespace icsneo;
|
||||||
|
|
||||||
|
|
@ -134,17 +133,6 @@ bool Encoder::encode(const Packetizer& packetizer, std::vector<uint8_t>& result,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} // End of Network::Type::MDIO
|
} // 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:
|
default:
|
||||||
report(APIEvent::Type::UnexpectedNetworkType, APIEvent::Severity::Error);
|
report(APIEvent::Type::UnexpectedNetworkType, APIEvent::Severity::Error);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ bool EthPhyMessage::appendPhyMessage(bool writeEnable, bool clause45, uint8_t ph
|
||||||
msg->Clause45Enable = clause45;
|
msg->Clause45Enable = clause45;
|
||||||
msg->Enabled = enabled;
|
msg->Enabled = enabled;
|
||||||
msg->WriteEnable = writeEnable;
|
msg->WriteEnable = writeEnable;
|
||||||
msg->Version = 1u;
|
msg->version = 1u;
|
||||||
if( (FiveBits < phyAddrOrPort) ||
|
if( (FiveBits < phyAddrOrPort) ||
|
||||||
(clause45 && (FiveBits < pageOrDevice)) ||
|
(clause45 && (FiveBits < pageOrDevice)) ||
|
||||||
(!clause45 && (FiveBits < regAddr)) )
|
(!clause45 && (FiveBits < regAddr)) )
|
||||||
|
|
@ -18,17 +18,17 @@ bool EthPhyMessage::appendPhyMessage(bool writeEnable, bool clause45, uint8_t ph
|
||||||
|
|
||||||
if(clause45)
|
if(clause45)
|
||||||
{
|
{
|
||||||
msg->Clause45.port = phyAddrOrPort;
|
msg->clause45.port = phyAddrOrPort;
|
||||||
msg->Clause45.device = pageOrDevice;
|
msg->clause45.device = pageOrDevice;
|
||||||
msg->Clause45.regAddr = regAddr;
|
msg->clause45.regAddr = regAddr;
|
||||||
msg->Clause45.regVal = regVal;
|
msg->clause45.regVal = regVal;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg->Clause22.phyAddr = phyAddrOrPort;
|
msg->clause22.phyAddr = phyAddrOrPort;
|
||||||
msg->Clause22.page = pageOrDevice;
|
msg->clause22.page = pageOrDevice;
|
||||||
msg->Clause22.regAddr = regAddr;
|
msg->clause22.regAddr = regAddr;
|
||||||
msg->Clause22.regVal = regVal;
|
msg->clause22.regVal = regVal;
|
||||||
}
|
}
|
||||||
return appendPhyMessage(msg);
|
return appendPhyMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ using namespace icsneo;
|
||||||
MultiChannelCommunication::MultiChannelCommunication(device_eventhandler_t err, std::unique_ptr<Driver> com,
|
MultiChannelCommunication::MultiChannelCommunication(device_eventhandler_t err, std::unique_ptr<Driver> com,
|
||||||
std::function<std::unique_ptr<Packetizer>()> makeConfiguredPacketizer, std::unique_ptr<Encoder> e,
|
std::function<std::unique_ptr<Packetizer>()> makeConfiguredPacketizer, std::unique_ptr<Encoder> e,
|
||||||
std::unique_ptr<Decoder> md, size_t vnetCount) :
|
std::unique_ptr<Decoder> md, size_t vnetCount) :
|
||||||
Communication(err, std::move(com), makeConfiguredPacketizer, std::move(e), std::move(md)), numVnets(vnetCount), packetRB(2048) {
|
Communication(err, std::move(com), makeConfiguredPacketizer, std::move(e), std::move(md)), numVnets(vnetCount) {
|
||||||
vnetThreads.resize(numVnets);
|
vnetThreads.resize(numVnets);
|
||||||
vnetQueues.resize(numVnets);
|
vnetQueues.resize(numVnets);
|
||||||
}
|
}
|
||||||
|
|
@ -24,7 +24,6 @@ void MultiChannelCommunication::spawnThreads() {
|
||||||
|
|
||||||
void MultiChannelCommunication::joinThreads() {
|
void MultiChannelCommunication::joinThreads() {
|
||||||
closing = true;
|
closing = true;
|
||||||
ringBufCV.notify_all();
|
|
||||||
if(hidReadThread.joinable())
|
if(hidReadThread.joinable())
|
||||||
hidReadThread.join();
|
hidReadThread.join();
|
||||||
for(auto& thread : vnetThreads) {
|
for(auto& thread : vnetThreads) {
|
||||||
|
|
@ -149,13 +148,9 @@ void MultiChannelCommunication::hidReadTask() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
if(!currentQueue->enqueue(std::move(payloadBytes)) && gotPacket)
|
||||||
std::unique_lock lk(ringBufMutex);
|
EventManager::GetInstance().add(APIEvent(APIEvent::Type::FailedToRead, APIEvent::Severity::Error));
|
||||||
if(!packetRB.write(std::move(payloadBytes)) && gotPacket)
|
payloadBytes.clear();
|
||||||
EventManager::GetInstance().add(APIEvent(APIEvent::Type::FailedToRead, APIEvent::Severity::Error));
|
|
||||||
payloadBytes.clear();
|
|
||||||
}
|
|
||||||
ringBufCV.notify_all();
|
|
||||||
gotPacket = true;
|
gotPacket = true;
|
||||||
state = PreprocessState::SearchForCommand;
|
state = PreprocessState::SearchForCommand;
|
||||||
break;
|
break;
|
||||||
|
|
@ -165,6 +160,7 @@ void MultiChannelCommunication::hidReadTask() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiChannelCommunication::vnetReadTask(size_t vnetIndex) {
|
void MultiChannelCommunication::vnetReadTask(size_t vnetIndex) {
|
||||||
|
moodycamel::BlockingReaderWriterQueue< std::vector<uint8_t> >& queue = vnetQueues[vnetIndex];
|
||||||
std::vector<uint8_t> payloadBytes;
|
std::vector<uint8_t> payloadBytes;
|
||||||
std::unique_ptr<Packetizer> packetizerLifetime;
|
std::unique_ptr<Packetizer> packetizerLifetime;
|
||||||
Packetizer* vnetPacketizer;
|
Packetizer* vnetPacketizer;
|
||||||
|
|
@ -178,19 +174,14 @@ void MultiChannelCommunication::vnetReadTask(size_t vnetIndex) {
|
||||||
EventManager::GetInstance().downgradeErrorsOnCurrentThread();
|
EventManager::GetInstance().downgradeErrorsOnCurrentThread();
|
||||||
|
|
||||||
while(!closing) {
|
while(!closing) {
|
||||||
std::unique_lock lk(ringBufMutex);
|
if(queue.wait_dequeue_timed(payloadBytes, std::chrono::milliseconds(250))) {
|
||||||
ringBufCV.wait(lk);
|
if(closing)
|
||||||
if(closing) {
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(vnetPacketizer->input(packetRB)) {
|
|
||||||
for(const auto& packet : vnetPacketizer->output()) {
|
|
||||||
std::shared_ptr<Message> msg;
|
|
||||||
if(!decoder->decode(msg, packet))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
dispatchMessage(msg);
|
auto& ringBuffer = driver->getReadBuffer();
|
||||||
}
|
ringBuffer.write(payloadBytes);
|
||||||
}
|
|
||||||
|
handleInput(*vnetPacketizer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
using namespace icsneo;
|
using namespace icsneo;
|
||||||
|
|
||||||
std::shared_ptr<EthernetMessage> HardwareEthernetPacket::DecodeToMessage(const std::vector<uint8_t>& bytestream) {
|
std::shared_ptr<EthernetMessage> HardwareEthernetPacket::DecodeToMessage(const std::vector<uint8_t>& bytestream, const device_eventhandler_t& report) {
|
||||||
const HardwareEthernetPacket* packet = (const HardwareEthernetPacket*)((const void*)bytestream.data());
|
const HardwareEthernetPacket* packet = (const HardwareEthernetPacket*)((const void*)bytestream.data());
|
||||||
const uint16_t* rawWords = (const uint16_t*)bytestream.data();
|
const uint16_t* rawWords = (const uint16_t*)bytestream.data();
|
||||||
// Make sure we have enough to read the packet length first
|
// Make sure we have enough to read the packet length first
|
||||||
|
|
@ -18,6 +18,9 @@ std::shared_ptr<EthernetMessage> HardwareEthernetPacket::DecodeToMessage(const s
|
||||||
const size_t bytestreamActualSize = bytestream.size();
|
const size_t bytestreamActualSize = bytestream.size();
|
||||||
if(bytestreamActualSize < bytestreamExpectedSize)
|
if(bytestreamActualSize < bytestreamExpectedSize)
|
||||||
return nullptr;
|
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>();
|
auto messagePtr = std::make_shared<EthernetMessage>();
|
||||||
EthernetMessage& message = *messagePtr;
|
EthernetMessage& message = *messagePtr;
|
||||||
message.transmitted = packet->eid.TXMSG;
|
message.transmitted = packet->eid.TXMSG;
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,11 @@ std::shared_ptr<EthPhyMessage> HardwareEthernetPhyRegisterPacket::DecodeToMessag
|
||||||
phyMessage->Enabled = (pEntry->Enabled != 0u);
|
phyMessage->Enabled = (pEntry->Enabled != 0u);
|
||||||
phyMessage->WriteEnable = (pEntry->WriteEnable != 0u);
|
phyMessage->WriteEnable = (pEntry->WriteEnable != 0u);
|
||||||
phyMessage->Clause45Enable = (pEntry->Clause45Enable != 0u);
|
phyMessage->Clause45Enable = (pEntry->Clause45Enable != 0u);
|
||||||
phyMessage->BusIndex = static_cast<uint8_t>(pEntry->BusIndex);
|
phyMessage->version = static_cast<uint8_t>(pEntry->version);
|
||||||
phyMessage->Version = static_cast<uint8_t>(pEntry->version);
|
|
||||||
if(phyMessage->Clause45Enable)
|
if(phyMessage->Clause45Enable)
|
||||||
phyMessage->Clause45 = pEntry->clause45;
|
phyMessage->clause45 = pEntry->clause45;
|
||||||
else
|
else
|
||||||
phyMessage->Clause22 = pEntry->clause22;
|
phyMessage->clause22 = pEntry->clause22;
|
||||||
msg->messages.push_back(phyMessage);
|
msg->messages.push_back(phyMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -70,35 +69,34 @@ bool HardwareEthernetPhyRegisterPacket::EncodeFromMessage(const EthPhyMessage& m
|
||||||
PhyRegisterPacket_t tempPacket;
|
PhyRegisterPacket_t tempPacket;
|
||||||
tempPacket.Enabled = phyMessage->Enabled ? 0x1u : 0x0u;
|
tempPacket.Enabled = phyMessage->Enabled ? 0x1u : 0x0u;
|
||||||
tempPacket.WriteEnable = phyMessage->WriteEnable ? 0x1u : 0x0u;
|
tempPacket.WriteEnable = phyMessage->WriteEnable ? 0x1u : 0x0u;
|
||||||
tempPacket.BusIndex = (phyMessage->BusIndex & 0xF);
|
tempPacket.version = (phyMessage->version & 0xF);
|
||||||
tempPacket.version = (phyMessage->Version & 0xF);
|
|
||||||
if(phyMessage->Clause45Enable)
|
if(phyMessage->Clause45Enable)
|
||||||
{
|
{
|
||||||
if( (FiveBits < phyMessage->Clause45.port) ||
|
if( (FiveBits < phyMessage->clause45.port) ||
|
||||||
(FiveBits < phyMessage->Clause45.device) )
|
(FiveBits < phyMessage->clause45.device) )
|
||||||
{
|
{
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
tempPacket.Clause45Enable = 0x1u;
|
tempPacket.Clause45Enable = 0x1u;
|
||||||
tempPacket.clause45.port = phyMessage->Clause45.port;
|
tempPacket.clause45.port = phyMessage->clause45.port;
|
||||||
tempPacket.clause45.device = phyMessage->Clause45.device;
|
tempPacket.clause45.device = phyMessage->clause45.device;
|
||||||
tempPacket.clause45.regAddr = phyMessage->Clause45.regAddr;
|
tempPacket.clause45.regAddr = phyMessage->clause45.regAddr;
|
||||||
tempPacket.clause45.regVal = phyMessage->Clause45.regVal;
|
tempPacket.clause45.regVal = phyMessage->clause45.regVal;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( (FiveBits < phyMessage->Clause22.phyAddr) ||
|
if( (FiveBits < phyMessage->clause22.phyAddr) ||
|
||||||
(FiveBits < phyMessage->Clause22.regAddr) )
|
(FiveBits < phyMessage->clause22.regAddr) )
|
||||||
{
|
{
|
||||||
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
tempPacket.Clause45Enable = 0x0u;
|
tempPacket.Clause45Enable = 0x0u;
|
||||||
tempPacket.clause22.phyAddr = phyMessage->Clause22.phyAddr;
|
tempPacket.clause22.phyAddr = phyMessage->clause22.phyAddr;
|
||||||
tempPacket.clause22.page = phyMessage->Clause22.page;
|
tempPacket.clause22.page = phyMessage->clause22.page;
|
||||||
tempPacket.clause22.regAddr = phyMessage->Clause22.regAddr;
|
tempPacket.clause22.regAddr = phyMessage->clause22.regAddr;
|
||||||
tempPacket.clause22.regVal = phyMessage->Clause22.regVal;
|
tempPacket.clause22.regVal = phyMessage->clause22.regVal;
|
||||||
}
|
}
|
||||||
uint8_t* pktPtr = reinterpret_cast<uint8_t*>(&tempPacket);
|
uint8_t* pktPtr = reinterpret_cast<uint8_t*>(&tempPacket);
|
||||||
bytestream.insert(bytestream.end(), pktPtr, pktPtr + sizeof(PhyRegisterPacket_t));
|
bytestream.insert(bytestream.end(), pktPtr, pktPtr + sizeof(PhyRegisterPacket_t));
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ namespace icsneo
|
||||||
report(APIEvent::Type::I2CMessageExceedsMaxLength, APIEvent::Severity::Error);
|
report(APIEvent::Type::I2CMessageExceedsMaxLength, APIEvent::Severity::Error);
|
||||||
return false;
|
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
|
//You'll need to provide a target R/W register in controlBytes
|
||||||
//alternatively, you're expecting to read without providing a dataBytes payload
|
//alternatively, you're expecting to read without providing a dataBytes payload
|
||||||
|
|
|
||||||
|
|
@ -1,82 +0,0 @@
|
||||||
#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,46 +31,24 @@ std::shared_ptr<WiVI::ResponseMessage> WiVI::CommandPacket::DecodeToMessage(cons
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WiVI::Command::GetAll: {
|
case WiVI::Command::GetAll: {
|
||||||
if(bytestream.size() < sizeof(WiVI::CommandPacket::GetAllHeader))
|
if(bytestream.size() < sizeof(WiVI::CommandPacket::GetAll))
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
const auto& getAll = *reinterpret_cast<const WiVI::CommandPacket::GetAllHeader*>(bytestream.data());
|
const auto& getAll = *reinterpret_cast<const WiVI::CommandPacket::GetAll*>(bytestream.data());
|
||||||
msg->responseTo = WiVI::Command::GetAll;
|
msg->responseTo = WiVI::Command::GetAll;
|
||||||
msg->info.emplace();
|
msg->info.emplace();
|
||||||
msg->info->sleepRequest = getAll.sleepRequest;
|
msg->info->sleepRequest = getAll.sleepRequest;
|
||||||
msg->info->connectionTimeoutMinutes = getAll.connectionTimeoutMinutes;
|
msg->info->connectionTimeoutMinutes = getAll.connectionTimeoutMinutes;
|
||||||
|
|
||||||
// Check that we have enough data for the capture infos
|
// Check that we have enough data for the capture infos
|
||||||
size_t captureInfosSize = sizeof(WiVI::CaptureInfo) * getAll.numCaptureInfos;
|
if(bytestream.size() < sizeof(WiVI::CommandPacket::GetAll) + (sizeof(WiVI::CaptureInfo) * getAll.numCaptureInfos))
|
||||||
if(bytestream.size() < sizeof(WiVI::CommandPacket::GetAllHeader) + captureInfosSize)
|
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
const WiVI::CaptureInfo* const captureInfos = (const WiVI::CaptureInfo*)(bytestream.data() + sizeof(WiVI::CommandPacket::GetAllHeader));
|
|
||||||
msg->info->captures.resize(getAll.numCaptureInfos);
|
msg->info->captures.resize(getAll.numCaptureInfos);
|
||||||
for(uint16_t i = 0; i < getAll.numCaptureInfos; i++)
|
for(uint16_t i = 0; i < getAll.numCaptureInfos; i++)
|
||||||
msg->info->captures[i] = captureInfos[i];
|
msg->info->captures[i] = getAll.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;
|
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
|
default: // Unknown command response
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
@ -100,9 +78,9 @@ std::vector<uint8_t> WiVI::CommandPacket::SetSignal::Encode(WiVI::SignalType typ
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<uint8_t> WiVI::CommandPacket::GetAllHeader::Encode() {
|
std::vector<uint8_t> WiVI::CommandPacket::GetAll::Encode() {
|
||||||
std::vector<uint8_t> ret(sizeof(WiVI::CommandPacket::GetAllHeader));
|
std::vector<uint8_t> ret(sizeof(WiVI::CommandPacket::GetAll));
|
||||||
auto& frame = *reinterpret_cast<WiVI::CommandPacket::GetAllHeader*>(ret.data());
|
auto& frame = *reinterpret_cast<WiVI::CommandPacket::GetAll*>(ret.data());
|
||||||
|
|
||||||
frame.header.cmd = WiVI::Command::GetAll;
|
frame.header.cmd = WiVI::Command::GetAll;
|
||||||
frame.header.length = sizeof(frame) - sizeof(frame.header);
|
frame.header.length = sizeof(frame) - sizeof(frame.header);
|
||||||
|
|
@ -120,15 +98,3 @@ std::vector<uint8_t> WiVI::CommandPacket::ClearUploads::Encode(const std::vector
|
||||||
|
|
||||||
return ret;
|
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,75 +207,6 @@ bool Device::refreshComponentVersions() {
|
||||||
return false;
|
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) {
|
bool Device::open(OpenFlags flags, OpenStatusHandler handler) {
|
||||||
if(!com) {
|
if(!com) {
|
||||||
report(APIEvent::Type::Unknown, APIEvent::Severity::Error);
|
report(APIEvent::Type::Unknown, APIEvent::Severity::Error);
|
||||||
|
|
@ -411,38 +342,6 @@ bool Device::open(OpenFlags flags, OpenStatusHandler handler) {
|
||||||
return true;
|
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() {
|
APIEvent::Type Device::attemptToBeginCommunication() {
|
||||||
versions.clear();
|
versions.clear();
|
||||||
|
|
||||||
|
|
@ -1279,7 +1178,7 @@ void Device::wiviThreadBody() {
|
||||||
|
|
||||||
// Use the command GetAll to get a WiVI::Info structure from the device
|
// Use the command GetAll to get a WiVI::Info structure from the device
|
||||||
const auto generic = com->waitForMessageSync([this]() {
|
const auto generic = com->waitForMessageSync([this]() {
|
||||||
return com->sendCommand(Command::WiVICommand, WiVI::CommandPacket::GetAllHeader::Encode());
|
return com->sendCommand(Command::WiVICommand, WiVI::CommandPacket::GetAll::Encode());
|
||||||
}, filter, std::chrono::milliseconds(1000));
|
}, filter, std::chrono::milliseconds(1000));
|
||||||
|
|
||||||
if(!generic || generic->type != Message::Type::WiVICommandResponse) {
|
if(!generic || generic->type != Message::Type::WiVICommandResponse) {
|
||||||
|
|
@ -1391,22 +1290,6 @@ void Device::wiviThreadBody() {
|
||||||
for(auto& cb : sleepRequestedCallbacks)
|
for(auto& cb : sleepRequestedCallbacks)
|
||||||
cb.second = false;
|
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1581,110 +1464,6 @@ bool Device::allowSleep(bool remoteWakeup) {
|
||||||
return true;
|
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()
|
void Device::scriptStatusThreadBody()
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lk(scriptStatusMutex);
|
std::unique_lock<std::mutex> lk(scriptStatusMutex);
|
||||||
|
|
@ -2067,7 +1846,7 @@ std::optional<EthPhyMessage> Device::sendEthPhyMsg(const EthPhyMessage& message,
|
||||||
HardwareEthernetPhyRegisterPacket::EncodeFromMessage(message, bytes, report);
|
HardwareEthernetPhyRegisterPacket::EncodeFromMessage(message, bytes, report);
|
||||||
std::shared_ptr<Message> response = com->waitForMessageSync(
|
std::shared_ptr<Message> response = com->waitForMessageSync(
|
||||||
[this, bytes](){ return com->sendCommand(Command::PHYControlRegisters, bytes); },
|
[this, bytes](){ return com->sendCommand(Command::PHYControlRegisters, bytes); },
|
||||||
std::make_shared<MessageFilter>(Message::Type::EthernetPhyRegister), timeout);
|
std::make_shared<MessageFilter>(Network::NetID::EthPHYControl), timeout);
|
||||||
|
|
||||||
if(!response) {
|
if(!response) {
|
||||||
report(APIEvent::Type::NoDeviceResponse, APIEvent::Severity::Error);
|
report(APIEvent::Type::NoDeviceResponse, APIEvent::Severity::Error);
|
||||||
|
|
@ -3536,18 +3315,10 @@ std::optional<uint64_t> Device::vsaReadLogicalDisk(uint64_t pos, uint8_t* into,
|
||||||
return readLogicalDisk(pos, into, amount);
|
return readLogicalDisk(pos, into, amount);
|
||||||
}
|
}
|
||||||
uint64_t firstReadAmount = diskSize - pos;
|
uint64_t firstReadAmount = diskSize - pos;
|
||||||
uint64_t bytesRead = 0;
|
if(!readLogicalDisk(pos, into, firstReadAmount)) {
|
||||||
if(auto optBytesReadFirst = readLogicalDisk(pos, into, firstReadAmount)) {
|
|
||||||
bytesRead = *optBytesReadFirst;
|
|
||||||
} else {
|
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
if(auto optBytesReadSecond = readLogicalDisk(VSA::RecordStartOffset, into + firstReadAmount, amount - firstReadAmount)) {
|
return readLogicalDisk(VSA::RecordStartOffset, into + firstReadAmount, amount - firstReadAmount);
|
||||||
bytesRead += *optBytesReadSecond;
|
|
||||||
} else {
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
return bytesRead;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Device::dispatchVSAMessages(VSAParser& parser) {
|
bool Device::dispatchVSAMessages(VSAParser& parser) {
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,15 @@ static void makeIfSerialMatches(const FoundDevice& dev, std::vector<std::shared_
|
||||||
into.push_back(std::make_shared<T>(dev));
|
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>
|
template<typename T>
|
||||||
static void makeIfSerialRangeMatches(const FoundDevice& dev, std::vector<std::shared_ptr<Device>>& into) {
|
static void makeIfSerialRangeMatches(const FoundDevice& dev, std::vector<std::shared_ptr<Device>>& into) {
|
||||||
// Relies on the subclass to have
|
// Relies on the subclass to have
|
||||||
|
|
@ -130,7 +139,7 @@ std::vector<std::shared_ptr<Device>> DeviceFinder::FindAll() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __NEOVIFIRE_H_
|
#ifdef __NEOVIFIRE_H_
|
||||||
makeIfSerialRangeMatches<NeoVIFIRE>(dev, newFoundDevices);
|
makeIfPIDMatches<NeoVIFIRE>(dev, newFoundDevices);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __NEOVIFIRE2_H_
|
#ifdef __NEOVIFIRE2_H_
|
||||||
|
|
@ -145,20 +154,16 @@ std::vector<std::shared_ptr<Device>> DeviceFinder::FindAll() {
|
||||||
makeIfSerialMatches<NeoVIFIRE3FlexRay>(dev, newFoundDevices);
|
makeIfSerialMatches<NeoVIFIRE3FlexRay>(dev, newFoundDevices);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __NEOVIFIRE3T1SLIN_H_
|
|
||||||
makeIfSerialMatches<NeoVIFIRE3T1SLIN>(dev, newFoundDevices);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __NEOVIRED2_H_
|
#ifdef __NEOVIRED2_H_
|
||||||
makeIfSerialMatches<NeoVIRED2>(dev, newFoundDevices);
|
makeIfSerialMatches<NeoVIRED2>(dev, newFoundDevices);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __NEOVIION_H_
|
#ifdef __NEOVIION_H_
|
||||||
makeIfSerialMatches<NeoVIION>(dev, newFoundDevices);
|
makeIfPIDMatches<NeoVIION>(dev, newFoundDevices);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __NEOVIPLASMA_H_
|
#ifdef __NEOVIPLASMA_H_
|
||||||
makeIfSerialMatches<NeoVIPLASMA>(dev, newFoundDevices);
|
makeIfPIDMatches<NeoVIPLASMA>(dev, newFoundDevices);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __RADA2B_H_
|
#ifdef __RADA2B_H_
|
||||||
|
|
@ -242,7 +247,7 @@ std::vector<std::shared_ptr<Device>> DeviceFinder::FindAll() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __VALUECAN3_H_
|
#ifdef __VALUECAN3_H_
|
||||||
makeIfSerialRangeMatches<ValueCAN3>(dev, newFoundDevices);
|
makeIfPIDMatches<ValueCAN3>(dev, newFoundDevices);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __VALUECAN4_1_H_
|
#ifdef __VALUECAN4_1_H_
|
||||||
|
|
@ -320,10 +325,6 @@ const std::vector<DeviceType>& DeviceFinder::GetSupportedDevices() {
|
||||||
NeoVIFIRE3FlexRay::DEVICE_TYPE,
|
NeoVIFIRE3FlexRay::DEVICE_TYPE,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __NEOVIFIRE3T1SLIN_H_
|
|
||||||
NeoVIFIRE3T1SLIN::DEVICE_TYPE,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __NEOVIION_H_
|
#ifdef __NEOVIION_H_
|
||||||
NeoVIION::DEVICE_TYPE,
|
NeoVIION::DEVICE_TYPE,
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@
|
||||||
|
|
||||||
using namespace icsneo;
|
using namespace icsneo;
|
||||||
|
|
||||||
std::optional<uint16_t> IDeviceSettings::CalculateGSChecksum(const std::vector<uint8_t>& settings) {
|
std::optional<uint16_t> IDeviceSettings::CalculateGSChecksum(const std::vector<uint8_t>& settings, std::optional<size_t> knownSize) {
|
||||||
const uint16_t* p = reinterpret_cast<const uint16_t*>(settings.data());
|
const uint16_t* p = reinterpret_cast<const uint16_t*>(settings.data());
|
||||||
size_t words = settings.size();
|
size_t words = std::min(knownSize.value_or(0), settings.size());
|
||||||
if(words % 2 == 1)
|
if(words % 2 == 1)
|
||||||
return std::nullopt; // Somehow settings is not word aligned
|
return std::nullopt; // Somehow settings is not word aligned
|
||||||
words /= 2;
|
words /= 2;
|
||||||
|
|
@ -159,12 +159,15 @@ bool IDeviceSettings::ValidateLINBaudrate(int64_t baudrate) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IDeviceSettings::refresh() {
|
bool IDeviceSettings::refresh(bool ignoreChecksum) {
|
||||||
if(disabled) {
|
if(disabled) {
|
||||||
report(APIEvent::Type::SettingsNotAvailable, APIEvent::Severity::Error);
|
report(APIEvent::Type::SettingsNotAvailable, APIEvent::Severity::Error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(disableGSChecksumming)
|
||||||
|
ignoreChecksum = true;
|
||||||
|
|
||||||
std::vector<uint8_t> rxSettings;
|
std::vector<uint8_t> rxSettings;
|
||||||
bool ret = com->getSettingsSync(rxSettings);
|
bool ret = com->getSettingsSync(rxSettings);
|
||||||
if(!ret) {
|
if(!ret) {
|
||||||
|
|
@ -172,14 +175,24 @@ bool IDeviceSettings::refresh() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr size_t GsSize = 3 * sizeof(uint16_t); // <version> <length> <checksum>
|
constexpr size_t GsSize = 3 * sizeof(uint16_t);
|
||||||
if(rxSettings.size() < GsSize) { // We need to at least have the header of GLOBAL_SETTINGS
|
if(rxSettings.size() < GsSize) { // We need to at least have the header of GLOBAL_SETTINGS
|
||||||
report(APIEvent::Type::SettingsReadError, APIEvent::Severity::Error);
|
report(APIEvent::Type::SettingsReadError, APIEvent::Severity::Error);
|
||||||
return false;
|
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);
|
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);
|
rxSettings.erase(rxSettings.begin(), rxSettings.begin() + GsSize);
|
||||||
|
|
||||||
if(gsVersion != GS_VERSION) {
|
if(gsVersion != GS_VERSION) {
|
||||||
|
|
@ -187,6 +200,19 @@ bool IDeviceSettings::refresh() {
|
||||||
return false;
|
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);
|
settings = std::move(rxSettings);
|
||||||
settingsInDeviceRAM = settings;
|
settingsInDeviceRAM = settings;
|
||||||
settingsLoaded = true;
|
settingsLoaded = true;
|
||||||
|
|
@ -235,7 +261,7 @@ bool IDeviceSettings::apply(bool temporary) {
|
||||||
|
|
||||||
std::shared_ptr<Main51Message> msg = std::dynamic_pointer_cast<Main51Message>(com->waitForMessageSync([this, &bytestream]() {
|
std::shared_ptr<Main51Message> msg = std::dynamic_pointer_cast<Main51Message>(com->waitForMessageSync([this, &bytestream]() {
|
||||||
return com->sendCommand(Command::SetSettings, bytestream);
|
return com->sendCommand(Command::SetSettings, bytestream);
|
||||||
}, std::make_shared<Main51MessageFilter>(Command::SetSettings), std::chrono::milliseconds(2000)));
|
}, std::make_shared<Main51MessageFilter>(Command::SetSettings), std::chrono::milliseconds(1000)));
|
||||||
|
|
||||||
if(!msg || msg->data[0] != 1) { // We did not receive a response
|
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
|
// Attempt to get the settings from the device so we're up to date if possible
|
||||||
|
|
@ -246,7 +272,7 @@ bool IDeviceSettings::apply(bool temporary) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh();
|
refresh(true); // Refresh ignoring checksum
|
||||||
// The device might modify the settings once they are applied, however in this case it does not update the checksum
|
// 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
|
// We refresh to get these updates, update the checksum, and send it back so it's all in sync
|
||||||
gsChecksum = CalculateGSChecksum(settings);
|
gsChecksum = CalculateGSChecksum(settings);
|
||||||
|
|
@ -261,7 +287,7 @@ bool IDeviceSettings::apply(bool temporary) {
|
||||||
|
|
||||||
msg = std::dynamic_pointer_cast<Main51Message>(com->waitForMessageSync([this, &bytestream]() {
|
msg = std::dynamic_pointer_cast<Main51Message>(com->waitForMessageSync([this, &bytestream]() {
|
||||||
return com->sendCommand(Command::SetSettings, bytestream);
|
return com->sendCommand(Command::SetSettings, bytestream);
|
||||||
}, std::make_shared<Main51MessageFilter>(Command::SetSettings), std::chrono::milliseconds(2000)));
|
}, std::make_shared<Main51MessageFilter>(Command::SetSettings), std::chrono::milliseconds(1000)));
|
||||||
if(!msg || msg->data[0] != 1) {
|
if(!msg || msg->data[0] != 1) {
|
||||||
// Attempt to get the settings from the device so we're up to date if possible
|
// Attempt to get the settings from the device so we're up to date if possible
|
||||||
if(refresh()) {
|
if(refresh()) {
|
||||||
|
|
@ -316,7 +342,7 @@ bool IDeviceSettings::applyDefaults(bool temporary) {
|
||||||
// This short wait helps on FIRE devices, otherwise the checksum might be wrong!
|
// This short wait helps on FIRE devices, otherwise the checksum might be wrong!
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(3));
|
std::this_thread::sleep_for(std::chrono::milliseconds(3));
|
||||||
|
|
||||||
refresh();
|
refresh(true); // Refresh ignoring checksum
|
||||||
// The device might modify the settings once they are applied, however in this case it does not update the checksum
|
// 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
|
// We refresh to get these updates, update the checksum, and send it back so it's all in sync
|
||||||
std::vector<uint8_t> bytestream;
|
std::vector<uint8_t> bytestream;
|
||||||
|
|
@ -338,7 +364,7 @@ bool IDeviceSettings::applyDefaults(bool temporary) {
|
||||||
|
|
||||||
msg = std::dynamic_pointer_cast<Main51Message>(com->waitForMessageSync([this, &bytestream]() {
|
msg = std::dynamic_pointer_cast<Main51Message>(com->waitForMessageSync([this, &bytestream]() {
|
||||||
return com->sendCommand(Command::SetSettings, bytestream);
|
return com->sendCommand(Command::SetSettings, bytestream);
|
||||||
}, std::make_shared<Main51MessageFilter>(Command::SetSettings), std::chrono::milliseconds(2000)));
|
}, std::make_shared<Main51MessageFilter>(Command::SetSettings), std::chrono::milliseconds(1000)));
|
||||||
if(!msg || msg->data[0] != 1) {
|
if(!msg || msg->data[0] != 1) {
|
||||||
// Attempt to get the settings from the device so we're up to date if possible
|
// Attempt to get the settings from the device so we're up to date if possible
|
||||||
if(refresh()) {
|
if(refresh()) {
|
||||||
|
|
|
||||||
|
|
@ -25,4 +25,19 @@ void VSAExtendedMessage::appendPacket(std::shared_ptr<Packet> packet) const
|
||||||
if(packet->network.getNetID() == Network::NetID::Invalid) {
|
if(packet->network.getNetID() == Network::NetID::Invalid) {
|
||||||
packet->network = network;
|
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);
|
constantIndex = *reinterpret_cast<uint16_t*>(recordBytes + 2);
|
||||||
flags = *reinterpret_cast<Flags*>(recordBytes + 4);
|
flags = *reinterpret_cast<Flags*>(recordBytes + 4);
|
||||||
pieceCount = recordBytes[5];
|
pieceCount = recordBytes[5];
|
||||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 6);
|
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 6) & UINT63_MAX;
|
||||||
samples.insert(samples.end(), recordBytes + 14, recordBytes + 30);
|
samples.insert(samples.end(), recordBytes + 14, recordBytes + 30);
|
||||||
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 30);
|
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 30);
|
||||||
doChecksum(recordBytes);
|
doChecksum(recordBytes);
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ VSA03::VSA03(uint8_t* const recordBytes)
|
||||||
setType(VSA::Type::AA03);
|
setType(VSA::Type::AA03);
|
||||||
eventType = static_cast<EventType>(*reinterpret_cast<uint16_t*>(recordBytes + 2));
|
eventType = static_cast<EventType>(*reinterpret_cast<uint16_t*>(recordBytes + 2));
|
||||||
eventData = *reinterpret_cast<uint16_t*>(recordBytes + 4);
|
eventData = *reinterpret_cast<uint16_t*>(recordBytes + 4);
|
||||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 6);
|
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 6) & UINT63_MAX;
|
||||||
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 14);
|
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 14);
|
||||||
doChecksum(recordBytes);
|
doChecksum(recordBytes);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ VSA04::VSA04(uint8_t* const recordBytes)
|
||||||
setType(VSA::Type::AA04);
|
setType(VSA::Type::AA04);
|
||||||
flags = *reinterpret_cast<Flags*>(recordBytes + 2);
|
flags = *reinterpret_cast<Flags*>(recordBytes + 2);
|
||||||
partitionIndex = *reinterpret_cast<uint16_t*>(recordBytes + 4);
|
partitionIndex = *reinterpret_cast<uint16_t*>(recordBytes + 4);
|
||||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 6);
|
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 6) & UINT63_MAX;
|
||||||
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 14);
|
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 14);
|
||||||
doChecksum(recordBytes);
|
doChecksum(recordBytes);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ VSA05::VSA05(uint8_t* const recordBytes)
|
||||||
setType(VSA::Type::AA05);
|
setType(VSA::Type::AA05);
|
||||||
errorType = static_cast<ErrorType>(*reinterpret_cast<uint16_t*>(recordBytes + 2));
|
errorType = static_cast<ErrorType>(*reinterpret_cast<uint16_t*>(recordBytes + 2));
|
||||||
errorNetwork = *reinterpret_cast<uint16_t*>(recordBytes + 4);
|
errorNetwork = *reinterpret_cast<uint16_t*>(recordBytes + 4);
|
||||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 6);
|
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 6) & UINT63_MAX;
|
||||||
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 14);
|
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));
|
savedSectors.insert(savedSectors.end(), reinterpret_cast<uint32_t*>(recordBytes + 2), reinterpret_cast<uint32_t*>(recordBytes + 18));
|
||||||
error = *reinterpret_cast<uint16_t*>(recordBytes + 18);
|
error = *reinterpret_cast<uint16_t*>(recordBytes + 18);
|
||||||
savedSectorsHigh = *reinterpret_cast<uint16_t*>(recordBytes + 20);
|
savedSectorsHigh = *reinterpret_cast<uint16_t*>(recordBytes + 20);
|
||||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 22);
|
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 22) & UINT63_MAX;
|
||||||
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 30);
|
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 30);
|
||||||
doChecksum(recordBytes);
|
doChecksum(recordBytes);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ VSA07::VSA07(uint8_t* const recordBytes)
|
||||||
lastSector = *reinterpret_cast<uint32_t*>(recordBytes + 2);
|
lastSector = *reinterpret_cast<uint32_t*>(recordBytes + 2);
|
||||||
currentSector = *reinterpret_cast<uint32_t*>(recordBytes + 6);
|
currentSector = *reinterpret_cast<uint32_t*>(recordBytes + 6);
|
||||||
reserved.insert(reserved.end(), recordBytes + 10, recordBytes + 22);
|
reserved.insert(reserved.end(), recordBytes + 10, recordBytes + 22);
|
||||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 22);
|
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 22) & UINT63_MAX;
|
||||||
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 30);
|
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 30);
|
||||||
doChecksum(recordBytes);
|
doChecksum(recordBytes);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ VSA08::VSA08(uint8_t* const recordBytes)
|
||||||
setType(VSA::Type::AA08);
|
setType(VSA::Type::AA08);
|
||||||
troubleSramCount.insert(troubleSramCount.end(), recordBytes + 2, recordBytes + 6);
|
troubleSramCount.insert(troubleSramCount.end(), recordBytes + 2, recordBytes + 6);
|
||||||
troubleSectors.insert(troubleSectors.end(), reinterpret_cast<uint32_t*>(recordBytes + 6), reinterpret_cast<uint32_t*>(recordBytes + 22));
|
troubleSectors.insert(troubleSectors.end(), reinterpret_cast<uint32_t*>(recordBytes + 6), reinterpret_cast<uint32_t*>(recordBytes + 22));
|
||||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 22);
|
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 22) & UINT63_MAX;
|
||||||
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 30);
|
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 30);
|
||||||
doChecksum(recordBytes);
|
doChecksum(recordBytes);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ VSA09::VSA09(uint8_t* const recordBytes)
|
||||||
reserved0.insert(reserved0.end(), recordBytes + 12, recordBytes + 18);
|
reserved0.insert(reserved0.end(), recordBytes + 12, recordBytes + 18);
|
||||||
hardwareID = static_cast<HardwareID>(recordBytes[18]);
|
hardwareID = static_cast<HardwareID>(recordBytes[18]);
|
||||||
reserved1.insert(reserved1.end(), recordBytes + 19, recordBytes + 22);
|
reserved1.insert(reserved1.end(), recordBytes + 19, recordBytes + 22);
|
||||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 22);
|
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 22) & UINT63_MAX;
|
||||||
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 30);
|
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 30);
|
||||||
doChecksum(recordBytes);
|
doChecksum(recordBytes);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ VSA0B::VSA0B(uint8_t* const recordBytes)
|
||||||
{
|
{
|
||||||
setType(VSA::Type::AA0B);
|
setType(VSA::Type::AA0B);
|
||||||
captureBitfield = reinterpret_cast<uint16_t*>(recordBytes)[1];
|
captureBitfield = reinterpret_cast<uint16_t*>(recordBytes)[1];
|
||||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 20);
|
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 20) & UINT63_MAX;
|
||||||
reserved = recordBytes[28];
|
reserved = recordBytes[28];
|
||||||
checksum = reinterpret_cast<uint16_t*>(recordBytes)[15];
|
checksum = reinterpret_cast<uint16_t*>(recordBytes)[15];
|
||||||
doChecksum(recordBytes);
|
doChecksum(recordBytes);
|
||||||
|
|
@ -30,8 +30,8 @@ void VSA0B::doChecksum(uint8_t* recordBytes)
|
||||||
bool VSA0B::filter(const std::shared_ptr<VSAMessageReadFilter> filter)
|
bool VSA0B::filter(const std::shared_ptr<VSAMessageReadFilter> filter)
|
||||||
{
|
{
|
||||||
if((filter->captureBitfield != captureBitfield && filter->captureBitfield != UINT16_MAX) ||
|
if((filter->captureBitfield != captureBitfield && filter->captureBitfield != UINT16_MAX) ||
|
||||||
getICSTimestampFromTimepoint(filter->readRange.first) > getTimestamp() ||
|
getICSTimestampFromTimepoint(filter->readRange.first) > timestamp ||
|
||||||
getICSTimestampFromTimepoint(filter->readRange.second) < getTimestamp()) {
|
getICSTimestampFromTimepoint(filter->readRange.second) < timestamp) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ VSA0C::VSA0C(uint8_t* const recordBytes)
|
||||||
audioPreamble = recordBytes[4];
|
audioPreamble = recordBytes[4];
|
||||||
audioHeader = recordBytes[5];
|
audioHeader = recordBytes[5];
|
||||||
pcmData.insert(pcmData.end(), recordBytes + 6, recordBytes + 20);
|
pcmData.insert(pcmData.end(), recordBytes + 6, recordBytes + 20);
|
||||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 20);
|
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 20) & UINT63_MAX;
|
||||||
vNetBitfield = *reinterpret_cast<VSA0C::VNet*>(recordBytes + 28);
|
vNetBitfield = *reinterpret_cast<VSA0C::VNet*>(recordBytes + 28);
|
||||||
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 30);
|
checksum = *reinterpret_cast<uint16_t*>(recordBytes + 30);
|
||||||
doChecksum(recordBytes);
|
doChecksum(recordBytes);
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,8 @@ void VSA0DFirst::reorderPayload(std::vector<uint8_t>& secondPayload)
|
||||||
bool VSA0DFirst::filter(const std::shared_ptr<VSAMessageReadFilter> filter)
|
bool VSA0DFirst::filter(const std::shared_ptr<VSAMessageReadFilter> filter)
|
||||||
{
|
{
|
||||||
if((filter->captureBitfield != captureBitfield && filter->captureBitfield != UINT16_MAX) ||
|
if((filter->captureBitfield != captureBitfield && filter->captureBitfield != UINT16_MAX) ||
|
||||||
getICSTimestampFromTimepoint(filter->readRange.first) > getTimestamp() ||
|
getICSTimestampFromTimepoint(filter->readRange.first) > timestamp ||
|
||||||
getICSTimestampFromTimepoint(filter->readRange.second) < getTimestamp()) {
|
getICSTimestampFromTimepoint(filter->readRange.second) < timestamp) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -66,8 +66,8 @@ void VSA0EFirst::reservePacketData(std::shared_ptr<Packet>& packet) const
|
||||||
bool VSA0EFirst::filter(const std::shared_ptr<VSAMessageReadFilter> filter)
|
bool VSA0EFirst::filter(const std::shared_ptr<VSAMessageReadFilter> filter)
|
||||||
{
|
{
|
||||||
if((filter->captureBitfield != captureBitfield && filter->captureBitfield != UINT16_MAX) ||
|
if((filter->captureBitfield != captureBitfield && filter->captureBitfield != UINT16_MAX) ||
|
||||||
getICSTimestampFromTimepoint(filter->readRange.first) > getTimestamp() ||
|
getICSTimestampFromTimepoint(filter->readRange.first) > timestamp ||
|
||||||
getICSTimestampFromTimepoint(filter->readRange.second) < getTimestamp()) {
|
getICSTimestampFromTimepoint(filter->readRange.second) < timestamp) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -78,8 +78,8 @@ void VSA0FFirst::reservePacketData(std::shared_ptr<Packet>& packet) const
|
||||||
bool VSA0FFirst::filter(const std::shared_ptr<VSAMessageReadFilter> filter)
|
bool VSA0FFirst::filter(const std::shared_ptr<VSAMessageReadFilter> filter)
|
||||||
{
|
{
|
||||||
if(filter->captureBitfield != captureBitfield ||
|
if(filter->captureBitfield != captureBitfield ||
|
||||||
getICSTimestampFromTimepoint(filter->readRange.first) > getTimestamp() ||
|
getICSTimestampFromTimepoint(filter->readRange.first) > timestamp ||
|
||||||
getICSTimestampFromTimepoint(filter->readRange.second) < getTimestamp()) {
|
getICSTimestampFromTimepoint(filter->readRange.second) < timestamp) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ VSA6A::VSA6A(uint8_t* const recordBytes)
|
||||||
sequenceNum = *reinterpret_cast<uint32_t*>(recordBytes + 34);
|
sequenceNum = *reinterpret_cast<uint32_t*>(recordBytes + 34);
|
||||||
totalSectors = *reinterpret_cast<uint32_t*>(recordBytes + 38);
|
totalSectors = *reinterpret_cast<uint32_t*>(recordBytes + 38);
|
||||||
reserved = *reinterpret_cast<uint32_t*>(recordBytes + 42);
|
reserved = *reinterpret_cast<uint32_t*>(recordBytes + 42);
|
||||||
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 46);
|
timestamp = *reinterpret_cast<uint64_t*>(recordBytes + 46) & UINT63_MAX;
|
||||||
timestampSum = *reinterpret_cast<uint16_t*>(recordBytes + 54);
|
timestampSum = *reinterpret_cast<uint16_t*>(recordBytes + 54);
|
||||||
data.insert(data.end(), recordBytes + 56, recordBytes + 508);
|
data.insert(data.end(), recordBytes + 56, recordBytes + 508);
|
||||||
checksum = *reinterpret_cast<uint32_t*>(recordBytes + 508);
|
checksum = *reinterpret_cast<uint32_t*>(recordBytes + 508);
|
||||||
|
|
|
||||||
|
|
@ -430,6 +430,7 @@ bool VSAParser::extractMessagePackets(std::vector<std::shared_ptr<Packet>>& pack
|
||||||
extendedMessageRecord->appendPacket(packet);
|
extendedMessageRecord->appendPacket(packet);
|
||||||
if(extendedMessageRecord->getRecordCount() == static_cast<uint32_t>(extendedMessageRecord->getIndex() + 1)) { // Last record in sequence
|
if(extendedMessageRecord->getRecordCount() == static_cast<uint32_t>(extendedMessageRecord->getIndex() + 1)) { // Last record in sequence
|
||||||
if(!settings.messageFilter || extendedMessageRecord->filter(settings.messageFilter)) {
|
if(!settings.messageFilter || extendedMessageRecord->filter(settings.messageFilter)) {
|
||||||
|
VSAExtendedMessage::truncatePacket(packet);
|
||||||
packets.push_back(packet);
|
packets.push_back(packet);
|
||||||
}
|
}
|
||||||
activeExtendedMessage = false;
|
activeExtendedMessage = false;
|
||||||
|
|
|
||||||
|
|
@ -66,11 +66,3 @@ Complete Ethernet Example
|
||||||
|
|
||||||
.. literalinclude:: ../../examples/python/ethernet/ethernet_complete_example.py
|
.. literalinclude:: ../../examples/python/ethernet/ethernet_complete_example.py
|
||||||
:language: python
|
: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,7 +11,6 @@ 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_VSA_EXAMPLE "Build the VSA example." ON)
|
||||||
option(LIBICSNEO_BUILD_CPP_APP_ERROR_EXAMPLE "Build the app error 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_FLEXRAY_EXAMPLE "Build the FlexRay example." ON)
|
||||||
option(LIBICSNEO_BUILD_CPP_SPI_EXAMPLE "Build the SPI example." ON)
|
|
||||||
|
|
||||||
if(LIBICSNEO_BUILD_C_INTERACTIVE_EXAMPLE)
|
if(LIBICSNEO_BUILD_C_INTERACTIVE_EXAMPLE)
|
||||||
add_subdirectory(c/interactive)
|
add_subdirectory(c/interactive)
|
||||||
|
|
@ -64,7 +63,3 @@ endif()
|
||||||
if(LIBICSNEO_BUILD_CPP_FLEXRAY_EXAMPLE)
|
if(LIBICSNEO_BUILD_CPP_FLEXRAY_EXAMPLE)
|
||||||
add_subdirectory(cpp/flexray)
|
add_subdirectory(cpp/flexray)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(LIBICSNEO_BUILD_CPP_SPI_EXAMPLE)
|
|
||||||
add_subdirectory(cpp/spi)
|
|
||||||
endif()
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
add_executable(libicsneocpp-spi src/spi.cpp)
|
|
||||||
target_link_libraries(libicsneocpp-spi icsneocpp)
|
|
||||||
|
|
@ -1,142 +0,0 @@
|
||||||
/**
|
|
||||||
* 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,9 +239,6 @@ int main(int argc, char* argv[]) {
|
||||||
return -1;
|
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;
|
std::cout << "info: " << currentMessage << " transmitted frames found" << std::endl;
|
||||||
resetScriptStatus(rxDevice, txDevice, rxInitialCoreminiStatus, txInitialCoreminiStatus);
|
resetScriptStatus(rxDevice, txDevice, rxInitialCoreminiStatus, txInitialCoreminiStatus);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
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,7 +56,6 @@ enum class ExtendedCommand : uint16_t {
|
||||||
GetComponentVersions = 0x001A,
|
GetComponentVersions = 0x001A,
|
||||||
Reboot = 0x001C,
|
Reboot = 0x001C,
|
||||||
SetRootFSEntryFlags = 0x0027,
|
SetRootFSEntryFlags = 0x0027,
|
||||||
TransmitCoreminiMessage = 0x0028,
|
|
||||||
GenericBinaryInfo = 0x0030,
|
GenericBinaryInfo = 0x0030,
|
||||||
LiveData = 0x0035,
|
LiveData = 0x0035,
|
||||||
RequestTC10Wake = 0x003D,
|
RequestTC10Wake = 0x003D,
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ public:
|
||||||
bool close();
|
bool close();
|
||||||
bool isOpen();
|
bool isOpen();
|
||||||
bool isDisconnected();
|
bool isDisconnected();
|
||||||
|
|
||||||
virtual void spawnThreads();
|
virtual void spawnThreads();
|
||||||
virtual void joinThreads();
|
virtual void joinThreads();
|
||||||
void modeChangeIncoming() { driver->modeChangeIncoming(); }
|
void modeChangeIncoming() { driver->modeChangeIncoming(); }
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,9 @@
|
||||||
#include "icsneo/api/eventmanager.h"
|
#include "icsneo/api/eventmanager.h"
|
||||||
#include "icsneo/third-party/concurrentqueue/blockingconcurrentqueue.h"
|
#include "icsneo/third-party/concurrentqueue/blockingconcurrentqueue.h"
|
||||||
#include "icsneo/communication/ringbuffer.h"
|
#include "icsneo/communication/ringbuffer.h"
|
||||||
#include "icsneo/device/founddevice.h"
|
|
||||||
|
|
||||||
namespace icsneo {
|
namespace icsneo {
|
||||||
|
|
||||||
typedef std::function<void(std::vector<FoundDevice>&)> driver_finder_t;
|
|
||||||
|
|
||||||
#define ICSNEO_DRIVER_RINGBUFFER_SIZE (512 * 1024)
|
#define ICSNEO_DRIVER_RINGBUFFER_SIZE (512 * 1024)
|
||||||
class Driver {
|
class Driver {
|
||||||
public:
|
public:
|
||||||
|
|
@ -28,20 +25,18 @@ public:
|
||||||
virtual void modeChangeIncoming() {}
|
virtual void modeChangeIncoming() {}
|
||||||
virtual void awaitModeChangeComplete() {}
|
virtual void awaitModeChangeComplete() {}
|
||||||
virtual bool close() = 0;
|
virtual bool close() = 0;
|
||||||
virtual driver_finder_t getFinder() = 0;
|
|
||||||
|
|
||||||
inline bool isDisconnected() const { return disconnected; };
|
inline bool isDisconnected() const { return disconnected; };
|
||||||
inline bool isClosing() const { return closing; }
|
inline bool isClosing() const { return closing; }
|
||||||
|
|
||||||
bool waitForRx(size_t limit, std::chrono::milliseconds timeout);
|
bool waitForRx(size_t limit, std::chrono::milliseconds timeout);
|
||||||
bool waitForRx(std::function<bool()> predicate, 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 = 1);
|
bool readWait(std::vector<uint8_t>& bytes, std::chrono::milliseconds timeout = std::chrono::milliseconds(100), size_t limit = 0);
|
||||||
bool write(const std::vector<uint8_t>& bytes);
|
bool write(const std::vector<uint8_t>& bytes);
|
||||||
virtual bool isEthernet() const { return false; }
|
virtual bool isEthernet() const { return false; }
|
||||||
bool readAvailable() { return readBuffer.size() > 0; }
|
bool readAvailable() { return readBuffer.size() > 0; }
|
||||||
RingBuffer& getReadBuffer() { return readBuffer; }
|
RingBuffer& getReadBuffer() { return readBuffer; }
|
||||||
|
|
||||||
|
|
||||||
virtual bool enableCommunication(bool /* enable */, bool& sendMsg) { sendMsg = true; return true; }
|
virtual bool enableCommunication(bool /* enable */, bool& sendMsg) { sendMsg = true; return true; }
|
||||||
|
|
||||||
device_eventhandler_t report;
|
device_eventhandler_t report;
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,10 @@ struct PhyMessage {
|
||||||
bool Enabled;
|
bool Enabled;
|
||||||
bool WriteEnable;
|
bool WriteEnable;
|
||||||
bool Clause45Enable;
|
bool Clause45Enable;
|
||||||
uint8_t BusIndex;
|
uint8_t version;
|
||||||
uint8_t Version;
|
|
||||||
union {
|
union {
|
||||||
Clause22Message Clause22;
|
Clause22Message clause22;
|
||||||
Clause45Message Clause45;
|
Clause45Message clause45;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
#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,7 +17,6 @@ struct Info {
|
||||||
uint8_t sleepRequest;
|
uint8_t sleepRequest;
|
||||||
uint16_t connectionTimeoutMinutes;
|
uint16_t connectionTimeoutMinutes;
|
||||||
std::vector<CaptureInfo> captures;
|
std::vector<CaptureInfo> captures;
|
||||||
uint8_t vinAvailable;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// The response for Command::WiVICommand
|
// The response for Command::WiVICommand
|
||||||
|
|
@ -28,7 +27,6 @@ public:
|
||||||
std::optional<Command> responseTo;
|
std::optional<Command> responseTo;
|
||||||
std::optional<int32_t> value;
|
std::optional<int32_t> value;
|
||||||
std::optional<Info> info;
|
std::optional<Info> info;
|
||||||
std::optional<std::string> vin;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace WiVI
|
} // namespace WiVI
|
||||||
|
|
|
||||||
|
|
@ -113,10 +113,6 @@ private:
|
||||||
std::vector< moodycamel::BlockingReaderWriterQueue< std::vector<uint8_t> > > vnetQueues;
|
std::vector< moodycamel::BlockingReaderWriterQueue< std::vector<uint8_t> > > vnetQueues;
|
||||||
void hidReadTask();
|
void hidReadTask();
|
||||||
void vnetReadTask(size_t vnetIndex);
|
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;
|
typedef uint16_t icscm_bitfield;
|
||||||
|
|
||||||
struct HardwareEthernetPacket {
|
struct HardwareEthernetPacket {
|
||||||
static std::shared_ptr<EthernetMessage> DecodeToMessage(const std::vector<uint8_t>& bytestream);
|
static std::shared_ptr<EthernetMessage> DecodeToMessage(const std::vector<uint8_t>& bytestream, const device_eventhandler_t& report);
|
||||||
static bool EncodeFromMessage(const EthernetMessage& message, std::vector<uint8_t>& bytestream, const device_eventhandler_t& report);
|
static bool EncodeFromMessage(const EthernetMessage& message, std::vector<uint8_t>& bytestream, const device_eventhandler_t& report);
|
||||||
|
|
||||||
// Word 0 - Header flags (offset 0)
|
// Word 0 - Header flags (offset 0)
|
||||||
|
|
@ -57,9 +57,8 @@ struct HardwareEthernetPacket {
|
||||||
struct {
|
struct {
|
||||||
icscm_bitfield T1S_BURST_COUNT : 8;
|
icscm_bitfield T1S_BURST_COUNT : 8;
|
||||||
icscm_bitfield T1S_NODE_ID : 8;
|
icscm_bitfield T1S_NODE_ID : 8;
|
||||||
|
uint8_t RESERVED[6];
|
||||||
} t1s_node;
|
} t1s_node;
|
||||||
|
|
||||||
uint8_t RESERVED[6];
|
|
||||||
|
|
||||||
// Words 4-7 - Reserved/Padding
|
// Words 4-7 - Reserved/Padding
|
||||||
uint16_t stats;
|
uint16_t stats;
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,7 @@ struct PhyRegisterPacket_t {
|
||||||
uint16_t Enabled : 1;
|
uint16_t Enabled : 1;
|
||||||
uint16_t WriteEnable : 1;
|
uint16_t WriteEnable : 1;
|
||||||
uint16_t Clause45Enable : 1;
|
uint16_t Clause45Enable : 1;
|
||||||
uint16_t status : 3;
|
uint16_t reserved : 9;
|
||||||
uint16_t reserved : 2;
|
|
||||||
uint16_t BusIndex : 4;
|
|
||||||
uint16_t version : 4;
|
uint16_t version : 4;
|
||||||
};
|
};
|
||||||
uint16_t flags;
|
uint16_t flags;
|
||||||
|
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
#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,7 +56,6 @@ enum class Command : uint16_t {
|
||||||
GetSignal = 0x0013,
|
GetSignal = 0x0013,
|
||||||
Result = 0x0014,
|
Result = 0x0014,
|
||||||
GetPhysicalSignal = 0x0015,
|
GetPhysicalSignal = 0x0015,
|
||||||
GetVIN = 0x0016,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class SignalType : uint16_t { // enumCoreMiniValueMiscValueType
|
enum class SignalType : uint16_t { // enumCoreMiniValueMiscValueType
|
||||||
|
|
@ -67,7 +66,6 @@ enum class SignalType : uint16_t { // enumCoreMiniValueMiscValueType
|
||||||
ConnectionTimeout = 0x006e,
|
ConnectionTimeout = 0x006e,
|
||||||
TimeSinceLastMessageMs = 0x006f,
|
TimeSinceLastMessageMs = 0x006f,
|
||||||
UploadsPending = 0x0077,
|
UploadsPending = 0x0077,
|
||||||
VINEnabled = 0x007D,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Upload {
|
struct Upload {
|
||||||
|
|
@ -127,7 +125,7 @@ struct CommandPacket {
|
||||||
CoreMiniFixedPointValue value;
|
CoreMiniFixedPointValue value;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GetAllHeader {
|
struct GetAll {
|
||||||
static std::vector<uint8_t> Encode();
|
static std::vector<uint8_t> Encode();
|
||||||
|
|
||||||
Header header;
|
Header header;
|
||||||
|
|
@ -135,6 +133,7 @@ struct CommandPacket {
|
||||||
uint8_t sleepRequest;
|
uint8_t sleepRequest;
|
||||||
uint16_t connectionTimeoutMinutes;
|
uint16_t connectionTimeoutMinutes;
|
||||||
uint16_t numCaptureInfos;
|
uint16_t numCaptureInfos;
|
||||||
|
CaptureInfo captureInfos[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ClearUploads {
|
struct ClearUploads {
|
||||||
|
|
@ -143,13 +142,6 @@ struct CommandPacket {
|
||||||
Header header;
|
Header header;
|
||||||
uint8_t bitmask[0];
|
uint8_t bitmask[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GetVIN {
|
|
||||||
static std::vector<uint8_t> Encode();
|
|
||||||
|
|
||||||
Header header;
|
|
||||||
char VIN[17];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace WiVI
|
} // namespace WiVI
|
||||||
|
|
|
||||||
|
|
@ -1,117 +0,0 @@
|
||||||
#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
|
|
||||||
|
|
@ -1,139 +0,0 @@
|
||||||
#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
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
#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,9 +24,6 @@
|
||||||
#include "icsneo/device/deviceversion.h"
|
#include "icsneo/device/deviceversion.h"
|
||||||
#include "icsneo/device/founddevice.h"
|
#include "icsneo/device/founddevice.h"
|
||||||
#include "icsneo/device/coremini.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/diskreaddriver.h"
|
||||||
#include "icsneo/disk/diskwritedriver.h"
|
#include "icsneo/disk/diskwritedriver.h"
|
||||||
#include "icsneo/disk/nulldiskdriver.h"
|
#include "icsneo/disk/nulldiskdriver.h"
|
||||||
|
|
@ -89,77 +86,6 @@ class Device {
|
||||||
public:
|
public:
|
||||||
virtual ~Device();
|
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 std::string SerialNumToString(uint32_t serial);
|
||||||
static uint32_t SerialStringToNum(const std::string& serial);
|
static uint32_t SerialStringToNum(const std::string& serial);
|
||||||
static bool SerialStringIsNumeric(const std::string& serial);
|
static bool SerialStringIsNumeric(const std::string& serial);
|
||||||
|
|
@ -229,7 +155,6 @@ public:
|
||||||
virtual bool goOffline();
|
virtual bool goOffline();
|
||||||
virtual bool enableLogData();
|
virtual bool enableLogData();
|
||||||
virtual bool disableLogData();
|
virtual bool disableLogData();
|
||||||
virtual bool reconnect(std::chrono::milliseconds timeout, std::chrono::milliseconds interval = std::chrono::milliseconds(100));
|
|
||||||
|
|
||||||
enum class PreloadReturn : uint8_t
|
enum class PreloadReturn : uint8_t
|
||||||
{
|
{
|
||||||
|
|
@ -643,12 +568,6 @@ public:
|
||||||
NODISCARD("If the Lifetime is not held, the callback will be immediately removed")
|
NODISCARD("If the Lifetime is not held, the callback will be immediately removed")
|
||||||
Lifetime addLoggingCallback(ScriptStatusCallback cb) { return addScriptStatusCallback(ScriptStatus::Logging, std::move(cb)); }
|
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 {}; }
|
virtual std::vector<std::shared_ptr<FlexRay::Controller>> getFlexRayControllers() const { return {}; }
|
||||||
|
|
||||||
void addExtension(std::shared_ptr<DeviceExtension>&& extension);
|
void addExtension(std::shared_ptr<DeviceExtension>&& extension);
|
||||||
|
|
@ -661,13 +580,10 @@ public:
|
||||||
|
|
||||||
bool refreshComponentVersions();
|
bool refreshComponentVersions();
|
||||||
/**
|
/**
|
||||||
* For use by extensions only.
|
* For use by extensions only. A more stable API will be provided in the future.
|
||||||
*/
|
*/
|
||||||
const std::vector<std::optional<DeviceAppVersion>>& getVersions() const { return versions; }
|
const std::vector<std::optional<DeviceAppVersion>>& getVersions() const { return versions; }
|
||||||
const std::vector<ComponentVersion>& getComponentVersions() const { return componentVersions; }
|
const std::vector<ComponentVersion>& getComponentVersions() const { return componentVersions; }
|
||||||
|
|
||||||
virtual std::vector<VersionReport> getChipVersions(bool refreshComponents = true);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Some alternate communication protocols do not support DFU
|
* Some alternate communication protocols do not support DFU
|
||||||
|
|
@ -1015,7 +931,6 @@ private:
|
||||||
std::atomic<bool> wiviSleepRequested{false};
|
std::atomic<bool> wiviSleepRequested{false};
|
||||||
std::vector<NewCaptureCallback> newCaptureCallbacks;
|
std::vector<NewCaptureCallback> newCaptureCallbacks;
|
||||||
std::vector< std::pair<SleepRequestedCallback, bool /* notified */> > sleepRequestedCallbacks;
|
std::vector< std::pair<SleepRequestedCallback, bool /* notified */> > sleepRequestedCallbacks;
|
||||||
std::vector<std::pair<VINAvailableCallback, bool /* notified */>> vinAvailableCallbacks;
|
|
||||||
void wiviThreadBody();
|
void wiviThreadBody();
|
||||||
void stopWiVIThreadIfNecessary(std::unique_lock<std::mutex> lk);
|
void stopWiVIThreadIfNecessary(std::unique_lock<std::mutex> lk);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,6 @@ public:
|
||||||
RADComet3 = (0x00000027),
|
RADComet3 = (0x00000027),
|
||||||
RADMoonT1S = (0x00000028),
|
RADMoonT1S = (0x00000028),
|
||||||
RADGigastar2 = (0x00000029),
|
RADGigastar2 = (0x00000029),
|
||||||
FIRE3_T1S_LIN = (0x0000002A),
|
|
||||||
FIRE3_T1S_SENT = (0x0000002B),
|
|
||||||
RED = (0x00000040),
|
RED = (0x00000040),
|
||||||
ECU = (0x00000080),
|
ECU = (0x00000080),
|
||||||
IEVB = (0x00000100),
|
IEVB = (0x00000100),
|
||||||
|
|
@ -198,10 +196,6 @@ public:
|
||||||
return "neoOBD2 SIM";
|
return "neoOBD2 SIM";
|
||||||
case FIRE3_FlexRay:
|
case FIRE3_FlexRay:
|
||||||
return "neoVI 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:
|
case RADComet3:
|
||||||
return "RAD-Comet 3";
|
return "RAD-Comet 3";
|
||||||
case RADMoonT1S:
|
case RADMoonT1S:
|
||||||
|
|
@ -269,8 +263,6 @@ private:
|
||||||
#define ICSNEO_DEVICETYPE_RADCOMET3 ((devicetype_t)0x00000027)
|
#define ICSNEO_DEVICETYPE_RADCOMET3 ((devicetype_t)0x00000027)
|
||||||
#define ICSNEO_DEVICETYPE_RADMOONT1S ((devicetype_t)0x00000028)
|
#define ICSNEO_DEVICETYPE_RADMOONT1S ((devicetype_t)0x00000028)
|
||||||
#define ICSNEO_DEVICETYPE_RADGIGASTAR2 ((devicetype_t)0x00000029)
|
#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_RED ((devicetype_t)0x00000040)
|
||||||
#define ICSNEO_DEVICETYPE_ECU ((devicetype_t)0x00000080)
|
#define ICSNEO_DEVICETYPE_ECU ((devicetype_t)0x00000080)
|
||||||
#define ICSNEO_DEVICETYPE_IEVB ((devicetype_t)0x00000100)
|
#define ICSNEO_DEVICETYPE_IEVB ((devicetype_t)0x00000100)
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
#ifndef __FOUNDDEVICE_H_
|
#ifndef __FOUNDDEVICE_H_
|
||||||
#define __FOUNDDEVICE_H_
|
#define __FOUNDDEVICE_H_
|
||||||
|
|
||||||
|
#include "icsneo/communication/driver.h"
|
||||||
#include "icsneo/device/neodevice.h"
|
#include "icsneo/device/neodevice.h"
|
||||||
#include "icsneo/api/eventmanager.h"
|
|
||||||
|
|
||||||
namespace icsneo {
|
namespace icsneo {
|
||||||
|
|
||||||
class Driver;
|
|
||||||
typedef std::function< std::unique_ptr<Driver>(device_eventhandler_t err, neodevice_t& forDevice) > driver_factory_t;
|
typedef std::function< std::unique_ptr<Driver>(device_eventhandler_t err, neodevice_t& forDevice) > driver_factory_t;
|
||||||
|
|
||||||
class FoundDevice {
|
class FoundDevice {
|
||||||
|
|
|
||||||
|
|
@ -669,15 +669,10 @@ typedef struct
|
||||||
#define FIRE3LINUXSETTINGS_SIZE 8
|
#define FIRE3LINUXSETTINGS_SIZE 8
|
||||||
static_assert(sizeof(Fire3LinuxSettings) == FIRE3LINUXSETTINGS_SIZE, "Fire3LinuxSettings is the wrong size!");
|
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 number of CMP streams per device*/
|
||||||
#define CMP_STREAMS_FIRE3 (10)
|
#define CMP_STREAMS_FIRE3 (10)
|
||||||
#define CMP_STREAMS_FIRE3FR (10)
|
#define CMP_STREAMS_FIRE3FR (10)
|
||||||
#define CMP_STREAMS_FIRE3T1SLIN (10)
|
|
||||||
#define CMP_STREAMS_RED2 (10)
|
#define CMP_STREAMS_RED2 (10)
|
||||||
#define CMP_STREAMS_A2B (3)
|
#define CMP_STREAMS_A2B (3)
|
||||||
#define CMP_STREAMS_GIGASTAR (10)
|
#define CMP_STREAMS_GIGASTAR (10)
|
||||||
|
|
@ -691,17 +686,7 @@ typedef struct
|
||||||
uint8_t spare : 4;
|
uint8_t spare : 4;
|
||||||
uint8_t streamId;
|
uint8_t streamId;
|
||||||
uint8_t dstMac[6];
|
uint8_t dstMac[6];
|
||||||
union
|
uint64_t network_enables_1;
|
||||||
{
|
|
||||||
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;
|
uint64_t network_enables_2;
|
||||||
} CMP_NETWORK_DATA;
|
} CMP_NETWORK_DATA;
|
||||||
|
|
||||||
|
|
@ -729,7 +714,7 @@ public:
|
||||||
using TerminationGroup = std::vector<Network>;
|
using TerminationGroup = std::vector<Network>;
|
||||||
|
|
||||||
static constexpr uint16_t GS_VERSION = 5;
|
static constexpr uint16_t GS_VERSION = 5;
|
||||||
static std::optional<uint16_t> CalculateGSChecksum(const std::vector<uint8_t>& settings);
|
static std::optional<uint16_t> CalculateGSChecksum(const std::vector<uint8_t>& settings, std::optional<size_t> knownSize = std::nullopt);
|
||||||
static CANBaudrate GetEnumValueForBaudrate(int64_t baudrate);
|
static CANBaudrate GetEnumValueForBaudrate(int64_t baudrate);
|
||||||
static int64_t GetBaudrateValueForEnum(CANBaudrate enumValue);
|
static int64_t GetBaudrateValueForEnum(CANBaudrate enumValue);
|
||||||
static bool ValidateLINBaudrate(int64_t baudrate);
|
static bool ValidateLINBaudrate(int64_t baudrate);
|
||||||
|
|
@ -738,7 +723,7 @@ public:
|
||||||
virtual ~IDeviceSettings() {}
|
virtual ~IDeviceSettings() {}
|
||||||
bool ok() const { return !disabled && settingsLoaded; }
|
bool ok() const { return !disabled && settingsLoaded; }
|
||||||
|
|
||||||
virtual bool refresh(); // Get from device
|
virtual bool refresh(bool ignoreChecksum = false); // Get from device
|
||||||
|
|
||||||
// Send to device, if temporary device keeps settings in volatile RAM until power cycle, otherwise saved to EEPROM
|
// Send to device, if temporary device keeps settings in volatile RAM until power cycle, otherwise saved to EEPROM
|
||||||
virtual bool apply(bool temporary = false);
|
virtual bool apply(bool temporary = false);
|
||||||
|
|
@ -946,6 +931,7 @@ public:
|
||||||
bool disabled = false;
|
bool disabled = false;
|
||||||
|
|
||||||
bool readonly = false;
|
bool readonly = false;
|
||||||
|
bool disableGSChecksumming = false;
|
||||||
|
|
||||||
std::atomic<bool> applyingSettings{false};
|
std::atomic<bool> applyingSettings{false};
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,6 @@ public:
|
||||||
return supportedNetworks;
|
return supportedNetworks;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProductID getProductID() const override {
|
|
||||||
return ProductID::EtherBADGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
EtherBADGE(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
EtherBADGE(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<EtherBADGESettings>(makeDriver);
|
initialize<EtherBADGESettings>(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,6 @@ public:
|
||||||
return supportedNetworks;
|
return supportedNetworks;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProductID getProductID() const override {
|
|
||||||
return ProductID::neoOBD2Pro;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NeoOBD2PRO(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
NeoOBD2PRO(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize(makeDriver);
|
initialize(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,7 @@ public:
|
||||||
};
|
};
|
||||||
return supportedNetworks;
|
return supportedNetworks;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProductID getProductID() const override {
|
|
||||||
return ProductID::neoOBD2Sim;
|
|
||||||
}
|
|
||||||
private:
|
private:
|
||||||
NeoOBD2SIM(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
NeoOBD2SIM(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize(makeDriver);
|
initialize(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -34,28 +34,6 @@ public:
|
||||||
return supportedNetworks;
|
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:
|
protected:
|
||||||
NeoVIConnect(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
NeoVIConnect(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<NeoVIConnectSettings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
initialize<NeoVIConnectSettings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ namespace icsneo {
|
||||||
class NeoVIFIRE : public Device {
|
class NeoVIFIRE : public Device {
|
||||||
public:
|
public:
|
||||||
// USB PID is 0x0701, standard driver is DXX
|
// USB PID is 0x0701, standard driver is DXX
|
||||||
ICSNEO_FINDABLE_DEVICE_BY_SERIAL_RANGE(NeoVIFIRE, DeviceType::FIRE, "50000", "79999");
|
ICSNEO_FINDABLE_DEVICE_BY_PID(NeoVIFIRE, DeviceType::FIRE, 0x0701);
|
||||||
|
|
||||||
static const std::vector<Network>& GetSupportedNetworks() {
|
static const std::vector<Network>& GetSupportedNetworks() {
|
||||||
static std::vector<Network> supportedNetworks = {
|
static std::vector<Network> supportedNetworks = {
|
||||||
|
|
@ -57,9 +57,6 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProductID getProductID() const override {
|
|
||||||
return ProductID::neoVIFIRE;
|
|
||||||
}
|
|
||||||
private:
|
private:
|
||||||
NeoVIFIRE(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
NeoVIFIRE(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<NeoVIFIRESettings>(makeDriver);
|
initialize<NeoVIFIRESettings>(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -87,28 +87,6 @@ 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:
|
protected:
|
||||||
NeoVIFIRE2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
NeoVIFIRE2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<NeoVIFIRE2Settings, Disk::NeoMemoryDiskDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
initialize<NeoVIFIRE2Settings, Disk::NeoMemoryDiskDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -50,34 +50,6 @@ public:
|
||||||
return supportedNetworks;
|
return supportedNetworks;
|
||||||
}
|
}
|
||||||
size_t getEthernetActivationLineCount() const override { return 2; }
|
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:
|
protected:
|
||||||
NeoVIFIRE3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
NeoVIFIRE3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<NeoVIFIRE3Settings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
initialize<NeoVIFIRE3Settings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||||
|
|
@ -108,7 +80,7 @@ protected:
|
||||||
bool supportsGPTP() const override { return true; }
|
bool supportsGPTP() const override { return true; }
|
||||||
|
|
||||||
std::optional<MemoryAddress> getCoreminiStartAddressFlash() const override {
|
std::optional<MemoryAddress> getCoreminiStartAddressFlash() const override {
|
||||||
return std::nullopt;
|
return 33*1024*1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<MemoryAddress> getCoreminiStartAddressSD() const override {
|
std::optional<MemoryAddress> getCoreminiStartAddressSD() const override {
|
||||||
|
|
|
||||||
|
|
@ -139,10 +139,6 @@ typedef struct {
|
||||||
|
|
||||||
uint64_t network_enables_2;
|
uint64_t network_enables_2;
|
||||||
uint64_t termination_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;
|
} neovifire3_settings_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace icsneo {
|
||||||
class NeoVIFIRE3FlexRay : public Device {
|
class NeoVIFIRE3FlexRay : public Device {
|
||||||
public:
|
public:
|
||||||
// Serial numbers start with FF
|
// Serial numbers start with FF
|
||||||
// Ethernet MAC allocation is 0x1E, standard driver is Raw
|
// Ethernet MAC allocation is 1F, standard driver is Raw
|
||||||
ICSNEO_FINDABLE_DEVICE(NeoVIFIRE3FlexRay, DeviceType::FIRE3_FlexRay, "FF");
|
ICSNEO_FINDABLE_DEVICE(NeoVIFIRE3FlexRay, DeviceType::FIRE3_FlexRay, "FF");
|
||||||
|
|
||||||
static const std::vector<Network>& GetSupportedNetworks() {
|
static const std::vector<Network>& GetSupportedNetworks() {
|
||||||
|
|
@ -53,36 +53,6 @@ public:
|
||||||
return supportedNetworks;
|
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:
|
protected:
|
||||||
NeoVIFIRE3FlexRay(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
NeoVIFIRE3FlexRay(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<NeoVIFIRE3FlexRaySettings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
initialize<NeoVIFIRE3FlexRaySettings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||||
|
|
@ -111,7 +81,7 @@ protected:
|
||||||
bool supportsLiveData() const override { return true; }
|
bool supportsLiveData() const override { return true; }
|
||||||
|
|
||||||
std::optional<MemoryAddress> getCoreminiStartAddressFlash() const override {
|
std::optional<MemoryAddress> getCoreminiStartAddressFlash() const override {
|
||||||
return std::nullopt;
|
return 512*4;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<MemoryAddress> getCoreminiStartAddressSD() const override {
|
std::optional<MemoryAddress> getCoreminiStartAddressSD() const override {
|
||||||
|
|
|
||||||
|
|
@ -122,10 +122,6 @@ typedef struct {
|
||||||
|
|
||||||
uint16_t flex_mode;
|
uint16_t flex_mode;
|
||||||
uint16_t flex_termination;
|
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;
|
} neovifire3flexray_settings_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
||||||
|
|
@ -1,109 +0,0 @@
|
||||||
#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
|
|
||||||
|
|
@ -1,271 +0,0 @@
|
||||||
#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,30 +37,6 @@ public:
|
||||||
|
|
||||||
bool supportsGPTP() const override { return true; }
|
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:
|
protected:
|
||||||
NeoVIRED2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
NeoVIRED2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<NeoVIRED2Settings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
initialize<NeoVIRED2Settings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,8 @@ namespace icsneo {
|
||||||
class NeoVIION : public Plasion {
|
class NeoVIION : public Plasion {
|
||||||
public:
|
public:
|
||||||
// USB PID is 0x0901, standard driver is DXX
|
// USB PID is 0x0901, standard driver is DXX
|
||||||
ICSNEO_FINDABLE_DEVICE(NeoVIION, DeviceType::ION, "40");
|
ICSNEO_FINDABLE_DEVICE_BY_PID(NeoVIION, DeviceType::ION, 0x0901);
|
||||||
|
|
||||||
ProductID getProductID() const override {
|
|
||||||
return ProductID::neoVIION;
|
|
||||||
}
|
|
||||||
private:
|
private:
|
||||||
NeoVIION(neodevice_t neodevice, const driver_factory_t& makeDriver) : Plasion(neodevice) {
|
NeoVIION(neodevice_t neodevice, const driver_factory_t& makeDriver) : Plasion(neodevice) {
|
||||||
initialize<NullSettings, Disk::PlasionDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
initialize<NullSettings, Disk::PlasionDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,8 @@ namespace icsneo {
|
||||||
class NeoVIPLASMA : public Plasion {
|
class NeoVIPLASMA : public Plasion {
|
||||||
public:
|
public:
|
||||||
// USB PID is 0x0801, standard driver is DXX
|
// USB PID is 0x0801, standard driver is DXX
|
||||||
ICSNEO_FINDABLE_DEVICE(NeoVIPLASMA, DeviceType::PLASMA, "30");
|
ICSNEO_FINDABLE_DEVICE_BY_PID(NeoVIPLASMA, DeviceType::PLASMA, 0x0801);
|
||||||
|
|
||||||
ProductID getProductID() const override {
|
|
||||||
return ProductID::neoVIPLASMA;
|
|
||||||
}
|
|
||||||
private:
|
private:
|
||||||
NeoVIPLASMA(neodevice_t neodevice, const driver_factory_t& makeDriver) : Plasion(neodevice) {
|
NeoVIPLASMA(neodevice_t neodevice, const driver_factory_t& makeDriver) : Plasion(neodevice) {
|
||||||
initialize<NullSettings, Disk::PlasionDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
initialize<NullSettings, Disk::PlasionDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,6 @@ public:
|
||||||
// Until VNET support is added, assume we have one FIRE 2 VNET or FlexRay VNETZ as the main
|
// 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; }
|
size_t getEthernetActivationLineCount() const override { return 1; }
|
||||||
|
|
||||||
bool supportsComponentVersions() const override { return true; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
using Device::Device;
|
using Device::Device;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,32 +42,11 @@ public:
|
||||||
size_t getEthernetActivationLineCount() const override { return 1; }
|
size_t getEthernetActivationLineCount() const override { return 1; }
|
||||||
bool supportsGPTP() const override { return true; }
|
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:
|
protected:
|
||||||
RADA2B(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
RADA2B(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<RADA2BSettings, Disk::NeoMemoryDiskDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
initialize<RADA2BSettings, Disk::NeoMemoryDiskDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void setupPacketizer(Packetizer& packetizer) override {
|
void setupPacketizer(Packetizer& packetizer) override {
|
||||||
Device::setupPacketizer(packetizer);
|
Device::setupPacketizer(packetizer);
|
||||||
packetizer.disableChecksum = true;
|
packetizer.disableChecksum = true;
|
||||||
|
|
|
||||||
|
|
@ -30,25 +30,6 @@ public:
|
||||||
bool getEthPhyRegControlSupported() const override { return true; }
|
bool getEthPhyRegControlSupported() const override { return true; }
|
||||||
bool supportsGPTP() 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:
|
protected:
|
||||||
using Device::Device;
|
using Device::Device;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,25 +54,6 @@ public:
|
||||||
bool supportsTC10() const override { return true; }
|
bool supportsTC10() const override { return true; }
|
||||||
bool supportsGPTP() 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:
|
protected:
|
||||||
RADComet3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
RADComet3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<RADComet3Settings>(makeDriver);
|
initialize<RADComet3Settings>(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -25,26 +25,6 @@ public:
|
||||||
return supportedNetworks;
|
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:
|
protected:
|
||||||
RADEpsilon(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
RADEpsilon(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<RADEpsilonSettings, Disk::NeoMemoryDiskDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
initialize<RADEpsilonSettings, Disk::NeoMemoryDiskDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -26,27 +26,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool supportsComponentVersions() const override { return true; }
|
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:
|
protected:
|
||||||
RADEpsilonXL(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
RADEpsilonXL(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<RADEpsilonSettings, Disk::NeoMemoryDiskDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
initialize<RADEpsilonSettings, Disk::NeoMemoryDiskDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||||
|
|
@ -76,10 +56,6 @@ protected:
|
||||||
bool supportsEraseMemory() const override {
|
bool supportsEraseMemory() const override {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t getDiskCount() const override {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // namespace icsneo
|
}; // namespace icsneo
|
||||||
|
|
|
||||||
|
|
@ -63,26 +63,6 @@ public:
|
||||||
size_t getEthernetActivationLineCount() const override { return 1; }
|
size_t getEthernetActivationLineCount() const override { return 1; }
|
||||||
bool supportsGPTP() const override { return true; }
|
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:
|
protected:
|
||||||
RADGalaxy(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
RADGalaxy(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<RADGalaxySettings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
initialize<RADGalaxySettings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -67,28 +67,6 @@ public:
|
||||||
bool supportsTC10() const override { return true; }
|
bool supportsTC10() const override { return true; }
|
||||||
bool supportsGPTP() 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:
|
protected:
|
||||||
RADGalaxy2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
RADGalaxy2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<RADGalaxy2Settings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
initialize<RADGalaxy2Settings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -24,103 +24,6 @@ public:
|
||||||
bool supportsTC10() const override { return true; }
|
bool supportsTC10() const override { return true; }
|
||||||
bool supportsGPTP() 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:
|
protected:
|
||||||
RADGigastar(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
RADGigastar(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<RADGigastarSettings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
initialize<RADGigastarSettings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -12,243 +12,137 @@
|
||||||
namespace icsneo
|
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()
|
|
||||||
{
|
{
|
||||||
static std::vector<Network> supportedNetworks = {
|
public:
|
||||||
Network::NetID::DWCAN_01,
|
// Serial numbers start with GT
|
||||||
Network::NetID::DWCAN_02,
|
// USB PID is 0x1210, standard driver is DXX
|
||||||
Network::NetID::DWCAN_03,
|
// Ethernet MAC allocation is 0x22, standard driver is Raw
|
||||||
Network::NetID::DWCAN_04,
|
ICSNEO_FINDABLE_DEVICE(RADGigastar2, DeviceType::RADGigastar2, "GT");
|
||||||
|
|
||||||
Network::NetID::ETHERNET_01,
|
static const std::vector<Network> &GetSupportedNetworks()
|
||||||
Network::NetID::ETHERNET_02,
|
{
|
||||||
|
static std::vector<Network> supportedNetworks = {
|
||||||
|
Network::NetID::DWCAN_01,
|
||||||
|
Network::NetID::DWCAN_02,
|
||||||
|
Network::NetID::DWCAN_03,
|
||||||
|
Network::NetID::DWCAN_04,
|
||||||
|
|
||||||
Network::NetID::AE_01,
|
Network::NetID::ETHERNET_01,
|
||||||
Network::NetID::AE_02,
|
Network::NetID::ETHERNET_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::AE_01,
|
||||||
Network::NetID::LIN_02,
|
Network::NetID::AE_02,
|
||||||
Network::NetID::LIN_03,
|
Network::NetID::AE_03,
|
||||||
Network::NetID::LIN_04,
|
Network::NetID::AE_04,
|
||||||
Network::NetID::LIN_05,
|
Network::NetID::AE_05,
|
||||||
Network::NetID::LIN_06,
|
Network::NetID::AE_06,
|
||||||
Network::NetID::LIN_07,
|
Network::NetID::AE_07,
|
||||||
Network::NetID::LIN_08,
|
Network::NetID::AE_08,
|
||||||
Network::NetID::LIN_09,
|
Network::NetID::AE_09,
|
||||||
Network::NetID::LIN_10,
|
Network::NetID::AE_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::LIN_01,
|
||||||
Network::NetID::I2C_02,
|
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::MDIO_01,
|
Network::NetID::I2C_01,
|
||||||
Network::NetID::MDIO_02,
|
Network::NetID::I2C_02,
|
||||||
|
|
||||||
Network::NetID::SPI_01,
|
Network::NetID::MDIO_01,
|
||||||
Network::NetID::SPI_02,
|
Network::NetID::MDIO_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; }
|
Network::NetID::SPI_01,
|
||||||
|
Network::NetID::SPI_02,
|
||||||
bool getEthPhyRegControlSupported() const override { return true; }
|
Network::NetID::SPI_03,
|
||||||
|
Network::NetID::SPI_04,
|
||||||
bool supportsTC10() const override { return true; }
|
Network::NetID::SPI_05,
|
||||||
bool supportsGPTP() const override { return true; }
|
Network::NetID::SPI_06,
|
||||||
|
Network::NetID::SPI_07,
|
||||||
ProductID getProductID() const override {
|
Network::NetID::SPI_08,
|
||||||
return ProductID::RADGigastar2;
|
};
|
||||||
}
|
return supportedNetworks;
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::vector<ChipInfo>& getChipInfo() const override {
|
size_t getEthernetActivationLineCount() const override { return 1; }
|
||||||
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},
|
|
||||||
};
|
|
||||||
|
|
||||||
static std::vector<ChipInfo> t1sChips = {
|
bool getEthPhyRegControlSupported() const override { return true; }
|
||||||
{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
|
|
||||||
}
|
|
||||||
|
|
||||||
BootloaderPipeline getBootloader() override {
|
bool supportsTC10() const override { return true; }
|
||||||
auto chipVersions = getChipVersions();
|
bool supportsGPTP() const override { return true; }
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<VersionReport> getChipVersions(bool refreshComponents = true) override {
|
|
||||||
if(variantToFlash == FirmwareVariant::Invalid) {
|
|
||||||
getCurrentVariant();
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
protected:
|
||||||
{
|
RADGigastar2(neodevice_t neodevice, const driver_factory_t &makeDriver) : Device(neodevice)
|
||||||
return 1;
|
{
|
||||||
}
|
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,10 +29,6 @@ public:
|
||||||
|
|
||||||
bool getEthPhyRegControlSupported() const override { return true; }
|
bool getEthPhyRegControlSupported() const override { return true; }
|
||||||
|
|
||||||
ProductID getProductID() const override {
|
|
||||||
return ProductID::RADJupiter;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RADJupiter(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
RADJupiter(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<RADJupiterSettings>(makeDriver);
|
initialize<RADJupiterSettings>(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,6 @@ public:
|
||||||
size_t getEthernetActivationLineCount() const override { return 1; }
|
size_t getEthernetActivationLineCount() const override { return 1; }
|
||||||
bool supportsGPTP() const override { return true; }
|
bool supportsGPTP() const override { return true; }
|
||||||
|
|
||||||
ProductID getProductID() const override {
|
|
||||||
return ProductID::RADMars;
|
|
||||||
}
|
|
||||||
protected:
|
protected:
|
||||||
RADMars(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
RADMars(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<RADMarsSettings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
initialize<RADMarsSettings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -16,26 +16,6 @@ public:
|
||||||
|
|
||||||
uint8_t getPhyAddrOrPort() const override { return 6; };
|
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:
|
protected:
|
||||||
RADMoon2(neodevice_t neodevice, const driver_factory_t& makeDriver) : RADMoon2Base(neodevice) {
|
RADMoon2(neodevice_t neodevice, const driver_factory_t& makeDriver) : RADMoon2Base(neodevice) {
|
||||||
initialize<RADMoon2Settings>(makeDriver);
|
initialize<RADMoon2Settings>(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -18,23 +18,6 @@ public:
|
||||||
|
|
||||||
bool supportsTC10() const override { return true; }
|
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:
|
protected:
|
||||||
RADMoon2ZL(neodevice_t neodevice, const driver_factory_t& makeDriver) : RADMoon2Base(neodevice) {
|
RADMoon2ZL(neodevice_t neodevice, const driver_factory_t& makeDriver) : RADMoon2Base(neodevice) {
|
||||||
initialize<RADMoon2Settings>(makeDriver);
|
initialize<RADMoon2Settings>(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -30,24 +30,6 @@ public:
|
||||||
|
|
||||||
bool supportsTC10() const override { return true; }
|
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:
|
protected:
|
||||||
RADMoon3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
RADMoon3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<RADMoon3Settings>(makeDriver);
|
initialize<RADMoon3Settings>(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,6 @@ public:
|
||||||
|
|
||||||
bool getEthPhyRegControlSupported() const override { return true; }
|
bool getEthPhyRegControlSupported() const override { return true; }
|
||||||
|
|
||||||
|
|
||||||
ProductID getProductID() const override {
|
|
||||||
return ProductID::RADMoonDuo;
|
|
||||||
}
|
|
||||||
protected:
|
protected:
|
||||||
RADMoonDuo(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
RADMoonDuo(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<RADMoonDuoSettings>(makeDriver);
|
initialize<RADMoonDuoSettings>(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,6 @@ public:
|
||||||
|
|
||||||
bool supportsTC10() const override { return true; }
|
bool supportsTC10() const override { return true; }
|
||||||
|
|
||||||
ProductID getProductID() const override {
|
|
||||||
return ProductID::RADMoonT1S;
|
|
||||||
}
|
|
||||||
protected:
|
protected:
|
||||||
RADMoonT1S(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
RADMoonT1S(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<RADMoonT1SSettings>(makeDriver);
|
initialize<RADMoonT1SSettings>(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,6 @@ public:
|
||||||
|
|
||||||
bool getEthPhyRegControlSupported() const override { return true; }
|
bool getEthPhyRegControlSupported() const override { return true; }
|
||||||
|
|
||||||
ProductID getProductID() const override {
|
|
||||||
return ProductID::RADPluto;
|
|
||||||
}
|
|
||||||
protected:
|
protected:
|
||||||
RADPluto(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
RADPluto(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<RADPlutoSettings>(makeDriver);
|
initialize<RADPlutoSettings>(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ static_assert(sizeof(radpluto_settings_t) == 322, "RAD-Pluto Settings are not pa
|
||||||
class RADPlutoSettings : public IDeviceSettings {
|
class RADPlutoSettings : public IDeviceSettings {
|
||||||
public:
|
public:
|
||||||
RADPlutoSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radpluto_settings_t)) {
|
RADPlutoSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radpluto_settings_t)) {
|
||||||
|
disableGSChecksumming = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,6 @@ public:
|
||||||
return supportedNetworks;
|
return supportedNetworks;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProductID getProductID() const override {
|
|
||||||
return ProductID::RADStar2;
|
|
||||||
}
|
|
||||||
protected:
|
protected:
|
||||||
RADStar2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
RADStar2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<RADStar2Settings>(makeDriver);
|
initialize<RADStar2Settings>(makeDriver);
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ typedef struct {
|
||||||
class RADStar2Settings : public IDeviceSettings {
|
class RADStar2Settings : public IDeviceSettings {
|
||||||
public:
|
public:
|
||||||
RADStar2Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radstar2_settings_t)) {
|
RADStar2Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radstar2_settings_t)) {
|
||||||
|
disableGSChecksumming = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue