From dab89657fab838dacbd5c9dd7f4d2bc2098a52e3 Mon Sep 17 00:00:00 2001 From: Reiko Asakura Date: Fri, 12 Mar 2021 17:09:12 -0500 Subject: Merge common definitions in power.h --- include/common/power.h | 175 +++++++++++++++++++++++++++++++++++++++++++++++++ include/kernel/power.h | 149 ----------------------------------------- include/user/power.h | 157 -------------------------------------------- 3 files changed, 175 insertions(+), 306 deletions(-) create mode 100644 include/common/power.h diff --git a/include/common/power.h b/include/common/power.h new file mode 100644 index 0000000..3a5ad75 --- /dev/null +++ b/include/common/power.h @@ -0,0 +1,175 @@ +/* + Vita Development Suite Libraries +*/ + +#ifndef _VDSUITE_COMMON_POWER_H +#define _VDSUITE_COMMON_POWER_H + +#include_next + +#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) +extern "C" { +#endif /* defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) */ + +/*J 電源関係通知コールバックの引数定義マクロ */ +/*E Constant Definitions */ + +#define SCE_POWER_CALLBACKARG_SUSPENDING 0x00010000 /** Entering suspend from timer */ +#define SCE_POWER_CALLBACKARG_RESUMING 0x00020000 /** Resuming from suspend */ +#define SCE_POWER_CALLBACKARG_RESUME_COMPLETE 0x00040000 /** Finished resuming from suspend */ +#define SCE_POWER_CALLBACKARG_POWER_SWITCH 0x80000000 /** Entering suspend from power button */ + +/*J プロトタイプ宣言 */ +/*E prototype declaration */ + +/** + * Returns battery life percentage + * + * @return Battery life percentage + */ +int scePowerGetBatteryLifePercent(void); + +/** + * Check if a suspend is required + * + * @return SCE_TRUE if suspend is required, SCE_FALSE otherwise + */ +SceBool scePowerIsSuspendRequired(void); + +/** + * Returns battery life time + * + * @return Battery life time in seconds + */ +int scePowerGetBatteryLifeTime(void); + +/** + * Returns battery remaining capacity + * + * @return battery remaining capacity in mAh (milliampere hour) + */ +int scePowerGetBatteryRemainCapacity(void); + +/** + * Returns battery full capacity + * + * @return battery full capacity in mAh (milliampere hour) + */ +int scePowerGetBatteryFullCapacity(void); + +/** + * Returns battery temperature + * + * @return temperature in degrees celcius * 100 + */ +int scePowerGetBatteryTemp(void); + +/** + * Returns battery voltage + * + * @return battery voltage in mV (millivolts) + */ +int scePowerGetBatteryVolt(void); + +/** + * Returns battery state of health + * + * @return battery state of health percent + */ +int scePowerGetBatterySOH(void); + +/** + * Returns battery cycle count + * + * @return battery cycle count + */ +int scePowerGetBatteryCycleCount(void); + +/** + * Returns CPU clock frequency + * + * @return CPU clock frequency in Mhz + */ +int scePowerGetArmClockFrequency(void); + +/** + * Returns BUS clock frequency + * + * @return BUS clock frequency in Mhz + */ +int scePowerGetBusClockFrequency(void); + +/** + * Returns GPU crossbar clock frequency + * + * @return GPU crossbar clock frequency in Mhz + */ +int scePowerGetGpuXbarClockFrequency(void); + +/** + * Requests PS Vita to do a cold reset + * + * @return always 0 + */ +int scePowerRequestColdReset(void); + +/** + * Requests PS Vita to go into standby + * + * @return always 0 + */ +int scePowerRequestStandby(void); + +/** + * Requests PS Vita to suspend + * + * @return always 0 + */ +int scePowerRequestSuspend(void); + +/** + * Request display on + * + * @return always 0 + */ +int scePowerRequestDisplayOn(void); + +/** + * Request display off + * + * @return always 0 + */ +int scePowerRequestDisplayOff(void); + +/** + * Sets CPU clock frequency + * + * @param freq - Frequency to set in Mhz + * + * @return 0 on success, < 0 on error + */ +int scePowerSetArmClockFrequency(int freq); + +/** + * Sets BUS clock frequency + * + * @param freq - Frequency to set in Mhz + * + * @return 0 on success, < 0 on error + */ +int scePowerSetBusClockFrequency(int freq); + +/** + * Sets GPU crossbar clock frequency + * + * @param freq - Frequency to set in Mhz + * + * @return 0 on success, < 0 on error + */ +int scePowerSetGpuXbarClockFrequency(int freq); + +#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) +} +#endif /* defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) */ + +#endif /* _VDSUITE_COMMON_POWER_H */ diff --git a/include/kernel/power.h b/include/kernel/power.h index 870191e..fe0a1d8 100644 --- a/include/kernel/power.h +++ b/include/kernel/power.h @@ -11,96 +11,8 @@ extern "C" { #endif -typedef enum ScePowerCallbackType { - /** indicates the power button was pushed, putting the unit into suspend mode */ - SCE_POWER_CB_POWER_SWITCH = 0x80000000, - /** indicates the unit has finish resuming from suspend mode */ - SCE_POWER_CB_RESUME_COMPLETE = 0x00040000, - /** indicates the unit is resuming from suspend mode */ - SCE_POWER_CB_RESUMING = 0x00020000, - /** indicates the unit is suspending, seems to occur due to inactivity */ - SCE_POWER_CB_SUSPENDING = 0x00010000, -} ScePowerCallbackType; - /* Prototypes */ -/** - * Returns battery life percentage - * - * @return Battery life percentage - */ -int scePowerGetBatteryLifePercent(void); - -/** - * Check if a suspend is required - * - * @return SCE_TRUE if suspend is required, SCE_FALSE otherwise - */ -SceBool scePowerIsSuspendRequired(void); - -/** - * Returns battery life time - * - * @return Battery life time in seconds - */ -int scePowerGetBatteryLifeTime(void); - -/** - * Returns battery remaining capacity - * - * @return battery remaining capacity in mAh (milliampere hour) - */ -int scePowerGetBatteryRemainCapacity(void); - -/** - * Returns battery full capacity - * - * @return battery full capacity in mAh (milliampere hour) - */ -int scePowerGetBatteryFullCapacity(void); - -/** - * Returns battery temperature - * - * @return temperature in degrees celcius * 100 - */ -int scePowerGetBatteryTemp(void); - -/** - * Returns battery voltage - * - * @return battery voltage in mV (millivolts) - */ -int scePowerGetBatteryVolt(void); - -/** - * Returns battery state of health - * - * @return battery state of health percent - */ -int scePowerGetBatterySOH(void); - -/** - * Returns battery cycle count - * - * @return battery cycle count - */ -int scePowerGetBatteryCycleCount(void); - -/** - * Returns CPU clock frequency - * - * @return CPU clock frequency in Mhz - */ -int scePowerGetArmClockFrequency(void); - -/** - * Returns BUS clock frequency - * - * @return BUS clock frequency in Mhz - */ -int scePowerGetBusClockFrequency(void); - /** * Returns Sys clock frequency * @@ -108,13 +20,6 @@ int scePowerGetBusClockFrequency(void); */ int scePowerGetSysClockFrequency(void); -/** - * Returns GPU crossbar clock frequency - * - * @return GPU crossbar clock frequency in Mhz - */ -int scePowerGetGpuXbarClockFrequency(void); - /** * Requests PS Vita to do a soft reset * @@ -122,34 +27,6 @@ int scePowerGetGpuXbarClockFrequency(void); */ int scePowerRequestSoftReset(void); -/** - * Requests PS Vita to do a cold reset - * - * @return always 0 - */ -int scePowerRequestColdReset(void); - -/** - * Requests PS Vita to go into standby - * - * @return always 0 - */ -int scePowerRequestStandby(void); - -/** - * Requests PS Vita to suspend - * - * @return always 0 - */ -int scePowerRequestSuspend(void); - -/** - * Request display off - * - * @return always 0 - */ -int scePowerRequestDisplayOff(void); - /** * Set the screen brightness. * @see ::sceAVConfigSetDisplayBrightness for userland counterpart. @@ -160,32 +37,6 @@ int scePowerRequestDisplayOff(void); */ int scePowerSetDisplayBrightness(int brightness); -/** - * Sets CPU clock frequency - * - * @param freq - Frequency to set in Mhz - * - * @return 0 on success, < 0 on error - */ -int scePowerSetArmClockFrequency(int freq); - -/** - * Sets BUS clock frequency - * - * @param freq - Frequency to set in Mhz - * - * @return 0 on success, < 0 on error - */ -int scePowerSetBusClockFrequency(int freq); -/** - * Sets GPU crossbar clock frequency - * - * @param freq - Frequency to set in Mhz - * - * @return 0 on success, < 0 on error - */ -int scePowerSetGpuXbarClockFrequency(int freq); - /** * Sets the time before idle callback is notified. * diff --git a/include/user/power.h b/include/user/power.h index bb5b068..90658e6 100644 --- a/include/user/power.h +++ b/include/user/power.h @@ -12,94 +12,6 @@ extern "C" { #endif -typedef enum ScePowerCallbackType { - /** indicates the power button was pushed, putting the unit into suspend mode */ - SCE_POWER_CB_POWER_SWITCH = 0x80000000, - /** indicates the unit has finish resuming from suspend mode */ - SCE_POWER_CB_RESUME_COMPLETE = 0x00040000, - /** indicates the unit is resuming from suspend mode */ - SCE_POWER_CB_RESUMING = 0x00020000, - /** indicates the unit is suspending, seems to occur due to inactivity */ - SCE_POWER_CB_SUSPENDING = 0x00010000, -} ScePowerCallbackType; - -/** - * Returns battery life percentage - * - * @return Battery life percentage - */ -int scePowerGetBatteryLifePercent(void); - -/** - * Check if a suspend is required - * - * @return SCE_TRUE if suspend is required, SCE_FALSE otherwise - */ -SceBool scePowerIsSuspendRequired(void); - -/** - * Returns battery life time - * - * @return Battery life time in seconds - */ -int scePowerGetBatteryLifeTime(void); - -/** - * Returns battery remaining capacity - * - * @return battery remaining capacity in mAh (milliampere hour) - */ -int scePowerGetBatteryRemainCapacity(void); - -/** - * Returns battery full capacity - * - * @return battery full capacity in mAh (milliampere hour) - */ -int scePowerGetBatteryFullCapacity(void); - -/** - * Returns battery temperature - * - * @return temperature in degrees celcius * 100 - */ -int scePowerGetBatteryTemp(void); - -/** - * Returns battery voltage - * - * @return battery voltage in mV (millivolts) - */ -int scePowerGetBatteryVolt(void); - -/** - * Returns battery state of health - * - * @return battery state of health percent - */ -int scePowerGetBatterySOH(void); - -/** - * Returns battery cycle count - * - * @return battery cycle count - */ -int scePowerGetBatteryCycleCount(void); - -/** - * Returns CPU clock frequency - * - * @return CPU clock frequency in Mhz - */ -int scePowerGetArmClockFrequency(void); - -/** - * Returns BUS clock frequency - * - * @return BUS clock frequency in Mhz - */ -int scePowerGetBusClockFrequency(void); - /** * Returns GPU clock frequency * @@ -107,66 +19,6 @@ int scePowerGetBusClockFrequency(void); */ int scePowerGetGpuClockFrequency(void); -/** - * Returns GPU crossbar clock frequency - * - * @return GPU crossbar clock frequency in Mhz - */ -int scePowerGetGpuXbarClockFrequency(void); - -/** - * Requests PS Vita to do a cold reset - * - * @return always 0 - */ -int scePowerRequestColdReset(void); - -/** - * Requests PS Vita to go into standby - * - * @return always 0 - */ -int scePowerRequestStandby(void); - -/** - * Requests PS Vita to suspend - * - * @return always 0 - */ -int scePowerRequestSuspend(void); - -/** - * Request display on - * - * @return always 0 - */ -int scePowerRequestDisplayOn(void); - -/** - * Request display off - * - * @return always 0 - */ -int scePowerRequestDisplayOff(void); - -/** - * Sets CPU clock frequency - * - * @param freq - Frequency to set in Mhz - * - * @return 0 on success, < 0 on error - */ -int scePowerSetArmClockFrequency(int freq); - -/** - * Sets BUS clock frequency - * - * @param freq - Frequency to set in Mhz - * - * @return 0 on success, < 0 on error - */ -int scePowerSetBusClockFrequency(int freq); - /** * Sets GPU clock frequency * @@ -176,15 +28,6 @@ int scePowerSetBusClockFrequency(int freq); */ int scePowerSetGpuClockFrequency(int freq); -/** - * Sets GPU crossbar clock frequency - * - * @param freq - Frequency to set in Mhz - * - * @return 0 on success, < 0 on error - */ -int scePowerSetGpuXbarClockFrequency(int freq); - /** * Sets wireless features usage * -- cgit v1.2.3