From fde83b60c12d5900a5247cfb2bcc23fa5caa486f Mon Sep 17 00:00:00 2001 From: Sunho Kim Date: Mon, 3 Aug 2020 14:20:28 +0900 Subject: Add sceKernelWaitSignal and sceKernelSendSignal (#462) * Add sceKernelWaitSignal and sceKernelSendSignal * Update threadmgr.h * Update threadmgr.h--- include/user/kernel/threadmgr.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'include') diff --git a/include/user/kernel/threadmgr.h b/include/user/kernel/threadmgr.h index 4bc8ac3..3ece29e 100644 --- a/include/user/kernel/threadmgr.h +++ b/include/user/kernel/threadmgr.h @@ -1129,6 +1129,29 @@ int sceKernelDeleteLwCond(SceKernelLwCondWork *pWork); int sceKernelSignalLwCond(SceKernelLwCondWork *pWork); int sceKernelWaitLwCond(SceKernelLwCondWork *pWork, unsigned int *pTimeout); +typedef struct SceKernelWaitSignalOptParam { + SceUInt32 unk; +} SceKernelWaitSignalOptParam; + +/** + * @brief Sleep current thread and wait for a signal. After it receives a signal, the thread wakes up. + * + * This is like a semphore with limit 1. + * If signal was sent before and not consumed before, the function will immediately return. + * + * @param params - extra parameters + * @return 0 on success + */ +int sceKernelWaitSignal(SceUInt32 unk0, SceUInt32 unk1, SceKernelWaitSignalOptParam *params); + +/** + * @brief Send a signal to another thread specified by thid. + * + * @param thid - the id of the thread to send a signal to + * @return 0 on success + * @return SCE_KERNEL_ERROR_ALREADY_SENT if the last signal was not consumed by sceKernelWaitSignal + */ +int sceKernelSendSignal(SceUID thid); /** * Get the system time (wide version) -- cgit v1.2.3 From f8a04eb839122da2cf9e2f4b7b52eb9b95f45d4d Mon Sep 17 00:00:00 2001 From: Rinnegatamante Date: Fri, 7 Aug 2020 15:19:36 +0200 Subject: Properly populated ScePowerCallbackType enum. --- include/user/power.h | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'include') diff --git a/include/user/power.h b/include/user/power.h index 8148139..ed35bed 100644 --- a/include/user/power.h +++ b/include/user/power.h @@ -18,24 +18,30 @@ typedef enum ScePowerErrorCode { } ScePowerErrorCode; typedef enum ScePowerCallbackType { - /** indicates the power button was pushed, putting the unit into suspend mode */ - SCE_POWER_CB_POWER_SWITCH = 0x80000000, - /** ? screen on after off ? **/ - SCE_POWER_CB_UNK_1 = 0x00600000, - /** ? screen off ? **/ - SCE_POWER_CB_UNK_2 = 0x00400000, - /** 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, - /** indicates the unit is plugged into an AC outlet */ - SCE_POWER_CB_AC_POWER = 0x00001000, + /** indicates the unit is using battery as power source */ + SCE_POWER_CB_BATTERY_MODE = 0x00000000, /** indicates the battery is in low state */ - SCE_POWER_CB_LOWBATTERY = 0x00000100, - /** indicates there is a battery present in the unit */ - SCE_POWER_CB_BATTERY_EXIST = 0x00000080 + SCE_POWER_CB_LOW_BATTERY = 0x00000100, + /** indicates the unit is using an AC outlet as power source */ + SCE_POWER_CB_AC_POWER_MODE = 0x00001000, + /** indicates the unit has been shutdown **/ + SCE_POWER_CB_SHUTDOWN = 0x00010000, + /** indicates the application resumed after being put in suspend from a LiveArea event **/ + SCE_POWER_CB_RESUME_LIVEAREA = 0x00200000, + /** indicates the unit entered suspend mode **/ + SCE_POWER_CB_SUSPENDING = 0x00400000, + /** indicates the unit resumed from suspend mode **/ + SCE_POWER_CB_RESUMING = 0x00800000, + /** indicates the system is taking a screenshot **/ + SCE_POWER_CB_SCREENSHOT_TRIGGER = 0x04000000, + /** indicates the system shown the Quick Menu screen **/ + SCE_POWER_CB_QUICK_MENU_TRIGGER = 0x10000000, + /** indicates the PS button was pushed **/ + SCE_POWER_CB_PS_BUTTON_PRESS = 0x20000000, + /** indicates the system shown the shutdown screen **/ + SCE_POWER_CB_SHUTDOWN_MENU_TRIGGER = 0x40000000, + /** indicates the system shown the unlock screen **/ + SCE_POWER_CB_UNLOCK_MENU_TRIGGER = 0x80000000, } ScePowerCallbackType; /* GPU, WLAN/COM configuration setting */ -- cgit v1.2.3 From 55267aa6979d1d70315d5e4c04a5087149e0a653 Mon Sep 17 00:00:00 2001 From: Princess of Sleeping Date: Mon, 10 Aug 2020 15:14:10 +0900 Subject: Fix return type of SceCpu --- include/kernel/kernel/cpu.h | 42 +++++++++++------------------------------- 1 file changed, 11 insertions(+), 31 deletions(-) (limited to 'include') diff --git a/include/kernel/kernel/cpu.h b/include/kernel/kernel/cpu.h index d0b5d5f..e60292c 100644 --- a/include/kernel/kernel/cpu.h +++ b/include/kernel/kernel/cpu.h @@ -34,10 +34,8 @@ extern "C" { * * @param ptr The pointer * @param[in] len The length - * - * @return Zero on success */ -int sceKernelCpuDcacheWritebackRange(const void *ptr, SceSize len); +void sceKernelCpuDcacheWritebackRange(const void *ptr, SceSize len); /** @@ -131,61 +129,47 @@ int sceKernelCpuEnableInterrupts(int flags); * * @param ptr The pointer * @param[in] len The length - * - * @return Zero on success */ -int sceKernelCpuDcacheInvalidateRange(const void *ptr, SceSize len); +void sceKernelCpuDcacheInvalidateRange(const void *ptr, SceSize len); /** * @brief Writeback and invalidate a range of L1 dcache (without L2) * * @param ptr The pointer * @param[in] len The length - * - * @return Zero on success */ -int sceKernelCpuDcacheWritebackInvalidateRange(const void *ptr, SceSize len); +void sceKernelCpuDcacheWritebackInvalidateRange(const void *ptr, SceSize len); /** * @brief Invalidate all the L1 dcache (without L2) - * - * @return Zero on success */ -int sceKernelCpuDcacheInvalidateAll(void); +void sceKernelCpuDcacheInvalidateAll(void); /** * @brief Writeback all the L1 dcache (without L2) - * - * @return Zero on success */ -int sceKernelCpuDcacheWritebackAll(void); +void sceKernelCpuDcacheWritebackAll(void); /** * @brief Writeback and invalidate all the L1 dcache (without L2) - * - * @return Zero on success */ -int sceKernelCpuDcacheWritebackInvalidateAll(void); +void sceKernelCpuDcacheWritebackInvalidateAll(void); /** * @brief Writeback a range of L1 dcache and L2 * * @param ptr The pointer * @param[in] len The length - * - * @return Zero on success */ -int sceKernelCpuDcacheAndL2WritebackRange(const void *ptr, SceSize len); +void sceKernelCpuDcacheAndL2WritebackRange(const void *ptr, SceSize len); /** * @brief Writeback and invalidate a range of L1 dcache and L2 * * @param ptr The pointer * @param[in] len The length - * - * @return Zero on success */ -int sceKernelCpuDcacheAndL2InvalidateRange(const void *ptr, SceSize len); +void sceKernelCpuDcacheAndL2InvalidateRange(const void *ptr, SceSize len); /** * @brief Writeback and invalidate a range of L1 dcache and L2 @@ -195,17 +179,15 @@ int sceKernelCpuDcacheAndL2InvalidateRange(const void *ptr, SceSize len); * * @return Zero on success */ -int sceKernelCpuDcacheAndL2WritebackInvalidateRange(const void *ptr, SceSize len); +void sceKernelCpuDcacheAndL2WritebackInvalidateRange(const void *ptr, SceSize len); /** * @brief Invalidate a range of L1 icache (without L2) * * @param ptr The pointer * @param[in] len The length - * - * @return Zero on success */ -int sceKernelCpuIcacheInvalidateRange(const void *ptr, SceSize len); +void sceKernelCpuIcacheInvalidateRange(const void *ptr, SceSize len); /** * @brief Invalidate all the L1 icache (without L2) @@ -219,10 +201,8 @@ int sceKernelCpuIcacheInvalidateAll(void); * * @param ptr The pointer * @param[in] len The length - * - * @return Zero on success */ -int sceKernelCpuIcacheAndL2WritebackInvalidateRange(const void *ptr, SceSize len); +void sceKernelCpuIcacheAndL2WritebackInvalidateRange(const void *ptr, SceSize len); /** * @brief Suspend all interrupts (disables IRQs) -- cgit v1.2.3 From 7d34210fc73a100f7e04efc9af3c69636302dc86 Mon Sep 17 00:00:00 2001 From: Princess of Sleeping Date: Tue, 11 Aug 2020 12:46:29 +0900 Subject: Refactor ksceKernelCpuUnrestrictedMemcpy apply memcpy and volatile --- include/kernel/kernel/cpu.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/kernel/kernel/cpu.h b/include/kernel/kernel/cpu.h index e60292c..b3ad11e 100644 --- a/include/kernel/kernel/cpu.h +++ b/include/kernel/kernel/cpu.h @@ -2,6 +2,7 @@ #define _PSP2_KERNEL_CPU_H_ #include +#include #ifdef __cplusplus extern "C" { @@ -89,15 +90,13 @@ static inline int sceKernelCpuUnrestrictedMemcpy(void *dst, const void *src, Sce { int prev_dacr; - asm ("mrc p15, 0, %0, c3, c0, 0" : "=r" (prev_dacr)); - asm ("mcr p15, 0, %0, c3, c0, 0" :: "r" (0xFFFF0000)); + asm volatile("mrc p15, 0, %0, c3, c0, 0" : "=r" (prev_dacr)); + asm volatile("mcr p15, 0, %0, c3, c0, 0" :: "r" (0xFFFF0000)); - for (size_t i=0; i < len; i++) { - ((char *) dst)[i] = ((char *) src)[i]; - } + memcpy(dst, src, len); sceKernelCpuDcacheWritebackRange((void *)((uintptr_t)dst & ~0x1F), (len + 0x1F) & ~0x1F); - asm ("mcr p15, 0, %0, c3, c0, 0" :: "r" (prev_dacr)); + asm volatile("mcr p15, 0, %0, c3, c0, 0" :: "r" (prev_dacr)); return 0; } -- cgit v1.2.3 From 53edefaeba6e139164642c2287cc098197be895a Mon Sep 17 00:00:00 2001 From: Princess of Sleeping Date: Thu, 3 Sep 2020 12:26:31 +0900 Subject: Add SceProcEvent (#466) * add SceProcEvent * Create proc_event.h * Fix args name--- include/kernel/kernel/proc_event.h | 73 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 include/kernel/kernel/proc_event.h (limited to 'include') diff --git a/include/kernel/kernel/proc_event.h b/include/kernel/kernel/proc_event.h new file mode 100644 index 0000000..37af5f9 --- /dev/null +++ b/include/kernel/kernel/proc_event.h @@ -0,0 +1,73 @@ +#ifndef _PSP2_KERNEL_PROC_EVENT_H_ +#define _PSP2_KERNEL_PROC_EVENT_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct SceProcEventInvokeParam1 { + SceSize size; // SceProcEventInvokeParam1 struct size : 0x10 + int unk_0x04; + int unk_0x08; + int unk_0x0C; +} SceProcEventInvokeParam1; + +typedef struct SceProcEventInvokeParam2 { + SceSize size; // SceProcEventInvokeParam2 struct size : 0x14 + SceUID pid; + int unk_0x08; + int unk_0x0C; + int unk_0x10; +} SceProcEventInvokeParam2; + +typedef struct SceProcEventHandler { + SceSize size; // SceProcEventHandler struct size : 0x1C + int (* create)(SceUID pid, SceProcEventInvokeParam2 *a2, int a3); + int (* exit)(SceUID pid, SceProcEventInvokeParam1 *a2, int a3); // current process exit + int (* kill)(SceUID pid, SceProcEventInvokeParam1 *a2, int a3); // by SceShell + int (* stop)(SceUID pid, int event_type, SceProcEventInvokeParam1 *a3, int a4); + int (* start)(SceUID pid, int event_type, SceProcEventInvokeParam1 *a3, int a4); + int (* switch_process)(int event_id, int event_type, SceProcEventInvokeParam2 *a3, int a4); // switch display frame? +} SceProcEventHandler; + +/** + * Register process event handler + * + * @param[in] name - Name of handler + * @param[in] handler - The pointer of handler + * @param[in] a3 - unknown, set to 0 + * + * @return uid on success, < 0 on error. + */ +SceUID sceKernelRegisterProcEventHandler(const char *name, const SceProcEventHandler *handler, int a3); + +/** + * Unregister process event handler + * + * @param[in] uid - ProcEvent uid + * + * @return uid on success, < 0 on error. + */ +int sceKernelUnregisterProcEventHandler(SceUID uid); + +/** + * Invoke process event handler + * + * @param[in] pid - The ProccessId + * @param[in] event_id - event_id, [1, 2, 3, 4, 5, 0x10, 0x11] + * @param[in] event_type - Various event types + * @param[in] param - The pointer of invoke parameter + * @param[in] a5 - Unknown + * @param[in] a6 - Unknown + * + * @return uid on success, < 0 on error. + */ +int sceKernelInvokeProcEventHandler(SceUID pid, int event_id, int event_type, void *param, void *a5, int a6); + +#ifdef __cplusplus +} +#endif + +#endif /* _PSP2_KERNEL_PROC_EVENT_H_ */ -- cgit v1.2.3 From b4fbb87694c8b0a9c04d4ca527488cdf90b1c8c3 Mon Sep 17 00:00:00 2001 From: Reiko Asakura Date: Mon, 14 Sep 2020 20:49:31 -0400 Subject: Revert vitasdk commits Revert "travis: Install libclang1-9 and libclang-cpp9 for doxygen" This reverts commit 18133956d69a0f02feb42cc441c013bfd84b6388. Revert "travis: Bump ubuntu version to 20.04" This reverts commit 5dee9e2f731747cbeff8003c05373dcd51557bee. Revert "travis: Bump up doxygen version to 1.8.20" This reverts commit 29b1e2243f12ea7f1dccfa1d182d858fb27ea949. Revert "Properly populated ScePowerCallbackType enum." This reverts commit faf03c48bdd0c698f8c5cd14947821de8ea71f6b. Revert "Added some prototypes for command lists and deferred contexts." This reverts commit 77791c80439a341e0ac05a2eb8f52f483f304428. --- include/user/power.h | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) (limited to 'include') diff --git a/include/user/power.h b/include/user/power.h index ed35bed..8148139 100644 --- a/include/user/power.h +++ b/include/user/power.h @@ -18,30 +18,24 @@ typedef enum ScePowerErrorCode { } ScePowerErrorCode; typedef enum ScePowerCallbackType { - /** indicates the unit is using battery as power source */ - SCE_POWER_CB_BATTERY_MODE = 0x00000000, + /** indicates the power button was pushed, putting the unit into suspend mode */ + SCE_POWER_CB_POWER_SWITCH = 0x80000000, + /** ? screen on after off ? **/ + SCE_POWER_CB_UNK_1 = 0x00600000, + /** ? screen off ? **/ + SCE_POWER_CB_UNK_2 = 0x00400000, + /** 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, + /** indicates the unit is plugged into an AC outlet */ + SCE_POWER_CB_AC_POWER = 0x00001000, /** indicates the battery is in low state */ - SCE_POWER_CB_LOW_BATTERY = 0x00000100, - /** indicates the unit is using an AC outlet as power source */ - SCE_POWER_CB_AC_POWER_MODE = 0x00001000, - /** indicates the unit has been shutdown **/ - SCE_POWER_CB_SHUTDOWN = 0x00010000, - /** indicates the application resumed after being put in suspend from a LiveArea event **/ - SCE_POWER_CB_RESUME_LIVEAREA = 0x00200000, - /** indicates the unit entered suspend mode **/ - SCE_POWER_CB_SUSPENDING = 0x00400000, - /** indicates the unit resumed from suspend mode **/ - SCE_POWER_CB_RESUMING = 0x00800000, - /** indicates the system is taking a screenshot **/ - SCE_POWER_CB_SCREENSHOT_TRIGGER = 0x04000000, - /** indicates the system shown the Quick Menu screen **/ - SCE_POWER_CB_QUICK_MENU_TRIGGER = 0x10000000, - /** indicates the PS button was pushed **/ - SCE_POWER_CB_PS_BUTTON_PRESS = 0x20000000, - /** indicates the system shown the shutdown screen **/ - SCE_POWER_CB_SHUTDOWN_MENU_TRIGGER = 0x40000000, - /** indicates the system shown the unlock screen **/ - SCE_POWER_CB_UNLOCK_MENU_TRIGGER = 0x80000000, + SCE_POWER_CB_LOWBATTERY = 0x00000100, + /** indicates there is a battery present in the unit */ + SCE_POWER_CB_BATTERY_EXIST = 0x00000080 } ScePowerCallbackType; /* GPU, WLAN/COM configuration setting */ -- cgit v1.2.3