mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Device: RAD-wBMS: Add class, chips, and bootloader information
This commit is contained in:
committed by
Kyle Schwarz
parent
0dd8dbfb64
commit
7a5c8c2879
@@ -45,6 +45,7 @@ Instructions for installing each API can be found in its respective documentatio
|
||||
- RAD-Pluto
|
||||
- RAD-Star 2
|
||||
- RAD-SuperMoon
|
||||
- RAD-wBMS
|
||||
- ValueCAN 3
|
||||
- ValueCAN 4
|
||||
|
||||
|
||||
@@ -1088,6 +1088,8 @@ int LegacyDLLExport icsneoGetDeviceSettingsType(void* hObject, EPlasmaIonVnetCha
|
||||
case NEODEVICE_FIRE3_FLEXRAY:
|
||||
*pDeviceSettingsType = DeviceFire3FlexraySettingsType;
|
||||
break;
|
||||
case NEODEVICE_RAD_BMS:
|
||||
*pDeviceSettingsType = DeviceRADBMSSettingsType;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ void init_devicetype(pybind11::module_& m) {
|
||||
.value("RADEpsilon", DeviceType::Enum::RADEpsilon)
|
||||
.value("RADEpsilonXL", DeviceType::Enum::RADEpsilonXL)
|
||||
.value("RADGalaxy2", DeviceType::Enum::RADGalaxy2)
|
||||
.value("RADwBMS", DeviceType::Enum::RADwBMS)
|
||||
.value("RADMoon3", DeviceType::Enum::RADMoon3)
|
||||
.value("RADGemini", DeviceType::Enum::RADGemini)
|
||||
.value("RADComet2", DeviceType::Enum::RADComet2)
|
||||
|
||||
@@ -241,6 +241,10 @@ std::vector<std::shared_ptr<Device>> DeviceFinder::FindAll() {
|
||||
makeIfSerialMatches<RADSupermoon>(dev, newFoundDevices);
|
||||
#endif
|
||||
|
||||
#ifdef __RADWBMS_H_
|
||||
makeIfSerialMatches<RADwBMS>(dev, newFoundDevices);
|
||||
#endif
|
||||
|
||||
#ifdef __VALUECAN3_H_
|
||||
makeIfSerialRangeMatches<ValueCAN3>(dev, newFoundDevices);
|
||||
#endif
|
||||
@@ -404,6 +408,10 @@ const std::vector<DeviceType>& DeviceFinder::GetSupportedDevices() {
|
||||
RADSupermoon::DEVICE_TYPE,
|
||||
#endif
|
||||
|
||||
#ifdef __RADWBMS_H_
|
||||
RADwBMS::DEVICE_TYPE,
|
||||
#endif
|
||||
|
||||
#ifdef __VALUECAN3_H_
|
||||
ValueCAN3::DEVICE_TYPE,
|
||||
#endif
|
||||
|
||||
@@ -126,6 +126,7 @@ enum class ChipID : icsneoc2_chip_id_t {
|
||||
RADA2B_REVB_ZCHIP = icsneoc2_chip_id_rada2b_revb_zchip,
|
||||
RADGigastar_FFG_ZYNQ = icsneoc2_chip_id_radgigastar_ffg_zynq,
|
||||
VEM_02_FR_FCHIP = icsneoc2_chip_id_vem_02_fr_fchip,
|
||||
RADBMS_WIL = icsneoc2_chip_id_radbms_wil,
|
||||
Connect_ZCHIP = icsneoc2_chip_id_connect_zchip,
|
||||
SFPModule_88q2221_MCHIP = icsneoc2_chip_id_sfpmodule_88q2221_mchip,
|
||||
RADGALAXY2_SYSMON_CHIP = icsneoc2_chip_id_radgalaxy2_sysmon_chip,
|
||||
|
||||
@@ -133,6 +133,7 @@ public:
|
||||
RADA2B = 40,
|
||||
SFPModule_88q2112 = 41,
|
||||
RADGalaxy2 = 47,
|
||||
RADwBMS = 48,
|
||||
RADMoon3 = 49,
|
||||
RADComet2 = 50,
|
||||
Connect = 51,
|
||||
|
||||
@@ -52,6 +52,7 @@ public:
|
||||
RADEpsilon = icsneoc2_devicetype_rad_epsilon,
|
||||
RADEpsilonXL = icsneoc2_devicetype_rad_epsilon_xl,
|
||||
RADGalaxy2 = icsneoc2_devicetype_rad_galaxy2,
|
||||
RADwBMS = icsneoc2_devicetype_rad_wbms,
|
||||
RADMoon3 = icsneoc2_devicetype_rad_moon3,
|
||||
RADComet2 = icsneoc2_devicetype_rad_comet2,
|
||||
FIRE3_FlexRay = icsneoc2_devicetype_fire3_flexray,
|
||||
@@ -216,6 +217,8 @@ public:
|
||||
return "neoVI Connect";
|
||||
case RADGigastar2:
|
||||
return "RAD-Gigastar 2";
|
||||
case RADwBMS:
|
||||
return "RAD-wBMS";
|
||||
case DONT_REUSE0:
|
||||
case DONT_REUSE1:
|
||||
case DONT_REUSE2:
|
||||
@@ -268,6 +271,7 @@ private:
|
||||
#define ICSNEO_DEVICETYPE_RADEPSILON ((devicetype_t)icsneoc2_devicetype_rad_epsilon)
|
||||
#define ICSNEO_DEVICETYPE_RADEPSILONXL ((devicetype_t)icsneoc2_devicetype_rad_epsilon_xl)
|
||||
#define ICSNEO_DEVICETYPE_RADGALAXY2 ((devicetype_t)icsneoc2_devicetype_rad_galaxy2)
|
||||
#define ICSNEO_DEVICETYPE_RADWBMS ((devicetype_t)icsneoc2_devicetype_rad_wbms)
|
||||
#define ICSNEO_DEVICETYPE_RADMoon3 ((devicetype_t)icsneoc2_devicetype_rad_moon3)
|
||||
#define ICSNEO_DEVICETYPE_RADCOMET2 ((devicetype_t)icsneoc2_devicetype_rad_comet2)
|
||||
#define ICSNEO_DEVICETYPE_FIRE3FLEXRAY ((devicetype_t)icsneoc2_devicetype_fire3_flexray)
|
||||
|
||||
@@ -753,6 +753,61 @@ typedef struct
|
||||
uint16_t cmp_device_id;
|
||||
} CMP_GLOBAL_DATA;
|
||||
|
||||
/* wBMS Structs */
|
||||
|
||||
typedef union
|
||||
{
|
||||
uint8_t byte;
|
||||
struct
|
||||
{
|
||||
uint8_t onboard_external : 1;
|
||||
uint8_t type : 1;
|
||||
uint8_t mode: 3;
|
||||
uint8_t reserved : 3;
|
||||
} config;
|
||||
} sSPI_PORT_SETTING;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
sSPI_PORT_SETTING port_a; //1
|
||||
sSPI_PORT_SETTING port_b; //1
|
||||
} sSPI_PORT_SETTINGS;
|
||||
|
||||
#define WBMS_GATEWAY_NETWORK_NONE (0)
|
||||
#define WBMS_GATEWAY_NETWORK_DWCAN_01 (1)
|
||||
#define WBMS_GATEWAY_NETWORK_DWCAN_02 (2)
|
||||
#define WBMS_GATEWAY_NETWORK_UDP_MULTICAST (3)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t wbms1_network;
|
||||
uint8_t wbms1_canfd_enable;
|
||||
uint8_t wbms2_network;
|
||||
uint8_t wbms2_canfd_enable;
|
||||
uint16_t reserved[6];
|
||||
} WBMSGatewaySettings;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t wBMSDeviceID;
|
||||
uint8_t enabled;
|
||||
} sWIL_FAULT_SERVICING_SETTINGS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t enabled;
|
||||
} sWIL_NETWORK_DATA_CAPTURE_SETTINGS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t using_port_a;
|
||||
uint8_t using_port_b;
|
||||
uint8_t attemptConnect;
|
||||
sWIL_FAULT_SERVICING_SETTINGS fault_servicing_config;
|
||||
sWIL_NETWORK_DATA_CAPTURE_SETTINGS network_data_capture_config;
|
||||
uint16_t sensor_buffer_size;
|
||||
} sWIL_CONNECTION_SETTINGS;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
#ifndef __RADWBMS_H_
|
||||
#define __RADWBMS_H_
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include "icsneo/device/tree/radwbms/radwbmssettings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class RADwBMS : public Device {
|
||||
public:
|
||||
enum class FirmwareVariant {
|
||||
Invalid = 0,
|
||||
WIL_1_1 = 0x0101000C,
|
||||
WIL_2_0 = 0x02000058,
|
||||
WIL_2_0_9_26 = 0x0200091A,
|
||||
WIL_2_1 = 0x02010047,
|
||||
WIL_2_2 = 0x0202000F,
|
||||
WIL_2_3 = 0x0203020B,
|
||||
WIL_3_1_0_9 = 0x03010009,
|
||||
WIL_3_2_0 = 0x03020000,
|
||||
WIL_3_3_0_27 = 0x0303001B,
|
||||
};
|
||||
|
||||
// Serial numbers start with BS
|
||||
// USB PID is 0x110B, standard driver is CDACM
|
||||
// Ethernet MAC allocation is 0x1B, standard driver is Raw
|
||||
ICSNEO_FINDABLE_DEVICE(RADwBMS, DeviceType::RADwBMS, "BS");
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::DWCAN_01,
|
||||
Network::NetID::DWCAN_02,
|
||||
Network::NetID::ETHERNET_01,
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
size_t getEthernetActivationLineCount() const override { return 1; }
|
||||
|
||||
bool supportsReboot() const override { return true; }
|
||||
|
||||
ProductID getProductID() const override {
|
||||
return ProductID::RADwBMS;
|
||||
}
|
||||
|
||||
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::RADBMS_WIL)) {
|
||||
FirmwareVariant res = FirmwareVariant::Invalid;
|
||||
switch(static_cast<FirmwareVariant>(component.dotVersion)) {
|
||||
case FirmwareVariant::WIL_1_1:
|
||||
case FirmwareVariant::WIL_2_0:
|
||||
case FirmwareVariant::WIL_2_0_9_26:
|
||||
case FirmwareVariant::WIL_2_1:
|
||||
case FirmwareVariant::WIL_2_2:
|
||||
case FirmwareVariant::WIL_2_3:
|
||||
case FirmwareVariant::WIL_3_1_0_9:
|
||||
case FirmwareVariant::WIL_3_2_0:
|
||||
case FirmwareVariant::WIL_3_3_0_27:
|
||||
res = static_cast<FirmwareVariant>(component.dotVersion);
|
||||
break;
|
||||
default:
|
||||
res = FirmwareVariant::Invalid;
|
||||
break;
|
||||
}
|
||||
if(variantToFlash == FirmwareVariant::Invalid) {
|
||||
// Set the variantToFlash if it hasn't been set yet, we always flash the same firmware variant as the current if it is unspecified
|
||||
variantToFlash = res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FirmwareVariant::Invalid;
|
||||
}
|
||||
|
||||
const std::vector<ChipInfo>& getChipInfo() const override {
|
||||
switch (variantToFlash) {
|
||||
case FirmwareVariant::WIL_1_1: {
|
||||
static std::vector<ChipInfo> chips = {{ChipID::RADBMS_MCHIP, true, "MCHIP", "rad_bms_mchip_WIL_1_1_ief", 0, FirmwareType::IEF}};
|
||||
return chips;
|
||||
}
|
||||
case FirmwareVariant::WIL_2_0: {
|
||||
static std::vector<ChipInfo> chips = {{ChipID::RADBMS_MCHIP, true, "MCHIP", "rad_bms_mchip_WIL_2_0_ief", 0, FirmwareType::IEF}};
|
||||
return chips;
|
||||
}
|
||||
case FirmwareVariant::WIL_2_0_9_26: {
|
||||
static std::vector<ChipInfo> chips = {{ChipID::RADBMS_MCHIP, true, "MCHIP", "rad_bms_mchip_WIL_2_0_9_26_ief", 0, FirmwareType::IEF}};
|
||||
return chips;
|
||||
}
|
||||
case FirmwareVariant::WIL_2_1: {
|
||||
static std::vector<ChipInfo> chips = {{ChipID::RADBMS_MCHIP, true, "MCHIP", "rad_bms_mchip_WIL_2_1_ief", 0, FirmwareType::IEF}};
|
||||
return chips;
|
||||
}
|
||||
case FirmwareVariant::WIL_2_2: {
|
||||
static std::vector<ChipInfo> chips = {{ChipID::RADBMS_MCHIP, true, "MCHIP", "rad_bms_mchip_WIL_2_2_ief", 0, FirmwareType::IEF}};
|
||||
return chips;
|
||||
}
|
||||
case FirmwareVariant::WIL_2_3: {
|
||||
static std::vector<ChipInfo> chips = {{ChipID::RADBMS_MCHIP, true, "MCHIP", "rad_bms_mchip_WIL_2_3_ief", 0, FirmwareType::IEF}};
|
||||
return chips;
|
||||
}
|
||||
case FirmwareVariant::WIL_3_1_0_9: {
|
||||
static std::vector<ChipInfo> chips = {{ChipID::RADBMS_MCHIP, true, "MCHIP", "rad_bms_mchip_WIL_3_1_0_9_ief", 0, FirmwareType::IEF}};
|
||||
return chips;
|
||||
}
|
||||
case FirmwareVariant::WIL_3_2_0: {
|
||||
static std::vector<ChipInfo> chips = {{ChipID::RADBMS_MCHIP, true, "MCHIP", "rad_bms_mchip_WIL_3_2_0_ief", 0, FirmwareType::IEF}};
|
||||
return chips;
|
||||
}
|
||||
case FirmwareVariant::WIL_3_3_0_27: {
|
||||
static std::vector<ChipInfo> chips = {{ChipID::RADBMS_MCHIP, true, "MCHIP", "rad_bms_mchip_WIL_3_3_0_27_ief", 0, FirmwareType::IEF}};
|
||||
return chips;
|
||||
}
|
||||
}
|
||||
// Return empty chip information if the WIL version is not set
|
||||
static std::vector<ChipInfo> chips = {};
|
||||
return chips;
|
||||
}
|
||||
|
||||
BootloaderPipeline getBootloader() override {
|
||||
return BootloaderPipeline()
|
||||
.add<EnterBootloaderPhase>()
|
||||
.add<FlashPhase>(ChipID::RADBMS_MCHIP, BootloaderCommunication::RED)
|
||||
.add<EnterApplicationPhase>(ChipID::RADBMS_MCHIP)
|
||||
.add<WaitPhase>(std::chrono::milliseconds(3000))
|
||||
.add<ReconnectPhase>();
|
||||
}
|
||||
|
||||
std::vector<VersionReport> getChipVersions(bool refreshComponents = true) override {
|
||||
if(variantToFlash == FirmwareVariant::Invalid) {
|
||||
getCurrentVariant();
|
||||
}
|
||||
return Device::getChipVersions(refreshComponents);
|
||||
}
|
||||
|
||||
protected:
|
||||
RADwBMS(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADwBMSSettings, Disk::NeoMemoryDiskDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||
}
|
||||
|
||||
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); }
|
||||
|
||||
std::optional<MemoryAddress> getCoreminiStartAddressFlash() const override {
|
||||
return 2048 * 512;
|
||||
}
|
||||
|
||||
std::optional<MemoryAddress> getCoreminiStartAddressSD() const override {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool supportsEraseMemory() const override {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
}; // namespace icsneo
|
||||
|
||||
#endif // __RADWBMS_H_
|
||||
@@ -0,0 +1,80 @@
|
||||
#ifndef __RADWBMSSETTINGS_H_
|
||||
#define __RADWBMSSETTINGS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "icsneo/device/idevicesettings.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#pragma pack(push, 2)
|
||||
typedef struct
|
||||
{
|
||||
uint16_t perf_en;
|
||||
|
||||
uint64_t termination_enables;
|
||||
|
||||
CAN_SETTINGS can1;
|
||||
CANFD_SETTINGS canfd1;
|
||||
|
||||
CAN_SETTINGS can2;
|
||||
CANFD_SETTINGS canfd2;
|
||||
|
||||
uint16_t network_enables;
|
||||
uint16_t network_enables_2;
|
||||
uint16_t network_enables_3;
|
||||
|
||||
int16_t iso15765_separation_time_offset;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32_t disableUsbCheckOnBoot : 1;
|
||||
uint32_t enableLatencyTest : 1;
|
||||
uint32_t enablePcEthernetComm : 1;
|
||||
uint32_t reserved : 29;
|
||||
} flags;
|
||||
|
||||
ETHERNET_SETTINGS ethernet;
|
||||
ETHERNET_SETTINGS2 ethernet2;
|
||||
|
||||
uint32_t pwr_man_timeout;
|
||||
uint16_t pwr_man_enable;
|
||||
uint16_t network_enabled_on_boot;
|
||||
|
||||
uint8_t rsvd[10]; //Was sWILBridgeConfig
|
||||
|
||||
sSPI_PORT_SETTINGS spi_config;
|
||||
|
||||
sWIL_CONNECTION_SETTINGS wbms_wil_1;
|
||||
sWIL_CONNECTION_SETTINGS wbms_wil_2;
|
||||
|
||||
uint16_t wil1_nwk_metadata_buff_count;
|
||||
uint16_t wil2_nwk_metadata_buff_count;
|
||||
|
||||
WBMSGatewaySettings gateway;
|
||||
|
||||
uint16_t network_enables_4;
|
||||
uint64_t network_enables_5;
|
||||
} radwbms_settings_t;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
static_assert(sizeof(radwbms_settings_t) == 156, "RAD-wBMS settings size mismatch");
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class RADwBMSSettings : public IDeviceSettings {
|
||||
public:
|
||||
RADwBMSSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radwbms_settings_t)) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // __RADWBMSSETTINGS_H_
|
||||
@@ -42,6 +42,7 @@ typedef enum _icsneoc2_devicetype_t {
|
||||
icsneoc2_devicetype_rad_epsilon = 0x00000018,
|
||||
icsneoc2_devicetype_rad_epsilon_xl = 0x0000001e,
|
||||
icsneoc2_devicetype_rad_galaxy2 = 0x00000021,
|
||||
icsneoc2_devicetype_rad_wbms = 0x00000022,
|
||||
icsneoc2_devicetype_rad_moon3 = 0x00000023,
|
||||
icsneoc2_devicetype_rad_comet2 = 0x00000024,
|
||||
icsneoc2_devicetype_fire3_flexray = 0x00000025,
|
||||
@@ -665,6 +666,7 @@ typedef enum _icsneoc2_chip_id_t {
|
||||
icsneoc2_chip_id_rada2b_revb_zchip = 116,
|
||||
icsneoc2_chip_id_radgigastar_ffg_zynq = 117,
|
||||
icsneoc2_chip_id_vem_02_fr_fchip = 118,
|
||||
icsneoc2_chip_id_radbms_wil = 119,
|
||||
icsneoc2_chip_id_connect_zchip = 121,
|
||||
icsneoc2_chip_id_sfpmodule_88q2221_mchip = 122,
|
||||
icsneoc2_chip_id_radgalaxy2_sysmon_chip = 123,
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "icsneo/device/tree/radpluto/radpluto.h"
|
||||
#include "icsneo/device/tree/radstar2/radstar2.h"
|
||||
#include "icsneo/device/tree/radsupermoon/radsupermoon.h"
|
||||
#include "icsneo/device/tree/radwbms/radwbms.h"
|
||||
#include "icsneo/device/tree/valuecan3/valuecan3.h"
|
||||
#include "icsneo/device/tree/valuecan4/valuecan4-1.h"
|
||||
#include "icsneo/device/tree/valuecan4/valuecan4-2.h"
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "icsneo/device/tree/radpluto/radpluto.h"
|
||||
#include "icsneo/device/tree/radstar2/radstar2.h"
|
||||
#include "icsneo/device/tree/radsupermoon/radsupermoon.h"
|
||||
#include "icsneo/device/tree/radwbms/radwbms.h"
|
||||
#include "icsneo/device/tree/valuecan3/valuecan3.h"
|
||||
#include "icsneo/device/tree/valuecan4/valuecan4-1.h"
|
||||
#include "icsneo/device/tree/valuecan4/valuecan4-2.h"
|
||||
|
||||
Reference in New Issue
Block a user