libnx  v4.2.2
psc.h
Go to the documentation of this file.
1 /**
2  * @file psc.h
3  * @brief PSC service IPC wrapper.
4  * @author SciresM
5  * @copyright libnx Authors
6  */
7 #pragma once
8 #include "../types.h"
9 #include "../kernel/event.h"
10 #include "../sf/service.h"
11 
12 typedef enum {
13  PscPmState_Awake = 0, ///< Everything is awake.
14  PscPmState_ReadyAwaken = 1, ///< Preparing to transition to awake.
15  PscPmState_ReadySleep = 2, ///< Preparing to transition to sleep.
16  PscPmState_ReadySleepCritical = 3, ///< Critical services are ready to sleep.
17  PscPmState_ReadyAwakenCritical = 4, ///< Critical services are ready to wake up.
18  PscPmState_ReadyShutdown = 5, ///< Preparing to transition to shutdown.
19 } PscPmState;
20 
21 typedef enum {
22  PscPmModuleId_Usb = 4,
23  PscPmModuleId_Ethernet = 5,
24  PscPmModuleId_Fgm = 6,
25  PscPmModuleId_PcvClock = 7,
26  PscPmModuleId_PcvVoltage = 8,
27  PscPmModuleId_Gpio = 9,
28  PscPmModuleId_Pinmux = 10,
29  PscPmModuleId_Uart = 11,
30  PscPmModuleId_I2c = 12,
31  PscPmModuleId_I2cPcv = 13,
32  PscPmModuleId_Spi = 14,
33  PscPmModuleId_Pwm = 15,
34  PscPmModuleId_Psm = 16,
35  PscPmModuleId_Tc = 17,
36  PscPmModuleId_Omm = 18,
37  PscPmModuleId_Pcie = 19,
38  PscPmModuleId_Lbl = 20,
39  PscPmModuleId_Display = 21,
40 
41  PscPmModuleId_Hid = 24,
42  PscPmModuleId_WlanSockets = 25,
43 
44  PscPmModuleId_Fs = 27,
45  PscPmModuleId_Audio = 28,
46 
47  PscPmModuleId_TmaHostIo = 30,
48  PscPmModuleId_Bluetooth = 31,
49  PscPmModuleId_Bpc = 32,
50  PscPmModuleId_Fan = 33,
51  PscPmModuleId_Pcm = 34,
52  PscPmModuleId_Nfc = 35,
53  PscPmModuleId_Apm = 36,
54  PscPmModuleId_Btm = 37,
55  PscPmModuleId_Nifm = 38,
56  PscPmModuleId_GpioLow = 39,
57  PscPmModuleId_Npns = 40,
58  PscPmModuleId_Lm = 41,
59  PscPmModuleId_Bcat = 42,
60  PscPmModuleId_Time = 43,
61  PscPmModuleId_Pctl = 44,
62  PscPmModuleId_Erpt = 45,
63  PscPmModuleId_Eupld = 46,
64  PscPmModuleId_Friends = 47,
65  PscPmModuleId_Bgtc = 48,
66  PscPmModuleId_Account = 49,
67  PscPmModuleId_Sasbus = 50,
68  PscPmModuleId_Ntc = 51,
69  PscPmModuleId_Idle = 52,
70  PscPmModuleId_Tcap = 53,
71  PscPmModuleId_PsmLow = 54,
72  PscPmModuleId_Ndd = 55,
73  PscPmModuleId_Olsc = 56,
74 
75  PscPmModuleId_Ns = 61,
76 
77  PscPmModuleId_Nvservices = 101,
78 
79  PscPmModuleId_Spsm = 127,
80 } PscPmModuleId;
81 
82 typedef struct {
83  Event event;
84  Service srv;
85  PscPmModuleId module_id;
86 } PscPmModule;
87 
88 /// Initialize psc:m.
90 
91 /// Exit psc:m.
92 void pscmExit(void);
93 
94 /// Gets the Service object for the actual psc:m service session.
96 
97 Result pscmGetPmModule(PscPmModule *out, PscPmModuleId module_id, const u32 *dependencies, size_t dependency_count, bool autoclear);
98 
99 Result pscPmModuleGetRequest(PscPmModule *module, PscPmState *out_state, u32 *out_flags);
100 Result pscPmModuleAcknowledge(PscPmModule *module, PscPmState state);
101 Result pscPmModuleFinalize(PscPmModule *module);
102 
103 void pscPmModuleClose(PscPmModule *module);
PscPmState_ReadyAwakenCritical
@ PscPmState_ReadyAwakenCritical
Critical services are ready to wake up.
Definition: psc.h:17
PscPmState_ReadyAwaken
@ PscPmState_ReadyAwaken
Preparing to transition to awake.
Definition: psc.h:14
pscmInitialize
Result pscmInitialize(void)
Initialize psc:m.
PscPmState
PscPmState
Definition: psc.h:12
PscPmState_ReadyShutdown
@ PscPmState_ReadyShutdown
Preparing to transition to shutdown.
Definition: psc.h:18
Event
Kernel-mode event structure.
Definition: event.h:13
PscPmState_ReadySleepCritical
@ PscPmState_ReadySleepCritical
Critical services are ready to sleep.
Definition: psc.h:16
u32
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21
PscPmState_ReadySleep
@ PscPmState_ReadySleep
Preparing to transition to sleep.
Definition: psc.h:15
Result
u32 Result
Function error code result type.
Definition: types.h:44
pscmGetServiceSession
Service * pscmGetServiceSession(void)
Gets the Service object for the actual psc:m service session.
PscPmState_Awake
@ PscPmState_Awake
Everything is awake.
Definition: psc.h:13
pscmExit
void pscmExit(void)
Exit psc:m.
PscPmModule
Definition: psc.h:82
Service
Service object structure.
Definition: service.h:13