PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
thsemap.h
Go to the documentation of this file.
1
/*
2
# _____ ___ ____ ___ ____
3
# ____| | ____| | | |____|
4
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5
#-----------------------------------------------------------------------
6
# Copyright (c) 2003 Marcus R. Brown <mrbrown@0xd6.org>
7
# Licenced under Academic Free License version 2.0
8
# Review ps2sdk README & LICENSE files for further details.
9
*/
10
16
/*
17
* This file is based off of the work [RO]man, Herben, and any others involved
18
* in the "modules" project at http://ps2dev.pgamers.com/. It is also based
19
* off of the work of the many contributors to the ps2lib project at
20
* http://ps2dev.livemedia.com.au/.
21
*/
22
23
#ifndef __THSEMAP_H__
24
#define __THSEMAP_H__
25
26
#include <types.h>
27
#include <
irx.h
>
28
29
#ifdef __cplusplus
30
extern
"C"
{
31
#endif
32
33
// Semaphore attributes
34
#define SA_THFIFO 0x000
35
#define SA_THPRI 0x001
36
#define SA_IHTHPRI 0x100
37
38
typedef
struct
39
{
40
u32 attr;
41
u32 option;
42
int
initial;
43
int
max;
44
}
iop_sema_t
;
45
46
typedef
struct
47
{
48
u32 attr;
49
u32 option;
50
int
initial;
51
int
max;
52
int
current;
53
int
numWaitThreads;
54
int
reserved[2];
55
}
iop_sema_info_t
;
56
57
int
CreateSema(
iop_sema_t
*sema);
58
int
DeleteSema(
int
semid);
59
60
int
SignalSema(
int
semid);
61
int
iSignalSema(
int
semid);
62
int
WaitSema(
int
semid);
63
int
PollSema(
int
semid);
64
65
int
ReferSemaStatus(
int
semid,
iop_sema_info_t
*
info
);
66
int
iReferSemaStatus(
int
semid,
iop_sema_info_t
*
info
);
67
68
#define IOP_MUTEX_LOCKED 0
69
#define IOP_MUTEX_UNLOCKED 1
70
71
static
inline
int
CreateMutex(
int
state)
72
{
73
iop_sema_t
sema;
74
sema.attr = 0;
75
sema.option = 0;
76
sema.initial = state;
77
sema.max = 1;
78
return
CreateSema(&sema);
79
}
80
81
#define thsemap_IMPORTS_start DECLARE_IMPORT_TABLE(thsemap, 1, 2)
82
#define thsemap_IMPORTS_end END_IMPORT_TABLE
83
84
#define I_CreateSema DECLARE_IMPORT(4, CreateSema)
85
#define I_DeleteSema DECLARE_IMPORT(5, DeleteSema)
86
#define I_SignalSema DECLARE_IMPORT(6, SignalSema)
87
#define I_iSignalSema DECLARE_IMPORT(7, iSignalSema)
88
#define I_WaitSema DECLARE_IMPORT(8, WaitSema);
89
#define I_PollSema DECLARE_IMPORT(9, PollSema);
90
#define I_ReferSemaStatus DECLARE_IMPORT(11, ReferSemaStatus)
91
#define I_iReferSemaStatus DECLARE_IMPORT(12, iReferSemaStatus)
92
93
#ifdef __cplusplus
94
}
95
#endif
96
97
#endif
/* __THSEMAP_H__ */
irx.h
s_info
Definition
xprintf.c:78
iop_sema_info_t
Definition
thsemap.h:47
iop_sema_t
Definition
thsemap.h:39
iop
kernel
include
thsemap.h
Generated on Thu Nov 14 2024 05:25:27 for PS2SDK by
1.9.8