Add ndmu LockState/Unlock State

This commit is contained in:
Joel16 2018-01-07 00:41:02 -06:00
parent 9171df99ea
commit eb2addbe75
2 changed files with 32 additions and 0 deletions

View File

@ -48,6 +48,12 @@ Result NDMU_LeaveExclusiveState(void);
*/
Result NDMU_GetExclusiveState(NDM_ExclusiveState *state);
/// Locks the ndm state.
Result NDMU_LockState(void);
/// Unlocks the ndm state.
Result NDMU_UnlockState(void);
/**
* @brief Suspends the ndm scheduler.
* @param flag 0 = Wait for completion, 1 = Perform in background.

View File

@ -74,6 +74,32 @@ Result NDMU_GetExclusiveState(NDM_ExclusiveState *state)
return (Result)cmdbuf[1];
}
Result NDMU_LockState(void)
{
u32* cmdbuf=getThreadCommandBuffer();
cmdbuf[0]=IPC_MakeHeader(0x4,0,2); // 0x40002
cmdbuf[1]=IPC_Desc_CurProcessHandle();
Result ret=0;
if(R_FAILED(ret=svcSendSyncRequest(ndmuHandle)))return ret;
return (Result)cmdbuf[1];
}
Result NDMU_UnlockState(void)
{
u32* cmdbuf=getThreadCommandBuffer();
cmdbuf[0]=IPC_MakeHeader(0x5,0,2); // 0x50002
cmdbuf[1]=IPC_Desc_CurProcessHandle();
Result ret=0;
if(R_FAILED(ret=svcSendSyncRequest(ndmuHandle)))return ret;
return (Result)cmdbuf[1];
}
Result NDMU_SuspendScheduler(u32 flag)
{
u32* cmdbuf=getThreadCommandBuffer();