Skip to content

Commit 682f8eb

Browse files
nsysccr/cdc: Add software functions
1 parent bd6799f commit 682f8eb

2 files changed

Lines changed: 164 additions & 1 deletion

File tree

include/nsysccr/cdc.h

Lines changed: 140 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ typedef struct CCRCDCSysMessage CCRCDCSysMessage;
1919
typedef struct CCRCDCEepromData CCRCDCEepromData;
2020
typedef struct CCRCDCWowlWakeDrcArg CCRCDCWowlWakeDrcArg;
2121
typedef struct CCRCDCUicConfig CCRCDCUicConfig;
22+
typedef struct CCRCDCFWInfo CCRCDCFWInfo;
23+
typedef struct CCRCDCSoftwareVersion CCRCDCSoftwareVersion;
2224
typedef uint8_t CCRCDCDestination;
2325
typedef uint32_t CCRCDCWpsStatusType;
2426
typedef uint8_t CCRCDCDrcState;
@@ -43,7 +45,7 @@ typedef enum CCRCDCDrcStateEnum
4345
{
4446
CCR_CDC_DRC_STATE_ACTIVE = 0,
4547
CCR_CDC_DRC_STATE_UNK1 = 1,
46-
CCR_CDC_DRC_STATE_UNK2 = 2,
48+
CCR_CDC_DRC_STATE_UPDATE = 2,
4749
CCR_CDC_DRC_STATE_UNK3 = 3,
4850
CCR_CDC_DRC_STATE_BACKGROUND = 4,
4951
CCR_CDC_DRC_STATE_DISCONNECT = 5,
@@ -107,6 +109,17 @@ typedef enum CCRCDCUicConfigIdEnum
107109
CCR_CDC_UIC_CONFIG_ID_UNK24 = 24,
108110
} CCRCDCUicConfigIdEnum;
109111

112+
typedef enum CCRCDCExt
113+
{
114+
//! Language data
115+
CCR_CDC_EXT_LANGUAGE = 0,
116+
//! Remote Control Database
117+
CCR_CDC_EXT_RC_DATABASE = 1,
118+
CCR_CDC_EXT_UNK2 = 2,
119+
CCR_CDC_EXT_UNK3 = 3,
120+
CCR_CDC_EXT_UNK4 = 4,
121+
} CCRCDCExt;
122+
110123
struct WUT_PACKED CCRCDCMacAddress
111124
{
112125
//! The device this mac address belongs to
@@ -175,6 +188,31 @@ WUT_CHECK_OFFSET(CCRCDCUicConfig, 0x00, configId);
175188
WUT_CHECK_OFFSET(CCRCDCUicConfig, 0x01, size);
176189
WUT_CHECK_OFFSET(CCRCDCUicConfig, 0x02, data);
177190

191+
struct CCRCDCFWInfo
192+
{
193+
uint32_t imageSize;
194+
uint32_t blockSize;
195+
uint32_t imageVersion;
196+
uint32_t sequencePerSession;
197+
//! Progress from 0-100
198+
uint32_t updateProgress;
199+
};
200+
WUT_CHECK_OFFSET(CCRCDCFWInfo, 0x00, imageSize);
201+
WUT_CHECK_OFFSET(CCRCDCFWInfo, 0x04, blockSize);
202+
WUT_CHECK_OFFSET(CCRCDCFWInfo, 0x08, imageVersion);
203+
WUT_CHECK_OFFSET(CCRCDCFWInfo, 0x0C, sequencePerSession);
204+
WUT_CHECK_OFFSET(CCRCDCFWInfo, 0x10, updateProgress);
205+
WUT_CHECK_SIZE(CCRCDCFWInfo, 0x14);
206+
207+
struct CCRCDCSoftwareVersion
208+
{
209+
uint32_t runningVersion;
210+
uint32_t activeVersion;
211+
};
212+
WUT_CHECK_OFFSET(CCRCDCSoftwareVersion, 0x0, runningVersion);
213+
WUT_CHECK_OFFSET(CCRCDCSoftwareVersion, 0x4, activeVersion);
214+
WUT_CHECK_SIZE(CCRCDCSoftwareVersion, 0x8);
215+
178216
/**
179217
* Send a command directly to the specified destination.
180218
*
@@ -454,6 +492,107 @@ uint16_t
454492
CCRCDCCalcCRC16(void *data,
455493
uint32_t dataSize);
456494

495+
/**
496+
* Get the firmware info during a pending update.
497+
*
498+
* \param dest
499+
* The destination to get the firmware info from.
500+
*
501+
* \param outInfo
502+
* Pointer to write the info to.
503+
*
504+
* \return
505+
* 0 on success.
506+
*/
507+
int32_t
508+
CCRCDCGetFWInfo(CCRCDCDestination dest,
509+
CCRCDCFWInfo *outInfo);
510+
511+
/**
512+
* Get software version information.
513+
*
514+
* \param dest
515+
* The destination to get the version information from.
516+
*
517+
* \param outVersion
518+
* Pointer to write the version info to.
519+
*
520+
* \return
521+
* 0 on success.
522+
*/
523+
int32_t
524+
CCRCDCSoftwareGetVersion(CCRCDCDestination dest,
525+
CCRCDCSoftwareVersion *outVersion);
526+
527+
/**
528+
* Perform a software update.
529+
*
530+
* \param dest
531+
* The destination to start a software update.
532+
*
533+
* \param path
534+
* Absolute path to read the update file from.
535+
* Note that this path needs to be accessible from IOS-PAD (e.g. on the MLC).
536+
*
537+
* \param callback
538+
* Callback to call once the update completes or \c NULL for synchronous updating.
539+
*
540+
* \param userContext
541+
* User provided value which is passed to the callback.
542+
*
543+
* \return
544+
* 0 on success.
545+
*/
546+
int32_t
547+
CCRCDCSoftwareUpdate(CCRCDCDestination dest,
548+
const char *path,
549+
IOSAsyncCallbackFn callback,
550+
void *userContext);
551+
552+
/**
553+
* Abort a software update.
554+
*
555+
* \param dest
556+
* The destination to send the command to.
557+
*
558+
* \return
559+
* 0 on success.
560+
*/
561+
int32_t
562+
CCRCDCSoftwareAbort(CCRCDCDestination dest);
563+
564+
/**
565+
* Activate a performed software update.
566+
*
567+
* \param dest
568+
* The destination to send the command to.
569+
*
570+
* \return
571+
* 0 on success.
572+
*/
573+
int32_t
574+
CCRCDCSoftwareActivate(CCRCDCDestination dest);
575+
576+
/**
577+
* Get an ext id from the specified destination.
578+
*
579+
* \param dest
580+
* The destination to get the ID from.
581+
*
582+
* \param ext
583+
* The ext to get the ID for.
584+
*
585+
* \param outId
586+
* Pointer to write the ID to.
587+
*
588+
* \return
589+
* 0 on success.
590+
*/
591+
int32_t
592+
CCRCDCSoftwareGetExtId(CCRCDCDestination dest,
593+
CCRCDCExt ext,
594+
uint32_t *outId);
595+
457596
#ifdef __cplusplus
458597
}
459598
#endif

include/nsysccr/cfg.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,30 @@ CCRCFGSetCachedEeprom(uint32_t drcSlot,
5151
void *buf,
5252
uint32_t size);
5353

54+
/**
55+
* Get the version check flag.
56+
*
57+
* \param outFlag
58+
* Pointer to write the flag to.
59+
*
60+
* \return
61+
* 0 on success.
62+
*/
63+
int32_t
64+
CCRCFGGetVersionCheckFlag(uint32_t *outFlag);
65+
66+
/**
67+
* Set the version check flag.
68+
*
69+
* \param outFlag
70+
* The flag to set.
71+
*
72+
* \return
73+
* 0 on success.
74+
*/
75+
int32_t
76+
CCRCFGSetVersionCheckFlag(uint32_t flag);
77+
5478
#ifdef __cplusplus
5579
}
5680
#endif

0 commit comments

Comments
 (0)