Skip to content

Commit bd6799f

Browse files
nsysccr/cdc: Add CCRCDCPerSetUicConfig and CCRCDCCalcCRC16 (#351)
* nsysccr/cdc: Add CCRCDCPerSetUicConfig * nsysccr/cdc: Add CCRCDCCalcCRC16
1 parent 4edae90 commit bd6799f

1 file changed

Lines changed: 109 additions & 0 deletions

File tree

include/nsysccr/cdc.h

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ typedef struct CCRCDCWpsArgs CCRCDCWpsArgs;
1818
typedef struct CCRCDCSysMessage CCRCDCSysMessage;
1919
typedef struct CCRCDCEepromData CCRCDCEepromData;
2020
typedef struct CCRCDCWowlWakeDrcArg CCRCDCWowlWakeDrcArg;
21+
typedef struct CCRCDCUicConfig CCRCDCUicConfig;
2122
typedef uint8_t CCRCDCDestination;
2223
typedef uint32_t CCRCDCWpsStatusType;
2324
typedef uint8_t CCRCDCDrcState;
2425
typedef uint8_t CCRCDCWakeState;
26+
typedef uint8_t CCRCDCUicConfigId;
2527

2628
typedef enum CCRCDCDestinationEnum
2729
{
@@ -57,6 +59,54 @@ typedef enum CCRCDCWakeStateEnum
5759
CCR_CDC_WAKE_STATE_BACKGROUND = 2,
5860
} CCRCDCWakeStateEnum;
5961

62+
typedef enum CCRCDCUicConfigIdEnum
63+
{
64+
//! EEPROM offset 0x200, Size 0x3
65+
CCR_CDC_UIC_CONFIG_ID_UNK0 = 0,
66+
//! EEPROM offset 0x20D, Size 0x6
67+
CCR_CDC_UIC_CONFIG_ID_UNK2 = 2,
68+
//! EEPROM offset 0x213, Size 0xE
69+
CCR_CDC_UIC_CONFIG_ID_UNK3 = 3,
70+
//! EEPROM offset 0x244, Size 0x12
71+
CCR_CDC_UIC_CONFIG_ID_UNK5 = 5,
72+
//! EEPROM offset 0x203, Size 0x3
73+
CCR_CDC_UIC_CONFIG_ID_UNK7 = 7,
74+
//! EEPROM offset 0x206, Size 0x3
75+
CCR_CDC_UIC_CONFIG_ID_UNK8 = 8,
76+
//! EEPROM offset 0x256, Size 0x6
77+
CCR_CDC_UIC_CONFIG_ID_UNK9 = 9,
78+
//! EEPROM offset 0x289, Size 0xC
79+
CCR_CDC_UIC_CONFIG_ID_UNK10 = 10,
80+
//! EEPROM offset 0x262, Size 0x6
81+
CCR_CDC_UIC_CONFIG_ID_UNK11 = 11,
82+
//! EEPROM offset 0x268, Size 0x6
83+
CCR_CDC_UIC_CONFIG_ID_UNK12 = 12,
84+
//! EEPROM offset 0x26E, Size 0x6
85+
CCR_CDC_UIC_CONFIG_ID_UNK13 = 13,
86+
//! EEPROM offset 0x274, Size 0x3
87+
CCR_CDC_UIC_CONFIG_ID_UNK14 = 14,
88+
//! EEPROM offset 0x277, Size 0xF
89+
CCR_CDC_UIC_CONFIG_ID_UNK15 = 15,
90+
//! EEPROM offset 0x286, Size 0x3
91+
CCR_CDC_UIC_CONFIG_ID_UNK16 = 16,
92+
//! EEPROM offset 0x25C, Size 0x6
93+
CCR_CDC_UIC_CONFIG_ID_UNK17 = 17,
94+
//! EEPROM offset 0x295, Size 0x3
95+
CCR_CDC_UIC_CONFIG_ID_UNK18 = 18,
96+
//! EEPROM offset 0x298, Size 0x3
97+
CCR_CDC_UIC_CONFIG_ID_UNK19 = 19,
98+
//! EEPROM offset 0x29B, Size 0x3
99+
CCR_CDC_UIC_CONFIG_ID_UNK20 = 20,
100+
//! EEPROM offset 0x29E, Size 0x3
101+
CCR_CDC_UIC_CONFIG_ID_UNK21 = 21,
102+
//! EEPROM offset 0x2A1, Size 0x3
103+
CCR_CDC_UIC_CONFIG_ID_UNK22 = 22,
104+
//! EEPROM offset 0x2A4, Size 0x3
105+
CCR_CDC_UIC_CONFIG_ID_UNK23 = 23,
106+
//! EEPROM offset 0x2A7, Size 0x4
107+
CCR_CDC_UIC_CONFIG_ID_UNK24 = 24,
108+
} CCRCDCUicConfigIdEnum;
109+
60110
struct WUT_PACKED CCRCDCMacAddress
61111
{
62112
//! The device this mac address belongs to
@@ -111,6 +161,20 @@ struct WUT_PACKED CCRCDCWowlWakeDrcArg
111161
WUT_CHECK_OFFSET(CCRCDCWowlWakeDrcArg, 0x6, state);
112162
WUT_CHECK_SIZE(CCRCDCWowlWakeDrcArg, 0x7);
113163

164+
struct CCRCDCUicConfig
165+
{
166+
//! Configuration ID (see \link CCRCDCUicConfigIdEnum \endlink)
167+
CCRCDCUicConfigId configId;
168+
//! Size of the configuration data (must match the size described in \link CCRCDCUicConfigIdEnum \endlink)
169+
uint8_t size;
170+
//! Configuration data
171+
uint8_t data[0x100];
172+
};
173+
WUT_CHECK_SIZE(CCRCDCUicConfig, 0x102);
174+
WUT_CHECK_OFFSET(CCRCDCUicConfig, 0x00, configId);
175+
WUT_CHECK_OFFSET(CCRCDCUicConfig, 0x01, size);
176+
WUT_CHECK_OFFSET(CCRCDCUicConfig, 0x02, data);
177+
114178
/**
115179
* Send a command directly to the specified destination.
116180
*
@@ -345,6 +409,51 @@ CCRCDCSysConsoleShutdownInd(CCRCDCDestination dest);
345409
int32_t
346410
CCRCDCWowlWakeDrc(CCRCDCWowlWakeDrcArg *arg);
347411

412+
/**
413+
* This doesn't seem to be implemented on the latest DRC/DRH firmware,
414+
* and always returns an error.
415+
*
416+
* \param dest
417+
* The destination to send the command to.
418+
*
419+
* \return
420+
* 0 on success.
421+
*/
422+
int32_t
423+
CCRCDCPerClearUicConfig(CCRCDCDestination dest);
424+
425+
/**
426+
* Set a configuration value in the DRC UIC EEPROM.
427+
*
428+
* \param dest
429+
* The destination to send the command to.
430+
*
431+
* \param config
432+
* Pointer to configuration data.
433+
*
434+
* \return
435+
* 0 on success.
436+
*/
437+
int32_t
438+
CCRCDCPerSetUicConfig(CCRCDCDestination dest,
439+
CCRCDCUicConfig *config);
440+
441+
/**
442+
* Calculate a CRC16 used for DRC UIC EEPROM values.
443+
*
444+
* \param data
445+
* Pointer to the data to calculate the CRC from.
446+
*
447+
* \param config
448+
* Size of the data.
449+
*
450+
* \return
451+
* The CRC value or \c 0xffff on error.
452+
*/
453+
uint16_t
454+
CCRCDCCalcCRC16(void *data,
455+
uint32_t dataSize);
456+
348457
#ifdef __cplusplus
349458
}
350459
#endif

0 commit comments

Comments
 (0)