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:
Paul Hollinsky
2020-09-14 11:57:01 -04:00
parent 9dc4b302ef
commit c48efe8e5b
19 changed files with 922 additions and 147 deletions
@@ -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