vitasdk
Documentation of the vitasdk

Exports for Kernel. More...

Data Structures

struct  ScePowerBatteryFakeStatus
 Simulated battery state used by kscePowerSetBatteryFakeStatus. More...
 

Typedefs

typedef void(* ScePowerCallback) (int notifyId, int notifyCount, int powerInfo, void *userData)
 Callback function prototype.
 
typedef void(* ScePowerIdleCallback) (SceUInt32 index, SceUInt32 idle_time, void *user_data)
 Idle callback called by ScePower's periodic idle worker.
 
typedef void(* ScePowerProcessIdleCallback) (ScePID pid, SceUInt32 idle_time, void *user_data)
 Process-idle callback called by ScePower's periodic idle worker.
 

Enumerations

enum  ScePowerErrorCode {
  SCE_POWER_ERROR_INVALID_VALUE = 0x802B0000 , SCE_POWER_ERROR_ALREADY_REGISTERED = 0x802B0001 , SCE_POWER_ERROR_CALLBACK_NOT_REGISTERED = 0x802B0002 , SCE_POWER_ERROR_CANT_SUSPEND = 0x802B0003 ,
  SCE_POWER_ERROR_NO_BATTERY = 0x802B0100 , SCE_POWER_ERROR_DETECTING = 0x802B0101
}
 
enum  ScePowerCallbackType {
  SCE_POWER_CB_AFTER_SYSTEM_RESUME = 0x00000080 , SCE_POWER_CB_BATTERY_ONLINE = 0x00000100 , SCE_POWER_CB_THERMAL_SUSPEND = 0x00000200 , SCE_POWER_CB_LOW_BATTERY_SUSPEND = 0x00000400 ,
  SCE_POWER_CB_LOW_BATTERY = 0x00000800 , SCE_POWER_CB_POWER_ONLINE = 0x00001000 , SCE_POWER_CB_SYSTEM_SUSPEND = 0x00010000 , SCE_POWER_CB_SYSTEM_RESUMING = 0x00020000 ,
  SCE_POWER_CB_SYSTEM_RESUME = 0x00040000 , SCE_POWER_CB_UNK_0x100000 = 0x00100000 , SCE_POWER_CB_APP_RESUME = 0x00200000 , SCE_POWER_CB_APP_SUSPEND = 0x00400000 ,
  SCE_POWER_CB_APP_RESUMING = 0x00800000 , SCE_POWER_CB_BUTTON_PS_START_PRESS = 0x04000000 , SCE_POWER_CB_BUTTON_PS_POWER_PRESS = 0x08000000 , SCE_POWER_CB_BUTTON_PS_HOLD = 0x10000000 ,
  SCE_POWER_CB_BUTTON_PS_PRESS = 0x20000000 , SCE_POWER_CB_BUTTON_POWER_HOLD = 0x40000000 , SCE_POWER_CB_BUTTON_POWER_PRESS = 0x80000000 , SCE_POWER_CB_VALID_MASK_KERNEL = 0xFCF71F80 ,
  SCE_POWER_CB_VALID_MASK_SYSTEM = 0xFCF71F80 , SCE_POWER_CB_VALID_MASK_NON_SYSTEM = 0x00361180
}
 
enum  ScePowerBatteryUsbStatus { SCE_POWER_BATTERY_USB_STATUS_DISCONNECTED = 0 , SCE_POWER_BATTERY_USB_STATUS_ACTIVE = 2 , SCE_POWER_BATTERY_USB_STATUS_CONFIGURED = 3 , SCE_POWER_BATTERY_USB_STATUS_SUSPENDED = 4 }
 USB device states observed on FW 3.60. More...
 

Functions

 VITASDK_BUILD_ASSERT_EQ (4, ScePowerErrorCode)
 
 VITASDK_BUILD_ASSERT_EQ (4, ScePowerCallbackType)
 
int kscePowerRegisterCallback (SceUID cbid)
 Registers a ScePower Callback.
 
int kscePowerUnregisterCallback (SceUID cbid)
 Unregister a callback.
 
SceBool kscePowerIsBatteryCharging (void)
 Returns battery charging status.
 
int kscePowerGetBatteryLifePercent (void)
 Returns battery life percentage.
 
SceBool kscePowerIsSuspendRequired (void)
 Check if a suspend is required.
 
SceBool kscePowerIsPowerOnline (void)
 Check if AC is plugged in.
 
int kscePowerGetBatteryLifeTime (void)
 Returns battery life time.
 
int kscePowerGetBatteryRemainCapacity (void)
 Returns battery remaining capacity.
 
SceBool kscePowerIsLowBattery (void)
 Returns battery state.
 
int kscePowerGetBatteryFullCapacity (void)
 Returns battery full capacity.
 
int kscePowerGetBatteryTemp (void)
 Returns battery temperature.
 
int kscePowerGetBatteryVolt (void)
 Returns battery voltage.
 
int kscePowerGetBatterySOH (void)
 Returns battery state of health.
 
int kscePowerGetBatteryCycleCount (void)
 Returns battery cycle count.
 
int kscePowerGetArmClockFrequency (void)
 Returns CPU clock frequency.
 
int kscePowerGetBusClockFrequency (void)
 Returns BUS clock frequency.
 
int kscePowerGetSysClockFrequency (void)
 Returns Sys clock frequency.
 
int kscePowerGetGpuXbarClockFrequency (void)
 Returns GPU crossbar clock frequency.
 
int kscePowerRequestSoftReset (void)
 Requests PS Vita to do a soft reset.
 
int kscePowerRequestColdReset (void)
 Requests PS Vita to do a cold reset.
 
int kscePowerRequestStandby (void)
 Requests PS Vita to go into standby.
 
int kscePowerRequestSuspend (void)
 Requests PS Vita to suspend.
 
int kscePowerRequestDisplayOff (void)
 Request display off.
 
int kscePowerSetDisplayBrightness (int brightness)
 Set the screen brightness.
 
int kscePowerSetArmClockFrequency (int freq)
 Sets CPU clock frequency.
 
int kscePowerSetBusClockFrequency (int freq)
 Sets BUS clock frequency.
 
int kscePowerSetGpuClockFrequency (int freq)
 Sets GPU clock frequency.
 
int kscePowerSetGpuXbarClockFrequency (int freq)
 Sets GPU crossbar clock frequency.
 
 VITASDK_BUILD_ASSERT_EQ (0x10, ScePowerBatteryFakeStatus)
 
int kscePowerBatteryDisableUsbCharging (void)
 Clear ScePower's USB-charging request.
 
int kscePowerBatteryEnableUsbCharging (void)
 Enable ScePower's USB-charging request.
 
int kscePowerBatteryForbidCharging (void)
 Increment the reference count that prevents charging.
 
int kscePowerBatteryPermitCharging (void)
 Decrement the reference count that prevents charging, if it is nonzero.
 
int kscePowerBatterySetUsbStatus (int usb_status)
 Set the USB device state reported to Syscon.
 
int kscePowerBatteryStopUsbCharging (void)
 Request that Syscon stop USB charging immediately.
 
int kscePowerGetArmClockFrequencyProc (ScePID pid)
 Get one process's ARM-clock request.
 
int kscePowerGetBusClockFrequencyProc (ScePID pid)
 Get one process's bus-clock request.
 
int kscePowerGetCameraBusClockFrequency (void)
 Get the applied camera-bus clock frequency.
 
int kscePowerGetCompatClockFrequency (void)
 Get the most recent compatibility-clock request.
 
int kscePowerGetDmac5ClockFrequency (void)
 Get the applied DMAC5 clock frequency.
 
int kscePowerGetGpuClockFrequencyInternal (SceInt32 *core_frequency, SceInt32 *mp_frequency)
 Get the applied GPU core and MP clock frequencies.
 
int kscePowerGetGpuClockFrequencyProc (ScePID pid)
 Get one process's GPU-clock request.
 
int kscePowerGetGpuXbarClockFrequencyProc (ScePID pid)
 Get one process's GPU-crossbar clock request.
 
int kscePowerGetPowerSwMode (void)
 Get the combined power-switch policy.
 
int kscePowerGetVeneziaClockFrequency (void)
 Get the most recent Venezia-clock request.
 
int kscePowerGetVipClockFrequency (void)
 Get the most recent VIP-clock request.
 
int kscePowerGetWakeupFactor (void)
 Get the wakeup factor captured during the most recent resume sequence.
 
int kscePowerRequestDisplayOn (void)
 Request that the display be turned on.
 
int kscePowerRequestHibernate (void)
 Queue an asynchronous hibernate request.
 
int kscePowerRequestResume (void)
 Request that an in-progress suspend sequence resume or abort sleeping.
 
int kscePowerSetArmClockFrequencyProc (ScePID pid, int frequency)
 Set one process's ARM-clock request.
 
int kscePowerSetBatteryFakeStatus (const ScePowerBatteryFakeStatus *fake_status)
 Enable or disable simulated battery values.
 
int kscePowerSetBusClockFrequencyProc (ScePID pid, int frequency)
 Set one process's bus-clock request.
 
int kscePowerSetCameraBusClockFrequency (int frequency)
 Set the camera-bus clock.
 
int kscePowerSetCompatClockFrequency (int frequency)
 Set the compatibility/Allegrex clock request.
 
int kscePowerSetDisplayMaxBrightness (int max_brightness)
 Set the maximum display brightness.
 
int kscePowerSetDmac5ClockFrequency (int frequency)
 Set the DMAC5 clock.
 
int kscePowerSetGpuClockFrequencyInternal (SceInt32 core_frequency, SceInt32 mp_frequency)
 Set the GPU core and MP clocks directly.
 
int kscePowerSetGpuClockFrequencyProc (ScePID pid, int frequency)
 Set one process's GPU-clock request.
 
int kscePowerSetGpuXbarClockFrequencyProc (ScePID pid, int frequency)
 Set one process's GPU-crossbar clock request.
 
int kscePowerSetIdleCallback (SceUInt32 index, int flags, SceUInt64 duration, ScePowerIdleCallback callback, void *user_data)
 Configure one of the eight global idle callbacks.
 
int kscePowerSetPowerSwMode (int mode)
 Set the Vsh/user power-switch policy slot.
 
int kscePowerSetPowerSwMode2 (int mode)
 Set the kernel power-switch policy slot.
 
int kscePowerSetProcessIdleCallback (ScePowerProcessIdleCallback callback, void *user_data)
 Install the process-idle callback used for every tracked process.
 
int kscePowerSetPsButtonPushTime (int push_time_us)
 Set the PS button hold threshold.
 
int kscePowerSetStandbyButtonPushTime (int push_time_us)
 Set the standby/power button hold threshold.
 
int kscePowerSetSysClockFrequency (int frequency)
 Set the system clock request.
 
int kscePowerSetVeneziaClockFrequency (int frequency)
 Set the Venezia clock request.
 
int kscePowerSetVipClockFrequency (int frequency)
 Set the VIP clock request.
 
int kscePowerTick (SceUInt32 type)
 Record activity for ScePower idle tracking.
 
int kscePowerWlanActivate (void)
 Set ScePower's software WLAN-active flag.
 
int kscePowerWlanDeactivate (void)
 Clear ScePower's software WLAN-active flag.
 

Variables

SceSize ScePowerBatteryFakeStatus::size
 Must be sizeof(ScePowerBatteryFakeStatus).
 
SceUInt32 ScePowerBatteryFakeStatus::remaining_capacity
 Initial remaining capacity in mAh. See kscePowerSetBatteryFakeStatus.
 
SceUInt32 ScePowerBatteryFakeStatus::full_capacity
 Full capacity in mAh; 0 is treated as 2000.
 
SceUInt32 ScePowerBatteryFakeStatus::discharge_time
 Simulated discharge duration in microseconds, or zero to keep the capacity constant.
 

Detailed Description

Exports for Kernel.


Using this library in your project

Include the header file in your project:




Using this library in your project

Include the header file in your project:


Link the library to the executable:

ScePowerForDriver_stub




Data Structure Documentation

◆ ScePowerBatteryFakeStatus

struct ScePowerBatteryFakeStatus

Simulated battery state used by kscePowerSetBatteryFakeStatus.

When discharge_time is nonzero, FW 3.60 linearly decreases the reported remaining capacity from remaining_capacity to zero over that many microseconds. A zero duration keeps the simulated capacity constant.

Data Fields
SceSize size Must be sizeof(ScePowerBatteryFakeStatus).
SceUInt32 remaining_capacity Initial remaining capacity in mAh. See kscePowerSetBatteryFakeStatus.
SceUInt32 full_capacity Full capacity in mAh; 0 is treated as 2000.
SceUInt32 discharge_time Simulated discharge duration in microseconds, or zero to keep the capacity constant.

Typedef Documentation

◆ ScePowerCallback

typedef void(* ScePowerCallback) (int notifyId, int notifyCount, int powerInfo, void *userData)

Callback function prototype.

◆ ScePowerIdleCallback

typedef void(* ScePowerIdleCallback) (SceUInt32 index, SceUInt32 idle_time, void *user_data)

Idle callback called by ScePower's periodic idle worker.

Parameters
[in]indexIdle-callback slot from 0 through 7.
[in]idle_timeNumber of elapsed microseconds, truncated to 32 bits. Zero reports that activity reset a previously expired callback.
[in]user_dataValue supplied to kscePowerSetIdleCallback.

◆ ScePowerProcessIdleCallback

typedef void(* ScePowerProcessIdleCallback) (ScePID pid, SceUInt32 idle_time, void *user_data)

Process-idle callback called by ScePower's periodic idle worker.

Parameters
[in]pidProcess whose idle state changed.
[in]idle_timeNumber of elapsed microseconds, truncated to 32 bits. Zero reports activity after a previous expiration.
[in]user_dataValue supplied to kscePowerSetProcessIdleCallback.

Enumeration Type Documentation

◆ ScePowerErrorCode

Enumerator
SCE_POWER_ERROR_INVALID_VALUE 
SCE_POWER_ERROR_ALREADY_REGISTERED 
SCE_POWER_ERROR_CALLBACK_NOT_REGISTERED 
SCE_POWER_ERROR_CANT_SUSPEND 
SCE_POWER_ERROR_NO_BATTERY 
SCE_POWER_ERROR_DETECTING 

◆ ScePowerCallbackType

Enumerator
SCE_POWER_CB_AFTER_SYSTEM_RESUME 
SCE_POWER_CB_BATTERY_ONLINE 
SCE_POWER_CB_THERMAL_SUSPEND 
SCE_POWER_CB_LOW_BATTERY_SUSPEND 
SCE_POWER_CB_LOW_BATTERY 
SCE_POWER_CB_POWER_ONLINE 
SCE_POWER_CB_SYSTEM_SUSPEND 
SCE_POWER_CB_SYSTEM_RESUMING 
SCE_POWER_CB_SYSTEM_RESUME 
SCE_POWER_CB_UNK_0x100000 
SCE_POWER_CB_APP_RESUME 
SCE_POWER_CB_APP_SUSPEND 
SCE_POWER_CB_APP_RESUMING 
SCE_POWER_CB_BUTTON_PS_START_PRESS 
SCE_POWER_CB_BUTTON_PS_POWER_PRESS 
SCE_POWER_CB_BUTTON_PS_HOLD 
SCE_POWER_CB_BUTTON_PS_PRESS 
SCE_POWER_CB_BUTTON_POWER_HOLD 
SCE_POWER_CB_BUTTON_POWER_PRESS 
SCE_POWER_CB_VALID_MASK_KERNEL 
SCE_POWER_CB_VALID_MASK_SYSTEM 
SCE_POWER_CB_VALID_MASK_NON_SYSTEM 

◆ ScePowerBatteryUsbStatus

USB device states observed on FW 3.60.

Enumerator
SCE_POWER_BATTERY_USB_STATUS_DISCONNECTED 

Controller teardown or disconnect.

SCE_POWER_BATTERY_USB_STATUS_ACTIVE 

Controller activation, bus reset, or unconfigured resume.

SCE_POWER_BATTERY_USB_STATUS_CONFIGURED 

Configured bus or configured resume.

SCE_POWER_BATTERY_USB_STATUS_SUSPENDED 

USB suspend or charging-stop state.

Function Documentation

◆ VITASDK_BUILD_ASSERT_EQ() [1/3]

VITASDK_BUILD_ASSERT_EQ ( 4  ,
ScePowerErrorCode   
)

◆ VITASDK_BUILD_ASSERT_EQ() [2/3]

VITASDK_BUILD_ASSERT_EQ ( 4  ,
ScePowerCallbackType   
)

◆ kscePowerRegisterCallback()

int kscePowerRegisterCallback ( SceUID  cbid)

Registers a ScePower Callback.

Parameters
cbid- The UID of the specified callback
Returns
0 on success, < 0 on error

◆ kscePowerUnregisterCallback()

int kscePowerUnregisterCallback ( SceUID  cbid)

Unregister a callback.

Parameters
cbid- The UID of the specified callback
Returns
0 on success, < 0 on error

◆ kscePowerIsBatteryCharging()

SceBool kscePowerIsBatteryCharging ( void  )

Returns battery charging status.

Returns
SCE_TRUE if under charge, SCE_FALSE otherwise

◆ kscePowerGetBatteryLifePercent()

int kscePowerGetBatteryLifePercent ( void  )

Returns battery life percentage.

Returns
Battery life percentage

◆ kscePowerIsSuspendRequired()

SceBool kscePowerIsSuspendRequired ( void  )

Check if a suspend is required.

Returns
SCE_TRUE if suspend is required, SCE_FALSE otherwise

◆ kscePowerIsPowerOnline()

SceBool kscePowerIsPowerOnline ( void  )

Check if AC is plugged in.

Returns
SCE_TRUE if plugged in, SCE_FALSE otherwise

◆ kscePowerGetBatteryLifeTime()

int kscePowerGetBatteryLifeTime ( void  )

Returns battery life time.

Returns
Battery life time in minutes

◆ kscePowerGetBatteryRemainCapacity()

int kscePowerGetBatteryRemainCapacity ( void  )

Returns battery remaining capacity.

Returns
battery remaining capacity in mAh (milliampere hour)

◆ kscePowerIsLowBattery()

SceBool kscePowerIsLowBattery ( void  )

Returns battery state.

Returns
SCE_TRUE if battery is low, SCE_FALSE otherwise

◆ kscePowerGetBatteryFullCapacity()

int kscePowerGetBatteryFullCapacity ( void  )

Returns battery full capacity.

Returns
battery full capacity in mAh (milliampere hour)

◆ kscePowerGetBatteryTemp()

int kscePowerGetBatteryTemp ( void  )

Returns battery temperature.

Returns
temperature in degrees celcius * 100

◆ kscePowerGetBatteryVolt()

int kscePowerGetBatteryVolt ( void  )

Returns battery voltage.

Returns
battery voltage in mV (millivolts)

◆ kscePowerGetBatterySOH()

int kscePowerGetBatterySOH ( void  )

Returns battery state of health.

Returns
battery state of health percent

◆ kscePowerGetBatteryCycleCount()

int kscePowerGetBatteryCycleCount ( void  )

Returns battery cycle count.

Returns
battery cycle count

◆ kscePowerGetArmClockFrequency()

int kscePowerGetArmClockFrequency ( void  )

Returns CPU clock frequency.

Returns
CPU clock frequency in Mhz

◆ kscePowerGetBusClockFrequency()

int kscePowerGetBusClockFrequency ( void  )

Returns BUS clock frequency.

Returns
BUS clock frequency in Mhz

◆ kscePowerGetSysClockFrequency()

int kscePowerGetSysClockFrequency ( void  )

Returns Sys clock frequency.

Returns
Sys clock frequency in Mhz

◆ kscePowerGetGpuXbarClockFrequency()

int kscePowerGetGpuXbarClockFrequency ( void  )

Returns GPU crossbar clock frequency.

Returns
GPU crossbar clock frequency in Mhz

◆ kscePowerRequestSoftReset()

int kscePowerRequestSoftReset ( void  )

Requests PS Vita to do a soft reset.

Returns
always 0

◆ kscePowerRequestColdReset()

int kscePowerRequestColdReset ( void  )

Requests PS Vita to do a cold reset.

Returns
always 0

◆ kscePowerRequestStandby()

int kscePowerRequestStandby ( void  )

Requests PS Vita to go into standby.

Returns
always 0

◆ kscePowerRequestSuspend()

int kscePowerRequestSuspend ( void  )

Requests PS Vita to suspend.

Returns
always 0

◆ kscePowerRequestDisplayOff()

int kscePowerRequestDisplayOff ( void  )

Request display off.

Returns
always 0

◆ kscePowerSetDisplayBrightness()

int kscePowerSetDisplayBrightness ( int  brightness)

Set the screen brightness.

See also
sceAVConfigSetDisplayBrightness for userland counterpart.
Parameters
brightnessBrightness that the screen will be set to (range 21-65536, 0 turns off the screen).
Returns
?

◆ kscePowerSetArmClockFrequency()

int kscePowerSetArmClockFrequency ( int  freq)

Sets CPU clock frequency.

Parameters
freq- Frequency to set in Mhz
Returns
0 on success, < 0 on error

◆ kscePowerSetBusClockFrequency()

int kscePowerSetBusClockFrequency ( int  freq)

Sets BUS clock frequency.

Parameters
freq- Frequency to set in Mhz
Returns
0 on success, < 0 on error

◆ kscePowerSetGpuClockFrequency()

int kscePowerSetGpuClockFrequency ( int  freq)

Sets GPU clock frequency.

Parameters
freq- Frequency to set in Mhz
Returns
0 on success, < 0 on error

◆ kscePowerSetGpuXbarClockFrequency()

int kscePowerSetGpuXbarClockFrequency ( int  freq)

Sets GPU crossbar clock frequency.

Parameters
freq- Frequency to set in Mhz
Returns
0 on success, < 0 on error

◆ VITASDK_BUILD_ASSERT_EQ() [3/3]

VITASDK_BUILD_ASSERT_EQ ( 0x10  ,
ScePowerBatteryFakeStatus   
)

◆ kscePowerBatteryDisableUsbCharging()

int kscePowerBatteryDisableUsbCharging ( void  )

Clear ScePower's USB-charging request.

This clears the software request and wakes the battery worker. It does not issue the separate immediate-stop Syscon command used by kscePowerBatteryStopUsbCharging.

Returns
Always 0 on FW 3.60.

◆ kscePowerBatteryEnableUsbCharging()

int kscePowerBatteryEnableUsbCharging ( void  )

Enable ScePower's USB-charging request.

Returns
The previous request state (0 or 1), or 0 while battery polling is suspended.

◆ kscePowerBatteryForbidCharging()

int kscePowerBatteryForbidCharging ( void  )

Increment the reference count that prevents charging.

The first forbid request cancels a pending re-enable timer and wakes the battery worker.

Returns
Always 0 on FW 3.60.

◆ kscePowerBatteryPermitCharging()

int kscePowerBatteryPermitCharging ( void  )

Decrement the reference count that prevents charging, if it is nonzero.

Releasing the last forbid request schedules charging to be reconsidered after five seconds.

Returns
Always 0 on FW 3.60.

◆ kscePowerBatterySetUsbStatus()

int kscePowerBatterySetUsbStatus ( int  usb_status)

Set the USB device state reported to Syscon.

Parameters
[in]usb_statusUSB device state. Normally one of ScePowerBatteryUsbStatus. Only the low eight bits are sent to Syscon; the value is not range-checked.
Returns
0 if battery polling is suspended, -1 if another request is pending, or the asynchronous Syscon request result.

◆ kscePowerBatteryStopUsbCharging()

int kscePowerBatteryStopUsbCharging ( void  )

Request that Syscon stop USB charging immediately.

The command is issued only while the USB-charging request is enabled. This function does not clear that request; use kscePowerBatteryDisableUsbCharging for that purpose.

Returns
Always 0 on FW 3.60.

◆ kscePowerGetArmClockFrequencyProc()

int kscePowerGetArmClockFrequencyProc ( ScePID  pid)

Get one process's ARM-clock request.

Parameters
[in]pidProcess ID, or 0 for the current process.
Returns
The requested frequency in MHz, or a negative process-local-storage error.

◆ kscePowerGetBusClockFrequencyProc()

int kscePowerGetBusClockFrequencyProc ( ScePID  pid)

Get one process's bus-clock request.

Parameters
[in]pidProcess ID, or 0 for the current process.
Returns
The requested frequency in MHz, or a negative process-local-storage error.

◆ kscePowerGetCameraBusClockFrequency()

int kscePowerGetCameraBusClockFrequency ( void  )

Get the applied camera-bus clock frequency.

Returns
The frequency in MHz, rounded up to a supported level, or zero for the released/default state.

◆ kscePowerGetCompatClockFrequency()

int kscePowerGetCompatClockFrequency ( void  )

Get the most recent compatibility-clock request.

This returns the caller-supplied request, not necessarily the physical frequency selected by the clock hardware.

Returns
The last requested frequency in MHz.

◆ kscePowerGetDmac5ClockFrequency()

int kscePowerGetDmac5ClockFrequency ( void  )

Get the applied DMAC5 clock frequency.

Returns
The frequency in MHz, rounded up to a supported level, or zero while DMAC5 is disabled.

◆ kscePowerGetGpuClockFrequencyInternal()

int kscePowerGetGpuClockFrequencyInternal ( SceInt32 *  core_frequency,
SceInt32 *  mp_frequency 
)

Get the applied GPU core and MP clock frequencies.

Parameters
[out]core_frequencyOptional output for the GPU core frequency in MHz.
[out]mp_frequencyOptional output for the GPU MP frequency in MHz.
Returns
Always 0 on FW 3.60.

◆ kscePowerGetGpuClockFrequencyProc()

int kscePowerGetGpuClockFrequencyProc ( ScePID  pid)

Get one process's GPU-clock request.

Parameters
[in]pidProcess ID, or 0 for the current process.
Returns
The requested frequency in MHz, or a negative process-local-storage error.

◆ kscePowerGetGpuXbarClockFrequencyProc()

int kscePowerGetGpuXbarClockFrequencyProc ( ScePID  pid)

Get one process's GPU-crossbar clock request.

Parameters
[in]pidProcess ID, or 0 for the current process.
Returns
The requested frequency in MHz, or a negative process-local-storage error.

◆ kscePowerGetPowerSwMode()

int kscePowerGetPowerSwMode ( void  )

Get the combined power-switch policy.

FW 3.60 keeps separate kernel and Vsh/user policy values and returns their bitwise OR. Only bits 0 through 2 can be set through the two exported setters.

Returns
The combined policy value from 0 through 7.

◆ kscePowerGetVeneziaClockFrequency()

int kscePowerGetVeneziaClockFrequency ( void  )

Get the most recent Venezia-clock request.

Returns
The last requested frequency in MHz, including zero.

◆ kscePowerGetVipClockFrequency()

int kscePowerGetVipClockFrequency ( void  )

Get the most recent VIP-clock request.

Returns
The last requested frequency in MHz, including zero.

◆ kscePowerGetWakeupFactor()

int kscePowerGetWakeupFactor ( void  )

Get the wakeup factor captured during the most recent resume sequence.

Callers on FW 3.60 interpret the low seven bits as the wake-reason value. The remaining bits are returned unchanged.

Returns
The raw wakeup factor.

◆ kscePowerRequestDisplayOn()

int kscePowerRequestDisplayOn ( void  )

Request that the display be turned on.

FW 3.60 queues the request only for the Shell process or a system program; other callers are silently ignored.

Returns
Always 0 on FW 3.60.

◆ kscePowerRequestHibernate()

int kscePowerRequestHibernate ( void  )

Queue an asynchronous hibernate request.

Returns
Always 0 on FW 3.60.

◆ kscePowerRequestResume()

int kscePowerRequestResume ( void  )

Request that an in-progress suspend sequence resume or abort sleeping.

Returns
Always 0 on FW 3.60.

◆ kscePowerSetArmClockFrequencyProc()

int kscePowerSetArmClockFrequencyProc ( ScePID  pid,
int  frequency 
)

Set one process's ARM-clock request.

ScePower applies the maximum request among active processes. FW 3.60 accepts frequencies from 1 through 444 MHz; values between hardware levels select the next level.

Parameters
[in]pidProcess ID, or 0 for the current process.
[in]frequencyRequested frequency in MHz.
Returns
0 on success, SCE_POWER_ERROR_INVALID_VALUE for an out-of-range frequency, or a negative process/clock-control error.

◆ kscePowerSetBatteryFakeStatus()

int kscePowerSetBatteryFakeStatus ( const ScePowerBatteryFakeStatus *  fake_status)

Enable or disable simulated battery values.

A NULL parameter disables simulation. For a non-NULL parameter, size must be 0x10. If remaining_capacity is zero, FW 3.60 starts from the real remaining capacity when it is available; otherwise it starts from full_capacity.

Parameters
[in]fake_statusSimulated state, or NULL to disable it.
Returns
0 on success, or SCE_POWER_ERROR_INVALID_VALUE if size is not 0x10.

◆ kscePowerSetBusClockFrequencyProc()

int kscePowerSetBusClockFrequencyProc ( ScePID  pid,
int  frequency 
)

Set one process's bus-clock request.

ScePower applies the maximum request among active processes. FW 3.60 accepts frequencies from 1 through 222 MHz and rounds upward to 55, 83, 111, 166, or 222 MHz.

Parameters
[in]pidProcess ID, or 0 for the current process.
[in]frequencyRequested frequency in MHz.
Returns
0 on success, SCE_POWER_ERROR_INVALID_VALUE for an out-of-range frequency, or a negative process/clock-control error.

◆ kscePowerSetCameraBusClockFrequency()

int kscePowerSetCameraBusClockFrequency ( int  frequency)

Set the camera-bus clock.

FW 3.60 accepts 0 through 166 MHz. Zero selects the released/default state; positive values are rounded upward to 41, 67, 83, 133, or 166 MHz.

Parameters
[in]frequencyRequested frequency in MHz.
Returns
0 on success, SCE_POWER_ERROR_INVALID_VALUE for an out-of-range value, or a negative clock/voltage-control error.

◆ kscePowerSetCompatClockFrequency()

int kscePowerSetCompatClockFrequency ( int  frequency)

Set the compatibility/Allegrex clock request.

The meaningful requests are 0, 222, and 333 MHz. Zero releases the override, 222 selects the low compatibility selector, and 333 selects the high selector. FW 3.60 accepts every other signed value below 334 except 222, including negative values, but all of them select the same hardware mode as 333 while the getter returns the supplied value.

Parameters
[in]frequencyRequested frequency in MHz.
Returns
0 on success, SCE_POWER_ERROR_INVALID_VALUE for a value greater than 333, or a negative clock/voltage error.

◆ kscePowerSetDisplayMaxBrightness()

int kscePowerSetDisplayMaxBrightness ( int  max_brightness)

Set the maximum display brightness.

Parameters
[in]max_brightnessBrightness limit in internal units. FW 3.60 normally uses 0x10000, or 0xC4EC when reducing brightness at high GPU clock speeds. A value of 1 is treated as 2. Other values are not checked.
Returns
Always 0.

◆ kscePowerSetDmac5ClockFrequency()

int kscePowerSetDmac5ClockFrequency ( int  frequency)

Set the DMAC5 clock.

FW 3.60 accepts 0 through 166 MHz. Zero disables/releases the clock; positive values are rounded upward to 41, 83, 133, or 166 MHz.

Parameters
[in]frequencyRequested frequency in MHz.
Returns
0 on success, SCE_POWER_ERROR_INVALID_VALUE for an out-of-range value, or a negative clock/voltage-control error.

◆ kscePowerSetGpuClockFrequencyInternal()

int kscePowerSetGpuClockFrequencyInternal ( SceInt32  core_frequency,
SceInt32  mp_frequency 
)

Set the GPU core and MP clocks directly.

Supplying zero for both frequencies disables the pair. Otherwise each value is rounded upward to 41, 55, 83, 111, 166, or 222 MHz; a zero value is treated as a request at or below 41 MHz. The resulting core frequency must not exceed the resulting MP frequency. During an actual selector change FW 3.60 quiesces Grab clients 8 through 11, waits at least three microseconds, programs the clock, and releases those clients.

Parameters
[in]core_frequencyGPU core frequency in MHz.
[in]mp_frequencyGPU MP frequency in MHz.
Returns
0 on success, SCE_POWER_ERROR_INVALID_VALUE for an invalid pair, or a negative clock/voltage-control error.

◆ kscePowerSetGpuClockFrequencyProc()

int kscePowerSetGpuClockFrequencyProc ( ScePID  pid,
int  frequency 
)

Set one process's GPU-clock request.

ScePower applies the maximum request among active processes to both the GPU core and MP clocks. FW 3.60 accepts frequencies from 1 through 222 MHz.

Parameters
[in]pidProcess ID, or 0 for the current process.
[in]frequencyRequested frequency in MHz.
Returns
0 on success, SCE_POWER_ERROR_INVALID_VALUE for an out-of-range frequency, or a negative process/clock-control error.

◆ kscePowerSetGpuXbarClockFrequencyProc()

int kscePowerSetGpuXbarClockFrequencyProc ( ScePID  pid,
int  frequency 
)

Set one process's GPU-crossbar clock request.

ScePower applies the maximum request among active processes. FW 3.60 accepts frequencies from 1 through 166 MHz; the effective hardware level is at most 83, 111, or 166 MHz.

Parameters
[in]pidProcess ID, or 0 for the current process.
[in]frequencyRequested frequency in MHz.
Returns
0 on success, SCE_POWER_ERROR_INVALID_VALUE for an out-of-range frequency, or a negative process/clock-control error.

◆ kscePowerSetIdleCallback()

int kscePowerSetIdleCallback ( SceUInt32  index,
int  flags,
SceUInt64  duration,
ScePowerIdleCallback  callback,
void *  user_data 
)

Configure one of the eight global idle callbacks.

FW 3.60 stores only the low 16 bits of flags. Bit 0x200 makes the slot's activity timestamp reset only when its corresponding explicit tick bit is supplied. Bit 0x400 makes resets conditional on the current display/input policy. The purpose of other flag bits is unknown. The callback is called once after duration expires and again with an idle time of zero if later activity resets the expired slot.

Parameters
[in]indexSlot from 0 through 7. A tick for this slot uses 1U << index with kscePowerTick.
[in]flagsIdle policy flags.
[in]durationExpiration interval in microseconds, or zero to use the global fallback interval.
[in]callbackCallback to install, or NULL to clear the slot.
[in]user_dataValue passed to callback.
Returns
0 on success, SCE_POWER_ERROR_INVALID_VALUE for an invalid index, or SCE_POWER_ERROR_ALREADY_REGISTERED when replacing a non-NULL callback with another non-NULL callback.

◆ kscePowerSetPowerSwMode()

int kscePowerSetPowerSwMode ( int  mode)

Set the Vsh/user power-switch policy slot.

The value is combined with the kernel slot set by kscePowerSetPowerSwMode2. The individual meanings of bits 0 through 2 are internal to FW 3.60's standby-button state machine.

Parameters
[in]modePolicy value from 0 through 7.
Returns
0 on success, or SCE_POWER_ERROR_INVALID_VALUE if other bits are set.

◆ kscePowerSetPowerSwMode2()

int kscePowerSetPowerSwMode2 ( int  mode)

Set the kernel power-switch policy slot.

The value is combined with the Vsh/user slot set by kscePowerSetPowerSwMode. The individual meanings of bits 0 through 2 are internal to FW 3.60's standby-button state machine.

Parameters
[in]modePolicy value from 0 through 7.
Returns
0 on success, or SCE_POWER_ERROR_INVALID_VALUE if other bits are set.

◆ kscePowerSetProcessIdleCallback()

int kscePowerSetProcessIdleCallback ( ScePowerProcessIdleCallback  callback,
void *  user_data 
)

Install the process-idle callback used for every tracked process.

Passing NULL disables notifications. FW 3.60 replaces the current callback and user-data value without synchronization or duplicate-registration checks.

Parameters
[in]callbackCallback to install, or NULL.
[in]user_dataValue passed to callback.
Returns
Always 0 on FW 3.60.

◆ kscePowerSetPsButtonPushTime()

int kscePowerSetPsButtonPushTime ( int  push_time_us)

Set the PS button hold threshold.

Parameters
[in]push_time_usHold threshold in microseconds. FW 3.60 defaults to 1000000 microseconds and does not range-check this value.
Returns
Always 0 on FW 3.60.

◆ kscePowerSetStandbyButtonPushTime()

int kscePowerSetStandbyButtonPushTime ( int  push_time_us)

Set the standby/power button hold threshold.

Parameters
[in]push_time_usHold threshold in microseconds. FW 3.60 defaults to 2000000 microseconds, or 4000000 in the special Sysroot mode selected during initialization, and does not range-check this value.
Returns
Always 0 on FW 3.60.

◆ kscePowerSetSysClockFrequency()

int kscePowerSetSysClockFrequency ( int  frequency)

Set the system clock request.

FW 3.60 accepts 1 through 222 MHz. Requests up to 190 select the 190 MHz level; requests from 191 through 222 select the 222 MHz level. The getter returns the supplied request rather than the selected level.

Parameters
[in]frequencyRequested frequency in MHz.
Returns
0 on success, SCE_POWER_ERROR_INVALID_VALUE for an out-of-range value, or a negative clock/voltage-control error.

◆ kscePowerSetVeneziaClockFrequency()

int kscePowerSetVeneziaClockFrequency ( int  frequency)

Set the Venezia clock request.

FW 3.60 accepts 0 through 333 MHz and selects the next level from 41, 55, 83, 111, 166, 222, and 333 MHz. Zero disables/releases the clock. The getter returns the supplied request rather than the selected level.

Parameters
[in]frequencyRequested frequency in MHz.
Returns
0 on success, SCE_POWER_ERROR_INVALID_VALUE for an out-of-range value, or a negative clock/voltage-control error.

◆ kscePowerSetVipClockFrequency()

int kscePowerSetVipClockFrequency ( int  frequency)

Set the VIP clock request.

FW 3.60 accepts 0 through 222 MHz and selects the next level from 41, 55, 83, 111, 166, and 222 MHz. Zero disables/releases the clock. The getter returns the supplied request rather than the selected level.

Parameters
[in]frequencyRequested frequency in MHz.
Returns
0 on success, SCE_POWER_ERROR_INVALID_VALUE for an out-of-range value, or a negative clock/voltage-control error.

◆ kscePowerTick()

int kscePowerTick ( SceUInt32  type)

Record activity for ScePower idle tracking.

Bits 0 through 7 select the corresponding global idle-callback slots. Bit 0 additionally refreshes the current process's idle timestamp. Other bits are ignored and the value is not range-checked.

Parameters
[in]typeBitmask of idle-callback slots to refresh.
Returns
Always 0 on FW 3.60.

◆ kscePowerWlanActivate()

int kscePowerWlanActivate ( void  )

Set ScePower's software WLAN-active flag.

This does not directly enable WLAN hardware.

Returns
Always 0 on FW 3.60.

◆ kscePowerWlanDeactivate()

int kscePowerWlanDeactivate ( void  )

Clear ScePower's software WLAN-active flag.

This does not directly disable WLAN hardware.

Returns
Always 0 on FW 3.60.

Variable Documentation

◆ size

SceSize ScePowerBatteryFakeStatus::size

Must be sizeof(ScePowerBatteryFakeStatus).

◆ remaining_capacity

SceUInt32 ScePowerBatteryFakeStatus::remaining_capacity

Initial remaining capacity in mAh. See kscePowerSetBatteryFakeStatus.

◆ full_capacity

SceUInt32 ScePowerBatteryFakeStatus::full_capacity

Full capacity in mAh; 0 is treated as 2000.

◆ discharge_time

SceUInt32 ScePowerBatteryFakeStatus::discharge_time

Simulated discharge duration in microseconds, or zero to keep the capacity constant.