PS2SDK
PS2 Homebrew Libraries
thmsgbx.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 __THMSGBX_H__
17 #define __THMSGBX_H__
18 
19 #include <types.h>
20 #include <irx.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 // Message box attributes
27 #define MBA_THFIFO 0x000
28 #define MBA_THPRI 0x001
29 #define MBA_MSFIFO 0x000
30 #define MBA_MSPRI 0x004
31 
32 typedef struct
33 {
34  unsigned int attr;
35  unsigned int option;
36 } iop_mbx_t;
37 
38 /* Define your own messages by putting iop_message_t at the
39  * head of your struct.
40  *
41  * typedef struct {
42  * iop_message_t msg;
43  * u32 mystuff;
44  * ...
45  * } my_message_t;
46  *
47  * You can then pass it as a message with
48  * SendMbx(mbxid, &struct.msg);
49  */
50 
51 typedef struct _iop_message
52 {
53  struct _iop_message *next;
54  unsigned char priority;
55  unsigned char unused[3];
57 
58 typedef struct _iop_mbx_status
59 {
60  unsigned int attr;
61  unsigned int option;
62  int numWaitThreads;
63  int numMessage;
64  iop_message_t *topPacket;
65  int reserved[2];
67 
68 extern int CreateMbx(iop_mbx_t *mbx);
69 extern int DeleteMbx(int mbxid);
70 
71 extern int SendMbx(int mbxid, void *msg);
72 extern int iSendMbx(int mbxid, void *msg);
73 extern int ReceiveMbx(void **msgvar, int mbxid);
74 extern int PollMbx(void **msgvar, int mbxid);
75 
76 extern int ReferMbxStatus(int mbxid, iop_mbx_status_t *info);
77 extern int iReferMbxStatus(int mbxid, iop_mbx_status_t *info);
78 
79 #define thmsgbx_IMPORTS_start DECLARE_IMPORT_TABLE(thmsgbx, 1, 1)
80 #define thmsgbx_IMPORTS_end END_IMPORT_TABLE
81 
82 #define I_CreateMbx DECLARE_IMPORT(4, CreateMbx)
83 #define I_DeleteMbx DECLARE_IMPORT(5, DeleteMbx)
84 #define I_SendMbx DECLARE_IMPORT(6, SendMbx)
85 #define I_iSendMbx DECLARE_IMPORT(7, iSendMbx)
86 #define I_ReceiveMbx DECLARE_IMPORT(8, ReceiveMbx)
87 #define I_PollMbx DECLARE_IMPORT(9, PollMbx)
88 #define I_ReferMbxStatus DECLARE_IMPORT(11, ReferMbxStatus)
89 #define I_iReferMbxStatus DECLARE_IMPORT(12, iReferMbxStatus)
90 
91 #ifdef __cplusplus
92 }
93 #endif
94 
95 #endif /* __THMSGBX_H__ */
iop_mbx_t
Definition: thmsgbx.h:32
s_info
Definition: xprintf.c:78
_iop_mbx_status
Definition: thmsgbx.h:58
irx.h
_iop_message
Definition: thmsgbx.h:51