libctru
v2.4.1
|
OS related stuff. More...
#include "svc.h"
Go to the source code of this file.
Data Structures | |
struct | osKernelConfig_s |
Kernel configuration page (read-only). More... | |
struct | osTimeRef_s |
Time reference information struct (filled in by PTM). More... | |
struct | osSharedConfig_s |
Shared system configuration page structure (read-only or read-write depending on exheader). More... | |
struct | TickCounter |
Tick counter. More... | |
struct | OS_VersionBin |
OS_VersionBin. Format of the system version: "<major>.<minor>.<build>-<nupver><region>". More... | |
Macros | |
#define | SYSCLOCK_SOC (16756991u) |
< The external clock rate for the SoC. More... | |
#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 svcGetSystemTick. | |
#define | SYSCLOCK_ARM11 (SYSCLOCK_ARM9 * 2) |
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_USEC (SYSCLOCK_ARM11 / 1000000.0) |
#define | SYSTEM_VERSION(major, minor, revision) (((major)<<24)|((minor)<<16)|((revision)<<8)) |
Packs a system version from its components. | |
#define | GET_VERSION_MAJOR(version) ((version) >>24) |
Retrieves the major version from a packed system version. | |
#define | GET_VERSION_MINOR(version) (((version)>>16)&0xFF) |
Retrieves the minor version from a packed system version. | |
#define | GET_VERSION_REVISION(version) (((version)>> 8)&0xFF) |
Retrieves the revision version from a packed system version. | |
#define | OS_HEAP_AREA_BEGIN 0x08000000 |
Start of the heap area in the virtual address space. | |
#define | OS_HEAP_AREA_END 0x0E000000 |
End of the heap area in the virtual address space. | |
#define | OS_MAP_AREA_BEGIN 0x10000000 |
Start of the mappable area in the virtual address space. | |
#define | OS_MAP_AREA_END 0x14000000 |
End of the mappable area in the virtual address space. | |
#define | OS_OLD_FCRAM_VADDR 0x14000000 |
Old pre-8.x linear FCRAM mapping virtual address. | |
#define | OS_OLD_FCRAM_PADDR 0x20000000 |
Old pre-8.x linear FCRAM mapping physical address. | |
#define | OS_OLD_FCRAM_SIZE 0x8000000 |
Old pre-8.x linear FCRAM mapping size (128 MiB) | |
#define | OS_QTMRAM_VADDR 0x1E800000 |
New3DS QTM memory virtual address. | |
#define | OS_QTMRAM_PADDR 0x1F000000 |
New3DS QTM memory physical address. | |
#define | OS_QTMRAM_SIZE 0x400000 |
New3DS QTM memory size (4 MiB; last 128 KiB reserved by kernel) | |
#define | OS_MMIO_VADDR 0x1EC00000 |
Memory mapped IO range virtual address. | |
#define | OS_MMIO_PADDR 0x10100000 |
Memory mapped IO range physical address. | |
#define | OS_MMIO_SIZE 0x400000 |
Memory mapped IO range size (4 MiB) | |
#define | OS_VRAM_VADDR 0x1F000000 |
VRAM virtual address. | |
#define | OS_VRAM_PADDR 0x18000000 |
VRAM physical address. | |
#define | OS_VRAM_SIZE 0x600000 |
VRAM size (6 MiB) | |
#define | OS_DSPRAM_VADDR 0x1FF00000 |
DSP memory virtual address. | |
#define | OS_DSPRAM_PADDR 0x1FF00000 |
DSP memory physical address. | |
#define | OS_DSPRAM_SIZE 0x80000 |
DSP memory size (512 KiB) | |
#define | OS_KERNELCFG_VADDR 0x1FF80000 |
Kernel configuration page virtual address. | |
#define | OS_SHAREDCFG_VADDR 0x1FF81000 |
Shared system configuration page virtual address. | |
#define | OS_FCRAM_VADDR 0x30000000 |
Linear FCRAM mapping virtual address. | |
#define | OS_FCRAM_PADDR 0x20000000 |
Linear FCRAM mapping physical address. | |
#define | OS_FCRAM_SIZE 0x10000000 |
Linear FCRAM mapping size (256 MiB) | |
#define | OS_KernelConfig ((osKernelConfig_s const*)OS_KERNELCFG_VADDR) |
Pointer to the kernel configuration page (see osKernelConfig_s) | |
#define | OS_SharedConfig ((osSharedConfig_s*)OS_SHAREDCFG_VADDR) |
Pointer to the shared system configuration page (see osSharedConfig_s) | |
Functions | |
u32 | osConvertVirtToPhys (const void *vaddr) |
Converts an address from virtual (process) memory to physical memory. More... | |
void * | osConvertOldLINEARMemToNew (const void *vaddr) |
Converts 0x14* vmem to 0x30*. More... | |
const char * | osStrError (Result error) |
Retrieves basic information about a service error. More... | |
static u32 | osGetFirmVersion (void) |
Gets the system's FIRM version. More... | |
static u32 | osGetKernelVersion (void) |
Gets the system's kernel version. More... | |
static u32 | osGetSystemCoreVersion (void) |
Gets the system's "core version" (2 on NATIVE_FIRM, 3 on SAFE_FIRM, etc.) | |
static u32 | osGetApplicationMemType (void) |
Gets the system's memory layout ID (0-5 on Old 3DS, 6-8 on New 3DS) | |
static u32 | osGetMemRegionSize (MemRegion region) |
Gets the size of the specified memory region. More... | |
static u32 | osGetMemRegionUsed (MemRegion region) |
Gets the number of used bytes within the specified memory region. More... | |
static u32 | osGetMemRegionFree (MemRegion region) |
Gets the number of free bytes within the specified memory region. More... | |
osTimeRef_s | osGetTimeRef (void) |
Reads the latest reference timepoint published by PTM. More... | |
u64 | osGetTime (void) |
Gets the current time. More... | |
static void | osTickCounterStart (TickCounter *cnt) |
Starts a tick counter. More... | |
static void | osTickCounterUpdate (TickCounter *cnt) |
Updates the elapsed time in a tick counter. More... | |
double | osTickCounterRead (const TickCounter *cnt) |
Reads the elapsed time in a tick counter. More... | |
static u8 | osGetWifiStrength (void) |
Gets the current Wifi signal strength. More... | |
static float | osGet3DSliderState (void) |
Gets the state of the 3D slider. More... | |
static bool | osIsHeadsetConnected (void) |
Checks whether a headset is connected. More... | |
void | osSetSpeedupEnable (bool enable) |
Configures the New 3DS speedup. More... | |
Result | osGetSystemVersionData (OS_VersionBin *nver_versionbin, OS_VersionBin *cver_versionbin) |
Gets the NAND system-version stored in NVer/CVer. More... | |
Result | osGetSystemVersionDataString (OS_VersionBin *nver_versionbin, OS_VersionBin *cver_versionbin, char *sysverstr, u32 sysverstr_maxsize) |
This is a wrapper for osGetSystemVersionData. More... | |
OS related stuff.
#define SYSCLOCK_SOC (16756991u) |
< The external clock rate for the SoC.
The base system clock rate (for I2C, NDMA, etc.).
void* osConvertOldLINEARMemToNew | ( | const void * | vaddr | ) |
Converts 0x14* vmem to 0x30*.
vaddr | Input virtual address. |
u32 osConvertVirtToPhys | ( | const void * | vaddr | ) |
Converts an address from virtual (process) memory to physical memory.
vaddr | Input virtual address. |
|
inlinestatic |
Gets the state of the 3D slider.
|
inlinestatic |
Gets the system's FIRM version.
This can be used to compare system versions easily with SYSTEM_VERSION.
|
inlinestatic |
Gets the system's kernel version.
This can be used to compare system versions easily with SYSTEM_VERSION.
Gets the number of free bytes within the specified memory region.
region | Memory region to check. |
Gets the size of the specified memory region.
region | Memory region to check. |
Gets the number of used bytes within the specified memory region.
region | Memory region to check. |
Result osGetSystemVersionData | ( | OS_VersionBin * | nver_versionbin, |
OS_VersionBin * | cver_versionbin | ||
) |
Gets the NAND system-version stored in NVer/CVer.
nver_versionbin | Output OS_VersionBin structure for the data read from NVer. |
cver_versionbin | Output OS_VersionBin structure for the data read from CVer. |
Result osGetSystemVersionDataString | ( | OS_VersionBin * | nver_versionbin, |
OS_VersionBin * | cver_versionbin, | ||
char * | sysverstr, | ||
u32 | sysverstr_maxsize | ||
) |
This is a wrapper for osGetSystemVersionData.
nver_versionbin | Optional output OS_VersionBin structure for the data read from NVer, can be NULL. |
cver_versionbin | Optional output OS_VersionBin structure for the data read from CVer, can be NULL. |
sysverstr | Output string where the printed system-version will be written, in the same format displayed by the System Settings title. |
sysverstr_maxsize | Max size of the above string buffer, including NULL-terminator. |
u64 osGetTime | ( | void | ) |
Gets the current time.
osTimeRef_s osGetTimeRef | ( | void | ) |
Reads the latest reference timepoint published by PTM.
|
inlinestatic |
Gets the current Wifi signal strength.
Valid values are 0-3:
Values outside the range of 0-3 should never be returned.
These values correspond with the number of wifi bars displayed by Home Menu.
|
inlinestatic |
Checks whether a headset is connected.
void osSetSpeedupEnable | ( | bool | enable | ) |
Configures the New 3DS speedup.
enable | Specifies whether to enable or disable the speedup. |
const char* osStrError | ( | Result | error | ) |
Retrieves basic information about a service error.
error | Error to retrieve information about. |
This can be used to get some details about an error returned by a service call.
double osTickCounterRead | ( | const TickCounter * | cnt | ) |
Reads the elapsed time in a tick counter.
cnt | The tick counter. |
|
inlinestatic |
Starts a tick counter.
cnt | The tick counter. |
|
inlinestatic |
Updates the elapsed time in a tick counter.
cnt | The tick counter. |