Add SDMMC speed info types, and more clock rates (#480)
This commit is contained in:
parent
4fdc40228a
commit
75b4d1f563
@ -5,10 +5,22 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "svc.h"
|
#include "svc.h"
|
||||||
|
|
||||||
#define SYSCLOCK_SOC (16756991)
|
///< The external clock rate for the SoC.
|
||||||
#define SYSCLOCK_ARM9 (SYSCLOCK_SOC * 8)
|
#define SYSCLOCK_SOC (16756991u)
|
||||||
|
///< The base system clock rate (for I2C, NDMA, etc.).
|
||||||
|
#define SYSCLOCK_SYS (SYSCLOCK_SOC * 2)
|
||||||
|
///< The base clock rate for the SDMMC controller (and some other peripherals).
|
||||||
|
#define SYSCLOCK_SDMMC (SYSCLOCK_SYS * 2)
|
||||||
|
///< The clock rate for the Arm9.
|
||||||
|
#define SYSCLOCK_ARM9 (SYSCLOCK_SYS * 4)
|
||||||
|
///< The clock rate for the Arm11 in CTR mode and in \ref svcGetSystemTick.
|
||||||
#define SYSCLOCK_ARM11 (SYSCLOCK_ARM9 * 2)
|
#define SYSCLOCK_ARM11 (SYSCLOCK_ARM9 * 2)
|
||||||
#define SYSCLOCK_ARM11_NEW (SYSCLOCK_ARM11 * 3)
|
///< The clock rate for the Arm11 in LGR1 mode.
|
||||||
|
#define SYSCLOCK_ARM11_LGR1 (SYSCLOCK_ARM11 * 2)
|
||||||
|
///< The clock rate for the Arm11 in LGR2 mode.
|
||||||
|
#define SYSCLOCK_ARM11_LGR2 (SYSCLOCK_ARM11 * 3)
|
||||||
|
///< The highest possible clock rate for the Arm11 on known New 3DS units.
|
||||||
|
#define SYSCLOCK_ARM11_NEW SYSCLOCK_ARM11_LGR2
|
||||||
|
|
||||||
#define CPU_TICKS_PER_MSEC (SYSCLOCK_ARM11 / 1000.0)
|
#define CPU_TICKS_PER_MSEC (SYSCLOCK_ARM11 / 1000.0)
|
||||||
#define CPU_TICKS_PER_USEC (SYSCLOCK_ARM11 / 1000000.0)
|
#define CPU_TICKS_PER_USEC (SYSCLOCK_ARM11 / 1000000.0)
|
||||||
|
@ -235,6 +235,14 @@ typedef struct
|
|||||||
const void* data; ///< Pointer to FS path data.
|
const void* data; ///< Pointer to FS path data.
|
||||||
} FS_Path;
|
} FS_Path;
|
||||||
|
|
||||||
|
/// SDMC/NAND speed information
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
bool highSpeedModeEnabled; ///< Whether or not High Speed Mode is enabled.
|
||||||
|
bool usesHighestClockRate; ///< Whether or not a clock divider of 2 is being used.
|
||||||
|
u16 sdClkCtrl; ///< The value of the SD_CLK_CTRL register.
|
||||||
|
} FS_SdMmcSpeedInfo;
|
||||||
|
|
||||||
/// Filesystem archive handle, providing access to a filesystem's contents.
|
/// Filesystem archive handle, providing access to a filesystem's contents.
|
||||||
typedef u64 FS_Archive;
|
typedef u64 FS_Archive;
|
||||||
|
|
||||||
@ -467,13 +475,13 @@ Result FSUSER_GetNandCid(u8* out, u32 length);
|
|||||||
* @brief Gets the SDMC speed info.
|
* @brief Gets the SDMC speed info.
|
||||||
* @param speedInfo Pointer to output the speed info to.
|
* @param speedInfo Pointer to output the speed info to.
|
||||||
*/
|
*/
|
||||||
Result FSUSER_GetSdmcSpeedInfo(u32 *speedInfo);
|
Result FSUSER_GetSdmcSpeedInfo(FS_SdMmcSpeedInfo *speedInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets the NAND speed info.
|
* @brief Gets the NAND speed info.
|
||||||
* @param speedInfo Pointer to output the speed info to.
|
* @param speedInfo Pointer to output the speed info to.
|
||||||
*/
|
*/
|
||||||
Result FSUSER_GetNandSpeedInfo(u32 *speedInfo);
|
Result FSUSER_GetNandSpeedInfo(FS_SdMmcSpeedInfo *speedInfo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets the SDMC log.
|
* @brief Gets the SDMC log.
|
||||||
|
@ -251,13 +251,13 @@ Result FSPXI_GetNandCid(Handle serviceHandle, void* out, u32 size);
|
|||||||
* @brief Gets the SDMC speed info
|
* @brief Gets the SDMC speed info
|
||||||
* @param out Buffer to output the speed info to.
|
* @param out Buffer to output the speed info to.
|
||||||
*/
|
*/
|
||||||
Result FSPXI_GetSdmcSpeedInfo(Handle serviceHandle, u32* out);
|
Result FSPXI_GetSdmcSpeedInfo(Handle serviceHandle, FS_SdMmcSpeedInfo* out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets the NAND speed info
|
* @brief Gets the NAND speed info
|
||||||
* @param out Buffer to output the speed info to.
|
* @param out Buffer to output the speed info to.
|
||||||
*/
|
*/
|
||||||
Result FSPXI_GetNandSpeedInfo(Handle serviceHandle, u32* out);
|
Result FSPXI_GetNandSpeedInfo(Handle serviceHandle, FS_SdMmcSpeedInfo* out);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets the SDMC log
|
* @brief Gets the SDMC log
|
||||||
|
@ -566,7 +566,7 @@ Result FSUSER_GetNandCid(u8* out, u32 length)
|
|||||||
return cmdbuf[1];
|
return cmdbuf[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
Result FSUSER_GetSdmcSpeedInfo(u32 *speedInfo)
|
Result FSUSER_GetSdmcSpeedInfo(FS_SdMmcSpeedInfo *speedInfo)
|
||||||
{
|
{
|
||||||
u32 *cmdbuf = getThreadCommandBuffer();
|
u32 *cmdbuf = getThreadCommandBuffer();
|
||||||
|
|
||||||
@ -575,12 +575,11 @@ Result FSUSER_GetSdmcSpeedInfo(u32 *speedInfo)
|
|||||||
Result ret = 0;
|
Result ret = 0;
|
||||||
if(R_FAILED(ret = svcSendSyncRequest(fsSession()))) return ret;
|
if(R_FAILED(ret = svcSendSyncRequest(fsSession()))) return ret;
|
||||||
|
|
||||||
if(speedInfo) *speedInfo = cmdbuf[2];
|
if(speedInfo) memcpy(speedInfo, &cmdbuf[2], sizeof(FS_SdMmcSpeedInfo));
|
||||||
|
|
||||||
return cmdbuf[1];
|
return cmdbuf[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
Result FSUSER_GetNandSpeedInfo(u32 *speedInfo)
|
Result FSUSER_GetNandSpeedInfo(FS_SdMmcSpeedInfo *speedInfo)
|
||||||
{
|
{
|
||||||
u32 *cmdbuf = getThreadCommandBuffer();
|
u32 *cmdbuf = getThreadCommandBuffer();
|
||||||
|
|
||||||
@ -589,7 +588,7 @@ Result FSUSER_GetNandSpeedInfo(u32 *speedInfo)
|
|||||||
Result ret = 0;
|
Result ret = 0;
|
||||||
if(R_FAILED(ret = svcSendSyncRequest(fsSession()))) return ret;
|
if(R_FAILED(ret = svcSendSyncRequest(fsSession()))) return ret;
|
||||||
|
|
||||||
if(speedInfo) *speedInfo = cmdbuf[2];
|
if(speedInfo) memcpy(speedInfo, &cmdbuf[2], sizeof(FS_SdMmcSpeedInfo));
|
||||||
|
|
||||||
return cmdbuf[1];
|
return cmdbuf[1];
|
||||||
}
|
}
|
||||||
|
@ -572,7 +572,7 @@ Result FSPXI_GetNandCid(Handle serviceHandle, void* out, u32 size)
|
|||||||
return (Result) cmdbuf[1];
|
return (Result) cmdbuf[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
Result FSPXI_GetSdmcSpeedInfo(Handle serviceHandle, u32* out)
|
Result FSPXI_GetSdmcSpeedInfo(Handle serviceHandle, FS_SdMmcSpeedInfo* out)
|
||||||
{
|
{
|
||||||
Result ret = 0;
|
Result ret = 0;
|
||||||
u32* cmdbuf = getThreadCommandBuffer();
|
u32* cmdbuf = getThreadCommandBuffer();
|
||||||
@ -581,12 +581,12 @@ Result FSPXI_GetSdmcSpeedInfo(Handle serviceHandle, u32* out)
|
|||||||
|
|
||||||
if(R_FAILED(ret = svcSendSyncRequest(serviceHandle))) return ret;
|
if(R_FAILED(ret = svcSendSyncRequest(serviceHandle))) return ret;
|
||||||
|
|
||||||
if(out) *out = cmdbuf[2];
|
if(out) memcpy(out, &cmdbuf[2], sizeof(FS_SdMmcSpeedInfo));
|
||||||
|
|
||||||
return (Result) cmdbuf[1];
|
return (Result) cmdbuf[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
Result FSPXI_GetNandSpeedInfo(Handle serviceHandle, u32* out)
|
Result FSPXI_GetNandSpeedInfo(Handle serviceHandle, FS_SdMmcSpeedInfo* out)
|
||||||
{
|
{
|
||||||
Result ret = 0;
|
Result ret = 0;
|
||||||
u32* cmdbuf = getThreadCommandBuffer();
|
u32* cmdbuf = getThreadCommandBuffer();
|
||||||
@ -595,7 +595,7 @@ Result FSPXI_GetNandSpeedInfo(Handle serviceHandle, u32* out)
|
|||||||
|
|
||||||
if(R_FAILED(ret = svcSendSyncRequest(serviceHandle))) return ret;
|
if(R_FAILED(ret = svcSendSyncRequest(serviceHandle))) return ret;
|
||||||
|
|
||||||
if(out) *out = cmdbuf[2];
|
if(out) memcpy(out, &cmdbuf[2], sizeof(FS_SdMmcSpeedInfo));
|
||||||
|
|
||||||
return (Result) cmdbuf[1];
|
return (Result) cmdbuf[1];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user