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