summaryrefslogtreecommitdiff
path: root/include/kernel/kernel/threadmgr.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/kernel/kernel/threadmgr.h')
-rw-r--r--include/kernel/kernel/threadmgr.h93
1 files changed, 76 insertions, 17 deletions
diff --git a/include/kernel/kernel/threadmgr.h b/include/kernel/kernel/threadmgr.h
index 3836f70..445c806 100644
--- a/include/kernel/kernel/threadmgr.h
+++ b/include/kernel/kernel/threadmgr.h
@@ -1,21 +1,14 @@
#ifndef _PSP2_KERNEL_THREADMGR_H_
#define _PSP2_KERNEL_THREADMGR_H_
-#include <psp2kern/types.h>
+#include <psp2common/kernel/threadmgr.h>
#ifdef __cplusplus
extern "C" {
#endif
-#define SCE_KERNEL_MUTEX_ATTR_RECURSIVE 2
-
-/** 64-bit system clock type. */
-typedef SceUInt64 SceKernelSysClock;
-
/* Threads. */
-typedef int (* SceKernelThreadEntry)(SceSize args, void *argp);
-
/** Additional options used when creating threads. */
typedef struct SceKernelThreadOptParam {
/** Size of the ::SceKernelThreadOptParam structure. */
@@ -449,18 +442,61 @@ int sceKernelCancelMutex(SceUID mutexid, int newCount, int *numWaitThreads);
*/
int sceKernelGetMutexInfo(SceUID mutexid, SceKernelMutexInfo *info);
-typedef struct SceKernelLwMutexWork {
- SceInt64 data[4];
-} SceKernelLwMutexWork;
+/* Fast mutex */
-typedef struct SceKernelLwMutexOptParam {
+typedef struct SceKernelFastMutexWork {
+ SceInt64 data[8];
+} SceKernelFastMutexWork;
+
+typedef enum SceKernelFastMutexAttr {
+ SCE_KERNEL_FAST_MUTEX_ATTR_RECURSIVE = 0x00000002,
+ SCE_KERNEL_FAST_MUTEX_ATTR_CEILING = 0x00000004,
+ SCE_KERNEL_FAST_MUTEX_ATTR_UNK_3 = 0x00000008,
+ SCE_KERNEL_FAST_MUTEX_ATTR_TH_FIFO = 0x00000000,
+ SCE_KERNEL_FAST_MUTEX_ATTR_TH_PRIO = 0x00002000,
+ SCE_KERNEL_FAST_MUTEX_ATTR_UNK_15 = 0x00008000,
+ // All other flags are invalid
+} SceKernelFastMutexAttr;
+
+typedef struct SceKernelFastMutexOptParam {
SceSize size;
-} SceKernelLwMutexOptParam;
+ SceInt32 ceilingPriority;
+} SceKernelFastMutexOptParam;
+
+SceInt32 sceKernelInitializeFastMutex(
+ SceKernelFastMutexWork *pWork,
+ const char *pName,
+ SceKernelFastMutexAttr attr,
+ const SceKernelFastMutexOptParam *pOptParam);
-int sceKernelInitializeFastMutex(void *mutex, const char *name, int unk0, int unk1);
-int sceKernelLockFastMutex(void *mutex);
-int sceKernelUnlockFastMutex(void *mutex);
-int sceKernelDeleteFastMutex(void *mutex);
+SceInt32 sceKernelLockFastMutex(SceKernelFastMutexWork *pWork);
+
+SceInt32 sceKernelTryLockFastMutex(SceKernelFastMutexWork *pWork);
+
+SceInt32 sceKernelUnlockFastMutex(SceKernelFastMutexWork *pWork);
+
+SceInt32 sceKernelFinalizeFastMutex(SceKernelFastMutexWork *pWork);
+
+typedef struct SceKernelFastMutexInfo {
+// 0x00
+ SceSize size;
+ SceUID uid;
+ char name[SCE_UID_NAMELEN + 1];
+ SceKernelFastMutexAttr attr;
+ SceKernelFastMutexWork *pWork;
+// 0x30
+ SceInt32 currentCount;
+ SceUID currentOwnerId;
+ SceInt32 ceilingPriority;
+ SceInt32 unk3C;
+// 0x40
+ SceUInt32 numWaitThreads;
+// 0x44
+} SceKernelFastMutexInfo;
+
+SceInt32 sceKernelGetFastMutexInfo(SceKernelFastMutexWork *pWork, SceKernelFastMutexInfo *pInfo);
+
+SceInt32 sceKernelGetFastMutexInfoById(SceUID uid, SceKernelFastMutexInfo *pInfo);
/* Event flags. */
@@ -1033,6 +1069,29 @@ int sceKernelTryReceiveMsgPipeVector(SceUID uid, const MsgPipeRecvData *v, SceSi
*/
int sceKernelCancelMsgPipe(SceUID uid, int *psend, int *precv);
+SceInt32 sceKernelWaitEvent(
+ SceUID eventId,
+ SceUInt32 waitPattern,
+ SceUInt32 *pResultPattern,
+ SceUInt64 *pUserData,
+ SceUInt32 *pTimeout
+);
+
+SceInt32 sceKernelWaitEventCB(
+ SceUID eventId,
+ SceUInt32 waitPattern,
+ SceUInt32 *pResultPattern,
+ SceUInt64 *pUserData,
+ SceUInt32 *pTimeout
+);
+
+SceInt32 sceKernelPollEvent(
+ SceUID eventId,
+ SceUInt32 bitPattern,
+ SceUInt32 *pResultPattern,
+ SceUInt64 *pUserData
+);
+
#ifdef __cplusplus
}
#endif