Difference between revisions of "PSC services"

From Nintendo Switch Brew
Jump to navigation Jump to search
(Document a bit more of time 9.0.0)
(13 intermediate revisions by 2 users not shown)
Line 155: Line 155:
 
| 12001 || [8.0.0+]
 
| 12001 || [8.0.0+]
 
|-
 
|-
| 13000 || [8.0.0+]
+
| 13000 || [8.0.0+] [[#OpenSyslogLogger]]
 
|-
 
|-
 
| 13001 || [8.0.0+]
 
| 13001 || [8.0.0+]
Line 174: Line 174:
 
|}
 
|}
  
== Cmd13000 ==
+
[10.0.0+] Cmd20100 now takes an additional 0x10-bytes of input.
 +
 
 +
== OpenSyslogLogger ==
 
Takes a type-0x5 input buffer, no output.
 
Takes a type-0x5 input buffer, no output.
  
[9.0.0+] No input, returns a total of 0xC-bytes of output, an [[#IUnknown0]], and a handle.
+
[9.0.0+] No input, returns a total of 0xC-bytes of output, an [[#ISyslogLogger]], and a handle.
  
== IUnknown0 ==
+
== ISyslogLogger ==
Added with [9.0.0+].
+
This is "nn::srepo::detail::ipc::ISyslogLogger".
 +
 
 +
This was added with [9.0.0+].
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 245: Line 249:
  
 
This was added with [9.0.0+].
 
This was added with [9.0.0+].
 +
 +
This service has max_sessions 1.
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 250: Line 256:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 || [[#GetUserStaticService]]
+
| 0 || [[#GetStaticServiceAsUser]]
 
|-
 
|-
| 5 || [[#GetAdminStaticService]]
+
| 5 || [[#GetStaticServiceAsAdmin]]
 
|-
 
|-
| 6 || [[#GetRepairStaticService]]
+
| 6 || [[#GetStaticServiceAsRepair]]
 
|-
 
|-
| 9 || [[#GetManufactureStaticService]]
+
| 9 || [[#GetStaticServiceAsServiceManager]]
 
|-
 
|-
| 10 || [[#SetupStandardSteadyClock]]
+
| 10 || [[#SetupStandardSteadyClockCore]]
 
|-
 
|-
| 11 || [[#SetupStandardLocalSystemClock]]
+
| 11 || [[#SetupStandardLocalSystemClockCore]]
 
|-
 
|-
| 12 || [[#SetupStandardNetworkSystemClock]]
+
| 12 || [[#SetupStandardNetworkSystemClockCore]]
 
|-
 
|-
| 13 || [[#SetupStandardUserSystemClock]]
+
| 13 || [[#SetupStandardUserSystemClockCore]]
 
|-
 
|-
| 14 || [[#SetupTimeZoneManager]]
+
| 14 || [[#SetupTimeZoneServiceCore]]
 
|-
 
|-
| 15 || [[#SetupEphemeralNetworkSystemClock]]
+
| 15 || [[#SetupEphemeralNetworkSystemClockCore]]
 
|-
 
|-
| 50 ||
+
| 50 || GetStandardLocalClockOperationEvent
 
|-
 
|-
| 51 ||
+
| 51 || GetStandardNetworkClockOperationEventForServiceManager
 
|-
 
|-
| 52 ||
+
| 52 || GetEphemeralNetworkClockOperationEventForServiceManager
 
|-
 
|-
| 60 || GetStandardUserSystemClockAutomaticCorrectionEvent
+
| 60 || GetStandardUserSystemClockAutomaticCorrectionUpdatedEvent
 
|-
 
|-
| 100 || [[#SetStandardSteadyClockRtcOffset]]
+
| 100 || [[#SetStandardSteadyClockBaseTime]]
 
|-
 
|-
| 200 || GetAlarmRegistrationEvent
+
| 200 || GetClosestAlarmUpdatedEvent
 
|-
 
|-
| 201 || [[#UpdateSteadyAlarms]]
+
| 201 || [[#CheckAndSignalAlarms]]
 
|-
 
|-
| 202 ||
+
| 202 || GetClosestAlarmInfo
 
|}
 
|}
  
== GetUserStaticService ==
+
== GetStaticServiceAsUser ==
 
Returns an [[#IStaticService]].
 
Returns an [[#IStaticService]].
  
This is used for the wrapped instance of "time:u" in glue.
+
This is used for the wrapped instance of "time:u" in [[Glue_services#time:a.2C_time:r.2C_time:u|glue]].
  
== GetAdminStaticService  ==
+
== GetStaticServiceAsAdmin ==
 
Returns an [[#IStaticService]].
 
Returns an [[#IStaticService]].
  
This is used for the wrapped instance of "time:a" in glue.
+
This is used for the wrapped instance of "time:a" in [[Glue_services#time:a.2C_time:r.2C_time:u|glue]].
  
== GetRepairStaticService ==
+
== GetStaticServiceAsRepair ==
 
Returns an [[#IStaticService]].
 
Returns an [[#IStaticService]].
  
This is used for the wrapped instance of "time:r" in glue.
+
This is used for the wrapped instance of "time:r" in [[Glue_services#time:a.2C_time:r.2C_time:u|glue]].
  
== GetManufactureStaticService ==
+
== GetStaticServiceAsServiceManager ==
 
Returns an [[#IStaticService]].
 
Returns an [[#IStaticService]].
  
This seems unused.
+
This is used as a wrapper for "time:sm".
  
== SetupStandardSteadyClock ==
+
== SetupStandardSteadyClockCore ==
 
Takes an input rtc_clock_source UUID, an input rtc_offset s64, an input internal_offset s64, an input test_offset s64 and a is_rtc_reset_detected bool. No output.
 
Takes an input rtc_clock_source UUID, an input rtc_offset s64, an input internal_offset s64, an input test_offset s64 and a is_rtc_reset_detected bool. No output.
  
== SetupStandardLocalSystemClock ==
+
== SetupStandardLocalSystemClockCore ==
 
Takes an input [[#SystemClockContext]] and an input [[#PosixTime]]. No output.
 
Takes an input [[#SystemClockContext]] and an input [[#PosixTime]]. No output.
  
== SetupStandardNetworkSystemClock ==
+
== SetupStandardNetworkSystemClockCore ==
 
Takes an input [[#SystemClockContext]] and an input sufficient_accuracy_minutes u64. No output.
 
Takes an input [[#SystemClockContext]] and an input sufficient_accuracy_minutes u64. No output.
  
== SetupStandardUserSystemClock ==
+
== SetupStandardUserSystemClockCore ==
 
Takes an input automatic_correction bool and an input [[#SteadyClockTimePoint]]. No output.
 
Takes an input automatic_correction bool and an input [[#SteadyClockTimePoint]]. No output.
  
== SetupTimeZoneManager ==
+
== SetupTimeZoneServiceCore ==
 
Takes an input [[#LocationName]], an input [[#SteadyClockTimePoint]], an input total_location_name_count u32, an input [[#TimeZoneRuleVersion]] and a type-0x21 input buffer containing a TimeZoneBinary. No output.
 
Takes an input [[#LocationName]], an input [[#SteadyClockTimePoint]], an input total_location_name_count u32, an input [[#TimeZoneRuleVersion]] and a type-0x21 input buffer containing a TimeZoneBinary. No output.
  
== SetupEphemeralNetworkSystemClock ==
+
== SetupEphemeralNetworkSystemClockCore ==
 
No input, no output.
 
No input, no output.
  
== SetStandardSteadyClockRtcOffset ==
+
== SetStandardSteadyClockBaseTime ==
 
An input rtc_offset s64, no output.
 
An input rtc_offset s64, no output.
  
== UpdateSteadyAlarms ==
+
== CheckAndSignalAlarms ==
 
No input, no output.
 
No input, no output.
  
Line 335: Line 341:
  
 
This was added with [9.0.0+].
 
This was added with [9.0.0+].
 +
 +
This has max_sessions 4.
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 340: Line 348:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 ||
+
| 0 || [[#CreateWakeupAlarm]]
 
|-
 
|-
| 1 ||
+
| 1 || [[#CreateBackgroundTaskAlarm]]
 
|}
 
|}
  
Cmd0/cmd1: no input, returns an [[#ISteadyClockAlarm]].
+
== CreateWakeupAlarm ==
 +
No input. Returns an [[#ISteadyClockAlarm]].
 +
 
 +
== CreateBackgroundTaskAlarm ==
 +
No input. Returns an [[#ISteadyClockAlarm]].
  
 
== ISteadyClockAlarm ==
 
== ISteadyClockAlarm ==
Line 356: Line 368:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 || GetWakeUpEvent
+
| 0 || GetAlarmEvent
 
|-
 
|-
 
| 1 || Enable
 
| 1 || Enable
Line 364: Line 376:
 
| 3 || IsEnabled
 
| 3 || IsEnabled
 
|-
 
|-
| 10 ||
+
| 10 || [[#CreateWakeLock]]
 
|-
 
|-
| 11 ||
+
| 11 || [[#DestroyWakeLock]]
 
|}
 
|}
  
=== Cmd10 ===
+
=== CreateWakeLock ===
 
Opens a session for [[#psc:l|psc:l]] and returns it's interface.
 
Opens a session for [[#psc:l|psc:l]] and returns it's interface.
  
=== Cmd11 ===
+
=== DestroyWakeLock ===
Close the session opened by [[#Cmd10]] when the alarm is disabled.
+
Close the session opened by [[#CreateWakeLock]] when the alarm is disabled.
  
 
= time:p =
 
= time:p =
Line 379: Line 391:
  
 
This was added with [9.0.0+].
 
This was added with [9.0.0+].
 +
 +
This service has max_sessions 1.
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 384: Line 398:
 
! Cmd || Name
 
! Cmd || Name
 
|-
 
|-
| 0 ||
+
| 0 || GetPowerStateRequestEventReadableHandle
 
|-
 
|-
| 1 ||
+
| 1 || GetAndClearPowerStateRequest
 
|}
 
|}
  
Line 393: Line 407:
  
 
These were added with [9.0.0+].
 
These were added with [9.0.0+].
 +
 +
The time:su service has max_sessions 6, and time:s has max_sessions 4.
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 694: Line 710:
 
Takes an input u32 '''InsID''' and an input u64 (unused, official software passes struct pointer). Returns an output Event handle with autoclear disabled.
 
Takes an input u32 '''InsID''' and an input u64 (unused, official software passes struct pointer). Returns an output Event handle with autoclear disabled.
  
= PSC Module IDs =
+
= PmModuleId =
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! ID || Module
+
! Name || Module
 +
|-
 +
| 0x00 ||
 +
|-
 +
| 0x01 ||
 +
|-
 +
| 0x02 ||
 
|-
 
|-
 
| 0x03 ||
 
| 0x03 ||
 
|-
 
|-
| 0x04 || [[USB services|USB]]
+
| 0x04 || [[USB_services|Usb]]
 +
|-
 +
| 0x05 || [[Sockets_services|Ethernet]]
 +
|-
 +
| 0x06 || [[PTM_services|Fgm]]
 +
|-
 +
| 0x07 || [[PCV_services|PcvClock]]
 +
|-
 +
| 0x08 || [[PCV_services|PcvVoltage]]
 +
|-
 +
| 0x09 || [[Bus_services|Gpio]]
 +
|-
 +
| 0x0A || [[Bus_services|Pinmux]]
 +
|-
 +
| 0x0B || [[Bus_services|Uart]]
 +
|-
 +
| 0x0C || [[Bus_services|I2c]]
 +
|-
 +
| 0x0D || [[Bus_services|I2cPcv]]
 
|-
 
|-
| 0x05 ||
+
| 0x0E || [[Bus_services|Spi]]
 
|-
 
|-
| 0x07 || [[PCV services|Pcv]]
+
| 0x0F || [[Bus_services|Pwm]]
 
|-
 
|-
| 0x08 || [[PCV services|Pcv:Imm]]
+
| 0x10 || [[PTM_services|Psm]]
 
|-
 
|-
| 0x09 || [[Bus services|Gpio]]
+
| 0x11 || [[PTM_services|Tc]]
 
|-
 
|-
| 0x0A || [[Bus services|Pinmux]]
+
| 0x12 || [[Applet_Manager_services|Omm]]
 
|-
 
|-
| 0x0B || [[Bus services|Uart]]
+
| 0x13 || [[PCIe_services|Pcie]]
 
|-
 
|-
| 0x0C || [[Bus services|I2c]]
+
| 0x14 || [[Backlight_services|Lbl]]
 
|-
 
|-
| 0x0D || [[Bus services|I2c:Pcv]]
+
| 0x15 || [[Nvnflinger_services|Display]]
 
|-
 
|-
| 0x0E || [[Bus services|Sasbus]]
+
| 0x16 ||
 
|-
 
|-
| 0x0F || [[Bus services|Pwm]]
+
| 0x17 ||
 
|-
 
|-
| 0x10 ||
+
| 0x18 || [[HID_services|Hid]]
 
|-
 
|-
| 0x13 || [[PCIe services|PCIe]]
+
| 0x19 || [[WLAN_services|WlanSockets]]
 
|-
 
|-
| 0x14 || [[Backlight services|Backlight]]
+
| 0x1A ||
 
|-
 
|-
| 0x15 || [[Nvnflinger services|Nvnflinger]]
+
| 0x1B || [[Filesystem_services|Fs]]
 
|-
 
|-
| 0x18 || [[HID services|nn::psc::PmModuleId_Hid]]
+
| 0x1C || [[Audio_services|Audio]]
 
|-
 
|-
| 0x1B ||
+
| 0x1D ||
 
|-
 
|-
| 0x1C || [[Audio services|Audio]]
+
| 0x1E || [[TMA_services|TmaHostIo]]
 
|-
 
|-
| 0x1E ||
+
| 0x1F || [[Bluetooth_Driver_services|Bluetooth]]
 
|-
 
|-
| 0x1F || [[Bluetooth Driver services|Bluetooth]]
+
| 0x20 || [[PCV_services|Bpc]]
 
|-
 
|-
| 0x20 || [[PCV services|Bpc]]
+
| 0x21 || [[PTM_services|Fan]]
 
|-
 
|-
| 0x21 || [[PTM services|Ptm]]
+
| 0x22 || [[PTM_services|Pcm]]
 
|-
 
|-
| 0x23 || [[NFC services|nn::psc::PmModuleId_Nfc]]
+
| 0x23 || [[NFC_services|Nfc]]
 
|-  
 
|-  
| 0x24 || [[PPC services|Ppc]]
+
| 0x24 || [[PTM_services|Apm]]
 +
|-
 +
| 0x25 || [[BTM_services|Btm]]
 +
|-
 +
| 0x26 || [[Network_Interface_services|Nifm]]
 +
|-
 +
| 0x27 || [[Bus_services|GpioLow]]
 +
|-
 +
| 0x28 || [[NPNS_services|Npns]]
 +
|-
 +
| 0x29 || [[Log_services|Lm]]
 +
|-
 +
| 0x2A || [[BCAT_services|Bcat]]
 +
|-
 +
| 0x2B || [[Glue_services|Time]]
 +
|-
 +
| 0x2C || [[Parental_Control_services|Pctl]]
 +
|-
 +
| 0x2D || [[Error_Report_services|Erpt]]
 +
|-
 +
| 0x2E || [[Error_Upload_services|Eupld]]
 +
|-
 +
| 0x2F || [[Friend_services|Friends]]
 +
|-
 +
| 0x30 || [[Glue_services|Bgtc]]
 +
|-
 +
| 0x31 || [[Account_services|Account]]
 +
|-
 +
| 0x32 || [[Bus_services|Sasbus]]
 
|-
 
|-
| 0x25 ||
+
| 0x33 || [[NIM_services|Ntc]]
 
|-
 
|-
| 0x26 || [[Network Interface services|Nifm]]
+
| 0x34 || [[Applet_Manager_services|Idle]]
 
|-
 
|-
| 0x28 || [[NPNS services|Npns]]
+
| 0x35 || [[Applet_Manager_services|Tcap]]
 
|-
 
|-
| 0x29 || [[Log services|nn::psc::PmModuleId_Lm]]
+
| 0x36 || [[PTM_services|PsmLow]]
 
|-
 
|-
| 0x2A || [[BCAT services|Bcat]]
+
| 0x37 || [[LDN_services|Ndd]]
 
|-
 
|-
| 0x2B || [[PCV services|Time]]
+
| 0x38 || [[OLSC_services|Olsc]]
 
|-
 
|-
| 0x2C || [[Parental Control services|Pctl]]
+
| 0x39 || [[PCV_services|Rtc]]
 
|-
 
|-
| 0x2D || [[Error Report services|Erpt]]
+
| 0x3A ||
 
|-
 
|-
| 0x2E || [[Error Upload services|Eupld]]
+
| 0x3B ||
 
|-
 
|-
| 0x2F || [[Friend services|Friend]]
+
| 0x3C ||
 
|-
 
|-
| 0x30 || [[Glue services|Glue]]
+
| 0x3D || [[NS_Services|Ns]]
 
|-
 
|-
| 0x31 || [[Account services|Account]]
+
| 0x3F || [[Applet_Manager_services|NotificationPresenter]]
 
|-
 
|-
| 0x32 || [[Bus services|SasBus]]
+
| 0x65 || [[NV_services|Nvservices]]
 
|-
 
|-
| 0x65 || [[NV services|NV]]
+
| 0x7F || [[Applet_Manager_services|Spsm]]
 
|}
 
|}
  
Line 781: Line 849:
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
|-
 
|-
! ID || Name || Description
+
! State || Name || Description
 
|-
 
|-
 
| Awake || 0 || Everything is awake.
 
| Awake || 0 || Everything is awake.

Revision as of 02:01, 15 April 2020

PSC (Power State Control) provides services related to power state changes in the system.

Concept

psc:m allows a process to register a module that depends on power management in some way. A client calls GetPmModule to receive an IPmModule (Power Managed Module), and then calls IPmModule->Initialize(module_id, module_dependency_list) where module_id is the ModuleId enum member for the client, and the dependency list is an array of module IDs for the modules that this depends on. Initialize() returns an event handle that the client can wait on to be notified of a power state change.

psc:c allows a module to the power state controller for the system (in practice, AM is the only client to the controller). IPmControl->DispatchRequest() is used notify all IPmModules of a state change.

For example, FS registers itself as an IPmModule with dependencies on pinmux, gpio, pcv, tma, and initializes the SD card once those dependencies have registered..

It then does (basically) the following pseudocode (actual code located at .text + 0xB2DB0 in 6.0.0 FS):

   while (true) {
       Fs_IPmModule->WaitSignaled();
       
       Fs_IPmModule->GetRequest(&state);
       switch (state) {
           case WakingUp:
               /* hardware devices are woken up here */
           case GoingToSleep:
               /* hardware devices are put to sleep here */
           case ShuttingDown:
               /* hardware devices are turned off here */
       }
       
       Fs_IPmModule->Acknowledge(state);
   }

psc:c

This is "nn::psc::sf::IPmControl".

Cmd Name
0 Initialize
1 DispatchRequest
2 GetResult
3 GetState
4 Cancel
5 [1.0.0-6.2.0] PrintModuleInformation
6 GetModuleInformation
10 [9.0.0+]
11 [9.0.0+]

psc:m

This is "nn::psc::sf::IPmService".

Cmd Name Notes
0 GetPmModule Returns an #IPmModule.

IPmModule

This is "nn::psc::sf::IPmModule".

Cmd Name
0 Initialize
1 GetRequest
2 Acknowledge
3 Finalize
4 [5.1.0+] AcknowledgeEx

psc:l

This was added with [9.0.0+].

Cmd Name
0
1
2
3
4

srepo:u, srepo:a

These are "nn::srepo::detail::ipc::ISrepoService".

These were added with [5.0.0+].

Cmd Name
10100
10101 [6.0.0+]
10200 [6.0.0+]
10201 [6.0.0+]
11000 [6.0.0+]
11001 [6.0.0+]
11002 [6.0.0+]
11003 [6.0.0+]
11004 [6.0.0+]
11100 [6.0.0+]
11200 [6.0.0+]
11300 [6.0.0+]
11400 [6.0.0+]
11500 [6.0.0+]
11600 [6.0.0+]
11601 [6.0.0+]
11602 [6.0.0+]
11700 [6.0.0+]
11800 [6.0.0+]
11801 [6.0.0+]
11810 [8.0.0+]
11811 [8.0.0+]
12000 [8.0.0+]
12001 [8.0.0+]
13000 [8.0.0+] #OpenSyslogLogger
13001 [8.0.0+]
20100
20200
20300 [6.0.0+]
20400 [6.0.0+]
20401 [6.0.0+]
20402 [7.0.0+]
20500 [8.0.0+]

[10.0.0+] Cmd20100 now takes an additional 0x10-bytes of input.

OpenSyslogLogger

Takes a type-0x5 input buffer, no output.

[9.0.0+] No input, returns a total of 0xC-bytes of output, an #ISyslogLogger, and a handle.

ISyslogLogger

This is "nn::srepo::detail::ipc::ISyslogLogger".

This was added with [9.0.0+].

Cmd Name
0

Cmd0: no input, returns a total of 8-bytes of output.

ovln:rcv

This is "nn::ovln::IReceiverService".

Cmd Name
0 OpenReceiver

IReceiver

This is "nn::ovln::IReceiver".

Cmd Name
0 AddSource
1 RemoveSource
2 GetReceiveEventHandle
3 Receive
4 ReceiveWithTick

ovln:snd

This is "nn::ovln::ISenderService".

Cmd Name
0 OpenSender

ISender

This is "nn::ovln::ISender".

Cmd Name
0 Send
1 GetUnreceivedMessageCount

time:m

This is "nn::timesrv::detail::service::ITimeServiceManager".

This was added with [9.0.0+].

This service has max_sessions 1.

Cmd Name
0 #GetStaticServiceAsUser
5 #GetStaticServiceAsAdmin
6 #GetStaticServiceAsRepair
9 #GetStaticServiceAsServiceManager
10 #SetupStandardSteadyClockCore
11 #SetupStandardLocalSystemClockCore
12 #SetupStandardNetworkSystemClockCore
13 #SetupStandardUserSystemClockCore
14 #SetupTimeZoneServiceCore
15 #SetupEphemeralNetworkSystemClockCore
50 GetStandardLocalClockOperationEvent
51 GetStandardNetworkClockOperationEventForServiceManager
52 GetEphemeralNetworkClockOperationEventForServiceManager
60 GetStandardUserSystemClockAutomaticCorrectionUpdatedEvent
100 #SetStandardSteadyClockBaseTime
200 GetClosestAlarmUpdatedEvent
201 #CheckAndSignalAlarms
202 GetClosestAlarmInfo

GetStaticServiceAsUser

Returns an #IStaticService.

This is used for the wrapped instance of "time:u" in glue.

GetStaticServiceAsAdmin

Returns an #IStaticService.

This is used for the wrapped instance of "time:a" in glue.

GetStaticServiceAsRepair

Returns an #IStaticService.

This is used for the wrapped instance of "time:r" in glue.

GetStaticServiceAsServiceManager

Returns an #IStaticService.

This is used as a wrapper for "time:sm".

SetupStandardSteadyClockCore

Takes an input rtc_clock_source UUID, an input rtc_offset s64, an input internal_offset s64, an input test_offset s64 and a is_rtc_reset_detected bool. No output.

SetupStandardLocalSystemClockCore

Takes an input #SystemClockContext and an input #PosixTime. No output.

SetupStandardNetworkSystemClockCore

Takes an input #SystemClockContext and an input sufficient_accuracy_minutes u64. No output.

SetupStandardUserSystemClockCore

Takes an input automatic_correction bool and an input #SteadyClockTimePoint. No output.

SetupTimeZoneServiceCore

Takes an input #LocationName, an input #SteadyClockTimePoint, an input total_location_name_count u32, an input #TimeZoneRuleVersion and a type-0x21 input buffer containing a TimeZoneBinary. No output.

SetupEphemeralNetworkSystemClockCore

No input, no output.

SetStandardSteadyClockBaseTime

An input rtc_offset s64, no output.

CheckAndSignalAlarms

No input, no output.

time:al

This is "nn::timesrv::detail::service::IAlarmService".

This was added with [9.0.0+].

This has max_sessions 4.

Cmd Name
0 #CreateWakeupAlarm
1 #CreateBackgroundTaskAlarm

CreateWakeupAlarm

No input. Returns an #ISteadyClockAlarm.

CreateBackgroundTaskAlarm

No input. Returns an #ISteadyClockAlarm.

ISteadyClockAlarm

This is "nn::timesrv::detail::service::ISteadyClockAlarm".

This was added with [9.0.0+].

Cmd Name
0 GetAlarmEvent
1 Enable
2 Disable
3 IsEnabled
10 #CreateWakeLock
11 #DestroyWakeLock

CreateWakeLock

Opens a session for psc:l and returns it's interface.

DestroyWakeLock

Close the session opened by #CreateWakeLock when the alarm is disabled.

time:p

This is "nn::timesrv::detail::service::IPowerStateRequestHandler".

This was added with [9.0.0+].

This service has max_sessions 1.

Cmd Name
0 GetPowerStateRequestEventReadableHandle
1 GetAndClearPowerStateRequest

time:su, time:s

These are "nn::timesrv::detail::service::IStaticService".

These were added with [9.0.0+].

The time:su service has max_sessions 6, and time:s has max_sessions 4.

Cmd Name Notes
0 GetStandardUserSystemClock Returns an #ISystemClock.
1 GetStandardNetworkSystemClock Returns an #ISystemClock.
2 GetStandardSteadyClock Returns an #ISteadyClock.
3 GetTimeZoneService Returns an #ITimeZoneService.
4 GetStandardLocalSystemClock Returns an #ISystemClock.
5 [4.0.0+] GetEphemeralNetworkSystemClock Returns an #ISystemClock.
20 [6.0.0+] GetSharedMemoryNativeHandle
30 [6.0.0-8.1.0] GetStandardNetworkClockOperationEventReadableHandle
31 [6.0.0-8.1.0] GetEphemeralNetworkClockOperationEventReadableHandle
50 [4.0.0+] SetStandardSteadyClockInternalOffset
51 [9.0.0+] GetStandardSteadyClockRtcValue
100 IsStandardUserSystemClockAutomaticCorrectionEnabled
101 SetStandardUserSystemClockAutomaticCorrectionEnabled
102 [5.0.0+] GetStandardUserSystemClockInitialYear
200 [3.0.0+] IsStandardNetworkSystemClockAccuracySufficient
201 [6.0.0+] GetStandardUserSystemClockAutomaticCorrectionUpdatedTime
300 [4.0.0+] CalculateMonotonicSystemClockBaseTimePoint
400 [4.0.0+] GetClockSnapshot
401 [4.0.0+] GetClockSnapshotFromSystemClockContext
500 [4.0.0+] CalculateStandardUserSystemClockDifferenceByUser
501 [4.0.0+] CalculateSpanBetween

ISteadyClock

This is "nn::timesrv::detail::service::ISteadyClock".

Cmd Name Notes
0 GetCurrentTimePoint No input, returns an output #SteadyClockTimePoint.
2 GetTestOffset No input, returns an output #TimeSpanType.
3 SetTestOffset Takes an input #TimeSpanType, no output.
100 [2.0.0+] GetRtcValue No input, returns an output s64.
101 [2.0.0+] IsRtcResetDetected No input, returns an output u8 bool.
102 [2.0.0+] GetSetupResultValue No input, returns an output u32.
200 [3.0.0+] GetInternalOffset No input, returns an output #TimeSpanType.
201 [3.0.0-3.0.2] SetInternalOffset Takes an input #TimeSpanType, no output.

SteadyClockTimePoint

Offset Size Description
0x0 0x8 A u64 representing a point in time.
0x8 0x10 An ID representing the clock source.

This is a 0x18-byte struct.

TimeSpanType

This is an u64.

ISystemClock

This is "nn::timesrv::detail::service::ISystemClock".

Cmd Name Notes
0 GetCurrentTime Returns an output #PosixTime.
1 SetCurrentTime Takes an input #PosixTime.
2 GetSystemClockContext Returns an output #SystemClockContext.
3 SetSystemClockContext Takes an input #SystemClockContext.
4 [9.0.0+] GetOperationEventReadableHandle

PosixTime

This is an s64 for UTC POSIX time.

SystemClockContext

This is an 0x20-byte struct.

Offset Size Description
0x0 0x8 a #PosixTime representing the system clock epoch.
0x8 0x18 a #SteadyClockTimePoint

ITimeZoneService

This is "nn::timesrv::detail::service::ITimeZoneService".

Cmd Name Notes
0 GetDeviceLocationName No input, returns an output #LocationName.
1 SetDeviceLocationName Takes an input #LocationName, no output.
2 GetTotalLocationNameCount No input, returns an output s32.
3 LoadLocationNameList
4 LoadTimeZoneRule Takes an input #LocationName and a type-0x16 output buffer for #TimeZoneRule, no output.
5 [2.0.0+] GetTimeZoneRuleVersion No input, returns an output #TimeZoneRuleVersion.
6 [5.0.0+] GetDeviceLocationNameAndUpdatedTime
7 [9.0.0+] SetDeviceLocationNameWithTimeZoneRule
8 [9.0.0+] ParseTimeZoneBinary
20 [9.0.0+] GetDeviceLocationNameOperationEventReadableHandle
100 ToCalendarTime Takes an input #PosixTime and a type-0x15 input buffer for #TimeZoneRule, returns an output #CalendarTime and #CalendarAdditionalInfo.
101 ToCalendarTimeWithMyRule Takes an input #PosixTime, returns an output #CalendarTime and #CalendarAdditionalInfo.
201 ToPosixTime Takes an input #CalendarTime, a type-0x15 input buffer for #TimeZoneRule, an type-0xA output buffer for #PosixTime array, and returns an output s32.
202 ToPosixTimeWithMyRule Takes an input #CalendarTime, an type-0xA output buffer for #PosixTime array, and returns an output s32.

LoadLocationNameList

Takes an input s32 LocationName_index and a type-0x6 output buffer for #LocationName, returns an output s32 for total output entries.

LocationName

This contains a TimeZone location string with a max size of 0x24 bytes.

TimeZoneRule

This is an 0x4000-byte struct. Official sw uses fixed-size 0x4000 for the buffer size with the above commands.

This is loaded from the TimeZoneBinary title with the specified LocationName under the zoneinfo/ directory, the content is then converted into this TimeZoneRule structure.

The files contained under zoneinfo/ directory are Tzif2 files without Tzif1 header and data at the begining of them (see RFC8536 for more information).

The conversion of a Tzif2 file to a TimeZoneRule structure is based on tz database code with some custom modifications (Leap seconds aren't handled, no usage of "posixrules" and Tzif1 support stripped out).

Offset Size Description
0x0 0x4 timecnt
0x4 0x4 typecnt
0x8 0x4 charcnt
0xC 0x1 goback
0xD 0x1 goahead
0xE 0x2 Padding
0x10 0x8 * 1000 ats
0x1f50 0x1 * 1000 types
0x2338 0x10 * 128 ttis (time type information), struct ttinfo[1000]
0x2b38 0x1 * 512 chars
0x2d38 0x4 defaulttype
0x2d3c 0x12c4 Reserved / Unused

ttinfo

This is an 0x10-byte struct. Represent a Time Type Information used in #TimeZoneRule.

Offset Size Description
0x0 0x4 tt_gmtoff
0x4 0x1 tt_isdst
0x5 0x3 Padding
0x8 0x4 tt_abbrind
0xC 0x1 tt_ttisstd
0xD 0x1 tt_ttisgmt
0xE 0x2 Padding

TimeZoneRuleVersion

This is an u128.

CalendarTime

Offset Size Description
0x0 0x2 Year
0x2 0x1 Month
0x3 0x1 Day
0x4 0x1 Hour
0x5 0x1 Minute
0x6 0x1 Second
0x7 0x1 Padding / unknown?

This is an 0x8-byte struct.

CalendarAdditionalInfo

Offset Size Description
0x0 0x4 0-based day-of-week.
0x4 0x4 0-based day-of-year.
0x8 0x8 Timezone name string.
0x10 0x4 0 = no DST, 1 = DST.
0x14 0x4 s32 seconds relative to UTC for this timezone.

This is an 0x18-byte struct. This stores timezone info.

ins:r

This is "nn::ins::IReceiverManager".

This was added with [9.0.0+].

Cmd Name
0
1

Cmd0

Takes an input u32 InsID. Returns an u64.

Cmd1

Takes an input u32 InsID and an input u64 (unused, official software passes struct pointer). Returns an output Event handle with autoclear disabled.

ins:s

This is "nn::ins::ISenderManager".

This was added with [9.0.0+].

Cmd Name
0

Cmd0

Takes an input u32 InsID and an input u64 (unused, official software passes struct pointer). Returns an output Event handle with autoclear disabled.

PmModuleId

Name Module
0x00
0x01
0x02
0x03
0x04 Usb
0x05 Ethernet
0x06 Fgm
0x07 PcvClock
0x08 PcvVoltage
0x09 Gpio
0x0A Pinmux
0x0B Uart
0x0C I2c
0x0D I2cPcv
0x0E Spi
0x0F Pwm
0x10 Psm
0x11 Tc
0x12 Omm
0x13 Pcie
0x14 Lbl
0x15 Display
0x16
0x17
0x18 Hid
0x19 WlanSockets
0x1A
0x1B Fs
0x1C Audio
0x1D
0x1E TmaHostIo
0x1F Bluetooth
0x20 Bpc
0x21 Fan
0x22 Pcm
0x23 Nfc
0x24 Apm
0x25 Btm
0x26 Nifm
0x27 GpioLow
0x28 Npns
0x29 Lm
0x2A Bcat
0x2B Time
0x2C Pctl
0x2D Erpt
0x2E Eupld
0x2F Friends
0x30 Bgtc
0x31 Account
0x32 Sasbus
0x33 Ntc
0x34 Idle
0x35 Tcap
0x36 PsmLow
0x37 Ndd
0x38 Olsc
0x39 Rtc
0x3A
0x3B
0x3C
0x3D Ns
0x3F NotificationPresenter
0x65 Nvservices
0x7F Spsm

Power Management States

State Name Description
Awake 0 Everything is awake.
ReadyAwaken 1 Preparing to transition to awake.
ReadySleep 2 Preparing to transition to sleep.
ReadySleepCritical 3 Critical services are ready to sleep.
ReadyAwakenCritical 4 Critical services are ready to wake up.
ReadyShutdown 5 Preparing to transition to shutdown.