Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
os_message.h
Go to the documentation of this file.
1 
2 /*====================================================================
3  * os_message.h
4  *
5  * Copyright 1995, Silicon Graphics, Inc.
6  * All Rights Reserved.
7  *
8  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
9  * Inc.; the contents of this file may not be disclosed to third
10  * parties, copied or duplicated in any form, in whole or in part,
11  * without the prior written permission of Silicon Graphics, Inc.
12  *
13  * RESTRICTED RIGHTS LEGEND:
14  * Use, duplication or disclosure by the Government is subject to
15  * restrictions as set forth in subdivision (c)(1)(ii) of the Rights
16  * in Technical Data and Computer Software clause at DFARS
17  * 252.227-7013, and/or in similar or successor clauses in the FAR,
18  * DOD or NASA FAR Supplement. Unpublished - rights reserved under the
19  * Copyright Laws of the United States.
20  *====================================================================*/
21 
22 /*---------------------------------------------------------------------*
23  Copyright (C) 1998 Nintendo. (Originated by SGI)
24 
25  $RCSfile: os_message.h,v $
26  $Revision: 1.1 $
27  $Date: 1998/10/09 08:01:15 $
28  *---------------------------------------------------------------------*/
29 
30 #ifndef _OS_MESSAGE_H_
31 #define _OS_MESSAGE_H_
32 
33 #ifdef _LANGUAGE_C_PLUS_PLUS
34 extern "C" {
35 #endif
36 
37 #include <PR/ultratypes.h>
38 
39 #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
40 
41 /**************************************************************************
42  *
43  * Type definitions
44  *
45  */
46 
47 typedef u32 OSEvent;
48 
49 /*
50  * Structure for message
51  */
52 typedef void * OSMesg;
53 
54 /*
55  * Structure for message queue
56  */
57 typedef struct OSMesgQueue_s {
58  OSThread *mtqueue; /* Queue to store threads blocked
59  on empty mailboxes (receive) */
60  OSThread *fullqueue; /* Queue to store threads blocked
61  on full mailboxes (send) */
62  s32 validCount; /* Contains number of valid message */
63  s32 first; /* Points to first valid message */
64  s32 msgCount; /* Contains total # of messages */
65  OSMesg *msg; /* Points to message buffer array */
66 } OSMesgQueue;
67 
68 
69 #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
70 
71 /**************************************************************************
72  *
73  * Global definitions
74  *
75  */
76 
77 /* Events */
78 #ifdef _FINALROM
79 #define OS_NUM_EVENTS 15
80 #else
81 #define OS_NUM_EVENTS 23
82 #endif
83 
84 #define OS_EVENT_SW1 0 /* CPU SW1 interrupt */
85 #define OS_EVENT_SW2 1 /* CPU SW2 interrupt */
86 #define OS_EVENT_CART 2 /* Cartridge interrupt: used by rmon */
87 #define OS_EVENT_COUNTER 3 /* Counter int: used by VI/Timer Mgr */
88 #define OS_EVENT_SP 4 /* SP task done interrupt */
89 #define OS_EVENT_SI 5 /* SI (controller) interrupt */
90 #define OS_EVENT_AI 6 /* AI interrupt */
91 #define OS_EVENT_VI 7 /* VI interrupt: used by VI/Timer Mgr */
92 #define OS_EVENT_PI 8 /* PI interrupt: used by PI Manager */
93 #define OS_EVENT_DP 9 /* DP full sync interrupt */
94 #define OS_EVENT_CPU_BREAK 10 /* CPU breakpoint: used by rmon */
95 #define OS_EVENT_SP_BREAK 11 /* SP breakpoint: used by rmon */
96 #define OS_EVENT_FAULT 12 /* CPU fault event: used by rmon */
97 #define OS_EVENT_THREADSTATUS 13 /* CPU thread status: used by rmon */
98 #define OS_EVENT_PRENMI 14 /* Pre NMI interrupt */
99 #ifndef _FINALROM
100 #define OS_EVENT_RDB_READ_DONE 15 /* RDB read ok event: used by rmon */
101 #define OS_EVENT_RDB_LOG_DONE 16 /* read of log data complete */
102 #define OS_EVENT_RDB_DATA_DONE 17 /* read of hostio data complete */
103 #define OS_EVENT_RDB_REQ_RAMROM 18 /* host needs ramrom access */
104 #define OS_EVENT_RDB_FREE_RAMROM 19 /* host is done with ramrom access */
105 #define OS_EVENT_RDB_DBG_DONE 20
106 #define OS_EVENT_RDB_FLUSH_PROF 21
107 #define OS_EVENT_RDB_ACK_PROF 22
108 #endif
109 
110 /* Flags to turn blocking on/off when sending/receiving message */
111 
112 #define OS_MESG_NOBLOCK 0
113 #define OS_MESG_BLOCK 1
114 
115 
116 #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
117 
118 /**************************************************************************
119  *
120  * Macro definitions
121  *
122  */
123 
124 /* Get count of valid messages in queue */
125 #define MQ_GET_COUNT(mq) ((mq)->validCount)
126 
127 /* Figure out if message queue is empty or full */
128 #define MQ_IS_EMPTY(mq) (MQ_GET_COUNT(mq) == 0)
129 #define MQ_IS_FULL(mq) (MQ_GET_COUNT(mq) >= (mq)->msgCount)
130 
131 
132 /**************************************************************************
133  *
134  * Extern variables
135  *
136  */
137 
138 
139 /**************************************************************************
140  *
141  * Function prototypes
142  *
143  */
144 
145 /* Message operations */
146 
147 extern void osCreateMesgQueue(OSMesgQueue *, OSMesg *, s32);
148 extern s32 osSendMesg(OSMesgQueue *, OSMesg, s32);
149 extern s32 osJamMesg(OSMesgQueue *, OSMesg, s32);
150 extern s32 osRecvMesg(OSMesgQueue *, OSMesg *, s32);
151 
152 /* Event operations */
153 
154 extern void osSetEventMesg(OSEvent, OSMesgQueue *, OSMesg);
155 
156 
157 #endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
158 
159 #ifdef _LANGUAGE_C_PLUS_PLUS
160 }
161 #endif
162 
163 #endif /* !_OS_MESSAGE_H_ */
void osSetEventMesg(OSEvent e, OSMesgQueue *mq, OSMesg msg)
Definition: osSetEventMesg.c:10
Definition: os_thread.h:50
void osCreateMesgQueue(OSMesgQueue *mq, OSMesg *msgBuf, s32 count)
Definition: osCreateMesgQueue.c:5
s32 osSendMesg(OSMesgQueue *mq, OSMesg msg, s32 flag)
Definition: osSendMesg.c:5
signed int s32
Definition: ultratypes.h:15
s32 osJamMesg(OSMesgQueue *mq, OSMesg msg, s32 flag)
Definition: osJamMesg.c:5
s32 osRecvMesg(OSMesgQueue *mq, OSMesg *msg, s32 flag)
Definition: osRecvMesg.c:5
unsigned int u32
Definition: ultratypes.h:16