// --------------------------------------------
#pragma pack(push, 1)
// --------------------------------------------
struct SysInfoV1{
struct Sig {
uint16_t size = {};
uint8_t maj : 6 = {}; // the size has changed (members added or removed)
uint8_t min : 2 = {}; // only some bitfields were added that used to be reserved
uint8_t res : 8 = {};
};
struct Supp {
bool usb3 : 1 = {}; // CyFx3DevIsUsb3Supported();
bool otg : 1 = {}; // CyFx3DevIsOtgSupported();
bool ram512 : 1 = {}; // CyFx3DevIsRam512Supported();
bool i2s : 1 = {}; // CyFx3DevIsI2sSupported();
bool gpif : 1 = {}; // CyFx3DevIsGpifSupported();
bool gpif32 : 1 = {}; // CyFx3DevIsGpif32Supported();
uint8_t res : 2 = {};
};
struct Config{
bool i2c : 1 = {}; // CyFx3DevIOIsI2cConfigured();
bool i2s : 1 = {}; // CyFx3DevIOIsI2sConfigured();
bool uart : 1 = {}; // CyFx3DevIOIsUartConfigured();
bool spi : 1 = {}; // CyFx3DevIOIsSpiConfigured();
bool pib : 1 = {}; // CyFx3PibIsOn();
bool dll : 1 = {}; // CyFx3PibGetDllStatus();
bool lpp : 1 = {}; // CyFx3LppIsOn();
uint8_t res : 1 = {};
};
struct Usb{
enum class UsbSpeed: uint8_t{disconnected, fs, hs, ss};
UsbSpeed speed : 3 = UsbSpeed::disconnected; // CyU3PUsbGetSpeed()
bool auxPower : 1 = {}; // bit 6 on I2C expander at 0x21
uint8_t res : 4 = {};
};
struct UsbErr{
uint16_t phy = {}, lnk = {};
};
Sig sig;
uint32_t uptime = {}; // CyU3PGetTime()
enum class CyPart: uint8_t {usb3014 = 0, unknown = 0xff} partno = CyPart::unknown; // CyFx3DevIdentifyPart() from cyfx3_api.h
Supp supported;
Config config;
Usb usb;
struct{
uint32_t allocCnt = {}, freeCnt = {};
} mem, dma; // CyU3PMemGetCounts(), CyU3PBufGetCounts()
UsbErr err_cur, err_tot; // CyU3PUsbGetErrorCounts
uint8_t memCheck = {}, dmaCheck = {}; // CyU3PMemCorruptionCheck(), CyU3PBufCorruptionCheck()
struct{
bool sfp_active : 1 = {}; // there's an active module plugged into SFP+ cage
bool res : 7 = {};
} peripherals;
};
static_assert(sizeof(SysInfoV1) == 39);
// --------------------------------------------
#pragma pack(pop)
// --------------------------------------------