mirror of
https://github.com/devkitPro/wut.git
synced 2026-03-21 17:34:47 -05:00
Add several nsysccr functions
This commit is contained in:
parent
c77e6f6015
commit
5c8a4a9056
22
include/nsysccr/ccr.h
Normal file
22
include/nsysccr/ccr.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#pragma once
|
||||
#include <wut.h>
|
||||
|
||||
/**
|
||||
* \defgroup nsysccr_ccr
|
||||
* \ingroup nsysccr
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int32_t
|
||||
CCRSetCompatMode(uint32_t compatMode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
323
include/nsysccr/cdc.h
Normal file
323
include/nsysccr/cdc.h
Normal file
|
|
@ -0,0 +1,323 @@
|
|||
#pragma once
|
||||
#include <wut.h>
|
||||
#include <coreinit/ios.h>
|
||||
|
||||
/**
|
||||
* \defgroup nsysccr_cdc
|
||||
* \ingroup nsysccr
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct CCRCDCMacAddress CCRCDCMacAddress;
|
||||
typedef struct CCRCDCWpsArgs CCRCDCWpsArgs;
|
||||
typedef struct CCRCDCSysMessage CCRCDCSysMessage;
|
||||
typedef struct CCRCDCEepromData CCRCDCEepromData;
|
||||
typedef uint8_t CCRCDCDestination;
|
||||
typedef uint32_t CCRCDCWpsStatusType;
|
||||
typedef uint8_t CCRCDCDrcState;
|
||||
|
||||
typedef enum CCRCDCDestinationEnum
|
||||
{
|
||||
CCR_CDC_DESTINATION_DRH = 1,
|
||||
CCR_CDC_DESTINATION_DRC0 = 2,
|
||||
CCR_CDC_DESTINATION_DRC1 = 3,
|
||||
} CCRCDCDestinationEnum;
|
||||
|
||||
typedef enum CCRCDCWpsStatusEnum
|
||||
{
|
||||
CCR_CDC_WPS_STATUS_PAIRED = 0,
|
||||
CCR_CDC_WPS_STATUS_SEARCHING = 1,
|
||||
CCR_CDC_WPS_STATUS_PAIRING = 2,
|
||||
} CCRCDCWpsStatusEnum;
|
||||
|
||||
typedef enum CCRCDCDrcStateEnum
|
||||
{
|
||||
CCR_CDC_DRC_STATE_ACTIVE = 0,
|
||||
CCR_CDC_DRC_STATE_UNK1 = 1,
|
||||
CCR_CDC_DRC_STATE_UNK2 = 2,
|
||||
CCR_CDC_DRC_STATE_UNK3 = 3,
|
||||
CCR_CDC_DRC_STATE_BACKGROUND = 4,
|
||||
CCR_CDC_DRC_STATE_DISCONNECT = 5,
|
||||
CCR_CDC_DRC_STATE_UNK12 = 12,
|
||||
CCR_CDC_DRC_STATE_UNK15 = 15,
|
||||
} CCRCDCDrcStateEnum;
|
||||
|
||||
struct WUT_PACKED CCRCDCMacAddress
|
||||
{
|
||||
//! The device this mac address belongs to
|
||||
CCRCDCDestination device;
|
||||
uint8_t address[6];
|
||||
};
|
||||
WUT_CHECK_OFFSET(CCRCDCMacAddress, 0x0, device);
|
||||
WUT_CHECK_OFFSET(CCRCDCMacAddress, 0x1, address);
|
||||
WUT_CHECK_SIZE(CCRCDCMacAddress, 0x7);
|
||||
|
||||
struct WUT_PACKED CCRCDCWpsArgs
|
||||
{
|
||||
//! Should be set to 1
|
||||
uint8_t hasArgs;
|
||||
//! The pin code used for WPS
|
||||
char pin[8];
|
||||
//! Timeout in seconds
|
||||
uint16_t timeout;
|
||||
// \c CCR_CDC_DESTINATION_DRC0 or \c CCR_CDC_DESTINATION_DRC1 depending on where the device should be paired to
|
||||
CCRCDCDestination pairDestination;
|
||||
};
|
||||
WUT_CHECK_OFFSET(CCRCDCWpsArgs, 0x0, hasArgs);
|
||||
WUT_CHECK_OFFSET(CCRCDCWpsArgs, 0x1, pin);
|
||||
WUT_CHECK_OFFSET(CCRCDCWpsArgs, 0x9, timeout);
|
||||
WUT_CHECK_OFFSET(CCRCDCWpsArgs, 0xb, pairDestination);
|
||||
WUT_CHECK_SIZE(CCRCDCWpsArgs, 0xc);
|
||||
|
||||
struct WUT_PACKED CCRCDCSysMessage
|
||||
{
|
||||
uint16_t message;
|
||||
//! Timeout in seconds
|
||||
uint16_t timeout;
|
||||
};
|
||||
WUT_CHECK_OFFSET(CCRCDCSysMessage, 0x0, message);
|
||||
WUT_CHECK_OFFSET(CCRCDCSysMessage, 0x2, timeout);
|
||||
WUT_CHECK_SIZE(CCRCDCSysMessage, 0x4);
|
||||
|
||||
struct WUT_PACKED CCRCDCEepromData
|
||||
{
|
||||
uint32_t version;
|
||||
WUT_UNKNOWN_BYTES(0x300);
|
||||
};
|
||||
WUT_CHECK_OFFSET(CCRCDCEepromData, 0x0, version);
|
||||
WUT_CHECK_SIZE(CCRCDCEepromData, 0x304);
|
||||
|
||||
/**
|
||||
* Send a command directly to the specified destination.
|
||||
*
|
||||
* \param dest
|
||||
* The device to send the command to.
|
||||
* See \link CCRCDCDestinationEnum \endlink.
|
||||
*
|
||||
* \return
|
||||
* 0 on success.
|
||||
*/
|
||||
int32_t
|
||||
CCRCDCCommand(uint8_t unk,
|
||||
uint8_t fragment,
|
||||
CCRCDCDestination dest,
|
||||
uint8_t flags0,
|
||||
uint8_t flags1,
|
||||
uint8_t service,
|
||||
uint8_t method,
|
||||
void *payload,
|
||||
uint32_t payloadSize,
|
||||
void *reply,
|
||||
uint32_t replySize);
|
||||
|
||||
/**
|
||||
* Send a ping to the specified destination.
|
||||
*
|
||||
* \param dest
|
||||
* The device to ping.
|
||||
* See \link CCRCDCDestinationEnum \endlink.
|
||||
*
|
||||
* \return
|
||||
* 0 on success.
|
||||
*/
|
||||
int32_t
|
||||
CCRCDCDevicePing(CCRCDCDestination dest);
|
||||
|
||||
int32_t
|
||||
CCRCDCSetStationId(CCRCDCMacAddress *id);
|
||||
|
||||
/**
|
||||
* Gets the mac address of the specified destination.
|
||||
*
|
||||
* \param dest
|
||||
* The device to get the mac address from.
|
||||
* See \link CCRCDCDestinationEnum \endlink.
|
||||
*
|
||||
* \param mac
|
||||
* A pointer to write the mac address to.
|
||||
*
|
||||
* \return
|
||||
* 0 on success.
|
||||
*/
|
||||
int32_t
|
||||
CCRCDCGetMacAddress(CCRCDCDestination dest,
|
||||
CCRCDCMacAddress *mac);
|
||||
|
||||
/**
|
||||
* Gets the amount of DRCs which can be connected to the system.
|
||||
*
|
||||
* \param numDrcs
|
||||
* A pointer to write the amount to.
|
||||
*
|
||||
* \return
|
||||
* 0 on success.
|
||||
*/
|
||||
int32_t
|
||||
CCRCDCGetMultiDrc(uint8_t *numDrcs);
|
||||
|
||||
/**
|
||||
* Sets the amount of DRCs which can be connected to the system.
|
||||
*
|
||||
* \param numDrcs
|
||||
* The amount of DRCs (must be 1 or 2).
|
||||
*
|
||||
* \return
|
||||
* 0 on success.
|
||||
*/
|
||||
int32_t
|
||||
CCRCDCSetMultiDrc(uint8_t numDrcs);
|
||||
|
||||
/**
|
||||
* Gets the state of the specified DRC.
|
||||
*
|
||||
* \param dest
|
||||
* The device to get the state from.
|
||||
* See \link CCRCDCDestinationEnum \endlink.
|
||||
*
|
||||
* \param state
|
||||
* A pointer to write the state to.
|
||||
*
|
||||
* \return
|
||||
* 0 on success.
|
||||
*/
|
||||
int32_t
|
||||
CCRCDCSysGetDrcState(CCRCDCDestination dest,
|
||||
CCRCDCDrcState *state);
|
||||
|
||||
/**
|
||||
* Sets the state of the specified DRC.
|
||||
*
|
||||
* \param dest
|
||||
* The device to set the state.
|
||||
* See \link CCRCDCDestinationEnum \endlink.
|
||||
*
|
||||
* \param state
|
||||
* A pointer to read the state from.
|
||||
*
|
||||
* \return
|
||||
* 0 on success.
|
||||
*/
|
||||
int32_t
|
||||
CCRCDCSysSetDrcState(CCRCDCDestination dest,
|
||||
CCRCDCDrcState *state);
|
||||
|
||||
/**
|
||||
* Start WPS (WiFi Protected Setup) on the DRH.
|
||||
*
|
||||
* \return
|
||||
* 0 on success.
|
||||
*/
|
||||
int32_t
|
||||
CCRCDCWpsStart(void);
|
||||
|
||||
/**
|
||||
* Start WPS (WiFi Protected Setup) on the DRH.
|
||||
*
|
||||
* \param args
|
||||
* Additional arguments.
|
||||
*
|
||||
* \return
|
||||
* 0 on success.
|
||||
*/
|
||||
int32_t
|
||||
CCRCDCWpsStartEx(CCRCDCWpsArgs *args);
|
||||
|
||||
/**
|
||||
* Get the WPS status.
|
||||
*
|
||||
* \param status
|
||||
* A pointer to write the status to.
|
||||
* See \link CCRCDCWpsStatusEnum \endlink.
|
||||
*
|
||||
* \return
|
||||
* 0 on success.
|
||||
*/
|
||||
int32_t
|
||||
CCRCDCWpsStatus(CCRCDCWpsStatusType *status);
|
||||
|
||||
/**
|
||||
* Stop WPS.
|
||||
*
|
||||
* \return
|
||||
* 0 on success.
|
||||
*/
|
||||
int32_t
|
||||
CCRCDCWpsStop(void);
|
||||
|
||||
/**
|
||||
* Display a message on the specified DRC.
|
||||
*
|
||||
* \param dest
|
||||
* The device to display the message on.
|
||||
* See \link CCRCDCDestinationEnum \endlink.
|
||||
*
|
||||
* \param message
|
||||
* The message struct.
|
||||
*
|
||||
* \return
|
||||
* 0 on success.
|
||||
*/
|
||||
int32_t
|
||||
CCRCDCSysDrcDisplayMessage(CCRCDCDestination dest,
|
||||
CCRCDCSysMessage *message);
|
||||
|
||||
/**
|
||||
* Read the Eeprom of the specified device.
|
||||
*
|
||||
* \param dest
|
||||
* The device to read the eeprom of.
|
||||
* See \link CCRCDCDestinationEnum \endlink.
|
||||
*
|
||||
* \param eeprom
|
||||
* Pointer to write the the eeprom data to.
|
||||
*
|
||||
* \return
|
||||
* 0 on success.
|
||||
*/
|
||||
int32_t
|
||||
CCRCDCPerGetUicEeprom(CCRCDCDestination dest,
|
||||
CCRCDCEepromData *eeprom);
|
||||
|
||||
/**
|
||||
* Read the Eeprom of the specified device (async version).
|
||||
*
|
||||
* \param dest
|
||||
* The device to read the eeprom of.
|
||||
* See \link CCRCDCDestinationEnum \endlink.
|
||||
*
|
||||
* \param eeprom
|
||||
* Pointer to write the the eeprom data to.
|
||||
*
|
||||
* \return
|
||||
* 0 on success.
|
||||
*/
|
||||
int32_t
|
||||
CCRCDCPerGetUicEepromEx(CCRCDCDestination dest,
|
||||
CCRCDCEepromData *eeprom,
|
||||
IOSAsyncCallbackFn callback,
|
||||
void* arg);
|
||||
|
||||
/**
|
||||
* Notify the specified device that the console is about to shut down,
|
||||
* and the device should shut down as well.
|
||||
*
|
||||
* \param dest
|
||||
* The device to notify.
|
||||
* See \link CCRCDCDestinationEnum \endlink.
|
||||
*
|
||||
* \return
|
||||
* 0 on success.
|
||||
*/
|
||||
int32_t
|
||||
CCRCDCSysConsoleShutdownInd(CCRCDCDestination dest);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
58
include/nsysccr/cfg.h
Normal file
58
include/nsysccr/cfg.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#pragma once
|
||||
#include <wut.h>
|
||||
|
||||
/**
|
||||
* \defgroup nsysccr_cfg
|
||||
* \ingroup nsysccr
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int32_t
|
||||
CCRCFGInit(void);
|
||||
|
||||
/**
|
||||
* Read from the cached Eeprom of the specified device.
|
||||
*
|
||||
* \param drcSlot
|
||||
* The DRC to read the eeprom from (0 or 1).
|
||||
*
|
||||
* \param offset
|
||||
* Offset of the Eeprom data.
|
||||
*
|
||||
* \return
|
||||
* 0 on success.
|
||||
*/
|
||||
int32_t
|
||||
CCRCFGGetCachedEeprom(uint32_t drcSlot,
|
||||
uint32_t offset,
|
||||
void *buf,
|
||||
uint32_t size);
|
||||
|
||||
/**
|
||||
* Write to the cached Eeprom of the specified device.
|
||||
*
|
||||
* \param drcSlot
|
||||
* The DRC to read the eeprom from (0 or 1).
|
||||
*
|
||||
* \param offset
|
||||
* Offset of the Eeprom data.
|
||||
*
|
||||
* \return
|
||||
* 0 on success.
|
||||
*/
|
||||
int32_t
|
||||
CCRCFGSetCachedEeprom(uint32_t drcSlot,
|
||||
uint32_t offset,
|
||||
void *buf,
|
||||
uint32_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
80
include/nsysccr/hid.h
Normal file
80
include/nsysccr/hid.h
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
#pragma once
|
||||
#include <wut.h>
|
||||
#include <coreinit/ios.h>
|
||||
|
||||
/**
|
||||
* \defgroup nsysccr_hid Raw HID data of the DRCs
|
||||
* \ingroup nsysccr
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct CCRHIDReport CCRHIDReport;
|
||||
|
||||
struct WUT_PACKED CCRHIDReport
|
||||
{
|
||||
WUT_UNKNOWN_BYTES(0x80);
|
||||
};
|
||||
WUT_CHECK_SIZE(CCRHIDReport, 0x80);
|
||||
|
||||
/**
|
||||
* Start transmission of HID reports from the specified DRC.
|
||||
*
|
||||
* \param drcSlot
|
||||
* The DRC to read the HID reports from (0 or 1).
|
||||
*
|
||||
* \param reportsBuffer
|
||||
* Aligned buffer to read reports to.
|
||||
*
|
||||
* \param numReports
|
||||
* The amount of reports the buffer can store.
|
||||
*
|
||||
* \return
|
||||
* 0 on success.
|
||||
*/
|
||||
int32_t
|
||||
CCRHIDStart(uint32_t drcSlot,
|
||||
CCRHIDReport *reportsBuffer,
|
||||
uint32_t numReports,
|
||||
IOSAsyncCallbackFn callback,
|
||||
void *arg);
|
||||
|
||||
/**
|
||||
* Stop HID report transmission.
|
||||
*
|
||||
* \param drcSlot
|
||||
* The DRC to read the HID reports from (0 or 1).
|
||||
*
|
||||
* \return
|
||||
* 0 on success.
|
||||
*/
|
||||
int32_t
|
||||
CCRHIDStop(uint32_t drcSlot,
|
||||
IOSAsyncCallbackFn callback,
|
||||
void *arg);
|
||||
|
||||
int32_t
|
||||
CCRHIDGetData(uint32_t drcSlot,
|
||||
CCRHIDReport *reportData);
|
||||
|
||||
int32_t
|
||||
CCRHIDGetBufferedData(uint32_t drcSlot,
|
||||
CCRHIDReport *reportData);
|
||||
|
||||
int32_t
|
||||
CCRHIDGetFirmwareVersion(CCRHIDReport *report,
|
||||
uint32_t *firmwareVersion);
|
||||
|
||||
int32_t
|
||||
CCRHIDGetSequence(CCRHIDReport *report,
|
||||
uint32_t *sequence);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
5
include/nsysccr/nsysccr.dox
Normal file
5
include/nsysccr/nsysccr.dox
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/**
|
||||
* \defgroup nsysccr nsysccr
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
|
@ -115,6 +115,10 @@
|
|||
#include <nn/spm.h>
|
||||
#include <nn/save.h>
|
||||
#include <nn/temp.h>
|
||||
#include <nsysccr/ccr.h>
|
||||
#include <nsysccr/cdc.h>
|
||||
#include <nsysccr/cfg.h>
|
||||
#include <nsysccr/hid.h>
|
||||
#include <nsyshid/hid.h>
|
||||
#include <nsysnet/_socket.h>
|
||||
#include <nsysnet/netconfig.h>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user