Add a bunch of ndmu functions and add breif comments
This commit is contained in:
parent
74128a1e8e
commit
9171df99ea
@ -12,13 +12,78 @@ typedef enum {
|
||||
EXCLUSIVE_STATE_STREETPASS_DATA = 4,
|
||||
} NDM_ExclusiveState;
|
||||
|
||||
typedef enum {
|
||||
STATE_INITIAL = 0,
|
||||
STATE_SUSPENDED = 1,
|
||||
STATE_INFRASTRUCTURE_CONNECTING = 2,
|
||||
STATE_INFRASTRUCTURE_CONNECTED = 3,
|
||||
STATE_INFRASTRUCTURE_WORKING = 4,
|
||||
STATE_INFRASTRUCTURE_SUSPENDING = 5,
|
||||
STATE_INFRASTRUCTURE_FORCE_SUSPENDING = 6,
|
||||
STATE_INFRASTRUCTURE_DISCONNECTING = 7,
|
||||
STATE_INFRASTRUCTURE_FORCE_DISCONNECTING = 8,
|
||||
STATE_CEC_WORKING = 9,
|
||||
STATE_CEC_FORCE_SUSPENDING = 10,
|
||||
STATE_CEC_SUSPENDING = 11,
|
||||
} NDM_State;
|
||||
|
||||
/// Initializes ndmu.
|
||||
Result ndmuInit(void);
|
||||
|
||||
/// Exits ndmu.
|
||||
void ndmuExit(void);
|
||||
|
||||
/**
|
||||
* @brief Enter an exclusive ndm state.
|
||||
* @param state State specified in the NDM_ExclusiveState enumerator.
|
||||
*/
|
||||
Result NDMU_EnterExclusiveState(NDM_ExclusiveState state);
|
||||
|
||||
/// Leaves the ndm exclusive state.
|
||||
Result NDMU_LeaveExclusiveState(void);
|
||||
|
||||
/**
|
||||
* @brief Returns the exclsuive ndm state.
|
||||
* @param state Pointer to write the exclsuive ndm state to.
|
||||
*/
|
||||
Result NDMU_GetExclusiveState(NDM_ExclusiveState *state);
|
||||
|
||||
/**
|
||||
* @brief Suspends the ndm scheduler.
|
||||
* @param flag 0 = Wait for completion, 1 = Perform in background.
|
||||
*/
|
||||
Result NDMU_SuspendScheduler(u32 flag);
|
||||
|
||||
/// Resumes the ndm scheduler.
|
||||
Result NDMU_ResumeScheduler(void);
|
||||
|
||||
/**
|
||||
* @brief Returns the current ndm state.
|
||||
* @param state Pointer to write the current NDM state to.
|
||||
*/
|
||||
Result NDMU_GetCurrentState(NDM_State *state);
|
||||
|
||||
/**
|
||||
* @brief Sets the scan interval.
|
||||
* @param interval Value to set the scan interval to.
|
||||
*/
|
||||
Result NDMU_SetScanInterval(u32 interval);
|
||||
|
||||
/**
|
||||
* @brief Returns the scan interval.
|
||||
* @param interval Pointer to write the interval value to.
|
||||
*/
|
||||
Result NDMU_GetScanInterval(u32 *interval);
|
||||
|
||||
/**
|
||||
* @brief Returns the retry interval.
|
||||
* @param interval Pointer to write the interval value to.
|
||||
*/
|
||||
Result NDMU_GetRetryInterval(u32 *interval);
|
||||
|
||||
/// Reset daemons to default daemon bit mask values.
|
||||
Result NDMU_ResetDaemons(void);
|
||||
|
||||
/// Clears half awake mac filter.
|
||||
Result NDMU_ClearMacFilter(void);
|
||||
|
||||
|
@ -44,7 +44,7 @@ Result NDMU_EnterExclusiveState(NDM_ExclusiveState state)
|
||||
Result ret=0;
|
||||
if(R_FAILED(ret=svcSendSyncRequest(ndmuHandle)))return ret;
|
||||
|
||||
return cmdbuf[1];
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result NDMU_LeaveExclusiveState(void)
|
||||
@ -57,6 +57,123 @@ Result NDMU_LeaveExclusiveState(void)
|
||||
Result ret=0;
|
||||
if(R_FAILED(ret=svcSendSyncRequest(ndmuHandle)))return ret;
|
||||
|
||||
return cmdbuf[1];
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result NDMU_GetExclusiveState(NDM_ExclusiveState *state)
|
||||
{
|
||||
u32* cmdbuf=getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0]=IPC_MakeHeader(0x3,0,0); // 0x30000
|
||||
|
||||
Result ret=0;
|
||||
if(R_FAILED(ret=svcSendSyncRequest(ndmuHandle)))return ret;
|
||||
|
||||
*state = cmdbuf[2];
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result NDMU_SuspendScheduler(u32 flag)
|
||||
{
|
||||
u32* cmdbuf=getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0]=IPC_MakeHeader(0x8,1,0); // 0x80040
|
||||
cmdbuf[1]=flag;
|
||||
|
||||
Result ret=0;
|
||||
if(R_FAILED(ret=svcSendSyncRequest(ndmuHandle)))return ret;
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result NDMU_ResumeScheduler(void)
|
||||
{
|
||||
u32* cmdbuf=getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0]=IPC_MakeHeader(0x9,0,0); // 0x90000
|
||||
|
||||
Result ret=0;
|
||||
if(R_FAILED(ret=svcSendSyncRequest(ndmuHandle)))return ret;
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result NDMU_GetCurrentState(NDM_State *state)
|
||||
{
|
||||
u32* cmdbuf=getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0]=IPC_MakeHeader(0xA,0,0); // 0xA0000
|
||||
|
||||
Result ret=0;
|
||||
if(R_FAILED(ret=svcSendSyncRequest(ndmuHandle)))return ret;
|
||||
|
||||
*state = cmdbuf[2];
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result NDMU_SetScanInterval(u32 interval)
|
||||
{
|
||||
u32* cmdbuf=getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0]=IPC_MakeHeader(0x10,1,0); // 0x10040
|
||||
cmdbuf[1]=interval;
|
||||
|
||||
Result ret=0;
|
||||
if(R_FAILED(ret=svcSendSyncRequest(ndmuHandle)))return ret;
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result NDMU_GetScanInterval(u32 *interval)
|
||||
{
|
||||
u32* cmdbuf=getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0]=IPC_MakeHeader(0x11,0,0); // 0x110000
|
||||
|
||||
Result ret=0;
|
||||
if(R_FAILED(ret=svcSendSyncRequest(ndmuHandle)))return ret;
|
||||
|
||||
*interval = cmdbuf[2];
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result NDMU_GetRetryInterval(u32 *interval)
|
||||
{
|
||||
u32* cmdbuf=getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0]=IPC_MakeHeader(0x13,0,0); // 0x130000
|
||||
|
||||
Result ret=0;
|
||||
if(R_FAILED(ret=svcSendSyncRequest(ndmuHandle)))return ret;
|
||||
|
||||
*interval = cmdbuf[2];
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result NDMU_ResetDaemons(void)
|
||||
{
|
||||
u32* cmdbuf=getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0]=IPC_MakeHeader(0x15,0,0); // 0x150000
|
||||
|
||||
Result ret=0;
|
||||
if(R_FAILED(ret=svcSendSyncRequest(ndmuHandle)))return ret;
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
||||
Result NDMU_ClearHalfAwakeMacFilter(void)
|
||||
{
|
||||
u32* cmdbuf=getThreadCommandBuffer();
|
||||
|
||||
cmdbuf[0]=IPC_MakeHeader(0x17,0,0); // 0x170000
|
||||
|
||||
Result ret=0;
|
||||
if(R_FAILED(ret=svcSendSyncRequest(ndmuHandle)))return ret;
|
||||
|
||||
return (Result)cmdbuf[1];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user