PSPSDK 1.0+beta2
Thread Manager Library

Library imports for the kernel threading library. More...

Data Structures

struct  SceKernelSysClock
 64-bit system clock type. More...
 
struct  SceKernelThreadOptParam
 Additional options used when creating threads. More...
 
struct  SceKernelThreadInfo
 Structure to hold the status information for a thread. More...
 
struct  SceKernelThreadRunStatus
 Statistics about a running thread. More...
 
struct  SceKernelSemaOptParam
 Additional options used when creating semaphores. More...
 
struct  SceKernelSemaInfo
 Current state of a semaphore. More...
 
struct  SceLwMutexWorkarea
 Struct as workarea for lightweight mutex. More...
 
struct  SceKernelEventFlagInfo
 Structure to hold the event flag information. More...
 
struct  SceKernelEventFlagOptParam
 
struct  SceKernelMbxOptParam
 Additional options used when creating messageboxes. More...
 
struct  SceKernelMbxInfo
 Current state of a messagebox. More...
 
struct  SceKernelMsgPacket
 Header for a message box packet. More...
 
struct  SceKernelAlarmInfo
 Struct containing alarm info. More...
 
struct  SceKernelCallbackInfo
 Structure to hold the status information for a callback. More...
 
struct  SceKernelSystemStatus
 Structure to contain the system status returned by sceKernelReferSystemStatus. More...
 
struct  SceKernelMppInfo
 Message Pipe status info. More...
 
struct  SceKernelVplOptParam
 
struct  SceKernelVplInfo
 Variable pool status info. More...
 
struct  SceKernelFplOptParam
 
struct  SceKernelFplInfo
 Fixed pool status information. More...
 
struct  SceKernelVTimerOptParam
 
struct  SceKernelVTimerInfo
 
struct  SceKernelThreadEventHandlerInfo
 Struct for event handler info. More...
 

Macros

#define THREAD_ATTR_VFPU   PSP_THREAD_ATTR_VFPU
 
#define THREAD_ATTR_USER   PSP_THREAD_ATTR_USER
 

Typedefs

typedef struct SceKernelSysClock SceKernelSysClock
 64-bit system clock type. More...
 
typedef int(* SceKernelThreadEntry) (SceSize args, void *argp)
 
typedef struct SceKernelThreadOptParam SceKernelThreadOptParam
 Additional options used when creating threads. More...
 
typedef struct SceKernelThreadInfo SceKernelThreadInfo
 Structure to hold the status information for a thread. More...
 
typedef struct SceKernelThreadRunStatus SceKernelThreadRunStatus
 Statistics about a running thread. More...
 
typedef struct SceKernelSemaOptParam SceKernelSemaOptParam
 Additional options used when creating semaphores. More...
 
typedef struct SceKernelSemaInfo SceKernelSemaInfo
 Current state of a semaphore. More...
 
typedef struct SceKernelEventFlagInfo SceKernelEventFlagInfo
 Structure to hold the event flag information. More...
 
typedef struct SceKernelEventFlagOptParam SceKernelEventFlagOptParam
 
typedef struct SceKernelMbxOptParam SceKernelMbxOptParam
 Additional options used when creating messageboxes. More...
 
typedef struct SceKernelMbxInfo SceKernelMbxInfo
 Current state of a messagebox. More...
 
typedef struct SceKernelMsgPacket SceKernelMsgPacket
 Header for a message box packet. More...
 
typedef SceUInt(* SceKernelAlarmHandler) (void *common)
 Prototype for alarm handlers. More...
 
typedef struct SceKernelAlarmInfo SceKernelAlarmInfo
 Struct containing alarm info. More...
 
typedef int(* SceKernelCallbackFunction) (int arg1, int arg2, void *arg)
 Callback function prototype. More...
 
typedef struct SceKernelCallbackInfo SceKernelCallbackInfo
 Structure to hold the status information for a callback. More...
 
typedef struct SceKernelSystemStatus SceKernelSystemStatus
 Structure to contain the system status returned by sceKernelReferSystemStatus. More...
 
typedef struct SceKernelMppInfo SceKernelMppInfo
 Message Pipe status info. More...
 
typedef struct SceKernelVplInfo SceKernelVplInfo
 Variable pool status info. More...
 
typedef struct SceKernelFplInfo SceKernelFplInfo
 Fixed pool status information. More...
 
typedef SceUInt(* SceKernelVTimerHandler) (SceUID uid, SceKernelSysClock *, SceKernelSysClock *, void *)
 
typedef SceUInt(* SceKernelVTimerHandlerWide) (SceUID uid, SceInt64, SceInt64, void *)
 
typedef struct SceKernelVTimerInfo SceKernelVTimerInfo
 
typedef int(* SceKernelThreadEventHandler) (int mask, SceUID thid, void *common)
 
typedef struct SceKernelThreadEventHandlerInfo SceKernelThreadEventHandlerInfo
 Struct for event handler info. More...
 

Enumerations

enum  PspThreadAttributes {
  PSP_THREAD_ATTR_VFPU = 0x00004000 , PSP_THREAD_ATTR_USER = 0x80000000 , PSP_THREAD_ATTR_USBWLAN = 0xa0000000 , PSP_THREAD_ATTR_VSH = 0xc0000000 ,
  PSP_THREAD_ATTR_SCRATCH_SRAM = 0x00008000 , PSP_THREAD_ATTR_NO_FILLSTACK = 0x00100000 , PSP_THREAD_ATTR_CLEAR_STACK = 0x00200000
}
 Attribute for threads. More...
 
enum  PspThreadStatus {
  PSP_THREAD_RUNNING = 1 , PSP_THREAD_READY = 2 , PSP_THREAD_WAITING = 4 , PSP_THREAD_SUSPEND = 8 ,
  PSP_THREAD_STOPPED = 16 , PSP_THREAD_KILLED = 32
}
 
enum  PspEventFlagAttributes { PSP_EVENT_WAITMULTIPLE = 0x200 }
 Event flag creation attributes. More...
 
enum  PspEventFlagWaitTypes { PSP_EVENT_WAITAND = 0 , PSP_EVENT_WAITOR = 1 , PSP_EVENT_WAITCLEAR = 0x20 }
 Event flag wait types. More...
 
enum  SceKernelIdListType {
  SCE_KERNEL_TMID_Thread = 1 , SCE_KERNEL_TMID_Semaphore = 2 , SCE_KERNEL_TMID_EventFlag = 3 , SCE_KERNEL_TMID_Mbox = 4 ,
  SCE_KERNEL_TMID_Vpl = 5 , SCE_KERNEL_TMID_Fpl = 6 , SCE_KERNEL_TMID_Mpipe = 7 , SCE_KERNEL_TMID_Callback = 8 ,
  SCE_KERNEL_TMID_ThreadEventHandler = 9 , SCE_KERNEL_TMID_Alarm = 10 , SCE_KERNEL_TMID_VTimer = 11 , SCE_KERNEL_TMID_SleepThread = 64 ,
  SCE_KERNEL_TMID_DelayThread = 65 , SCE_KERNEL_TMID_SuspendThread = 66 , SCE_KERNEL_TMID_DormantThread = 67
}
 Threadman types for sceKernelGetThreadmanIdList. More...
 
enum  ThreadEventIds { THREADEVENT_ALL = 0xFFFFFFFF , THREADEVENT_KERN = 0xFFFFFFF8 , THREADEVENT_USER = 0xFFFFFFF0 , THREADEVENT_CURRENT = 0 }
 
enum  ThreadEvents { THREAD_CREATE = 1 , THREAD_START = 2 , THREAD_EXIT = 4 , THREAD_DELETE = 8 }
 

Functions

SceUID sceKernelCreateThread (const char *name, SceKernelThreadEntry entry, int initPriority, int stackSize, SceUInt attr, SceKernelThreadOptParam *option)
 Create a thread. More...
 
int sceKernelDeleteThread (SceUID thid)
 Delate a thread. More...
 
int sceKernelStartThread (SceUID thid, SceSize arglen, void *argp)
 Start a created thread. More...
 
int sceKernelExitThread (int status)
 Exit a thread. More...
 
int sceKernelExitDeleteThread (int status)
 Exit a thread and delete itself. More...
 
int sceKernelTerminateThread (SceUID thid)
 Terminate a thread. More...
 
int sceKernelTerminateDeleteThread (SceUID thid)
 Terminate and delete a thread. More...
 
int sceKernelSuspendDispatchThread (void)
 Suspend the dispatch thread. More...
 
int sceKernelResumeDispatchThread (int state)
 Resume the dispatch thread. More...
 
int sceKernelSleepThread (void)
 Sleep thread. More...
 
int sceKernelSleepThreadCB (void)
 Sleep thread but service any callbacks as necessary. More...
 
int sceKernelWakeupThread (SceUID thid)
 Wake a thread previously put into the sleep state. More...
 
int sceKernelCancelWakeupThread (SceUID thid)
 Cancel a thread that was to be woken with sceKernelWakeupThread. More...
 
int sceKernelSuspendThread (SceUID thid)
 Suspend a thread. More...
 
int sceKernelResumeThread (SceUID thid)
 Resume a thread previously put into a suspended state with sceKernelSuspendThread. More...
 
int sceKernelWaitThreadEnd (SceUID thid, SceUInt *timeout)
 Wait until a thread has ended. More...
 
int sceKernelWaitThreadEndCB (SceUID thid, SceUInt *timeout)
 Wait until a thread has ended and handle callbacks if necessary. More...
 
int sceKernelDelayThread (SceUInt delay)
 Delay the current thread by a specified number of microseconds. More...
 
int sceKernelDelayThreadCB (SceUInt delay)
 Delay the current thread by a specified number of microseconds and handle any callbacks. More...
 
int sceKernelDelaySysClockThread (SceKernelSysClock *delay)
 Delay the current thread by a specified number of sysclocks. More...
 
int sceKernelDelaySysClockThreadCB (SceKernelSysClock *delay)
 Delay the current thread by a specified number of sysclocks handling callbacks. More...
 
int sceKernelChangeCurrentThreadAttr (int unknown, SceUInt attr)
 Modify the attributes of the current thread. More...
 
int sceKernelChangeThreadPriority (SceUID thid, int priority)
 Change the threads current priority. More...
 
int sceKernelRotateThreadReadyQueue (int priority)
 Rotate thread ready queue at a set priority. More...
 
int sceKernelReleaseWaitThread (SceUID thid)
 Release a thread in the wait state. More...
 
int sceKernelGetThreadId (void)
 Get the current thread Id. More...
 
int sceKernelGetThreadCurrentPriority (void)
 Get the current priority of the thread you are in. More...
 
int sceKernelGetThreadExitStatus (SceUID thid)
 Get the exit status of a thread. More...
 
int sceKernelCheckThreadStack (void)
 Check the thread stack? More...
 
int sceKernelGetThreadStackFreeSize (SceUID thid)
 Get the free stack size for a thread. More...
 
int sceKernelReferThreadStatus (SceUID thid, SceKernelThreadInfo *info)
 Get the status information for the specified thread. More...
 
int sceKernelReferThreadRunStatus (SceUID thid, SceKernelThreadRunStatus *status)
 Retrive the runtime status of a thread. More...
 
SceUID sceKernelCreateSema (const char *name, SceUInt attr, int initVal, int maxVal, SceKernelSemaOptParam *option)
 Creates a new semaphore. More...
 
int sceKernelDeleteSema (SceUID semaid)
 Destroy a semaphore. More...
 
int sceKernelSignalSema (SceUID semaid, int signal)
 Send a signal to a semaphore. More...
 
int sceKernelWaitSema (SceUID semaid, int signal, SceUInt *timeout)
 Lock a semaphore. More...
 
int sceKernelWaitSemaCB (SceUID semaid, int signal, SceUInt *timeout)
 Lock a semaphore a handle callbacks if necessary. More...
 
int sceKernelPollSema (SceUID semaid, int signal)
 Poll a sempahore. More...
 
int sceKernelReferSemaStatus (SceUID semaid, SceKernelSemaInfo *info)
 Retrieve information about a semaphore. More...
 
int sceKernelCreateLwMutex (SceLwMutexWorkarea *workarea, const char *name, u32 attr, int initialCount, u32 *optionsPtr)
 Create a lightweight mutex. More...
 
int sceKernelDeleteLwMutex (SceLwMutexWorkarea *workarea)
 Delete a lightweight mutex. More...
 
int sceKernelTryLockLwMutex (SceLwMutexWorkarea *workarea, int lockCount)
 Try to lock a lightweight mutex. More...
 
int sceKernelLockLwMutex (SceLwMutexWorkarea *workarea, int lockCount, unsigned int *pTimeout)
 Lock a lightweight mutex. More...
 
int sceKernelUnlockLwMutex (SceLwMutexWorkarea *workarea, int lockCount)
 Lock a lightweight mutex. More...
 
SceUID sceKernelCreateEventFlag (const char *name, int attr, int bits, SceKernelEventFlagOptParam *opt)
 Create an event flag. More...
 
int sceKernelSetEventFlag (SceUID evid, u32 bits)
 Set an event flag bit pattern. More...
 
int sceKernelClearEventFlag (SceUID evid, u32 bits)
 Clear a event flag bit pattern. More...
 
int sceKernelPollEventFlag (int evid, u32 bits, u32 wait, u32 *outBits)
 Poll an event flag for a given bit pattern. More...
 
int sceKernelWaitEventFlag (int evid, u32 bits, u32 wait, u32 *outBits, SceUInt *timeout)
 Wait for an event flag for a given bit pattern. More...
 
int sceKernelWaitEventFlagCB (int evid, u32 bits, u32 wait, u32 *outBits, SceUInt *timeout)
 Wait for an event flag for a given bit pattern with callback. More...
 
int sceKernelDeleteEventFlag (int evid)
 Delete an event flag. More...
 
int sceKernelReferEventFlagStatus (SceUID event, SceKernelEventFlagInfo *status)
 Get the status of an event flag. More...
 
SceUID sceKernelCreateMbx (const char *name, SceUInt attr, SceKernelMbxOptParam *option)
 Creates a new messagebox. More...
 
int sceKernelDeleteMbx (SceUID mbxid)
 Destroy a messagebox. More...
 
int sceKernelSendMbx (SceUID mbxid, void *message)
 Send a message to a messagebox. More...
 
int sceKernelReceiveMbx (SceUID mbxid, void **pmessage, SceUInt *timeout)
 Wait for a message to arrive in a messagebox. More...
 
int sceKernelReceiveMbxCB (SceUID mbxid, void **pmessage, SceUInt *timeout)
 Wait for a message to arrive in a messagebox and handle callbacks if necessary. More...
 
int sceKernelPollMbx (SceUID mbxid, void **pmessage)
 Check if a message has arrived in a messagebox. More...
 
int sceKernelCancelReceiveMbx (SceUID mbxid, int *pnum)
 Abort all wait operations on a messagebox. More...
 
int sceKernelReferMbxStatus (SceUID mbxid, SceKernelMbxInfo *info)
 Retrieve information about a messagebox. More...
 
SceUID sceKernelSetAlarm (SceUInt clock, SceKernelAlarmHandler handler, void *common)
 Set an alarm. More...
 
SceUID sceKernelSetSysClockAlarm (SceKernelSysClock *clock, SceKernelAlarmHandler handler, void *common)
 Set an alarm using a SceKernelSysClock structure for the time. More...
 
int sceKernelCancelAlarm (SceUID alarmid)
 Cancel a pending alarm. More...
 
int sceKernelReferAlarmStatus (SceUID alarmid, SceKernelAlarmInfo *info)
 Refer the status of a created alarm. More...
 
int sceKernelCreateCallback (const char *name, SceKernelCallbackFunction func, void *arg)
 Create callback. More...
 
int sceKernelReferCallbackStatus (SceUID cb, SceKernelCallbackInfo *status)
 Gets the status of a specified callback. More...
 
int sceKernelDeleteCallback (SceUID cb)
 Delete a callback. More...
 
int sceKernelNotifyCallback (SceUID cb, int arg2)
 Notify a callback. More...
 
int sceKernelCancelCallback (SceUID cb)
 Cancel a callback ? More...
 
int sceKernelGetCallbackCount (SceUID cb)
 Get the callback count. More...
 
int sceKernelCheckCallback (void)
 Check callback ? More...
 
int sceKernelGetThreadmanIdList (enum SceKernelIdListType type, SceUID *readbuf, int readbufsize, int *idcount)
 Get a list of UIDs from threadman. More...
 
int sceKernelReferSystemStatus (SceKernelSystemStatus *status)
 Get the current system status. More...
 
SceUID sceKernelCreateMsgPipe (const char *name, int part, int attr, void *unk1, void *opt)
 Create a message pipe. More...
 
int sceKernelDeleteMsgPipe (SceUID uid)
 Delete a message pipe. More...
 
int sceKernelSendMsgPipe (SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout)
 Send a message to a pipe. More...
 
int sceKernelSendMsgPipeCB (SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout)
 Send a message to a pipe (with callback) More...
 
int sceKernelTrySendMsgPipe (SceUID uid, void *message, unsigned int size, int unk1, void *unk2)
 Try to send a message to a pipe. More...
 
int sceKernelReceiveMsgPipe (SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout)
 Receive a message from a pipe. More...
 
int sceKernelReceiveMsgPipeCB (SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout)
 Receive a message from a pipe (with callback) More...
 
int sceKernelTryReceiveMsgPipe (SceUID uid, void *message, unsigned int size, int unk1, void *unk2)
 Receive a message from a pipe. More...
 
int sceKernelCancelMsgPipe (SceUID uid, int *psend, int *precv)
 Cancel a message pipe. More...
 
int sceKernelReferMsgPipeStatus (SceUID uid, SceKernelMppInfo *info)
 Get the status of a Message Pipe. More...
 
SceUID sceKernelCreateVpl (const char *name, int part, int attr, unsigned int size, struct SceKernelVplOptParam *opt)
 Create a variable pool. More...
 
int sceKernelDeleteVpl (SceUID uid)
 Delete a variable pool. More...
 
int sceKernelAllocateVpl (SceUID uid, unsigned int size, void **data, unsigned int *timeout)
 Allocate from the pool. More...
 
int sceKernelAllocateVplCB (SceUID uid, unsigned int size, void **data, unsigned int *timeout)
 Allocate from the pool (with callback) More...
 
int sceKernelTryAllocateVpl (SceUID uid, unsigned int size, void **data)
 Try to allocate from the pool. More...
 
int sceKernelFreeVpl (SceUID uid, void *data)
 Free a block. More...
 
int sceKernelCancelVpl (SceUID uid, int *pnum)
 Cancel a pool. More...
 
int sceKernelReferVplStatus (SceUID uid, SceKernelVplInfo *info)
 Get the status of an VPL. More...
 
int sceKernelCreateFpl (const char *name, int part, int attr, unsigned int size, unsigned int blocks, struct SceKernelFplOptParam *opt)
 Create a fixed pool. More...
 
int sceKernelDeleteFpl (SceUID uid)
 Delete a fixed pool. More...
 
int sceKernelAllocateFpl (SceUID uid, void **data, unsigned int *timeout)
 Allocate from the pool. More...
 
int sceKernelAllocateFplCB (SceUID uid, void **data, unsigned int *timeout)
 Allocate from the pool (with callback) More...
 
int sceKernelTryAllocateFpl (SceUID uid, void **data)
 Try to allocate from the pool. More...
 
int sceKernelFreeFpl (SceUID uid, void *data)
 Free a block. More...
 
int sceKernelCancelFpl (SceUID uid, int *pnum)
 Cancel a pool. More...
 
int sceKernelReferFplStatus (SceUID uid, SceKernelFplInfo *info)
 Get the status of an FPL. More...
 
void _sceKernelReturnFromTimerHandler (void)
 Return from a timer handler (doesn't seem to do alot) More...
 
void _sceKernelReturnFromCallback (void)
 Return from a callback (used as a syscall for the return of the callback function) More...
 
int sceKernelUSec2SysClock (unsigned int usec, SceKernelSysClock *clock)
 Convert a number of microseconds to a SceKernelSysClock structure. More...
 
SceInt64 sceKernelUSec2SysClockWide (unsigned int usec)
 Convert a number of microseconds to a wide time. More...
 
int sceKernelSysClock2USec (SceKernelSysClock *clock, unsigned int *low, unsigned int *high)
 Convert a SceKernelSysClock structure to microseconds. More...
 
int sceKernelSysClock2USecWide (SceInt64 clock, unsigned *low, unsigned int *high)
 Convert a wide time to microseconds. More...
 
int sceKernelGetSystemTime (SceKernelSysClock *time)
 Get the system time. More...
 
SceInt64 sceKernelGetSystemTimeWide (void)
 Get the system time (wide version) More...
 
unsigned int sceKernelGetSystemTimeLow (void)
 Get the low 32bits of the current system time. More...
 
SceUID sceKernelCreateVTimer (const char *name, struct SceKernelVTimerOptParam *opt)
 Create a virtual timer. More...
 
int sceKernelDeleteVTimer (SceUID uid)
 Delete a virtual timer. More...
 
int sceKernelGetVTimerBase (SceUID uid, SceKernelSysClock *base)
 Get the timer base. More...
 
SceInt64 sceKernelGetVTimerBaseWide (SceUID uid)
 Get the timer base (wide format) More...
 
int sceKernelGetVTimerTime (SceUID uid, SceKernelSysClock *time)
 Get the timer time. More...
 
SceInt64 sceKernelGetVTimerTimeWide (SceUID uid)
 Get the timer time (wide format) More...
 
int sceKernelSetVTimerTime (SceUID uid, SceKernelSysClock *time)
 Set the timer time. More...
 
SceInt64 sceKernelSetVTimerTimeWide (SceUID uid, SceInt64 time)
 Set the timer time (wide format) More...
 
int sceKernelStartVTimer (SceUID uid)
 Start a virtual timer. More...
 
int sceKernelStopVTimer (SceUID uid)
 Stop a virtual timer. More...
 
int sceKernelSetVTimerHandler (SceUID uid, SceKernelSysClock *time, SceKernelVTimerHandler handler, void *common)
 Set the timer handler. More...
 
int sceKernelSetVTimerHandlerWide (SceUID uid, SceInt64 time, SceKernelVTimerHandlerWide handler, void *common)
 Set the timer handler (wide mode) More...
 
int sceKernelCancelVTimerHandler (SceUID uid)
 Cancel the timer handler. More...
 
int sceKernelReferVTimerStatus (SceUID uid, SceKernelVTimerInfo *info)
 Get the status of a VTimer. More...
 
void _sceKernelExitThread (void)
 Exit the thread (probably used as the syscall when the main thread returns. More...
 
enum SceKernelIdListType sceKernelGetThreadmanIdType (SceUID uid)
 Get the type of a threadman uid. More...
 
SceUID sceKernelRegisterThreadEventHandler (const char *name, SceUID threadID, int mask, SceKernelThreadEventHandler handler, void *common)
 Register a thread event handler. More...
 
int sceKernelReleaseThreadEventHandler (SceUID uid)
 Release a thread event handler. More...
 
int sceKernelReferThreadEventHandlerStatus (SceUID uid, struct SceKernelThreadEventHandlerInfo *info)
 Refer the status of an thread event handler. More...
 
PspDebugProfilerRegssceKernelReferThreadProfiler (void)
 Get the thread profiler registers. More...
 
PspDebugProfilerRegssceKernelReferGlobalProfiler (void)
 Get the globile profiler registers. More...
 

Detailed Description

Library imports for the kernel threading library.

Macro Definition Documentation

◆ THREAD_ATTR_USER

#define THREAD_ATTR_USER   PSP_THREAD_ATTR_USER

◆ THREAD_ATTR_VFPU

#define THREAD_ATTR_VFPU   PSP_THREAD_ATTR_VFPU

Typedef Documentation

◆ SceKernelAlarmHandler

typedef SceUInt(* SceKernelAlarmHandler) (void *common)

Prototype for alarm handlers.

◆ SceKernelAlarmInfo

Struct containing alarm info.

◆ SceKernelCallbackFunction

typedef int(* SceKernelCallbackFunction) (int arg1, int arg2, void *arg)

Callback function prototype.

◆ SceKernelCallbackInfo

Structure to hold the status information for a callback.

◆ SceKernelEventFlagInfo

Structure to hold the event flag information.

◆ SceKernelEventFlagOptParam

◆ SceKernelFplInfo

Fixed pool status information.

◆ SceKernelMbxInfo

Current state of a messagebox.

See also
sceKernelReferMbxStatus.

◆ SceKernelMbxOptParam

Additional options used when creating messageboxes.

◆ SceKernelMppInfo

Message Pipe status info.

◆ SceKernelMsgPacket

Header for a message box packet.

◆ SceKernelSemaInfo

Current state of a semaphore.

See also
sceKernelReferSemaStatus.

◆ SceKernelSemaOptParam

Additional options used when creating semaphores.

◆ SceKernelSysClock

64-bit system clock type.

◆ SceKernelSystemStatus

Structure to contain the system status returned by sceKernelReferSystemStatus.

◆ SceKernelThreadEntry

typedef int(* SceKernelThreadEntry) (SceSize args, void *argp)

◆ SceKernelThreadEventHandler

typedef int(* SceKernelThreadEventHandler) (int mask, SceUID thid, void *common)

◆ SceKernelThreadEventHandlerInfo

Struct for event handler info.

◆ SceKernelThreadInfo

Structure to hold the status information for a thread.

See also
sceKernelReferThreadStatus

◆ SceKernelThreadOptParam

Additional options used when creating threads.

◆ SceKernelThreadRunStatus

Statistics about a running thread.

See also
sceKernelReferThreadRunStatus.

◆ SceKernelVplInfo

Variable pool status info.

◆ SceKernelVTimerHandler

typedef SceUInt(* SceKernelVTimerHandler) (SceUID uid, SceKernelSysClock *, SceKernelSysClock *, void *)

◆ SceKernelVTimerHandlerWide

typedef SceUInt(* SceKernelVTimerHandlerWide) (SceUID uid, SceInt64, SceInt64, void *)

◆ SceKernelVTimerInfo

Enumeration Type Documentation

◆ PspEventFlagAttributes

Event flag creation attributes.

Enumerator
PSP_EVENT_WAITMULTIPLE 

Allow the event flag to be waited upon by multiple threads.

◆ PspEventFlagWaitTypes

Event flag wait types.

Enumerator
PSP_EVENT_WAITAND 

Wait for all bits in the pattern to be set.

PSP_EVENT_WAITOR 

Wait for one or more bits in the pattern to be set.

PSP_EVENT_WAITCLEAR 

Clear the wait pattern when it matches.

◆ PspThreadAttributes

Attribute for threads.

Enumerator
PSP_THREAD_ATTR_VFPU 

Enable VFPU access for the thread.

PSP_THREAD_ATTR_USER 

Start the thread in user mode (done automatically if the thread creating it is in user mode).

PSP_THREAD_ATTR_USBWLAN 

Thread is part of the USB/WLAN API.

PSP_THREAD_ATTR_VSH 

Thread is part of the VSH API.

PSP_THREAD_ATTR_SCRATCH_SRAM 

Allow using scratchpad memory for a thread, NOT USABLE ON V1.0.

PSP_THREAD_ATTR_NO_FILLSTACK 

Disables filling the stack with 0xFF on creation.

PSP_THREAD_ATTR_CLEAR_STACK 

Clear the stack when the thread is deleted.

◆ PspThreadStatus

Enumerator
PSP_THREAD_RUNNING 
PSP_THREAD_READY 
PSP_THREAD_WAITING 
PSP_THREAD_SUSPEND 
PSP_THREAD_STOPPED 
PSP_THREAD_KILLED 

◆ SceKernelIdListType

Threadman types for sceKernelGetThreadmanIdList.

Enumerator
SCE_KERNEL_TMID_Thread 
SCE_KERNEL_TMID_Semaphore 
SCE_KERNEL_TMID_EventFlag 
SCE_KERNEL_TMID_Mbox 
SCE_KERNEL_TMID_Vpl 
SCE_KERNEL_TMID_Fpl 
SCE_KERNEL_TMID_Mpipe 
SCE_KERNEL_TMID_Callback 
SCE_KERNEL_TMID_ThreadEventHandler 
SCE_KERNEL_TMID_Alarm 
SCE_KERNEL_TMID_VTimer 
SCE_KERNEL_TMID_SleepThread 
SCE_KERNEL_TMID_DelayThread 
SCE_KERNEL_TMID_SuspendThread 
SCE_KERNEL_TMID_DormantThread 

◆ ThreadEventIds

Enumerator
THREADEVENT_ALL 
THREADEVENT_KERN 
THREADEVENT_USER 
THREADEVENT_CURRENT 

◆ ThreadEvents

Enumerator
THREAD_CREATE 
THREAD_START 
THREAD_EXIT 
THREAD_DELETE 

Function Documentation

◆ _sceKernelExitThread()

void _sceKernelExitThread ( void  )

Exit the thread (probably used as the syscall when the main thread returns.

◆ _sceKernelReturnFromCallback()

void _sceKernelReturnFromCallback ( void  )

Return from a callback (used as a syscall for the return of the callback function)

◆ _sceKernelReturnFromTimerHandler()

void _sceKernelReturnFromTimerHandler ( void  )

Return from a timer handler (doesn't seem to do alot)

◆ sceKernelAllocateFpl()

int sceKernelAllocateFpl ( SceUID  uid,
void **  data,
unsigned int *  timeout 
)

Allocate from the pool.

Parameters
uid- The UID of the pool
data- Receives the address of the allocated data
timeout- Amount of time to wait for allocation?
Returns
0 on success, < 0 on error

◆ sceKernelAllocateFplCB()

int sceKernelAllocateFplCB ( SceUID  uid,
void **  data,
unsigned int *  timeout 
)

Allocate from the pool (with callback)

Parameters
uid- The UID of the pool
data- Receives the address of the allocated data
timeout- Amount of time to wait for allocation?
Returns
0 on success, < 0 on error

◆ sceKernelAllocateVpl()

int sceKernelAllocateVpl ( SceUID  uid,
unsigned int  size,
void **  data,
unsigned int *  timeout 
)

Allocate from the pool.

Parameters
uid- The UID of the pool
size- The size to allocate
data- Receives the address of the allocated data
timeout- Amount of time to wait for allocation?
Returns
0 on success, < 0 on error

◆ sceKernelAllocateVplCB()

int sceKernelAllocateVplCB ( SceUID  uid,
unsigned int  size,
void **  data,
unsigned int *  timeout 
)

Allocate from the pool (with callback)

Parameters
uid- The UID of the pool
size- The size to allocate
data- Receives the address of the allocated data
timeout- Amount of time to wait for allocation?
Returns
0 on success, < 0 on error

◆ sceKernelCancelAlarm()

int sceKernelCancelAlarm ( SceUID  alarmid)

Cancel a pending alarm.

Parameters
alarmid- UID of the alarm to cancel.
Returns
0 on success, < 0 on error.

◆ sceKernelCancelCallback()

int sceKernelCancelCallback ( SceUID  cb)

Cancel a callback ?

Parameters
cb- The UID of the specified callback
Returns
0 on succes, < 0 on error

◆ sceKernelCancelFpl()

int sceKernelCancelFpl ( SceUID  uid,
int *  pnum 
)

Cancel a pool.

Parameters
uid- The UID of the pool
pnum- Receives the number of waiting threads
Returns
0 on success, < 0 on error

◆ sceKernelCancelMsgPipe()

int sceKernelCancelMsgPipe ( SceUID  uid,
int *  psend,
int *  precv 
)

Cancel a message pipe.

Parameters
uid- UID of the pipe to cancel
psend- Receive number of sending threads?
precv- Receive number of receiving threads?
Returns
0 on success, < 0 on error

◆ sceKernelCancelReceiveMbx()

int sceKernelCancelReceiveMbx ( SceUID  mbxid,
int *  pnum 
)

Abort all wait operations on a messagebox.

Example:
int sceKernelCancelReceiveMbx(SceUID mbxid, int *pnum)
Abort all wait operations on a messagebox.
#define NULL
Definition: psptypes.h:31
Parameters
mbxid- The mbx id returned from sceKernelCreateMbx
pnum- A pointer to where the number of threads which were waiting on the mbx should be stored (NULL if you don't care)
Returns
< 0 on error

◆ sceKernelCancelVpl()

int sceKernelCancelVpl ( SceUID  uid,
int *  pnum 
)

Cancel a pool.

Parameters
uid- The UID of the pool
pnum- Receives the number of waiting threads
Returns
0 on success, < 0 on error

◆ sceKernelCancelVTimerHandler()

int sceKernelCancelVTimerHandler ( SceUID  uid)

Cancel the timer handler.

Parameters
uid- The UID of the vtimer
Returns
0 on success, < 0 on error

◆ sceKernelCancelWakeupThread()

int sceKernelCancelWakeupThread ( SceUID  thid)

Cancel a thread that was to be woken with sceKernelWakeupThread.

Parameters
thid- UID of the thread to cancel.
Returns
Success if >= 0, an error if < 0.

◆ sceKernelChangeCurrentThreadAttr()

int sceKernelChangeCurrentThreadAttr ( int  unknown,
SceUInt  attr 
)

Modify the attributes of the current thread.

Parameters
unknown- Set to 0.
attr- The thread attributes to modify. One of PspThreadAttributes.
Returns
< 0 on error.

Referenced by pspvfpu_initcontext().

◆ sceKernelChangeThreadPriority()

int sceKernelChangeThreadPriority ( SceUID  thid,
int  priority 
)

Change the threads current priority.

Parameters
thid- The ID of the thread (from sceKernelCreateThread or sceKernelGetThreadId)
priority- The new priority (the lower the number the higher the priority)
Example:
int thid = sceKernelGetThreadId();
// Change priority of current thread to 16
int sceKernelGetThreadId(void)
Get the current thread Id.
int sceKernelChangeThreadPriority(SceUID thid, int priority)
Change the threads current priority.
Returns
0 if successful, otherwise the error code.

◆ sceKernelCheckCallback()

int sceKernelCheckCallback ( void  )

Check callback ?

Returns
Something or another

◆ sceKernelCheckThreadStack()

int sceKernelCheckThreadStack ( void  )

Check the thread stack?

Returns
Unknown.

◆ sceKernelClearEventFlag()

int sceKernelClearEventFlag ( SceUID  evid,
u32  bits 
)

Clear a event flag bit pattern.

Parameters
evid- The event id returned by sceKernelCreateEventFlag
bits- The bits to clean
Returns
< 0 on Error

◆ sceKernelCreateCallback()

int sceKernelCreateCallback ( const char *  name,
SceKernelCallbackFunction  func,
void *  arg 
)

Create callback.

Example:
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_cb, NULL);
int sceKernelCreateCallback(const char *name, SceKernelCallbackFunction func, void *arg)
Create callback.
Parameters
name- A textual name for the callback
func- A pointer to a function that will be called as the callback
arg- Argument for the callback ?
Returns
>= 0 A callback id which can be used in subsequent functions, < 0 an error.

◆ sceKernelCreateEventFlag()

SceUID sceKernelCreateEventFlag ( const char *  name,
int  attr,
int  bits,
SceKernelEventFlagOptParam opt 
)

Create an event flag.

Parameters
name- The name of the event flag.
attr- Attributes from PspEventFlagAttributes
bits- Initial bit pattern.
opt- Options, set to NULL
Returns
< 0 on error. >= 0 event flag id.
Example:
int evid;
evid = sceKernelCreateEventFlag("wait_event", 0, 0, 0);
SceUID sceKernelCreateEventFlag(const char *name, int attr, int bits, SceKernelEventFlagOptParam *opt)
Create an event flag.

Referenced by sceGuInit().

◆ sceKernelCreateFpl()

int sceKernelCreateFpl ( const char *  name,
int  part,
int  attr,
unsigned int  size,
unsigned int  blocks,
struct SceKernelFplOptParam opt 
)

Create a fixed pool.

Parameters
name- Name of the pool
part- The memory partition ID
attr- Attributes
size- Size of pool block
blocks- Number of blocks to allocate
opt- Options (set to NULL)
Returns
The UID of the created pool, < 0 on error.

◆ sceKernelCreateLwMutex()

int sceKernelCreateLwMutex ( SceLwMutexWorkarea workarea,
const char *  name,
u32  attr,
int  initialCount,
u32 optionsPtr 
)

Create a lightweight mutex.

Parameters
workarea- The pointer to the workarea
name- The name of the lightweight mutex
attr-
initialCount- THe inital value of the mutex
optionsPTr- Other optioons for mutex
Returns
0 on success, otherwise one of PspKernelErrorCodes

◆ sceKernelCreateMbx()

SceUID sceKernelCreateMbx ( const char *  name,
SceUInt  attr,
SceKernelMbxOptParam option 
)

Creates a new messagebox.

Example:
int mbxid;
mbxid = sceKernelCreateMbx("MyMessagebox", 0, NULL);
SceUID sceKernelCreateMbx(const char *name, SceUInt attr, SceKernelMbxOptParam *option)
Creates a new messagebox.
Parameters
name- Specifies the name of the mbx
attr- Mbx attribute flags (normally set to 0)
option- Mbx options (normally set to NULL)
Returns
A messagebox id

◆ sceKernelCreateMsgPipe()

SceUID sceKernelCreateMsgPipe ( const char *  name,
int  part,
int  attr,
void *  unk1,
void *  opt 
)

Create a message pipe.

Parameters
name- Name of the pipe
part- ID of the memory partition
attr- Set to 0?
unk1- Unknown
opt- Message pipe options (set to NULL)
Returns
The UID of the created pipe, < 0 on error

◆ sceKernelCreateSema()

SceUID sceKernelCreateSema ( const char *  name,
SceUInt  attr,
int  initVal,
int  maxVal,
SceKernelSemaOptParam option 
)

Creates a new semaphore.

Example:
int semaid;
semaid = sceKernelCreateSema("MyMutex", 0, 1, 1, 0);
SceUID sceKernelCreateSema(const char *name, SceUInt attr, int initVal, int maxVal, SceKernelSemaOptParam *option)
Creates a new semaphore.
Parameters
name- Specifies the name of the sema
attr- Sema attribute flags (normally set to 0)
initVal- Sema initial value
maxVal- Sema maximum value
option- Sema options (normally set to 0)
Returns
A semaphore id

◆ sceKernelCreateThread()

SceUID sceKernelCreateThread ( const char *  name,
SceKernelThreadEntry  entry,
int  initPriority,
int  stackSize,
SceUInt  attr,
SceKernelThreadOptParam option 
)

Create a thread.

Example:
SceUID thid;
thid = sceKernelCreateThread("my_thread", threadFunc, 0x18, 0x10000, 0, NULL);
SceUID sceKernelCreateThread(const char *name, SceKernelThreadEntry entry, int initPriority, int stackSize, SceUInt attr, SceKernelThreadOptParam *option)
Create a thread.
int SceUID
UIDs are used to describe many different kernel objects.
Definition: pspkerneltypes.h:24
Parameters
name- An arbitrary thread name.
entry- The thread function to run when started.
initPriority- The initial priority of the thread. Less if higher priority.
stackSize- The size of the initial stack.
attr- The thread attributes, zero or more of PspThreadAttributes.
option- Additional options specified by SceKernelThreadOptParam.
Returns
UID of the created thread, or an error code.

Referenced by _start().

◆ sceKernelCreateVpl()

SceUID sceKernelCreateVpl ( const char *  name,
int  part,
int  attr,
unsigned int  size,
struct SceKernelVplOptParam opt 
)

Create a variable pool.

Parameters
name- Name of the pool
part- The memory partition ID
attr- Attributes
size- Size of pool
opt- Options (set to NULL)
Returns
The UID of the created pool, < 0 on error.

◆ sceKernelCreateVTimer()

SceUID sceKernelCreateVTimer ( const char *  name,
struct SceKernelVTimerOptParam opt 
)

Create a virtual timer.

Parameters
name- Name for the timer.
opt- Pointer to an SceKernelVTimerOptParam (pass NULL)
Returns
The VTimer's UID or < 0 on error.

◆ sceKernelDelaySysClockThread()

int sceKernelDelaySysClockThread ( SceKernelSysClock delay)

Delay the current thread by a specified number of sysclocks.

Parameters
delay- Delay in sysclocks
Returns
0 on success, < 0 on error

◆ sceKernelDelaySysClockThreadCB()

int sceKernelDelaySysClockThreadCB ( SceKernelSysClock delay)

Delay the current thread by a specified number of sysclocks handling callbacks.

Parameters
delay- Delay in sysclocks
Returns
0 on success, < 0 on error

◆ sceKernelDelayThread()

int sceKernelDelayThread ( SceUInt  delay)

Delay the current thread by a specified number of microseconds.

Parameters
delay- Delay in microseconds.
Example:
sceKernelDelayThread(1000000); // Delay for a second
int sceKernelDelayThread(SceUInt delay)
Delay the current thread by a specified number of microseconds.

Referenced by pspDebugSioInit().

◆ sceKernelDelayThreadCB()

int sceKernelDelayThreadCB ( SceUInt  delay)

Delay the current thread by a specified number of microseconds and handle any callbacks.

Parameters
delay- Delay in microseconds.
Example:
sceKernelDelayThread(1000000); // Delay for a second

◆ sceKernelDeleteCallback()

int sceKernelDeleteCallback ( SceUID  cb)

Delete a callback.

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

◆ sceKernelDeleteEventFlag()

int sceKernelDeleteEventFlag ( int  evid)

Delete an event flag.

Parameters
evid- The event id returned by sceKernelCreateEventFlag.
Returns
< 0 On error

Referenced by sceGuTerm().

◆ sceKernelDeleteFpl()

int sceKernelDeleteFpl ( SceUID  uid)

Delete a fixed pool.

Parameters
uid- The UID of the pool
Returns
0 on success, < 0 on error

◆ sceKernelDeleteLwMutex()

int sceKernelDeleteLwMutex ( SceLwMutexWorkarea workarea)

Delete a lightweight mutex.

Parameters
workarea- The pointer to the workarea
Returns
0 on success, otherwise one of PspKernelErrorCodes

◆ sceKernelDeleteMbx()

int sceKernelDeleteMbx ( SceUID  mbxid)

Destroy a messagebox.

Parameters
mbxid- The mbxid returned from a previous create call.
Returns
Returns the value 0 if its succesful otherwise an error code

◆ sceKernelDeleteMsgPipe()

int sceKernelDeleteMsgPipe ( SceUID  uid)

Delete a message pipe.

Parameters
uid- The UID of the pipe
Returns
0 on success, < 0 on error

◆ sceKernelDeleteSema()

int sceKernelDeleteSema ( SceUID  semaid)

Destroy a semaphore.

Parameters
semaid- The semaid returned from a previous create call.
Returns
Returns the value 0 if its succesful otherwise -1

◆ sceKernelDeleteThread()

int sceKernelDeleteThread ( SceUID  thid)

Delate a thread.

Parameters
thid- UID of the thread to be deleted.
Returns
< 0 on error.

◆ sceKernelDeleteVpl()

int sceKernelDeleteVpl ( SceUID  uid)

Delete a variable pool.

Parameters
uid- The UID of the pool
Returns
0 on success, < 0 on error

◆ sceKernelDeleteVTimer()

int sceKernelDeleteVTimer ( SceUID  uid)

Delete a virtual timer.

Parameters
uid- The UID of the timer
Returns
< 0 on error.

◆ sceKernelExitDeleteThread()

int sceKernelExitDeleteThread ( int  status)

Exit a thread and delete itself.

Parameters
status- Exit status

◆ sceKernelExitThread()

int sceKernelExitThread ( int  status)

Exit a thread.

Parameters
status- Exit status.

◆ sceKernelFreeFpl()

int sceKernelFreeFpl ( SceUID  uid,
void *  data 
)

Free a block.

Parameters
uid- The UID of the pool
data- The data block to deallocate
Returns
0 on success, < 0 on error

◆ sceKernelFreeVpl()

int sceKernelFreeVpl ( SceUID  uid,
void *  data 
)

Free a block.

Parameters
uid- The UID of the pool
data- The data block to deallocate
Returns
0 on success, < 0 on error

◆ sceKernelGetCallbackCount()

int sceKernelGetCallbackCount ( SceUID  cb)

Get the callback count.

Parameters
cb- The UID of the specified callback
Returns
The callback count, < 0 on error

◆ sceKernelGetSystemTime()

int sceKernelGetSystemTime ( SceKernelSysClock time)

Get the system time.

Parameters
time- Pointer to a SceKernelSysClock structure
Returns
0 on success, < 0 on error

◆ sceKernelGetSystemTimeLow()

unsigned int sceKernelGetSystemTimeLow ( void  )

Get the low 32bits of the current system time.

Returns
The low 32bits of the system time

◆ sceKernelGetSystemTimeWide()

SceInt64 sceKernelGetSystemTimeWide ( void  )

Get the system time (wide version)

Returns
The system time

◆ sceKernelGetThreadCurrentPriority()

int sceKernelGetThreadCurrentPriority ( void  )

Get the current priority of the thread you are in.

Returns
The current thread priority

◆ sceKernelGetThreadExitStatus()

int sceKernelGetThreadExitStatus ( SceUID  thid)

Get the exit status of a thread.

Parameters
thid- The UID of the thread to check.
Returns
The exit status

◆ sceKernelGetThreadId()

int sceKernelGetThreadId ( void  )

Get the current thread Id.

Returns
The thread id of the calling thread.

Referenced by pspDebugGetStackTrace2().

◆ sceKernelGetThreadmanIdList()

int sceKernelGetThreadmanIdList ( enum SceKernelIdListType  type,
SceUID readbuf,
int  readbufsize,
int *  idcount 
)

Get a list of UIDs from threadman.

Allows you to enumerate resources such as threads or semaphores.

Parameters
type- The type of resource to list, one of SceKernelIdListType.
readbuf- A pointer to a buffer to store the list.
readbufsize- The size of the buffer in SceUID units.
idcount- Pointer to an integer in which to return the number of ids in the list.
Returns
< 0 on error. Either 0 or the same as idcount on success.

◆ sceKernelGetThreadmanIdType()

enum SceKernelIdListType sceKernelGetThreadmanIdType ( SceUID  uid)

Get the type of a threadman uid.

Parameters
uid- The uid to get the type from
Returns
The type, < 0 on error

◆ sceKernelGetThreadStackFreeSize()

int sceKernelGetThreadStackFreeSize ( SceUID  thid)

Get the free stack size for a thread.

Parameters
thid- The thread ID. Seem to take current thread if set to 0.
Returns
The free size.

◆ sceKernelGetVTimerBase()

int sceKernelGetVTimerBase ( SceUID  uid,
SceKernelSysClock base 
)

Get the timer base.

Parameters
uid- UID of the vtimer
base- Pointer to a SceKernelSysClock structure
Returns
0 on success, < 0 on error

◆ sceKernelGetVTimerBaseWide()

SceInt64 sceKernelGetVTimerBaseWide ( SceUID  uid)

Get the timer base (wide format)

Parameters
uid- UID of the vtimer
Returns
The 64bit timer base

◆ sceKernelGetVTimerTime()

int sceKernelGetVTimerTime ( SceUID  uid,
SceKernelSysClock time 
)

Get the timer time.

Parameters
uid- UID of the vtimer
time- Pointer to a SceKernelSysClock structure
Returns
0 on success, < 0 on error

◆ sceKernelGetVTimerTimeWide()

SceInt64 sceKernelGetVTimerTimeWide ( SceUID  uid)

Get the timer time (wide format)

Parameters
uid- UID of the vtimer
Returns
The 64bit timer time

◆ sceKernelLockLwMutex()

int sceKernelLockLwMutex ( SceLwMutexWorkarea workarea,
int  lockCount,
unsigned int *  pTimeout 
)

Lock a lightweight mutex.

Parameters
workarea- The pointer to the workarea
lockCount- value of increase the lock counter
pTimeout- The pointer for timeout waiting
Returns
0 on success, otherwise one of PspKernelErrorCodes

◆ sceKernelNotifyCallback()

int sceKernelNotifyCallback ( SceUID  cb,
int  arg2 
)

Notify a callback.

Parameters
cb- The UID of the specified callback
arg2- Passed as arg2 into the callback function
Returns
0 on success, < 0 on error

◆ sceKernelPollEventFlag()

int sceKernelPollEventFlag ( int  evid,
u32  bits,
u32  wait,
u32 outBits 
)

Poll an event flag for a given bit pattern.

Parameters
evid- The event id returned by sceKernelCreateEventFlag.
bits- The bit pattern to poll for.
wait- Wait type, one or more of PspEventFlagWaitTypes or'ed together
outBits- The bit pattern that was matched.
Returns
< 0 On error

◆ sceKernelPollMbx()

int sceKernelPollMbx ( SceUID  mbxid,
void **  pmessage 
)

Check if a message has arrived in a messagebox.

Example:
void *msg;
sceKernelPollMbx(mbxid, &msg);
int sceKernelPollMbx(SceUID mbxid, void **pmessage)
Check if a message has arrived in a messagebox.
Parameters
mbxid- The mbx id returned from sceKernelCreateMbx
pmessage- A pointer to where a pointer to the received message should be stored
Returns
< 0 on error (SCE_KERNEL_ERROR_MBOX_NOMSG if the mbx is empty).

◆ sceKernelPollSema()

int sceKernelPollSema ( SceUID  semaid,
int  signal 
)

Poll a sempahore.

Parameters
semaid- UID of the semaphore to poll.
signal- The value to test for.
Returns
< 0 on error.

◆ sceKernelReceiveMbx()

int sceKernelReceiveMbx ( SceUID  mbxid,
void **  pmessage,
SceUInt timeout 
)

Wait for a message to arrive in a messagebox.

Example:
void *msg;
sceKernelReceiveMbx(mbxid, &msg, NULL);
int sceKernelReceiveMbx(SceUID mbxid, void **pmessage, SceUInt *timeout)
Wait for a message to arrive in a messagebox.
Parameters
mbxid- The mbx id returned from sceKernelCreateMbx
pmessage- A pointer to where a pointer to the received message should be stored
timeout- Timeout in microseconds
Returns
< 0 on error.

◆ sceKernelReceiveMbxCB()

int sceKernelReceiveMbxCB ( SceUID  mbxid,
void **  pmessage,
SceUInt timeout 
)

Wait for a message to arrive in a messagebox and handle callbacks if necessary.

Example:
void *msg;
int sceKernelReceiveMbxCB(SceUID mbxid, void **pmessage, SceUInt *timeout)
Wait for a message to arrive in a messagebox and handle callbacks if necessary.
Parameters
mbxid- The mbx id returned from sceKernelCreateMbx
pmessage- A pointer to where a pointer to the received message should be stored
timeout- Timeout in microseconds
Returns
< 0 on error.

◆ sceKernelReceiveMsgPipe()

int sceKernelReceiveMsgPipe ( SceUID  uid,
void *  message,
unsigned int  size,
int  unk1,
void *  unk2,
unsigned int *  timeout 
)

Receive a message from a pipe.

Parameters
uid- The UID of the pipe
message- Pointer to the message
size- Size of the message
unk1- Unknown
unk2- Unknown
timeout- Timeout for receive
Returns
0 on success, < 0 on error

◆ sceKernelReceiveMsgPipeCB()

int sceKernelReceiveMsgPipeCB ( SceUID  uid,
void *  message,
unsigned int  size,
int  unk1,
void *  unk2,
unsigned int *  timeout 
)

Receive a message from a pipe (with callback)

Parameters
uid- The UID of the pipe
message- Pointer to the message
size- Size of the message
unk1- Unknown
unk2- Unknown
timeout- Timeout for receive
Returns
0 on success, < 0 on error

◆ sceKernelReferAlarmStatus()

int sceKernelReferAlarmStatus ( SceUID  alarmid,
SceKernelAlarmInfo info 
)

Refer the status of a created alarm.

Parameters
alarmid- UID of the alarm to get the info of
info- Pointer to a SceKernelAlarmInfo structure
Returns
0 on success, < 0 on error.

◆ sceKernelReferCallbackStatus()

int sceKernelReferCallbackStatus ( SceUID  cb,
SceKernelCallbackInfo status 
)

Gets the status of a specified callback.

Parameters
cb- The UID of the callback to refer.
status- Pointer to a status structure. The size parameter should be initialised before calling.
Returns
< 0 on error.

◆ sceKernelReferEventFlagStatus()

int sceKernelReferEventFlagStatus ( SceUID  event,
SceKernelEventFlagInfo status 
)

Get the status of an event flag.

Parameters
event- The UID of the event.
status- A pointer to a SceKernelEventFlagInfo structure.
Returns
< 0 on error.

◆ sceKernelReferFplStatus()

int sceKernelReferFplStatus ( SceUID  uid,
SceKernelFplInfo info 
)

Get the status of an FPL.

Parameters
uid- The uid of the FPL
info- Pointer to a SceKernelFplInfo structure
Returns
0 on success, < 0 on error

◆ sceKernelReferGlobalProfiler()

PspDebugProfilerRegs * sceKernelReferGlobalProfiler ( void  )

Get the globile profiler registers.

Returns
Pointer to the registers, NULL on error

◆ sceKernelReferMbxStatus()

int sceKernelReferMbxStatus ( SceUID  mbxid,
SceKernelMbxInfo info 
)

Retrieve information about a messagebox.

Parameters
mbxid- UID of the messagebox to retrieve info for.
info- Pointer to a SceKernelMbxInfo struct to receive the info.
Returns
< 0 on error.

◆ sceKernelReferMsgPipeStatus()

int sceKernelReferMsgPipeStatus ( SceUID  uid,
SceKernelMppInfo info 
)

Get the status of a Message Pipe.

Parameters
uid- The uid of the Message Pipe
info- Pointer to a SceKernelMppInfo structure
Returns
0 on success, < 0 on error

◆ sceKernelReferSemaStatus()

int sceKernelReferSemaStatus ( SceUID  semaid,
SceKernelSemaInfo info 
)

Retrieve information about a semaphore.

Parameters
semaid- UID of the semaphore to retrieve info for.
info- Pointer to a SceKernelSemaInfo struct to receive the info.
Returns
< 0 on error.

◆ sceKernelReferSystemStatus()

int sceKernelReferSystemStatus ( SceKernelSystemStatus status)

Get the current system status.

Parameters
status- Pointer to a SceKernelSystemStatus structure.
Returns
< 0 on error.

◆ sceKernelReferThreadEventHandlerStatus()

int sceKernelReferThreadEventHandlerStatus ( SceUID  uid,
struct SceKernelThreadEventHandlerInfo info 
)

Refer the status of an thread event handler.

Parameters
uid- The UID of the event handler
info- Pointer to a SceKernelThreadEventHandlerInfo structure
Returns
0 on success, < 0 on error

◆ sceKernelReferThreadProfiler()

PspDebugProfilerRegs * sceKernelReferThreadProfiler ( void  )

Get the thread profiler registers.

Returns
Pointer to the registers, NULL on error

◆ sceKernelReferThreadRunStatus()

int sceKernelReferThreadRunStatus ( SceUID  thid,
SceKernelThreadRunStatus status 
)

Retrive the runtime status of a thread.

Parameters
thid- UID of the thread to retrive status.
status- Pointer to a SceKernelThreadRunStatus struct to receive the runtime status.
Returns
0 if successful, otherwise the error code.

◆ sceKernelReferThreadStatus()

int sceKernelReferThreadStatus ( SceUID  thid,
SceKernelThreadInfo info 
)

Get the status information for the specified thread.

Parameters
thid- Id of the thread to get status
info- Pointer to the info structure to receive the data. Note: The structures size field should be set to sizeof(SceKernelThreadInfo) before calling this function.
Example:
status.size = sizeof(SceKernelThreadInfo);
if(sceKernelReferThreadStatus(thid, &status) == 0)
{ Do something... }
struct SceKernelThreadInfo SceKernelThreadInfo
Structure to hold the status information for a thread.
int sceKernelReferThreadStatus(SceUID thid, SceKernelThreadInfo *info)
Get the status information for the specified thread.
Structure to hold the status information for a thread.
Definition: pspthreadman.h:84
SceSize size
Size of the structure.
Definition: pspthreadman.h:86
Returns
0 if successful, otherwise the error code.

Referenced by pspDebugGetStackTrace2().

◆ sceKernelReferVplStatus()

int sceKernelReferVplStatus ( SceUID  uid,
SceKernelVplInfo info 
)

Get the status of an VPL.

Parameters
uid- The uid of the VPL
info- Pointer to a SceKernelVplInfo structure
Returns
0 on success, < 0 on error

◆ sceKernelReferVTimerStatus()

int sceKernelReferVTimerStatus ( SceUID  uid,
SceKernelVTimerInfo info 
)

Get the status of a VTimer.

Parameters
uid- The uid of the VTimer
info- Pointer to a SceKernelVTimerInfo structure
Returns
0 on success, < 0 on error

◆ sceKernelRegisterThreadEventHandler()

SceUID sceKernelRegisterThreadEventHandler ( const char *  name,
SceUID  threadID,
int  mask,
SceKernelThreadEventHandler  handler,
void *  common 
)

Register a thread event handler.

Parameters
name- Name for the thread event handler
threadID- Thread ID to monitor
mask- Bit mask for what events to handle (only lowest 4 bits valid)
handler- Pointer to a SceKernelThreadEventHandler function
common- Common pointer
Returns
The UID of the create event handler, < 0 on error

◆ sceKernelReleaseThreadEventHandler()

int sceKernelReleaseThreadEventHandler ( SceUID  uid)

Release a thread event handler.

Parameters
uid- The UID of the event handler
Returns
0 on success, < 0 on error

◆ sceKernelReleaseWaitThread()

int sceKernelReleaseWaitThread ( SceUID  thid)

Release a thread in the wait state.

Parameters
thid- The UID of the thread.
Returns
0 on success, < 0 on error

◆ sceKernelResumeDispatchThread()

int sceKernelResumeDispatchThread ( int  state)

Resume the dispatch thread.

Parameters
state- The state of the dispatch thread (from sceKernelSuspendDispatchThread)
Returns
0 on success, < 0 on error

◆ sceKernelResumeThread()

int sceKernelResumeThread ( SceUID  thid)

Resume a thread previously put into a suspended state with sceKernelSuspendThread.

Parameters
thid- UID of the thread to resume.
Returns
Success if >= 0, an error if < 0.

◆ sceKernelRotateThreadReadyQueue()

int sceKernelRotateThreadReadyQueue ( int  priority)

Rotate thread ready queue at a set priority.

Parameters
priority- The priority of the queue
Returns
0 on success, < 0 on error.

◆ sceKernelSendMbx()

int sceKernelSendMbx ( SceUID  mbxid,
void *  message 
)

Send a message to a messagebox.

Example:
struct MyMessage {
char text[8];
};
struct MyMessage msg = { {0}, "Hello" };
// Send the message
sceKernelSendMbx(mbxid, (void*) &msg);
int sceKernelSendMbx(SceUID mbxid, void *message)
Send a message to a messagebox.
Header for a message box packet.
Definition: pspthreadman.h:819
Parameters
mbxid- The mbx id returned from sceKernelCreateMbx
message- A message to be forwarded to the receiver. The start of the message should be the SceKernelMsgPacket structure, the rest
Returns
< 0 On error.

◆ sceKernelSendMsgPipe()

int sceKernelSendMsgPipe ( SceUID  uid,
void *  message,
unsigned int  size,
int  unk1,
void *  unk2,
unsigned int *  timeout 
)

Send a message to a pipe.

Parameters
uid- The UID of the pipe
message- Pointer to the message
size- Size of the message
unk1- Unknown
unk2- Unknown
timeout- Timeout for send
Returns
0 on success, < 0 on error

◆ sceKernelSendMsgPipeCB()

int sceKernelSendMsgPipeCB ( SceUID  uid,
void *  message,
unsigned int  size,
int  unk1,
void *  unk2,
unsigned int *  timeout 
)

Send a message to a pipe (with callback)

Parameters
uid- The UID of the pipe
message- Pointer to the message
size- Size of the message
unk1- Unknown
unk2- Unknown
timeout- Timeout for send
Returns
0 on success, < 0 on error

◆ sceKernelSetAlarm()

SceUID sceKernelSetAlarm ( SceUInt  clock,
SceKernelAlarmHandler  handler,
void *  common 
)

Set an alarm.

Parameters
clock- The number of micro seconds till the alarm occurrs.
handler- Pointer to a SceKernelAlarmHandler
common- Common pointer for the alarm handler
Returns
A UID representing the created alarm, < 0 on error.

◆ sceKernelSetEventFlag()

int sceKernelSetEventFlag ( SceUID  evid,
u32  bits 
)

Set an event flag bit pattern.

Parameters
evid- The event id returned by sceKernelCreateEventFlag.
bits- The bit pattern to set.
Returns
< 0 On error

Referenced by callbackSig().

◆ sceKernelSetSysClockAlarm()

SceUID sceKernelSetSysClockAlarm ( SceKernelSysClock clock,
SceKernelAlarmHandler  handler,
void *  common 
)

Set an alarm using a SceKernelSysClock structure for the time.

Parameters
clock- Pointer to a SceKernelSysClock structure
handler- Pointer to a SceKernelAlarmHandler
common- Common pointer for the alarm handler.
Returns
A UID representing the created alarm, < 0 on error.

◆ sceKernelSetVTimerHandler()

int sceKernelSetVTimerHandler ( SceUID  uid,
SceKernelSysClock time,
SceKernelVTimerHandler  handler,
void *  common 
)

Set the timer handler.

Parameters
uid- UID of the vtimer
time- Time to call the handler?
handler- The timer handler
common- Common pointer
Returns
0 on success, < 0 on error

◆ sceKernelSetVTimerHandlerWide()

int sceKernelSetVTimerHandlerWide ( SceUID  uid,
SceInt64  time,
SceKernelVTimerHandlerWide  handler,
void *  common 
)

Set the timer handler (wide mode)

Parameters
uid- UID of the vtimer
time- Time to call the handler?
handler- The timer handler
common- Common pointer
Returns
0 on success, < 0 on error

◆ sceKernelSetVTimerTime()

int sceKernelSetVTimerTime ( SceUID  uid,
SceKernelSysClock time 
)

Set the timer time.

Parameters
uid- UID of the vtimer
time- Pointer to a SceKernelSysClock structure
Returns
0 on success, < 0 on error

◆ sceKernelSetVTimerTimeWide()

SceInt64 sceKernelSetVTimerTimeWide ( SceUID  uid,
SceInt64  time 
)

Set the timer time (wide format)

Parameters
uid- UID of the vtimer
time- Pointer to a SceKernelSysClock structure
Returns
Possibly the last time

◆ sceKernelSignalSema()

int sceKernelSignalSema ( SceUID  semaid,
int  signal 
)

Send a signal to a semaphore.

Example:
// Signal the sema
int sceKernelSignalSema(SceUID semaid, int signal)
Send a signal to a semaphore.
Parameters
semaid- The sema id returned from sceKernelCreateSema
signal- The amount to signal the sema (i.e. if 2 then increment the sema by 2)
Returns
< 0 On error.

◆ sceKernelSleepThread()

int sceKernelSleepThread ( void  )

Sleep thread.

Returns
< 0 on error.

◆ sceKernelSleepThreadCB()

int sceKernelSleepThreadCB ( void  )

Sleep thread but service any callbacks as necessary.

Example:
// Once all callbacks have been setup call this function
int sceKernelSleepThreadCB(void)
Sleep thread but service any callbacks as necessary.

◆ sceKernelStartThread()

int sceKernelStartThread ( SceUID  thid,
SceSize  arglen,
void *  argp 
)

Start a created thread.

Parameters
thid- Thread id from sceKernelCreateThread
arglen- Length of the data pointed to by argp, in bytes
argp- Pointer to the arguments.

Referenced by _start().

◆ sceKernelStartVTimer()

int sceKernelStartVTimer ( SceUID  uid)

Start a virtual timer.

Parameters
uid- The UID of the timer
Returns
< 0 on error

◆ sceKernelStopVTimer()

int sceKernelStopVTimer ( SceUID  uid)

Stop a virtual timer.

Parameters
uid- The UID of the timer
Returns
< 0 on error

Referenced by gprof_cleanup().

◆ sceKernelSuspendDispatchThread()

int sceKernelSuspendDispatchThread ( void  )

Suspend the dispatch thread.

Returns
The current state of the dispatch thread, < 0 on error

◆ sceKernelSuspendThread()

int sceKernelSuspendThread ( SceUID  thid)

Suspend a thread.

Parameters
thid- UID of the thread to suspend.
Returns
Success if >= 0, an error if < 0.

◆ sceKernelSysClock2USec()

int sceKernelSysClock2USec ( SceKernelSysClock clock,
unsigned int *  low,
unsigned int *  high 
)

Convert a SceKernelSysClock structure to microseconds.

Parameters
clock- Pointer to a SceKernelSysClock structure
low- Pointer to the low part of the time
high- Pointer to the high part of the time
Returns
0 on success, < 0 on error

◆ sceKernelSysClock2USecWide()

int sceKernelSysClock2USecWide ( SceInt64  clock,
unsigned *  low,
unsigned int *  high 
)

Convert a wide time to microseconds.

Parameters
clock- Wide time
low- Pointer to the low part of the time
high- Pointer to the high part of the time
Returns
0 on success, < 0 on error

◆ sceKernelTerminateDeleteThread()

int sceKernelTerminateDeleteThread ( SceUID  thid)

Terminate and delete a thread.

Parameters
thid- UID of the thread to terminate and delete.
Returns
Success if >= 0, an error if < 0.

◆ sceKernelTerminateThread()

int sceKernelTerminateThread ( SceUID  thid)

Terminate a thread.

Parameters
thid- UID of the thread to terminate.
Returns
Success if >= 0, an error if < 0.

◆ sceKernelTryAllocateFpl()

int sceKernelTryAllocateFpl ( SceUID  uid,
void **  data 
)

Try to allocate from the pool.

Parameters
uid- The UID of the pool
data- Receives the address of the allocated data
Returns
0 on success, < 0 on error

◆ sceKernelTryAllocateVpl()

int sceKernelTryAllocateVpl ( SceUID  uid,
unsigned int  size,
void **  data 
)

Try to allocate from the pool.

Parameters
uid- The UID of the pool
size- The size to allocate
data- Receives the address of the allocated data
Returns
0 on success, < 0 on error

◆ sceKernelTryLockLwMutex()

int sceKernelTryLockLwMutex ( SceLwMutexWorkarea workarea,
int  lockCount 
)

Try to lock a lightweight mutex.

Parameters
workarea- The pointer to the workarea
lockCount- value of increase the lock counter
Returns
0 on success, otherwise one of PspKernelErrorCodes

◆ sceKernelTryReceiveMsgPipe()

int sceKernelTryReceiveMsgPipe ( SceUID  uid,
void *  message,
unsigned int  size,
int  unk1,
void *  unk2 
)

Receive a message from a pipe.

Parameters
uid- The UID of the pipe
message- Pointer to the message
size- Size of the message
unk1- Unknown
unk2- Unknown
Returns
0 on success, < 0 on error

◆ sceKernelTrySendMsgPipe()

int sceKernelTrySendMsgPipe ( SceUID  uid,
void *  message,
unsigned int  size,
int  unk1,
void *  unk2 
)

Try to send a message to a pipe.

Parameters
uid- The UID of the pipe
message- Pointer to the message
size- Size of the message
unk1- Unknown
unk2- Unknown
Returns
0 on success, < 0 on error

◆ sceKernelUnlockLwMutex()

int sceKernelUnlockLwMutex ( SceLwMutexWorkarea workarea,
int  lockCount 
)

Lock a lightweight mutex.

Parameters
workarea- The pointer to the workarea
name- The name of the lightweight mutex
lockCount- value of decrease the lock counter
Returns
0 on success, otherwise one of PspKernelErrorCodes

◆ sceKernelUSec2SysClock()

int sceKernelUSec2SysClock ( unsigned int  usec,
SceKernelSysClock clock 
)

Convert a number of microseconds to a SceKernelSysClock structure.

Parameters
usec- Number of microseconds
clock- Pointer to a SceKernelSysClock structure
Returns
0 on success, < 0 on error

◆ sceKernelUSec2SysClockWide()

SceInt64 sceKernelUSec2SysClockWide ( unsigned int  usec)

Convert a number of microseconds to a wide time.

Parameters
usec- Number of microseconds.
Returns
The time

◆ sceKernelWaitEventFlag()

int sceKernelWaitEventFlag ( int  evid,
u32  bits,
u32  wait,
u32 outBits,
SceUInt timeout 
)

Wait for an event flag for a given bit pattern.

Parameters
evid- The event id returned by sceKernelCreateEventFlag.
bits- The bit pattern to poll for.
wait- Wait type, one or more of PspEventFlagWaitTypes or'ed together
outBits- The bit pattern that was matched.
timeout- Timeout in microseconds
Returns
< 0 On error

◆ sceKernelWaitEventFlagCB()

int sceKernelWaitEventFlagCB ( int  evid,
u32  bits,
u32  wait,
u32 outBits,
SceUInt timeout 
)

Wait for an event flag for a given bit pattern with callback.

Parameters
evid- The event id returned by sceKernelCreateEventFlag.
bits- The bit pattern to poll for.
wait- Wait type, one or more of PspEventFlagWaitTypes or'ed together
outBits- The bit pattern that was matched.
timeout- Timeout in microseconds
Returns
< 0 On error

◆ sceKernelWaitSema()

int sceKernelWaitSema ( SceUID  semaid,
int  signal,
SceUInt timeout 
)

Lock a semaphore.

Example:
sceKernelWaitSema(semaid, 1, 0);
int sceKernelWaitSema(SceUID semaid, int signal, SceUInt *timeout)
Lock a semaphore.
Parameters
semaid- The sema id returned from sceKernelCreateSema
signal- The value to wait for (i.e. if 1 then wait till reaches a signal state of 1)
timeout- Timeout in microseconds (assumed).
Returns
< 0 on error.

◆ sceKernelWaitSemaCB()

int sceKernelWaitSemaCB ( SceUID  semaid,
int  signal,
SceUInt timeout 
)

Lock a semaphore a handle callbacks if necessary.

Example:
sceKernelWaitSemaCB(semaid, 1, 0);
int sceKernelWaitSemaCB(SceUID semaid, int signal, SceUInt *timeout)
Lock a semaphore a handle callbacks if necessary.
Parameters
semaid- The sema id returned from sceKernelCreateSema
signal- The value to wait for (i.e. if 1 then wait till reaches a signal state of 1)
timeout- Timeout in microseconds (assumed).
Returns
< 0 on error.

◆ sceKernelWaitThreadEnd()

int sceKernelWaitThreadEnd ( SceUID  thid,
SceUInt timeout 
)

Wait until a thread has ended.

Parameters
thid- Id of the thread to wait for.
timeout- Timeout in microseconds (assumed).
Returns
< 0 on error.

◆ sceKernelWaitThreadEndCB()

int sceKernelWaitThreadEndCB ( SceUID  thid,
SceUInt timeout 
)

Wait until a thread has ended and handle callbacks if necessary.

Parameters
thid- Id of the thread to wait for.
timeout- Timeout in microseconds (assumed).
Returns
< 0 on error.

◆ sceKernelWakeupThread()

int sceKernelWakeupThread ( SceUID  thid)

Wake a thread previously put into the sleep state.

Parameters
thid- UID of the thread to wake.
Returns
Success if >= 0, an error if < 0.