pspsdk-1.0+beta2
psppower.h File Reference
#include <pspkerneltypes.h>
Include dependency graph for psppower.h:

Go to the source code of this file.

Macros

#define PSP_POWER_CB_POWER_SWITCH   0x80000000
 Power callback flags.
#define PSP_POWER_CB_HOLD_SWITCH   0x40000000
#define PSP_POWER_CB_STANDBY   0x00080000
#define PSP_POWER_CB_RESUME_COMPLETE   0x00040000
#define PSP_POWER_CB_RESUMING   0x00020000
#define PSP_POWER_CB_SUSPENDING   0x00010000
#define PSP_POWER_CB_AC_POWER   0x00001000
#define PSP_POWER_CB_BATTERY_LOW   0x00000100
#define PSP_POWER_CB_BATTERY_EXIST   0x00000080
#define PSP_POWER_CB_BATTPOWER   0x0000007F
#define PSP_POWER_TICK_ALL   0
 Power tick flags.
#define PSP_POWER_TICK_SUSPEND   1
#define PSP_POWER_TICK_DISPLAY   6

Typedefs

typedef void(* powerCallback_t )(int unknown, int powerInfo)
 Power Callback Function Definition.

Functions

int scePowerRegisterCallback (int slot, SceUID cbid)
 Register Power Callback Function.
int scePowerUnregisterCallback (int slot)
 Unregister Power Callback Function.
int scePowerIsPowerOnline (void)
 Check if unit is plugged in.
int scePowerIsBatteryExist (void)
 Check if a battery is present.
int scePowerIsBatteryCharging (void)
 Check if the battery is charging.
int scePowerGetBatteryChargingStatus (void)
 Get the status of the battery charging.
int scePowerIsLowBattery (void)
 Check if the battery is low.
int scePowerGetBatteryLifePercent (void)
 Get battery life as integer percent.
int scePowerGetBatteryLifeTime (void)
 Get battery life as time.
int scePowerGetBatteryTemp (void)
 Get temperature of the battery.
int scePowerGetBatteryElec (void)
 unknown? - crashes PSP in usermode
int scePowerGetBatteryVolt (void)
 Get battery volt level.
int scePowerSetCpuClockFrequency (int cpufreq)
 Set CPU Frequency.
int scePowerSetBusClockFrequency (int busfreq)
 Set Bus Frequency.
int scePowerGetCpuClockFrequency (void)
 Alias for scePowerGetCpuClockFrequencyInt.
int scePowerGetCpuClockFrequencyInt (void)
 Get CPU Frequency as Integer.
float scePowerGetCpuClockFrequencyFloat (void)
 Get CPU Frequency as Float.
int scePowerGetBusClockFrequency (void)
 Alias for scePowerGetBusClockFrequencyInt.
int scePowerGetBusClockFrequencyInt (void)
 Get Bus fequency as Integer.
float scePowerGetBusClockFrequencyFloat (void)
 Get Bus frequency as Float.
int scePowerSetClockFrequency (int pllfreq, int cpufreq, int busfreq)
 Set Clock Frequencies.
int scePowerLock (int unknown)
 Lock power switch.
int scePowerUnlock (int unknown)
 Unlock power switch.
int scePowerTick (int type)
 Generate a power tick, preventing unit from powering off and turning off display.
int scePowerGetIdleTimer (void)
 Get Idle timer.
int scePowerIdleTimerEnable (int unknown)
 Enable Idle timer.
int scePowerIdleTimerDisable (int unknown)
 Disable Idle timer.
int scePowerRequestStandby (void)
 Request the PSP to go into standby.
int scePowerRequestSuspend (void)
 Request the PSP to go into suspend.

Macro Definition Documentation

#define PSP_POWER_CB_AC_POWER   0x00001000
#define PSP_POWER_CB_BATTERY_EXIST   0x00000080
#define PSP_POWER_CB_BATTERY_LOW   0x00000100
#define PSP_POWER_CB_BATTPOWER   0x0000007F
#define PSP_POWER_CB_HOLD_SWITCH   0x40000000
#define PSP_POWER_CB_POWER_SWITCH   0x80000000

Power callback flags.

#define PSP_POWER_CB_RESUME_COMPLETE   0x00040000
#define PSP_POWER_CB_RESUMING   0x00020000
#define PSP_POWER_CB_STANDBY   0x00080000
#define PSP_POWER_CB_SUSPENDING   0x00010000
#define PSP_POWER_TICK_ALL   0

Power tick flags.

#define PSP_POWER_TICK_DISPLAY   6
#define PSP_POWER_TICK_SUSPEND   1

Typedef Documentation

typedef void(* powerCallback_t)(int unknown, int powerInfo)

Power Callback Function Definition.

Parameters
unknown- unknown function, appears to cycle between 1,2 and 3
powerInfo- combination of PSP_POWER_CB_ flags

Function Documentation

int scePowerGetBatteryChargingStatus ( void  )

Get the status of the battery charging.

int scePowerGetBatteryElec ( void  )

unknown? - crashes PSP in usermode

int scePowerGetBatteryLifePercent ( void  )

Get battery life as integer percent.

Returns
Battery charge percentage (0-100), < 0 on error.
int scePowerGetBatteryLifeTime ( void  )

Get battery life as time.

Returns
Battery life in minutes, < 0 on error.
int scePowerGetBatteryTemp ( void  )

Get temperature of the battery.

int scePowerGetBatteryVolt ( void  )

Get battery volt level.

int scePowerGetBusClockFrequency ( void  )

Alias for scePowerGetBusClockFrequencyInt.

Returns
frequency as int
float scePowerGetBusClockFrequencyFloat ( void  )

Get Bus frequency as Float.

Returns
frequency as float
int scePowerGetBusClockFrequencyInt ( void  )

Get Bus fequency as Integer.

Returns
frequency as int
int scePowerGetCpuClockFrequency ( void  )

Alias for scePowerGetCpuClockFrequencyInt.

Returns
frequency as int
float scePowerGetCpuClockFrequencyFloat ( void  )

Get CPU Frequency as Float.

Returns
frequency as float
int scePowerGetCpuClockFrequencyInt ( void  )

Get CPU Frequency as Integer.

Returns
frequency as int
int scePowerGetIdleTimer ( void  )

Get Idle timer.

int scePowerIdleTimerDisable ( int  unknown)

Disable Idle timer.

Parameters
unknown- pass 0
int scePowerIdleTimerEnable ( int  unknown)

Enable Idle timer.

Parameters
unknown- pass 0
int scePowerIsBatteryCharging ( void  )

Check if the battery is charging.

Returns
1 if battery charging, 0 if battery not charging, < 0 on error.
int scePowerIsBatteryExist ( void  )

Check if a battery is present.

Returns
1 if battery present, 0 if battery not present, < 0 on error.
int scePowerIsLowBattery ( void  )

Check if the battery is low.

Returns
1 if the battery is low, 0 if the battery is not low, < 0 on error.
int scePowerIsPowerOnline ( void  )

Check if unit is plugged in.

Returns
1 if plugged in, 0 if not plugged in, < 0 on error.
int scePowerLock ( int  unknown)

Lock power switch.

Note: if the power switch is toggled while locked it will fire immediately after being unlocked.

Parameters
unknown- pass 0
Returns
0 on success, < 0 on error.
int scePowerRegisterCallback ( int  slot,
SceUID  cbid 
)

Register Power Callback Function.

Parameters
slot- slot of the callback in the list, 0 to 15, pass -1 to get an auto assignment.
cbid- callback id from calling sceKernelCreateCallback
Returns
0 on success, the slot number if -1 is passed, < 0 on error.
int scePowerRequestStandby ( void  )

Request the PSP to go into standby.

Returns
0 always
int scePowerRequestSuspend ( void  )

Request the PSP to go into suspend.

Returns
0 always
int scePowerSetBusClockFrequency ( int  busfreq)

Set Bus Frequency.

Parameters
busfreq- new BUS frequency, valid values are 1 - 167
int scePowerSetClockFrequency ( int  pllfreq,
int  cpufreq,
int  busfreq 
)

Set Clock Frequencies.

Parameters
pllfreq- pll frequency, valid from 19-333
cpufreq- cpu frequency, valid from 1-333
busfreq- bus frequency, valid from 1-167

and:

cpufreq <= pllfreq busfreq*2 <= pllfreq

int scePowerSetCpuClockFrequency ( int  cpufreq)

Set CPU Frequency.

Parameters
cpufreq- new CPU frequency, valid values are 1 - 333
int scePowerTick ( int  type)

Generate a power tick, preventing unit from powering off and turning off display.

Parameters
type- Either PSP_POWER_TICK_ALL, PSP_POWER_TICK_SUSPEND or PSP_POWER_TICK_DISPLAY
Returns
0 on success, < 0 on error.
int scePowerUnlock ( int  unknown)

Unlock power switch.

Parameters
unknown- pass 0
Returns
0 on success, < 0 on error.
int scePowerUnregisterCallback ( int  slot)

Unregister Power Callback Function.

Parameters
slot- slot of the callback
Returns
0 on success, < 0 on error.