Merge pull request #305 from Thog/ptmsysm
Add PTMSYSM_CheckNew3DS, PTMSYSM_ShutdownAsync and PTMSYSM_RebootAsync
This commit is contained in:
commit
1258cfcccb
@ -10,9 +10,26 @@ Result ptmSysmInit(void);
|
|||||||
/// Exits ptm:sysm.
|
/// Exits ptm:sysm.
|
||||||
void ptmSysmExit(void);
|
void ptmSysmExit(void);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief return 1 if it's a New 3DS otherwise, return 0 for Old 3DS.
|
||||||
|
*/
|
||||||
|
Result PTMSYSM_CheckNew3DS(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Configures the New 3DS' CPU clock speed and L2 cache.
|
* @brief Configures the New 3DS' CPU clock speed and L2 cache.
|
||||||
* @param value Bit0: enable higher clock, Bit1: enable L2 cache.
|
* @param value Bit0: enable higher clock, Bit1: enable L2 cache.
|
||||||
*/
|
*/
|
||||||
Result PTMSYSM_ConfigureNew3DSCPU(u8 value);
|
Result PTMSYSM_ConfigureNew3DSCPU(u8 value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Trigger a hardware system shutdown via the MCU
|
||||||
|
* @param timeout: timeout passed to PMApp:TerminateNonEssential.
|
||||||
|
*/
|
||||||
|
Result PTMSYSM_ShutdownAsync(u64 timeout);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Trigger a hardware system reboot via the MCU.
|
||||||
|
* @param timeout: timeout passed to PMApp:TerminateNonEssential.
|
||||||
|
*/
|
||||||
|
Result PTMSYSM_RebootAsync(u64 timeout);
|
||||||
|
@ -24,6 +24,17 @@ void ptmSysmExit(void)
|
|||||||
svcCloseHandle(ptmSysmHandle);
|
svcCloseHandle(ptmSysmHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result PTMSYSM_CheckNew3DS(void)
|
||||||
|
{
|
||||||
|
Result ret;
|
||||||
|
u32 *cmdbuf = getThreadCommandBuffer();
|
||||||
|
cmdbuf[0] = IPC_MakeHeader(0x040A,0,0); // 0x040A0000
|
||||||
|
|
||||||
|
if(R_FAILED(ret = svcSendSyncRequest(ptmSysmHandle)))return 0;
|
||||||
|
|
||||||
|
return (Result)cmdbuf[1];
|
||||||
|
}
|
||||||
|
|
||||||
Result PTMSYSM_ConfigureNew3DSCPU(u8 value)
|
Result PTMSYSM_ConfigureNew3DSCPU(u8 value)
|
||||||
{
|
{
|
||||||
Result ret;
|
Result ret;
|
||||||
@ -37,3 +48,29 @@ Result PTMSYSM_ConfigureNew3DSCPU(u8 value)
|
|||||||
return (Result)cmdbuf[1];
|
return (Result)cmdbuf[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result PTMSYSM_ShutdownAsync(u64 timeout)
|
||||||
|
{
|
||||||
|
Result ret;
|
||||||
|
u32 *cmdbuf = getThreadCommandBuffer();
|
||||||
|
cmdbuf[0] = IPC_MakeHeader(0x407,3,0); // 0x040700C0
|
||||||
|
cmdbuf[1] = 0;
|
||||||
|
cmdbuf[2] = timeout & 0xffffffff;
|
||||||
|
cmdbuf[3] = (timeout >> 32) & 0xffffffff;
|
||||||
|
|
||||||
|
if(R_FAILED(ret = svcSendSyncRequest(ptmSysmHandle)))return ret;
|
||||||
|
|
||||||
|
return (Result)cmdbuf[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
Result PTMSYSM_RebootAsync(u64 timeout)
|
||||||
|
{
|
||||||
|
Result ret;
|
||||||
|
u32 *cmdbuf = getThreadCommandBuffer();
|
||||||
|
cmdbuf[0] = IPC_MakeHeader(0x409,2,0); // 0x04090080
|
||||||
|
cmdbuf[1] = timeout & 0xffffffff;
|
||||||
|
cmdbuf[2] = (timeout >> 32) & 0xffffffff;
|
||||||
|
|
||||||
|
if(R_FAILED(ret = svcSendSyncRequest(ptmSysmHandle)))return ret;
|
||||||
|
|
||||||
|
return (Result)cmdbuf[1];
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user