Device: Add RADMoonT1S

ks-refactor-docs
Yaroslav Stetsyk 2024-10-18 18:23:58 +00:00 committed by Kyle Schwarz
parent 80904dd84c
commit f552df372b
7 changed files with 140 additions and 0 deletions

View File

@ -58,3 +58,5 @@
- RADComet3 - RADComet3
- CAN works - CAN works
- Ethernet works - Ethernet works
- RADMoonT1S
- Ethernet works

View File

@ -185,6 +185,10 @@ std::vector<std::shared_ptr<Device>> DeviceFinder::FindAll() {
makeIfSerialMatches<RADComet3>(dev, newFoundDevices); makeIfSerialMatches<RADComet3>(dev, newFoundDevices);
#endif #endif
#ifdef __RADMOONT1S_H_
makeIfSerialMatches<RADMoonT1S>(dev, newFoundDevices);
#endif
#ifdef __RADEPSILON_H_ #ifdef __RADEPSILON_H_
makeIfSerialMatches<RADEpsilon>(dev, newFoundDevices); makeIfSerialMatches<RADEpsilon>(dev, newFoundDevices);
#endif #endif
@ -332,6 +336,10 @@ const std::vector<DeviceType>& DeviceFinder::GetSupportedDevices() {
RADComet3::DEVICE_TYPE, RADComet3::DEVICE_TYPE,
#endif #endif
#ifdef __RADMOONT1S_H_
RADMoonT1S::DEVICE_TYPE,
#endif
#ifdef __RADEPSILON_H_ #ifdef __RADEPSILON_H_
RADEpsilon::DEVICE_TYPE, RADEpsilon::DEVICE_TYPE,
#endif #endif

View File

@ -52,6 +52,7 @@ public:
FIRE3_FlexRay = (0x00000025), FIRE3_FlexRay = (0x00000025),
Connect = (0x00000026), Connect = (0x00000026),
RADComet3 = (0x00000027), RADComet3 = (0x00000027),
RADMoonT1S = (0x00000028),
RED = (0x00000040), RED = (0x00000040),
ECU = (0x00000080), ECU = (0x00000080),
IEVB = (0x00000100), IEVB = (0x00000100),
@ -190,6 +191,8 @@ public:
return "neoVI FIRE3 FlexRay"; return "neoVI FIRE3 FlexRay";
case RADComet3: case RADComet3:
return "RAD-Comet 3"; return "RAD-Comet 3";
case RADMoonT1S:
return "RAD-Moon T1S";
case Connect: case Connect:
return "neoVI Connect"; return "neoVI Connect";
case DONT_REUSE0: case DONT_REUSE0:
@ -247,6 +250,7 @@ private:
#define ICSNEO_DEVICETYPE_FIRE3FLEXRAY ((devicetype_t)0x00000025) #define ICSNEO_DEVICETYPE_FIRE3FLEXRAY ((devicetype_t)0x00000025)
#define ICSNEO_DEVICETYPE_CONNECT ((devicetype_t)0x00000026) #define ICSNEO_DEVICETYPE_CONNECT ((devicetype_t)0x00000026)
#define ICSNEO_DEVICETYPE_RADCOMET3 ((devicetype_t)0x00000027) #define ICSNEO_DEVICETYPE_RADCOMET3 ((devicetype_t)0x00000027)
#define ICSNEO_DEVICETYPE_RADMOONT1S ((devicetype_t)0x00000028)
#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)

View File

@ -0,0 +1,73 @@
#ifndef __RADMOONT1S_H_
#define __RADMOONT1S_H_
#ifdef __cplusplus
#include "icsneo/device/device.h"
#include "icsneo/device/tree/radmoont1s/radmoont1ssettings.h"
namespace icsneo {
class RADMoonT1S : public Device {
public:
// Serial numbers start with MS
// USB PID is 0x1209, standard driver is FTDI3
// Ethernet MAC allocation is 0x21, standard driver is Raw
ICSNEO_FINDABLE_DEVICE(RADMoonT1S, DeviceType::RADMoonT1S, "MS");
static const std::vector<Network>& GetSupportedNetworks() {
static std::vector<Network> supportedNetworks = {
Network::NetID::Ethernet,
Network::NetID::OP_Ethernet1,
Network::NetID::MDIO1,
Network::NetID::SPI1,
};
return supportedNetworks;
}
bool getEthPhyRegControlSupported() const override { return true; }
bool supportsTC10() const override { return true; }
protected:
RADMoonT1S(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
initialize<RADMoonT1SSettings>(makeDriver);
}
void setupPacketizer(Packetizer& packetizer) override {
Device::setupPacketizer(packetizer);
packetizer.disableChecksum = true;
packetizer.align16bit = false;
}
void setupEncoder(Encoder& encoder) override {
Device::setupEncoder(encoder);
encoder.supportEthPhy = true;
}
void setupDecoder(Decoder& decoder) override {
Device::setupDecoder(decoder);
decoder.timestampResolution = 10; // Timestamps are in 10ns increments instead of the usual 25ns
}
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 // __RADMOONT1S_H_

View File

@ -0,0 +1,51 @@
#ifndef __RADMOONT1SSETTINGS_H_
#define __RADMOONT1SSETTINGS_H_
#include <stdint.h>
#include "icsneo/device/idevicesettings.h"
#ifdef __cplusplus
namespace icsneo {
#endif
#pragma pack(push, 2)
typedef struct {
uint16_t perf_en;
struct
{
uint16_t hwComLatencyTestEn : 1;
uint16_t disableUsbCheckOnBoot : 1;
uint16_t reserved : 14;
} flags;
uint16_t network_enabled_on_boot;
uint64_t network_enables;
uint64_t network_enables_2;
RAD_REPORTING_SETTINGS reporting;
uint32_t pwr_man_timeout;
uint16_t pwr_man_enable;
// Ethernet 10/100/1000
ETHERNET_SETTINGS2 ethernet;
// Ethernet General
OP_ETH_GENERAL_SETTINGS opEthGen;
// 10T1S
ETHERNET_SETTINGS2 ethT1s;
ETHERNET10T1S_SETTINGS t1s;
} radmoont1s_settings_t;
#pragma pack(pop)
#ifdef __cplusplus
#include <iostream>
class RADMoonT1SSettings : public IDeviceSettings {
public:
RADMoonT1SSettings(std::shared_ptr<Communication> com) : IDeviceSettings(com, sizeof(radmoont1s_settings_t)) {}
};
}
#endif // __cplusplus
#endif // __RADMOONT1SSETTINGS_H_

View File

@ -16,6 +16,7 @@
#include "icsneo/device/tree/radcomet/radcomet.h" #include "icsneo/device/tree/radcomet/radcomet.h"
#include "icsneo/device/tree/radcomet/radcomet2.h" #include "icsneo/device/tree/radcomet/radcomet2.h"
#include "icsneo/device/tree/radcomet3/radcomet3.h" #include "icsneo/device/tree/radcomet3/radcomet3.h"
#include "icsneo/device/tree/radmoont1s/radmoont1s.h"
#include "icsneo/device/tree/radepsilon/radepsilon.h" #include "icsneo/device/tree/radepsilon/radepsilon.h"
#include "icsneo/device/tree/radgalaxy/radgalaxy.h" #include "icsneo/device/tree/radgalaxy/radgalaxy.h"
#include "icsneo/device/tree/radgigastar/radgigastar.h" #include "icsneo/device/tree/radgigastar/radgigastar.h"

View File

@ -16,6 +16,7 @@
#include "icsneo/device/tree/radcomet/radcomet.h" #include "icsneo/device/tree/radcomet/radcomet.h"
#include "icsneo/device/tree/radcomet/radcomet2.h" #include "icsneo/device/tree/radcomet/radcomet2.h"
#include "icsneo/device/tree/radcomet3/radcomet3.h" #include "icsneo/device/tree/radcomet3/radcomet3.h"
#include "icsneo/device/tree/radmoont1s/radmoont1s.h"
#include "icsneo/device/tree/radepsilon/radepsilon.h" #include "icsneo/device/tree/radepsilon/radepsilon.h"
#include "icsneo/device/tree/radgalaxy/radgalaxy.h" #include "icsneo/device/tree/radgalaxy/radgalaxy.h"
#include "icsneo/device/tree/radgigastar/radgigastar.h" #include "icsneo/device/tree/radgigastar/radgigastar.h"