mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Add Gigalog, Gigastar, Moon 2, Moon Duo, and Supermoon
The USB drivers for these devices are currently stubbed, it will find them but not connect. The Ethernet drivers work though, where applicable.
This commit is contained in:
@@ -11,143 +11,6 @@ namespace icsneo {
|
||||
#endif
|
||||
|
||||
#pragma pack(push, 2)
|
||||
#define SERDESCAM_SETTINGS_FLAG_ENABLE 0x01
|
||||
#define SERDESCAM_SETTINGS_RTSP_ENABLE 0x02
|
||||
#define SERDESCAM_SETTINGS_AUTO_DETECT_ENABLE 0x04
|
||||
#define SERDESCAM_SETTINGS_CONFIG_ENABLE 0x08
|
||||
|
||||
/* mode in SERDESCAM_SETTINGS */
|
||||
enum
|
||||
{
|
||||
SERDESCAM_MODE_PASSTHROUGH = 0,
|
||||
SERDESCAM_MODE_TAP,
|
||||
SERDESCAM_MODE_PLAYBACK,
|
||||
};
|
||||
|
||||
/* ucCamConfigMode in SERDESCAM_SETTINGS */
|
||||
enum
|
||||
{
|
||||
SERDESCAM_CONFIG_MODE_EXTERNAL_OVER_TAP = 0,
|
||||
SERDESCAM_CONFIG_MODE_LOCAL_SCRIPT,
|
||||
};
|
||||
|
||||
/* bitPos in SERDESCAM_SETTINGS */
|
||||
enum
|
||||
{
|
||||
SERDESCAM_PIXEL_BIT_POS_0 = 0,
|
||||
SERDESCAM_PIXEL_BIT_POS_1,
|
||||
SERDESCAM_PIXEL_BIT_POS_2,
|
||||
SERDESCAM_PIXEL_BIT_POS_3,
|
||||
};
|
||||
|
||||
/* videoFormat in SERDESCAM_SETTINGS */
|
||||
enum
|
||||
{
|
||||
SERDESCAM_VIDEO_FORMAT_NONE = -1,
|
||||
SERDESCAM_VIDEO_FORMAT_UYVY_422_8 = 0, // packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
|
||||
SERDESCAM_VIDEO_FORMAT_YUYV_422_8, // packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
|
||||
SERDESCAM_VIDEO_FORMAT_YVYU_422_8, // packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
|
||||
SERDESCAM_VIDEO_FORMAT_VYUY_422_8, // packed YUV 4:2:2, 16bpp, Cr Y0 Cb Y1
|
||||
SERDESCAM_VIDEO_FORMAT_BAYER_BGGR_8,
|
||||
SERDESCAM_VIDEO_FORMAT_RAW_8, // e.g. bayer 8 bit, gray 8 bit
|
||||
SERDESCAM_VIDEO_FORMAT_RAW_10, // e.g. bayer 10 bit, gray 10 bit
|
||||
SERDESCAM_VIDEO_FORMAT_RAW_12,
|
||||
SERDESCAM_VIDEO_FORMAT_RAW_16, // e.g. planar YUV 4:2:2, 16bpp, 8 bit samples
|
||||
SERDESCAM_VIDEO_FORMAT_RAW_20, // e.g. planar YUV 4:2:2, 20bpp, 10 bit samples
|
||||
SERDESCAM_VIDEO_FORMAT_RAW_24, // e.g. packed RGB 8:8:8 24bpp, 8 bit samples
|
||||
SERDESCAM_VIDEO_FORMAT_RAW_30, // e.g. planar YUV 4:4:4, 30bpp, 10 bit samples
|
||||
SERDESCAM_VIDEO_FORMAT_RAW_32, // e.g. packed ARGB 8:8:8:8, 32bpp, 8 bit samples
|
||||
SERDESCAM_VIDEO_FORMAT_RAW_36,
|
||||
SERDESCAM_VIDEO_FORMAT_RGB888, // packed RGB 8:8:8, 24bpp, RGBRGB...
|
||||
SERDESCAM_VIDEO_FORMAT_UYVY_422_10LE_PACKED,// packed YUV 4:2:2, 20bpp, Cb Y0 Cr Y1, bitpacked
|
||||
SERDESCAM_VIDEO_FORMAT_YUYV_422_10LE_PACKED,// packed YUV 4:2:2, 20bpp, Y0 Cb Y1 Cr, FOURCC Y210 bitpacked
|
||||
SERDESCAM_VIDEO_FORMAT_YVYU_422_10LE_PACKED,// packed YUV 4:2:2, 20bpp, Y0 Cr Y1 Cb, bitpacked
|
||||
SERDESCAM_VIDEO_FORMAT_VYUY_422_10LE_PACKED,// packed YUV 4:2:2, 20bpp, Cr Y0 Cb Y1, bitpacked
|
||||
SERDESCAM_VIDEO_FORMAT_BAYER_BGGR_10LE_PACKED,// 10-bit samples bitpacked into 40-bits little endian
|
||||
SERDESCAM_VIDEO_FORMAT_BAYER_BGGR_12LE_PACKED,// 12-bit samples bitpacked into 40-bits little endian
|
||||
SERDESCAM_VIDEO_FORMAT_BAYER_BGGR_16LE,// 16-bit samples little endian
|
||||
SERDESCAM_VIDEO_FORMAT_BAYER_BGGR_16BE,// 16-bit samples big endian
|
||||
SERDESCAM_VIDEO_FORMAT_JPEG,
|
||||
SERDESCAM_VIDEO_FORMAT_UYVY_422_12LE_PACKED,// packed YUV 4:2:2, 24bpp, Cb Y0 Cr Y1, bitpacked
|
||||
SERDESCAM_VIDEO_FORMAT_YUYV_422_12LE_PACKED,// packed YUV 4:2:2, 24bpp, Y0 Cb Y1 Cr, bitpacked
|
||||
SERDESCAM_VIDEO_FORMAT_YVYU_422_12LE_PACKED,// packed YUV 4:2:2, 24bpp, Y0 Cr Y1 Cb, bitpacked
|
||||
SERDESCAM_VIDEO_FORMAT_VYUY_422_12LE_PACKED,// packed YUV 4:2:2, 24bpp, Cr Y0 Cb Y1, bitpacked
|
||||
SERDESCAM_VIDEO_FORMAT_YUV422_10LE_PLANAR,// planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
|
||||
SERDESCAM_VIDEO_FORMAT_YUV422_16LE_PLANAR,// planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
|
||||
SERDESCAM_VIDEO_FORMAT_RGB565, // packed RGB 5:6:5, 16bpp, RGBRGB...
|
||||
SERDESCAM_VIDEO_FORMAT_RGB666, // packed RGB 6:6:6, 18bpp, RGBRGB...
|
||||
SERDESCAM_VIDEO_FORMAT_RAW_11x2,
|
||||
SERDESCAM_VIDEO_FORMAT_RAW_12x2,
|
||||
SERDESCAM_VIDEO_FORMAT_RAW_14,
|
||||
// NOTE: CSI2 formats are only used internal to VSPY
|
||||
// Firmware should flag video as CSI2 source types
|
||||
// Vspy will then convert formats into the proper CSI2 version
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_UYVY_422_8, // packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_YUYV_422_8, // packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_YVYU_422_8, // packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_VYUY_422_8, // packed YUV 4:2:2, 16bpp, Cr Y0 Cb Y1
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_UYVY_422_10LE_PACKED,// packed YUV 4:2:2, 20bpp, Cb Y0 Cr Y1, bitpacked
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_YUYV_422_10LE_PACKED,// packed YUV 4:2:2, 20bpp, Y0 Cb Y1 Cr, FOURCC Y210 bitpacked
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_YVYU_422_10LE_PACKED,// packed YUV 4:2:2, 20bpp, Y0 Cr Y1 Cb, bitpacked
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_VYUY_422_10LE_PACKED,// packed YUV 4:2:2, 20bpp, Cr Y0 Cb Y1, bitpacked
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_UYVY_422_12LE_PACKED,// packed YUV 4:2:2, 24bpp, Cb Y0 Cr Y1, bitpacked
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_YUYV_422_12LE_PACKED,// packed YUV 4:2:2, 24bpp, Y0 Cb Y1 Cr, bitpacked
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_YVYU_422_12LE_PACKED,// packed YUV 4:2:2, 24bpp, Y0 Cr Y1 Cb, bitpacked
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_VYUY_422_12LE_PACKED,// packed YUV 4:2:2, 24bpp, Cr Y0 Cb Y1, bitpacked
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_RGB565, // packed RGB 5:6:5, 16bpp, BGRBGR...
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_RGB666, // packed RGB 6:6:6, 18bpp, BGRBGR...
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_RGB888, // packed RGB 8:8:8, 24bpp, BGRBGR...
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_BAYER_BGGR_8,
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_BAYER_BGGR_10LE_PACKED,// 10-bit samples bitpacked into 40-bits little endian
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_BAYER_BGGR_12LE_PACKED,// 12-bit samples bitpacked into 40-bits little endian
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_RAW_8, // e.g. bayer 8 bit, gray 8 bit
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_RAW_10, // e.g. bayer 10 bit, gray 10 bit
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_RAW_11x2,
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_RAW_12,
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_RAW_12x2,
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_RAW_14,
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_RAW_16, // e.g. planar YUV 4:2:2, 16bpp, 8 bit samples
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_RAW_20, // e.g. planar YUV 4:2:2, 20bpp, 10 bit samples
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_RAW_24, // e.g. packed RGB 8:8:8 24bpp, 8 bit samples
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_RAW_30, // e.g. planar YUV 4:4:4, 30bpp, 10 bit samples
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_RAW_32, // e.g. packed ARGB 8:8:8:8, 32bpp, 8 bit samples
|
||||
SERDESCAM_VIDEO_FORMAT_CSI2_RAW_36,
|
||||
// NOTE: new entries must be appended to maintain backwards compatibility
|
||||
// insert new entries before this
|
||||
SERDESCAM_VIDEO_FORMAT_COUNT,
|
||||
};
|
||||
|
||||
typedef struct SERDESCAM_SETTINGS_t
|
||||
{
|
||||
/* bit0: enable
|
||||
* bit1: RTSP stream enable
|
||||
* bit2: auto detect resolution
|
||||
*/
|
||||
uint32_t flags;
|
||||
uint8_t mode;// passthrough, tap, etc
|
||||
uint8_t rsvd1;
|
||||
uint8_t bitPos;
|
||||
uint8_t videoFormat;// bytes per pixel
|
||||
uint16_t resWidth;
|
||||
uint16_t resHeight;
|
||||
uint8_t frameSkip;// skip every nth frame
|
||||
uint8_t rsvd2[19];
|
||||
} SERDESCAM_SETTINGS;
|
||||
#define SERDESCAM_SETTINGS_SIZE 32
|
||||
|
||||
#define SERDESPOC_SETTINGS_MODE_DISABLED 0x00
|
||||
#define SERDESPOC_SETTINGS_MODE_SUPPLY 0x01
|
||||
#define SERDESPOC_SETTINGS_MODE_SERIALIZER 0x02
|
||||
|
||||
typedef struct SERDESPOC_SETTINGS_t
|
||||
{
|
||||
uint8_t mode;// no poc, generated supply, serializer passthrough
|
||||
uint8_t rsvd[6];
|
||||
uint8_t voltage;// generated voltage
|
||||
uint16_t chksum;// checksum to protect settings structure (don't want corrupt voltage settings)
|
||||
} SERDESPOC_SETTINGS;
|
||||
#define SERDESPOC_SETTINGS_SIZE 10
|
||||
|
||||
typedef struct {
|
||||
uint32_t ecu_id;
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef __RADGIGALOG_USB_H_
|
||||
#define __RADGIGALOG_USB_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/tree/radgigalog/radgigalog.h"
|
||||
#include "icsneo/platform/ftdi3.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class RADGigalogUSB : public RADGigalog {
|
||||
public:
|
||||
static constexpr const uint16_t PRODUCT_ID = 0x1203;
|
||||
static std::vector<std::shared_ptr<Device>> Find() {
|
||||
std::vector<std::shared_ptr<Device>> found;
|
||||
|
||||
for(auto neodevice : FTDI3::FindByProduct(PRODUCT_ID))
|
||||
found.emplace_back(new RADGigalogUSB(neodevice)); // Creation of the shared_ptr
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
private:
|
||||
RADGigalogUSB(neodevice_t neodevice) : RADGigalog(neodevice) {
|
||||
initialize<FTDI3, RADGigalogSettings>();
|
||||
productId = PRODUCT_ID;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,87 @@
|
||||
#ifndef __RADGIGASTAR_H_
|
||||
#define __RADGIGASTAR_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include "icsneo/device/tree/radgigastar/radgigastarsettings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class RADGigastar : public Device {
|
||||
public:
|
||||
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::RADGigastar;
|
||||
static constexpr const char* SERIAL_START = "GS";
|
||||
|
||||
protected:
|
||||
RADGigastar(neodevice_t neodevice) : Device(neodevice) {
|
||||
getWritableNeoDevice().type = DEVICE_TYPE;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
static std::vector<Network> supportedRxNetworks = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::MSCAN,
|
||||
Network::NetID::HSCAN2,
|
||||
Network::NetID::HSCAN3,
|
||||
Network::NetID::HSCAN4,
|
||||
Network::NetID::HSCAN5,
|
||||
|
||||
Network::NetID::Ethernet,
|
||||
Network::NetID::Ethernet2,
|
||||
|
||||
Network::NetID::OP_Ethernet1,
|
||||
Network::NetID::OP_Ethernet2,
|
||||
|
||||
Network::NetID::LIN,
|
||||
|
||||
Network::NetID::FlexRay
|
||||
};
|
||||
rxNetworks.insert(rxNetworks.end(), supportedRxNetworks.begin(), supportedRxNetworks.end());
|
||||
}
|
||||
|
||||
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override {
|
||||
static std::vector<Network> supportedTxNetworks = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::MSCAN,
|
||||
Network::NetID::HSCAN2,
|
||||
Network::NetID::HSCAN3,
|
||||
Network::NetID::HSCAN4,
|
||||
Network::NetID::HSCAN5,
|
||||
|
||||
Network::NetID::Ethernet,
|
||||
Network::NetID::Ethernet2,
|
||||
|
||||
Network::NetID::OP_Ethernet1,
|
||||
Network::NetID::OP_Ethernet2,
|
||||
|
||||
Network::NetID::LIN
|
||||
|
||||
// FlexRay is Receive Only
|
||||
};
|
||||
txNetworks.insert(txNetworks.end(), supportedTxNetworks.begin(), supportedTxNetworks.end());
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
#ifndef __RADGIGASTAR_ETH_H_
|
||||
#define __RADGIGASTAR_ETH_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/tree/radgigastar/radgigastar.h"
|
||||
#include "icsneo/platform/pcap.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class RADGigastarETH : public RADGigastar {
|
||||
public:
|
||||
static constexpr const uint16_t PRODUCT_ID = 0x000F;
|
||||
static std::vector<std::shared_ptr<Device>> Find(const std::vector<PCAP::PCAPFoundDevice>& pcapDevices) {
|
||||
std::vector<std::shared_ptr<Device>> found;
|
||||
|
||||
for(auto& foundDev : pcapDevices) {
|
||||
auto fakedev = std::shared_ptr<RADGigastarETH>(new RADGigastarETH({}));
|
||||
for (auto& payload : foundDev.discoveryPackets)
|
||||
fakedev->com->packetizer->input(payload);
|
||||
for (auto& packet : fakedev->com->packetizer->output()) {
|
||||
std::shared_ptr<Message> msg;
|
||||
if (!fakedev->com->decoder->decode(msg, packet))
|
||||
continue; // We failed to decode this packet
|
||||
|
||||
if(!msg || msg->network.getNetID() != Network::NetID::Main51)
|
||||
continue; // Not a message we care about
|
||||
auto sn = std::dynamic_pointer_cast<SerialNumberMessage>(msg);
|
||||
if(!sn)
|
||||
continue; // Not a serial number message
|
||||
|
||||
if(sn->deviceSerial.length() < 2)
|
||||
continue;
|
||||
if(sn->deviceSerial.substr(0, 2) != SERIAL_START)
|
||||
continue; // Not a RADGigastar
|
||||
|
||||
auto device = foundDev.device;
|
||||
device.serial[sn->deviceSerial.copy(device.serial, sizeof(device.serial))] = '\0';
|
||||
found.push_back(std::shared_ptr<RADGigastarETH>(new RADGigastarETH(std::move(device))));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
private:
|
||||
RADGigastarETH(neodevice_t neodevice) : RADGigastar(neodevice) {
|
||||
initialize<PCAP, RADGigastarSettings>();
|
||||
productId = PRODUCT_ID;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,142 @@
|
||||
#ifndef __RADGIGASTARSETTINGS_H_
|
||||
#define __RADGIGASTARSETTINGS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "icsneo/device/idevicesettings.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
#endif
|
||||
|
||||
#pragma pack(push, 2)
|
||||
typedef struct {
|
||||
uint32_t ecu_id;
|
||||
|
||||
uint16_t perf_en;
|
||||
|
||||
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;
|
||||
|
||||
uint16_t network_enables;
|
||||
uint16_t network_enables_2;
|
||||
|
||||
uint32_t pwr_man_timeout;
|
||||
uint16_t pwr_man_enable;
|
||||
|
||||
uint16_t network_enabled_on_boot;
|
||||
|
||||
uint16_t iso15765_separation_time_offset;
|
||||
|
||||
uint16_t iso_9141_kwp_enable_reserved;
|
||||
ISO9141_KEYWORD2000_SETTINGS iso9141_kwp_settings_1;
|
||||
uint16_t iso_parity_1;
|
||||
|
||||
uint16_t iso_msg_termination_1;
|
||||
|
||||
uint16_t idle_wakeup_network_enables_1;
|
||||
uint16_t idle_wakeup_network_enables_2;
|
||||
|
||||
uint16_t network_enables_3;
|
||||
uint16_t idle_wakeup_network_enables_3;
|
||||
|
||||
STextAPISettings text_api;
|
||||
uint64_t termination_enables;
|
||||
|
||||
DISK_SETTINGS disk;
|
||||
|
||||
TIMESYNC_ICSHARDWARE_SETTINGS timeSyncSettings;
|
||||
struct
|
||||
{
|
||||
uint16_t hwComLatencyTestEn : 1;
|
||||
uint16_t reserved : 15;
|
||||
} flags;
|
||||
ETHERNET_SETTINGS2 ethernet1;
|
||||
ETHERNET_SETTINGS2 ethernet2;
|
||||
|
||||
LIN_SETTINGS lin1;
|
||||
|
||||
OP_ETH_GENERAL_SETTINGS opEthGen;
|
||||
OP_ETH_SETTINGS opEth1;
|
||||
OP_ETH_SETTINGS opEth2;
|
||||
|
||||
SERDESCAM_SETTINGS serdescam1;
|
||||
SERDESPOC_SETTINGS serdespoc;
|
||||
LOGGER_SETTINGS logger;
|
||||
SERDESCAM_SETTINGS serdescam2;
|
||||
SERDESCAM_SETTINGS serdescam3;
|
||||
SERDESCAM_SETTINGS serdescam4;
|
||||
RAD_REPORTING_SETTINGS reporting;
|
||||
uint16_t network_enables_4;
|
||||
} radgigastar_settings_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
static_assert(sizeof(radgigastar_settings_t) == 634, "RADGigastar settings size mismatch");
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class RADGigastarSettings : public IDeviceSettings {
|
||||
public:
|
||||
RADGigastarSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radgigastar_settings_t)) {}
|
||||
const CAN_SETTINGS* getCANSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<radgigastar_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
switch(net.getNetID()) {
|
||||
case Network::NetID::HSCAN:
|
||||
return &(cfg->can1);
|
||||
case Network::NetID::MSCAN:
|
||||
return &(cfg->can2);
|
||||
case Network::NetID::HSCAN2:
|
||||
return &(cfg->can3);
|
||||
case Network::NetID::HSCAN3:
|
||||
return &(cfg->can4);
|
||||
case Network::NetID::HSCAN4:
|
||||
return &(cfg->can5);
|
||||
case Network::NetID::HSCAN5:
|
||||
return &(cfg->can6);
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
const CANFD_SETTINGS* getCANFDSettingsFor(Network net) const override {
|
||||
auto cfg = getStructurePointer<radgigastar_settings_t>();
|
||||
if(cfg == nullptr)
|
||||
return nullptr;
|
||||
switch(net.getNetID()) {
|
||||
case Network::NetID::HSCAN:
|
||||
return &(cfg->canfd1);
|
||||
case Network::NetID::MSCAN:
|
||||
return &(cfg->canfd2);
|
||||
case Network::NetID::HSCAN2:
|
||||
return &(cfg->canfd3);
|
||||
case Network::NetID::HSCAN3:
|
||||
return &(cfg->canfd4);
|
||||
case Network::NetID::HSCAN4:
|
||||
return &(cfg->canfd5);
|
||||
case Network::NetID::HSCAN5:
|
||||
return &(cfg->canfd6);
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef __RADGIGASTAR_USB_H_
|
||||
#define __RADGIGASTAR_USB_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/tree/radgigastar/radgigastar.h"
|
||||
#include "icsneo/platform/ftdi3.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class RADGigastarUSB : public RADGigastar {
|
||||
public:
|
||||
static constexpr const uint16_t PRODUCT_ID = 0x1204;
|
||||
static std::vector<std::shared_ptr<Device>> Find() {
|
||||
std::vector<std::shared_ptr<Device>> found;
|
||||
|
||||
for(auto neodevice : FTDI3::FindByProduct(PRODUCT_ID))
|
||||
found.emplace_back(new RADGigastarUSB(neodevice)); // Creation of the shared_ptr
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
private:
|
||||
RADGigastarUSB(neodevice_t neodevice) : RADGigastar(neodevice) {
|
||||
initialize<FTDI3, RADGigastarSettings>();
|
||||
productId = PRODUCT_ID;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,63 @@
|
||||
#ifndef __RADMOON2_H_
|
||||
#define __RADMOON2_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include "icsneo/device/tree/radmoon2/radmoon2settings.h"
|
||||
#include "icsneo/platform/ftdi3.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class RADMoon2 : public Device {
|
||||
public:
|
||||
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::RADMoon2;
|
||||
static constexpr const uint16_t PRODUCT_ID = 0x1202;
|
||||
static constexpr const char* SERIAL_START = "RM";
|
||||
|
||||
static std::vector<std::shared_ptr<Device>> Find() {
|
||||
std::vector<std::shared_ptr<Device>> found;
|
||||
|
||||
for(auto neodevice : FTDI3::FindByProduct(PRODUCT_ID))
|
||||
found.emplace_back(new RADMoon2(neodevice));
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
// RADMoon 2 does not go online, you can only set settings and
|
||||
// view PHY information (when supported)
|
||||
bool goOnline() override {
|
||||
report(APIEvent::Type::OnlineNotSupported, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool goOffline() override {
|
||||
report(APIEvent::Type::OnlineNotSupported, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
RADMoon2(neodevice_t neodevice) : Device(neodevice) {
|
||||
initialize<FTDI3, RADMoon2Settings>();
|
||||
productId = PRODUCT_ID;
|
||||
getWritableNeoDevice().type = DEVICE_TYPE;
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef __RADMOON2SETTINGS_H_
|
||||
#define __RADMOON2SETTINGS_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;
|
||||
|
||||
OP_ETH_GENERAL_SETTINGS opEthGen;
|
||||
OP_ETH_SETTINGS opEth1;
|
||||
|
||||
uint16_t network_enables;
|
||||
uint16_t network_enables_2;
|
||||
uint16_t network_enabled_on_boot;
|
||||
uint16_t network_enables_3;
|
||||
|
||||
STextAPISettings text_api;
|
||||
|
||||
uint16_t pc_com_mode;
|
||||
TIMESYNC_ICSHARDWARE_SETTINGS timeSyncSettings;
|
||||
uint16_t hwComLatencyTestEn;
|
||||
} radmoon2_settings_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class RADMoon2Settings : public IDeviceSettings {
|
||||
public:
|
||||
RADMoon2Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radmoon2_settings_t)) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,56 @@
|
||||
#ifndef __RADMOONDUO_H_
|
||||
#define __RADMOONDUO_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include "icsneo/device/tree/radmoonduo/radmoonduosettings.h"
|
||||
#include "icsneo/platform/stm32.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class RADMoonDuo : public Device {
|
||||
public:
|
||||
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::RADMoonDuo;
|
||||
static constexpr const uint16_t PRODUCT_ID = 0x1106;
|
||||
static constexpr const char* SERIAL_START = "MD";
|
||||
|
||||
static std::vector<std::shared_ptr<Device>> Find() {
|
||||
std::vector<std::shared_ptr<Device>> found;
|
||||
|
||||
for(auto neodevice : STM32::FindByProduct(PRODUCT_ID))
|
||||
found.emplace_back(new RADMoonDuo(neodevice));
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
// If Converter1 Target is set to USB/CM, OP_Ethernet2 will be exposed to the PC
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::OP_Ethernet2
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
protected:
|
||||
RADMoonDuo(neodevice_t neodevice) : Device(neodevice) {
|
||||
initialize<STM32, RADMoonDuoSettings>();
|
||||
productId = PRODUCT_ID;
|
||||
getWritableNeoDevice().type = DEVICE_TYPE;
|
||||
}
|
||||
|
||||
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); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,64 @@
|
||||
#ifndef __RADMOONDUOSETTINGS_H_
|
||||
#define __RADMOONDUOSETTINGS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "icsneo/device/idevicesettings.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#pragma pack(push, 2)
|
||||
enum RadMoonDuoConverterMode {
|
||||
CONVERTER_TARGET_RJ45 = 0,
|
||||
CONVERTER_TARGET_USB_CM
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
// OPETH_LINK_AUTO/MASTER/SLAVE
|
||||
uint8_t linkMode0;
|
||||
uint8_t linkMode1;
|
||||
// USB/CM or RJ45 selection (RadMoonDuoConverterMode)
|
||||
uint8_t converter1Mode;
|
||||
// IP Settings if converter is hooked up to Coremini
|
||||
// Currently unused
|
||||
uint32_t ipAddress;
|
||||
uint32_t ipMask;
|
||||
uint32_t ipGateway;
|
||||
} RadMoonDuoConverterSettings;
|
||||
|
||||
typedef struct {
|
||||
uint16_t perf_en;
|
||||
uint16_t network_enabled_on_boot;
|
||||
uint32_t pwr_man_timeout;
|
||||
uint16_t pwr_man_enable;
|
||||
RadMoonDuoConverterSettings converter;
|
||||
uint64_t network_enables;
|
||||
struct
|
||||
{
|
||||
uint32_t disableUsbCheckOnBoot : 1;
|
||||
uint32_t enableLatencyTest : 1;
|
||||
uint32_t reserved : 30;
|
||||
} flags;
|
||||
} radmoonduo_settings_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
static_assert(sizeof(RadMoonDuoConverterSettings) == 16, "RAD-Moon Duo converter settings size error");
|
||||
static_assert(sizeof(radmoonduo_settings_t) == 38, "RAD-Moon Duo settings size error");
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class RADMoonDuoSettings : public IDeviceSettings {
|
||||
public:
|
||||
RADMoonDuoSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radmoonduo_settings_t)) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -5,35 +5,60 @@
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include "icsneo/platform/ftdi.h"
|
||||
#include "icsneo/device/tree/radsupermoon/radsupermoonsettings.h"
|
||||
#include "icsneo/platform/ftdi3.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class RADSupermoon : public Device {
|
||||
public:
|
||||
// RSM does not connect at all yet (needs FTDI D3xx driver, not the 2xx compatible one)
|
||||
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::RADSupermoon;
|
||||
static constexpr const uint16_t PRODUCT_ID = 0x1201;
|
||||
static constexpr const char* SERIAL_START = "SM";
|
||||
|
||||
static std::vector<std::shared_ptr<Device>> Find() {
|
||||
std::vector<std::shared_ptr<Device>> found;
|
||||
|
||||
for(auto neodevice : FTDI::FindByProduct(PRODUCT_ID))
|
||||
for(auto neodevice : FTDI3::FindByProduct(PRODUCT_ID))
|
||||
found.emplace_back(new RADSupermoon(neodevice));
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::Ethernet,
|
||||
Network::NetID::OP_Ethernet1,
|
||||
Network::NetID::OP_Ethernet2
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void setupDecoder(Decoder& decoder) override {
|
||||
RADSupermoon(neodevice_t neodevice) : Device(neodevice) {
|
||||
initialize<FTDI3, RADSupermoonSettings>();
|
||||
productId = PRODUCT_ID;
|
||||
getWritableNeoDevice().type = DEVICE_TYPE;
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
private:
|
||||
RADSupermoon(neodevice_t neodevice) : Device(neodevice) {
|
||||
initialize<FTDI>();
|
||||
getWritableNeoDevice().type = DEVICE_TYPE;
|
||||
productId = PRODUCT_ID;
|
||||
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); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
#ifndef __RADSUPERMOONSETTINGS_H_
|
||||
#define __RADSUPERMOONSETTINGS_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;
|
||||
|
||||
OP_ETH_GENERAL_SETTINGS opEthGen;
|
||||
OP_ETH_SETTINGS opEth1;
|
||||
|
||||
uint16_t network_enables;
|
||||
uint16_t network_enables_2;
|
||||
uint16_t network_enabled_on_boot;
|
||||
uint16_t network_enables_3;
|
||||
|
||||
STextAPISettings text_api;
|
||||
|
||||
uint16_t pc_com_mode;
|
||||
TIMESYNC_ICSHARDWARE_SETTINGS timeSyncSettings;
|
||||
uint16_t hwComLatencyTestEn;
|
||||
|
||||
ETHERNET_SETTINGS2 eth2;
|
||||
} radsupermoon_settings_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class RADSupermoonSettings : public IDeviceSettings {
|
||||
public:
|
||||
RADSupermoonSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radsupermoon_settings_t)) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user