mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
RAD-Moon3: Add initial support
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
#ifndef __RADMOON3_H_
|
||||
#define __RADMOON3_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include "icsneo/device/tree/radmoon3/radmoon3settings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class RADMoon3 : public Device {
|
||||
public:
|
||||
// Serial numbers start with R3
|
||||
// USB PID is 0x110D, standard driver is CDCACM
|
||||
ICSNEO_FINDABLE_DEVICE(RADMoon3, DeviceType::RADMoon3, "R3");
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::Ethernet,
|
||||
Network::NetID::OP_Ethernet1,
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
bool getEthPhyRegControlSupported() const override { return true; }
|
||||
|
||||
protected:
|
||||
RADMoon3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADMoon3Settings>(makeDriver);
|
||||
}
|
||||
|
||||
void setupPacketizer(Packetizer& packetizer) override {
|
||||
Device::setupPacketizer(packetizer);
|
||||
packetizer.align16bit = true;
|
||||
}
|
||||
|
||||
virtual void setupEncoder(Encoder& encoder) override {
|
||||
Device::setupEncoder(encoder);
|
||||
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); }
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef __RADMOON3SETTINGS_H_
|
||||
#define __RADMOON3SETTINGS_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; // 2
|
||||
|
||||
ETHERNET10G_SETTINGS autoEth10g; // 24
|
||||
ETHERNET10G_SETTINGS eth10g; // 24
|
||||
|
||||
uint16_t network_enables; // 2
|
||||
uint16_t network_enables_2; // 2
|
||||
uint16_t network_enabled_on_boot; // 2
|
||||
uint16_t network_enables_3; // 2
|
||||
|
||||
struct
|
||||
{
|
||||
uint16_t enableLatencyTest : 1;
|
||||
uint16_t reserved : 15;
|
||||
} flags; // 2
|
||||
} radmoon3_settings_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class RADMoon3Settings : public IDeviceSettings {
|
||||
public:
|
||||
RADMoon3Settings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radmoon3_settings_t)) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user