PS2SDK
PS2 Homebrew Libraries
thevent.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 #ifndef __THEVENT_H__
17 #define __THEVENT_H__
18 
19 #include <types.h>
20 #include <irx.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /* Defines for WaitEventFlag */
27 #define WEF_AND 0
28 #define WEF_OR 1
29 #define WEF_CLEAR 0x10
30 
31 // Attributes for event flags
33 #define EA_SINGLE 0
34 
35 #define EA_MULTI 2
36 
37 typedef struct
38 {
39  u32 attr;
40  u32 option;
41  u32 bits;
42 } iop_event_t;
43 
44 typedef struct
45 {
47  u32 attr;
49  u32 option;
51  u32 initBits;
53  u32 currBits;
56  int reserved1;
57  int reserved2;
59 
60 extern int CreateEventFlag(iop_event_t *event);
61 extern int DeleteEventFlag(int ef);
62 
63 extern int SetEventFlag(int ef, u32 bits);
64 extern int iSetEventFlag(int ef, u32 bits);
65 
66 extern int ClearEventFlag(int ef, u32 bits);
67 extern int iClearEventFlag(int ef, u32 bits);
68 
69 extern int WaitEventFlag(int ef, u32 bits, int mode, u32 *resbits);
70 
71 extern int PollEventFlag(int ef, u32 bits, int mode, u32 *resbits);
72 
73 extern int ReferEventFlagStatus(int ef, iop_event_info_t *info);
74 extern int iReferEventFlagStatus(int ef, iop_event_info_t *info);
75 
76 // clang-format off
77 #define thevent_IMPORTS \
78  thevent_IMPORTS_start \
79  \
80  I_CreateEventFlag \
81  I_DeleteEventFlag \
82  \
83  I_SetEventFlag \
84  I_iSetEventFlag \
85  \
86  I_ClearEventFlag \
87  I_iClearEventFlag \
88  \
89  I_WaitEventFlag \
90  \
91  I_PollEventFlag \
92  \
93  I_ReferEventFlagStatus \
94  I_iReferEventFlagStatus \
95  \
96  thevent_IMPORTS_end END_IMPORT_TABLE
97 // clang-format on
98 
99 #define thevent_IMPORTS_start DECLARE_IMPORT_TABLE(thevent, 1, 1)
100 #define thevent_IMPORTS_end END_IMPORT_TABLE
101 
102 #define I_CreateEventFlag DECLARE_IMPORT(4, CreateEventFlag)
103 #define I_DeleteEventFlag DECLARE_IMPORT(5, DeleteEventFlag)
104 #define I_SetEventFlag DECLARE_IMPORT(6, SetEventFlag)
105 #define I_iSetEventFlag DECLARE_IMPORT(7, iSetEventFlag)
106 #define I_ClearEventFlag DECLARE_IMPORT(8, ClearEventFlag)
107 #define I_iClearEventFlag DECLARE_IMPORT(9, iClearEventFlag)
108 #define I_WaitEventFlag DECLARE_IMPORT(10, WaitEventFlag)
109 #define I_PollEventFlag DECLARE_IMPORT(11, PollEventFlag)
110 #define I_ReferEventFlagStatus DECLARE_IMPORT(13, ReferEventFlagStatus)
111 #define I_iReferEventFlagStatus DECLARE_IMPORT(14, iReferEventFlagStatus)
112 
113 #ifdef __cplusplus
114 }
115 #endif
116 
117 #endif /* __THEVENT_H__ */
iop_event_info_t::option
u32 option
Definition: thevent.h:49
iop_event_info_t::numThreads
int numThreads
Definition: thevent.h:55
s_info
Definition: xprintf.c:78
iop_event_info_t::currBits
u32 currBits
Definition: thevent.h:53
event
Definition: thcommon.h:71
iop_event_info_t::attr
u32 attr
Definition: thevent.h:47
irx.h
iop_event_info_t
Definition: thevent.h:44
iop_event_info_t::initBits
u32 initBits
Definition: thevent.h:51
iop_event_t
Definition: thevent.h:37