PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
thbase.h File Reference
#include <types.h>
#include <irx.h>
+ Include dependency graph for thbase.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

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_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

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 *), void *arg)
 
int iSetAlarm (iop_sys_clock_t *sys_clock, unsigned int(*alarm_cb)(void *), void *arg)
 
int CancelAlarm (unsigned int(*alarm_cb)(void *), void *arg)
 
int iCancelAlarm (unsigned int(*alarm_cb)(void *), 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.


Data Structure Documentation

◆ _iop_thread_status

struct _iop_thread_status

Definition at line 68 of file thbase.h.

Data Fields
unsigned int attr
unsigned int option
int status
void * entry
void * stack
int stackSize
void * gpReg
int initPriority
int currentPriority
int waitType
int waitId
int wakeupCount
long int * regContext

Only valid for use with iReferThreadStatus.

unsigned int reserved[4]

◆ _iop_sys_clock

struct _iop_sys_clock

Definition at line 87 of file thbase.h.

Data Fields
u32 lo
u32 hi

◆ _iop_thread_run_status

struct _iop_thread_run_status

Definition at line 92 of file thbase.h.

+ Collaboration diagram for _iop_thread_run_status:
Data Fields
int status
int currentPriority
int waitType
int waitId
int wakeupCount
long int * regContext
iop_sys_clock_t runClocks
unsigned int intrPreemptCount
unsigned int threadPreemptCount
unsigned int releaseCount

◆ _iop_sys_status

struct _iop_sys_status

Definition at line 106 of file thbase.h.

+ Collaboration diagram for _iop_sys_status:
Data Fields
unsigned int status
int systemLowTimerWidth
iop_sys_clock_t idleClocks
iop_sys_clock_t kernelClocks
unsigned int comesOutOfIdleCount
unsigned int threadSwitchCount
unsigned int reserved[8]

Macro Definition Documentation

◆ TH_ASM

#define TH_ASM   0x01000000

Definition at line 27 of file thbase.h.

◆ TH_C

#define TH_C   0x02000000

Definition at line 28 of file thbase.h.

◆ TH_UMODE

#define TH_UMODE   0x00000008

Definition at line 29 of file thbase.h.

◆ TH_NO_FILLSTACK

#define TH_NO_FILLSTACK   0x00100000

Definition at line 30 of file thbase.h.

◆ TH_CLEAR_STACK

#define TH_CLEAR_STACK   0x00200000

Definition at line 31 of file thbase.h.

◆ HIGHEST_PRIORITY

#define HIGHEST_PRIORITY   1

Definition at line 34 of file thbase.h.

◆ USER_HIGHEST_PRIORITY

#define USER_HIGHEST_PRIORITY   9

Definition at line 35 of file thbase.h.

◆ USER_LOWEST_PRIORITY

#define USER_LOWEST_PRIORITY   123

Definition at line 36 of file thbase.h.

◆ LOWEST_PRIORITY

#define LOWEST_PRIORITY   126

Definition at line 37 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 49 of file thbase.h.

◆ THS_RUN

#define THS_RUN   0x01

Definition at line 52 of file thbase.h.

◆ THS_READY

#define THS_READY   0x02

Definition at line 53 of file thbase.h.

◆ THS_WAIT

#define THS_WAIT   0x04

Definition at line 54 of file thbase.h.

◆ THS_SUSPEND

#define THS_SUSPEND   0x08

Definition at line 55 of file thbase.h.

◆ THS_WAITSUSPEND

#define THS_WAITSUSPEND   0x0C

Definition at line 56 of file thbase.h.

◆ THS_DORMANT

#define THS_DORMANT   0x10

Definition at line 57 of file thbase.h.

◆ TSW_SLEEP

#define TSW_SLEEP   1

Definition at line 60 of file thbase.h.

◆ TSW_DELAY

#define TSW_DELAY   2

Definition at line 61 of file thbase.h.

◆ TSW_SEMA

#define TSW_SEMA   3

Definition at line 62 of file thbase.h.

◆ TSW_EVENTFLAG

#define TSW_EVENTFLAG   4

Definition at line 63 of file thbase.h.

◆ TSW_MBX

#define TSW_MBX   5

Definition at line 64 of file thbase.h.

◆ TSW_VPL

#define TSW_VPL   6

Definition at line 65 of file thbase.h.

◆ TSW_FPL

#define TSW_FPL   7

Definition at line 66 of file thbase.h.

◆ thbase_IMPORTS

#define thbase_IMPORTS

Definition at line 169 of file thbase.h.

◆ thbase_IMPORTS_start

#define thbase_IMPORTS_start   DECLARE_IMPORT_TABLE(thbase, 1, 1)

Definition at line 225 of file thbase.h.

◆ thbase_IMPORTS_end

#define thbase_IMPORTS_end   END_IMPORT_TABLE

Definition at line 226 of file thbase.h.

◆ I_CreateThread

#define I_CreateThread   DECLARE_IMPORT(4, CreateThread)

Definition at line 228 of file thbase.h.

◆ I_DeleteThread

#define I_DeleteThread   DECLARE_IMPORT(5, DeleteThread)

Definition at line 229 of file thbase.h.

◆ I_StartThread

#define I_StartThread   DECLARE_IMPORT(6, StartThread)

Definition at line 230 of file thbase.h.

◆ I_StartThreadArgs

#define I_StartThreadArgs   DECLARE_IMPORT(7, StartThreadArgs)

Definition at line 231 of file thbase.h.

◆ I_ExitThread

#define I_ExitThread   DECLARE_IMPORT(8, ExitThread)

Definition at line 232 of file thbase.h.

◆ I_ExitDeleteThread

#define I_ExitDeleteThread   DECLARE_IMPORT(9, ExitDeleteThread)

Definition at line 233 of file thbase.h.

◆ I_TerminateThread

#define I_TerminateThread   DECLARE_IMPORT(10, TerminateThread)

Definition at line 234 of file thbase.h.

◆ I_iTerminateThread

#define I_iTerminateThread   DECLARE_IMPORT(11, iTerminateThread)

Definition at line 235 of file thbase.h.

◆ I_DisableDispatchThread

#define I_DisableDispatchThread   DECLARE_IMPORT(12, DisableDispatchThread)

Definition at line 236 of file thbase.h.

◆ I_EnableDispatchThread

#define I_EnableDispatchThread   DECLARE_IMPORT(13, EnableDispatchThread)

Definition at line 237 of file thbase.h.

◆ I_ChangeThreadPriority

#define I_ChangeThreadPriority   DECLARE_IMPORT(14, ChangeThreadPriority)

Definition at line 238 of file thbase.h.

◆ I_iChangeThreadPriority

#define I_iChangeThreadPriority   DECLARE_IMPORT(15, iChangeThreadPriority)

Definition at line 239 of file thbase.h.

◆ I_RotateThreadReadyQueue

#define I_RotateThreadReadyQueue   DECLARE_IMPORT(16, RotateThreadReadyQueue)

Definition at line 240 of file thbase.h.

◆ I_iRotateThreadReadyQueue

#define I_iRotateThreadReadyQueue   DECLARE_IMPORT(17, iRotateThreadReadyQueue)

Definition at line 241 of file thbase.h.

◆ I_ReleaseWaitThread

#define I_ReleaseWaitThread   DECLARE_IMPORT(18, ReleaseWaitThread)

Definition at line 242 of file thbase.h.

◆ I_iReleaseWaitThread

#define I_iReleaseWaitThread   DECLARE_IMPORT(19, iReleaseWaitThread)

Definition at line 243 of file thbase.h.

◆ I_GetThreadId

#define I_GetThreadId   DECLARE_IMPORT(20, GetThreadId)

Definition at line 244 of file thbase.h.

◆ I_CheckThreadStack

#define I_CheckThreadStack   DECLARE_IMPORT(21, CheckThreadStack)

Definition at line 245 of file thbase.h.

◆ I_ReferThreadStatus

#define I_ReferThreadStatus   DECLARE_IMPORT(22, ReferThreadStatus)

Definition at line 246 of file thbase.h.

◆ I_iReferThreadStatus

#define I_iReferThreadStatus   DECLARE_IMPORT(23, iReferThreadStatus)

Definition at line 247 of file thbase.h.

◆ I_SleepThread

#define I_SleepThread   DECLARE_IMPORT(24, SleepThread)

Definition at line 248 of file thbase.h.

◆ I_WakeupThread

#define I_WakeupThread   DECLARE_IMPORT(25, WakeupThread)

Definition at line 249 of file thbase.h.

◆ I_iWakeupThread

#define I_iWakeupThread   DECLARE_IMPORT(26, iWakeupThread)

Definition at line 250 of file thbase.h.

◆ I_CancelWakeupThread

#define I_CancelWakeupThread   DECLARE_IMPORT(27, CancelWakeupThread)

Definition at line 251 of file thbase.h.

◆ I_iCancelWakeupThread

#define I_iCancelWakeupThread   DECLARE_IMPORT(28, iCancelWakeupThread)

Definition at line 252 of file thbase.h.

◆ I_SuspendThread

#define I_SuspendThread   DECLARE_IMPORT(29, SuspendThread)

Definition at line 253 of file thbase.h.

◆ I_iSuspendThread

#define I_iSuspendThread   DECLARE_IMPORT(30, iSuspendThread)

Definition at line 254 of file thbase.h.

◆ I_ResumeThread

#define I_ResumeThread   DECLARE_IMPORT(31, ResumeThread)

Definition at line 255 of file thbase.h.

◆ I_iResumeThread

#define I_iResumeThread   DECLARE_IMPORT(32, iResumeThread)

Definition at line 256 of file thbase.h.

◆ I_DelayThread

#define I_DelayThread   DECLARE_IMPORT(33, DelayThread)

Definition at line 257 of file thbase.h.

◆ I_GetSystemTime

#define I_GetSystemTime   DECLARE_IMPORT(34, GetSystemTime)

Definition at line 258 of file thbase.h.

◆ I_SetAlarm

#define I_SetAlarm   DECLARE_IMPORT(35, SetAlarm)

Definition at line 259 of file thbase.h.

◆ I_iSetAlarm

#define I_iSetAlarm   DECLARE_IMPORT(36, iSetAlarm)

Definition at line 260 of file thbase.h.

◆ I_CancelAlarm

#define I_CancelAlarm   DECLARE_IMPORT(37, CancelAlarm)

Definition at line 261 of file thbase.h.

◆ I_iCancelAlarm

#define I_iCancelAlarm   DECLARE_IMPORT(38, iCancelAlarm)

Definition at line 262 of file thbase.h.

◆ I_USec2SysClock

#define I_USec2SysClock   DECLARE_IMPORT(39, USec2SysClock)

Definition at line 263 of file thbase.h.

◆ I_SysClock2USec

#define I_SysClock2USec   DECLARE_IMPORT(40, SysClock2USec)

Definition at line 264 of file thbase.h.

◆ I_GetSystemStatusFlag

#define I_GetSystemStatusFlag   DECLARE_IMPORT(41, GetSystemStatusFlag)

Definition at line 265 of file thbase.h.

Function Documentation

◆ CreateThread()

int CreateThread ( iop_thread_t thread)

Definition at line 26 of file thbase.c.

◆ DeleteThread()

int DeleteThread ( int  thid)

Definition at line 92 of file thbase.c.

◆ StartThread()

int StartThread ( int  thid,
void *  arg 
)

Definition at line 132 of file thbase.c.

◆ StartThreadArgs()

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

Definition at line 169 of file thbase.c.

◆ ExitThread()

int ExitThread ( )

Definition at line 217 of file thbase.c.

◆ ExitDeleteThread()

int ExitDeleteThread ( )

Definition at line 237 of file thbase.c.

◆ TerminateThread()

int TerminateThread ( int  thid)

Definition at line 257 of file thbase.c.

◆ iTerminateThread()

int iTerminateThread ( int  thid)

Definition at line 297 of file thbase.c.

◆ DisableDispatchThread()

int DisableDispatchThread ( void  )

Definition at line 342 of file thbase.c.

◆ EnableDispatchThread()

int EnableDispatchThread ( void  )

Definition at line 347 of file thbase.c.

◆ ChangeThreadPriority()

int ChangeThreadPriority ( int  thid,
int  priority 
)

Definition at line 352 of file thbase.c.

◆ iChangeThreadPriority()

int iChangeThreadPriority ( int  thid,
int  priority 
)

Definition at line 422 of file thbase.c.

◆ RotateThreadReadyQueue()

int RotateThreadReadyQueue ( int  priority)

Definition at line 475 of file thbase.c.

◆ iRotateThreadReadyQueue()

int iRotateThreadReadyQueue ( int  priority)

Definition at line 516 of file thbase.c.

◆ ReleaseWaitThread()

int ReleaseWaitThread ( int  thid)

Definition at line 554 of file thbase.c.

◆ iReleaseWaitThread()

int iReleaseWaitThread ( int  thid)

Definition at line 598 of file thbase.c.

◆ GetThreadId()

int GetThreadId ( void  )

Definition at line 636 of file thbase.c.

◆ CheckThreadStack()

int CheckThreadStack ( void  )

Definition at line 645 of file thbase.c.

◆ ReferThreadStatus()

int ReferThreadStatus ( int  thid,
iop_thread_info_t info 
)

Definition at line 654 of file thbase.c.

◆ iReferThreadStatus()

int iReferThreadStatus ( int  thid,
iop_thread_info_t info 
)

Definition at line 678 of file thbase.c.

◆ SleepThread()

int SleepThread ( void  )

Definition at line 697 of file thbase.c.

◆ WakeupThread()

int WakeupThread ( int  thid)

Definition at line 730 of file thbase.c.

◆ iWakeupThread()

int iWakeupThread ( int  thid)

Definition at line 773 of file thbase.c.

◆ CancelWakeupThread()

int CancelWakeupThread ( int  thid)

Definition at line 806 of file thbase.c.

◆ iCancelWakeupThread()

int iCancelWakeupThread ( int  thid)

Definition at line 833 of file thbase.c.

◆ SuspendThread()

int SuspendThread ( int  thid)

Definition at line 857 of file thbase.c.

◆ iSuspendThread()

int iSuspendThread ( int  thid)

Definition at line 862 of file thbase.c.

◆ ResumeThread()

int ResumeThread ( int  thid)

Definition at line 867 of file thbase.c.

◆ iResumeThread()

int iResumeThread ( int  thid)

Definition at line 872 of file thbase.c.

◆ DelayThread()

int DelayThread ( int  usec)

Definition at line 877 of file thbase.c.

◆ GetSystemTime()

int GetSystemTime ( iop_sys_clock_t sys_clock)

Definition at line 913 of file thbase.c.

◆ SetAlarm()

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

Definition at line 918 of file thbase.c.

◆ iSetAlarm()

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

Definition at line 968 of file thbase.c.

◆ CancelAlarm()

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

Definition at line 1007 of file thbase.c.

◆ iCancelAlarm()

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

Definition at line 1039 of file thbase.c.

◆ USec2SysClock()

void USec2SysClock ( u32  usec,
iop_sys_clock_t sys_clock 
)

Definition at line 1064 of file thbase.c.

◆ SysClock2USec()

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

Definition at line 1072 of file thbase.c.

◆ GetSystemStatusFlag()

int GetSystemStatusFlag ( )

Definition at line 1081 of file thbase.c.