sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
thbase.h File Reference
#include <types.h>
#include <irx.h>

Go to the source code of this file.

Classes

struct  _iop_thread
struct  _iop_thread_status
struct  _iop_sys_clock
struct  _iop_thread_run_status
struct  _iop_sys_status

Macros

#define TH_ASM   0x01000000
#define TH_C   0x02000000
#define TH_UMODE   0x00000008
#define TH_NO_FILLSTACK   0x00100000
#define TH_CLEAR_STACK   0x00200000
#define HIGHEST_PRIORITY   1
#define USER_HIGHEST_PRIORITY   9
#define USER_LOWEST_PRIORITY   123
#define LOWEST_PRIORITY   126
#define TH_SELF   0
#define THS_RUN   0x01
#define THS_READY   0x02
#define THS_WAIT   0x04
#define THS_SUSPEND   0x08
#define THS_WAITSUSPEND   0x0C
#define THS_DORMANT   0x10
#define TSW_SLEEP   1
#define TSW_DELAY   2
#define TSW_SEMA   3
#define TSW_EVENTFLAG   4
#define TSW_MBX   5
#define TSW_VPL   6
#define TSW_FPL   7
#define thbase_IMPORTS
#define thbase_IMPORTS_start   DECLARE_IMPORT_TABLE(thbase, 1, 1)
#define thbase_IMPORTS_end   END_IMPORT_TABLE
#define I_GetThreadmanData   DECLARE_IMPORT(3, GetThreadmanData)
#define I_CreateThread   DECLARE_IMPORT(4, CreateThread)
#define I_DeleteThread   DECLARE_IMPORT(5, DeleteThread)
#define I_StartThread   DECLARE_IMPORT(6, StartThread)
#define I_StartThreadArgs   DECLARE_IMPORT(7, StartThreadArgs)
#define I_ExitThread   DECLARE_IMPORT(8, ExitThread)
#define I_ExitDeleteThread   DECLARE_IMPORT(9, ExitDeleteThread)
#define I_TerminateThread   DECLARE_IMPORT(10, TerminateThread)
#define I_iTerminateThread   DECLARE_IMPORT(11, iTerminateThread)
#define I_DisableDispatchThread   DECLARE_IMPORT(12, DisableDispatchThread)
#define I_EnableDispatchThread   DECLARE_IMPORT(13, EnableDispatchThread)
#define I_ChangeThreadPriority   DECLARE_IMPORT(14, ChangeThreadPriority)
#define I_iChangeThreadPriority   DECLARE_IMPORT(15, iChangeThreadPriority)
#define I_RotateThreadReadyQueue   DECLARE_IMPORT(16, RotateThreadReadyQueue)
#define I_iRotateThreadReadyQueue   DECLARE_IMPORT(17, iRotateThreadReadyQueue)
#define I_ReleaseWaitThread   DECLARE_IMPORT(18, ReleaseWaitThread)
#define I_iReleaseWaitThread   DECLARE_IMPORT(19, iReleaseWaitThread)
#define I_GetThreadId   DECLARE_IMPORT(20, GetThreadId)
#define I_CheckThreadStack   DECLARE_IMPORT(21, CheckThreadStack)
#define I_ReferThreadStatus   DECLARE_IMPORT(22, ReferThreadStatus)
#define I_iReferThreadStatus   DECLARE_IMPORT(23, iReferThreadStatus)
#define I_SleepThread   DECLARE_IMPORT(24, SleepThread)
#define I_WakeupThread   DECLARE_IMPORT(25, WakeupThread)
#define I_iWakeupThread   DECLARE_IMPORT(26, iWakeupThread)
#define I_CancelWakeupThread   DECLARE_IMPORT(27, CancelWakeupThread)
#define I_iCancelWakeupThread   DECLARE_IMPORT(28, iCancelWakeupThread)
#define I_SuspendThread   DECLARE_IMPORT(29, SuspendThread)
#define I_iSuspendThread   DECLARE_IMPORT(30, iSuspendThread)
#define I_ResumeThread   DECLARE_IMPORT(31, ResumeThread)
#define I_iResumeThread   DECLARE_IMPORT(32, iResumeThread)
#define I_DelayThread   DECLARE_IMPORT(33, DelayThread)
#define I_GetSystemTime   DECLARE_IMPORT(34, GetSystemTime)
#define I_SetAlarm   DECLARE_IMPORT(35, SetAlarm)
#define I_iSetAlarm   DECLARE_IMPORT(36, iSetAlarm)
#define I_CancelAlarm   DECLARE_IMPORT(37, CancelAlarm)
#define I_iCancelAlarm   DECLARE_IMPORT(38, iCancelAlarm)
#define I_USec2SysClock   DECLARE_IMPORT(39, USec2SysClock)
#define I_SysClock2USec   DECLARE_IMPORT(40, SysClock2USec)
#define I_GetSystemStatusFlag   DECLARE_IMPORT(41, GetSystemStatusFlag)

Typedefs

typedef struct _iop_thread iop_thread_t
typedef struct _iop_thread_status iop_thread_info_t
typedef struct _iop_sys_clock iop_sys_clock_t
typedef struct _iop_thread_run_status iop_thread_run_status_t
typedef struct _iop_sys_status iop_sys_status_t

Functions

void * GetThreadmanData (void)
int CreateThread (iop_thread_t *thread)
int DeleteThread (int thid)
int StartThread (int thid, void *arg)
int StartThreadArgs (int thid, int args, void *argp)
int ExitThread ()
int ExitDeleteThread ()
int TerminateThread (int thid)
int iTerminateThread (int thid)
int DisableDispatchThread (void)
int EnableDispatchThread (void)
int ChangeThreadPriority (int thid, int priority)
int iChangeThreadPriority (int thid, int priority)
int RotateThreadReadyQueue (int priority)
int iRotateThreadReadyQueue (int priority)
int ReleaseWaitThread (int thid)
int iReleaseWaitThread (int thid)
int GetThreadId (void)
int CheckThreadStack (void)
int ReferThreadStatus (int thid, iop_thread_info_t *info)
int iReferThreadStatus (int thid, iop_thread_info_t *info)
int SleepThread (void)
int WakeupThread (int thid)
int iWakeupThread (int thid)
int CancelWakeupThread (int thid)
int iCancelWakeupThread (int thid)
int SuspendThread (int thid)
int iSuspendThread (int thid)
int ResumeThread (int thid)
int iResumeThread (int thid)
int DelayThread (int usec)
int GetSystemTime (iop_sys_clock_t *sys_clock)
int SetAlarm (iop_sys_clock_t *sys_clock, unsigned int(*alarm_cb)(void *userdata), void *arg)
int iSetAlarm (iop_sys_clock_t *sys_clock, unsigned int(*alarm_cb)(void *userdata), void *arg)
int CancelAlarm (unsigned int(*alarm_cb)(void *userdata), void *arg)
int iCancelAlarm (unsigned int(*alarm_cb)(void *userdata), void *arg)
void USec2SysClock (u32 usec, iop_sys_clock_t *sys_clock)
void SysClock2USec (iop_sys_clock_t *sys_clock, u32 *sec, u32 *usec)
int GetSystemStatusFlag ()

Detailed Description

Kernel-based threads.

Definition in file thbase.h.

Macro Definition Documentation

◆ HIGHEST_PRIORITY

#define HIGHEST_PRIORITY   1

Definition at line 35 of file thbase.h.

◆ I_CancelAlarm

#define I_CancelAlarm   DECLARE_IMPORT(37, CancelAlarm)

Definition at line 267 of file thbase.h.

◆ I_CancelWakeupThread

#define I_CancelWakeupThread   DECLARE_IMPORT(27, CancelWakeupThread)

Definition at line 257 of file thbase.h.

◆ I_ChangeThreadPriority

#define I_ChangeThreadPriority   DECLARE_IMPORT(14, ChangeThreadPriority)

Definition at line 244 of file thbase.h.

◆ I_CheckThreadStack

#define I_CheckThreadStack   DECLARE_IMPORT(21, CheckThreadStack)

Definition at line 251 of file thbase.h.

◆ I_CreateThread

#define I_CreateThread   DECLARE_IMPORT(4, CreateThread)

Definition at line 234 of file thbase.h.

◆ I_DelayThread

#define I_DelayThread   DECLARE_IMPORT(33, DelayThread)

Definition at line 263 of file thbase.h.

◆ I_DeleteThread

#define I_DeleteThread   DECLARE_IMPORT(5, DeleteThread)

Definition at line 235 of file thbase.h.

◆ I_DisableDispatchThread

#define I_DisableDispatchThread   DECLARE_IMPORT(12, DisableDispatchThread)

Definition at line 242 of file thbase.h.

◆ I_EnableDispatchThread

#define I_EnableDispatchThread   DECLARE_IMPORT(13, EnableDispatchThread)

Definition at line 243 of file thbase.h.

◆ I_ExitDeleteThread

#define I_ExitDeleteThread   DECLARE_IMPORT(9, ExitDeleteThread)

Definition at line 239 of file thbase.h.

◆ I_ExitThread

#define I_ExitThread   DECLARE_IMPORT(8, ExitThread)

Definition at line 238 of file thbase.h.

◆ I_GetSystemStatusFlag

#define I_GetSystemStatusFlag   DECLARE_IMPORT(41, GetSystemStatusFlag)

Definition at line 271 of file thbase.h.

◆ I_GetSystemTime

#define I_GetSystemTime   DECLARE_IMPORT(34, GetSystemTime)

Definition at line 264 of file thbase.h.

◆ I_GetThreadId

#define I_GetThreadId   DECLARE_IMPORT(20, GetThreadId)

Definition at line 250 of file thbase.h.

◆ I_GetThreadmanData

#define I_GetThreadmanData   DECLARE_IMPORT(3, GetThreadmanData)

Definition at line 233 of file thbase.h.

◆ I_iCancelAlarm

#define I_iCancelAlarm   DECLARE_IMPORT(38, iCancelAlarm)

Definition at line 268 of file thbase.h.

◆ I_iCancelWakeupThread

#define I_iCancelWakeupThread   DECLARE_IMPORT(28, iCancelWakeupThread)

Definition at line 258 of file thbase.h.

◆ I_iChangeThreadPriority

#define I_iChangeThreadPriority   DECLARE_IMPORT(15, iChangeThreadPriority)

Definition at line 245 of file thbase.h.

◆ I_iReferThreadStatus

#define I_iReferThreadStatus   DECLARE_IMPORT(23, iReferThreadStatus)

Definition at line 253 of file thbase.h.

◆ I_iReleaseWaitThread

#define I_iReleaseWaitThread   DECLARE_IMPORT(19, iReleaseWaitThread)

Definition at line 249 of file thbase.h.

◆ I_iResumeThread

#define I_iResumeThread   DECLARE_IMPORT(32, iResumeThread)

Definition at line 262 of file thbase.h.

◆ I_iRotateThreadReadyQueue

#define I_iRotateThreadReadyQueue   DECLARE_IMPORT(17, iRotateThreadReadyQueue)

Definition at line 247 of file thbase.h.

◆ I_iSetAlarm

#define I_iSetAlarm   DECLARE_IMPORT(36, iSetAlarm)

Definition at line 266 of file thbase.h.

◆ I_iSuspendThread

#define I_iSuspendThread   DECLARE_IMPORT(30, iSuspendThread)

Definition at line 260 of file thbase.h.

◆ I_iTerminateThread

#define I_iTerminateThread   DECLARE_IMPORT(11, iTerminateThread)

Definition at line 241 of file thbase.h.

◆ I_iWakeupThread

#define I_iWakeupThread   DECLARE_IMPORT(26, iWakeupThread)

Definition at line 256 of file thbase.h.

◆ I_ReferThreadStatus

#define I_ReferThreadStatus   DECLARE_IMPORT(22, ReferThreadStatus)

Definition at line 252 of file thbase.h.

◆ I_ReleaseWaitThread

#define I_ReleaseWaitThread   DECLARE_IMPORT(18, ReleaseWaitThread)

Definition at line 248 of file thbase.h.

◆ I_ResumeThread

#define I_ResumeThread   DECLARE_IMPORT(31, ResumeThread)

Definition at line 261 of file thbase.h.

◆ I_RotateThreadReadyQueue

#define I_RotateThreadReadyQueue   DECLARE_IMPORT(16, RotateThreadReadyQueue)

Definition at line 246 of file thbase.h.

◆ I_SetAlarm

#define I_SetAlarm   DECLARE_IMPORT(35, SetAlarm)

Definition at line 265 of file thbase.h.

◆ I_SleepThread

#define I_SleepThread   DECLARE_IMPORT(24, SleepThread)

Definition at line 254 of file thbase.h.

◆ I_StartThread

#define I_StartThread   DECLARE_IMPORT(6, StartThread)

Definition at line 236 of file thbase.h.

◆ I_StartThreadArgs

#define I_StartThreadArgs   DECLARE_IMPORT(7, StartThreadArgs)

Definition at line 237 of file thbase.h.

◆ I_SuspendThread

#define I_SuspendThread   DECLARE_IMPORT(29, SuspendThread)

Definition at line 259 of file thbase.h.

◆ I_SysClock2USec

#define I_SysClock2USec   DECLARE_IMPORT(40, SysClock2USec)

Definition at line 270 of file thbase.h.

◆ I_TerminateThread

#define I_TerminateThread   DECLARE_IMPORT(10, TerminateThread)

Definition at line 240 of file thbase.h.

◆ I_USec2SysClock

#define I_USec2SysClock   DECLARE_IMPORT(39, USec2SysClock)

Definition at line 269 of file thbase.h.

◆ I_WakeupThread

#define I_WakeupThread   DECLARE_IMPORT(25, WakeupThread)

Definition at line 255 of file thbase.h.

◆ LOWEST_PRIORITY

#define LOWEST_PRIORITY   126

Definition at line 38 of file thbase.h.

◆ TH_ASM

#define TH_ASM   0x01000000

Definition at line 28 of file thbase.h.

◆ TH_C

#define TH_C   0x02000000

Definition at line 29 of file thbase.h.

◆ TH_CLEAR_STACK

#define TH_CLEAR_STACK   0x00200000

Definition at line 32 of file thbase.h.

◆ TH_NO_FILLSTACK

#define TH_NO_FILLSTACK   0x00100000

Definition at line 31 of file thbase.h.

◆ TH_SELF

#define TH_SELF   0

Special thread ID for referring to the running thread. Not supported by all functions.

Definition at line 50 of file thbase.h.

◆ TH_UMODE

#define TH_UMODE   0x00000008

Definition at line 30 of file thbase.h.

◆ thbase_IMPORTS

#define thbase_IMPORTS

Definition at line 172 of file thbase.h.

◆ thbase_IMPORTS_end

#define thbase_IMPORTS_end   END_IMPORT_TABLE

Definition at line 231 of file thbase.h.

◆ thbase_IMPORTS_start

#define thbase_IMPORTS_start   DECLARE_IMPORT_TABLE(thbase, 1, 1)

Definition at line 230 of file thbase.h.

◆ THS_DORMANT

#define THS_DORMANT   0x10

Definition at line 58 of file thbase.h.

◆ THS_READY

#define THS_READY   0x02

Definition at line 54 of file thbase.h.

◆ THS_RUN

#define THS_RUN   0x01

Definition at line 53 of file thbase.h.

◆ THS_SUSPEND

#define THS_SUSPEND   0x08

Definition at line 56 of file thbase.h.

◆ THS_WAIT

#define THS_WAIT   0x04

Definition at line 55 of file thbase.h.

◆ THS_WAITSUSPEND

#define THS_WAITSUSPEND   0x0C

Definition at line 57 of file thbase.h.

◆ TSW_DELAY

#define TSW_DELAY   2

Definition at line 62 of file thbase.h.

◆ TSW_EVENTFLAG

#define TSW_EVENTFLAG   4

Definition at line 64 of file thbase.h.

◆ TSW_FPL

#define TSW_FPL   7

Definition at line 67 of file thbase.h.

◆ TSW_MBX

#define TSW_MBX   5

Definition at line 65 of file thbase.h.

◆ TSW_SEMA

#define TSW_SEMA   3

Definition at line 63 of file thbase.h.

◆ TSW_SLEEP

#define TSW_SLEEP   1

Definition at line 61 of file thbase.h.

◆ TSW_VPL

#define TSW_VPL   6

Definition at line 66 of file thbase.h.

◆ USER_HIGHEST_PRIORITY

#define USER_HIGHEST_PRIORITY   9

Definition at line 36 of file thbase.h.

◆ USER_LOWEST_PRIORITY

#define USER_LOWEST_PRIORITY   123

Definition at line 37 of file thbase.h.

Function Documentation

◆ CancelAlarm()

int CancelAlarm ( unsigned int(* alarm_cb )(void *userdata),
void * arg )
extern

Definition at line 1006 of file thbase.c.

◆ CancelWakeupThread()

int CancelWakeupThread ( int thid)
extern

Definition at line 805 of file thbase.c.

◆ ChangeThreadPriority()

int ChangeThreadPriority ( int thid,
int priority )
extern

Definition at line 351 of file thbase.c.

◆ CheckThreadStack()

int CheckThreadStack ( void )
extern

Definition at line 644 of file thbase.c.

◆ CreateThread()

int CreateThread ( iop_thread_t * thread)
extern

Definition at line 27 of file thbase.c.

◆ DelayThread()

int DelayThread ( int usec)
extern

Definition at line 876 of file thbase.c.

◆ DeleteThread()

int DeleteThread ( int thid)
extern

Definition at line 91 of file thbase.c.

◆ DisableDispatchThread()

int DisableDispatchThread ( void )
extern

Definition at line 341 of file thbase.c.

◆ EnableDispatchThread()

int EnableDispatchThread ( void )
extern

Definition at line 346 of file thbase.c.

◆ ExitDeleteThread()

int ExitDeleteThread ( )
extern

Definition at line 236 of file thbase.c.

◆ ExitThread()

int ExitThread ( )
extern

Definition at line 216 of file thbase.c.

◆ GetSystemStatusFlag()

int GetSystemStatusFlag ( )
extern

Definition at line 1080 of file thbase.c.

◆ GetSystemTime()

int GetSystemTime ( iop_sys_clock_t * sys_clock)
extern

Definition at line 912 of file thbase.c.

◆ GetThreadId()

int GetThreadId ( void )
extern

Definition at line 635 of file thbase.c.

◆ iCancelAlarm()

int iCancelAlarm ( unsigned int(* alarm_cb )(void *userdata),
void * arg )
extern

Definition at line 1038 of file thbase.c.

◆ iCancelWakeupThread()

int iCancelWakeupThread ( int thid)
extern

Definition at line 832 of file thbase.c.

◆ iChangeThreadPriority()

int iChangeThreadPriority ( int thid,
int priority )
extern

Definition at line 421 of file thbase.c.

◆ iReferThreadStatus()

int iReferThreadStatus ( int thid,
iop_thread_info_t * info )
extern

Definition at line 677 of file thbase.c.

◆ iReleaseWaitThread()

int iReleaseWaitThread ( int thid)
extern

Definition at line 597 of file thbase.c.

◆ iResumeThread()

int iResumeThread ( int thid)
extern

Definition at line 871 of file thbase.c.

◆ iRotateThreadReadyQueue()

int iRotateThreadReadyQueue ( int priority)
extern

Definition at line 515 of file thbase.c.

◆ iSetAlarm()

int iSetAlarm ( iop_sys_clock_t * sys_clock,
unsigned int(* alarm_cb )(void *userdata),
void * arg )
extern

Definition at line 967 of file thbase.c.

◆ iSuspendThread()

int iSuspendThread ( int thid)
extern

Definition at line 861 of file thbase.c.

◆ iTerminateThread()

int iTerminateThread ( int thid)
extern

Definition at line 296 of file thbase.c.

◆ iWakeupThread()

int iWakeupThread ( int thid)
extern

Definition at line 772 of file thbase.c.

◆ ReferThreadStatus()

int ReferThreadStatus ( int thid,
iop_thread_info_t * info )
extern

Definition at line 653 of file thbase.c.

◆ ReleaseWaitThread()

int ReleaseWaitThread ( int thid)
extern

Definition at line 553 of file thbase.c.

◆ ResumeThread()

int ResumeThread ( int thid)
extern

Definition at line 866 of file thbase.c.

◆ RotateThreadReadyQueue()

int RotateThreadReadyQueue ( int priority)
extern

Definition at line 474 of file thbase.c.

◆ SetAlarm()

int SetAlarm ( iop_sys_clock_t * sys_clock,
unsigned int(* alarm_cb )(void *userdata),
void * arg )
extern

Definition at line 917 of file thbase.c.

◆ SleepThread()

int SleepThread ( void )
extern

Definition at line 696 of file thbase.c.

◆ StartThread()

int StartThread ( int thid,
void * arg )
extern

Definition at line 131 of file thbase.c.

◆ StartThreadArgs()

int StartThreadArgs ( int thid,
int args,
void * argp )
extern

Definition at line 168 of file thbase.c.

◆ SuspendThread()

int SuspendThread ( int thid)
extern

Definition at line 856 of file thbase.c.

◆ SysClock2USec()

void SysClock2USec ( iop_sys_clock_t * sys_clock,
u32 * sec,
u32 * usec )
extern

Definition at line 1071 of file thbase.c.

◆ TerminateThread()

int TerminateThread ( int thid)
extern

Definition at line 256 of file thbase.c.

◆ USec2SysClock()

void USec2SysClock ( u32 usec,
iop_sys_clock_t * sys_clock )
extern

Definition at line 1063 of file thbase.c.

◆ WakeupThread()

int WakeupThread ( int thid)
extern

Definition at line 729 of file thbase.c.