Mario Kart 64
Loading...
Searching...
No Matches
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
34extern "C" {
35#endif
36
37#include <PR/ultratypes.h>
38#include <PR/os_thread.h>
39
40#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
41
42/**************************************************************************
43 *
44 * Type definitions
45 *
46 */
47
48typedef u32 OSEvent;
49
50/*
51 * Structure for message
52 */
53typedef void* OSMesg;
54
55/*
56 * Structure for message queue
57 */
58typedef struct OSMesgQueue_s {
59 OSThread* mtqueue; /* Queue to store threads blocked
60 on empty mailboxes (receive) */
61 OSThread* fullqueue; /* Queue to store threads blocked
62 on full mailboxes (send) */
63 s32 validCount; /* Contains number of valid message */
64 s32 first; /* Points to first valid message */
65 s32 msgCount; /* Contains total # of messages */
66 OSMesg* msg; /* Points to message buffer array */
67} OSMesgQueue;
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#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
116
117/**************************************************************************
118 *
119 * Macro definitions
120 *
121 */
122
123/* Get count of valid messages in queue */
124#define MQ_GET_COUNT(mq) ((mq)->validCount)
125
126/* Figure out if message queue is empty or full */
127#define MQ_IS_EMPTY(mq) (MQ_GET_COUNT(mq) == 0)
128#define MQ_IS_FULL(mq) (MQ_GET_COUNT(mq) >= (mq)->msgCount)
129
130/**************************************************************************
131 *
132 * Extern variables
133 *
134 */
135
136/**************************************************************************
137 *
138 * Function prototypes
139 *
140 */
141
142/* Message operations */
143
144extern void osCreateMesgQueue(OSMesgQueue*, OSMesg*, s32);
145extern s32 osSendMesg(OSMesgQueue*, OSMesg, s32);
146extern s32 osJamMesg(OSMesgQueue*, OSMesg, s32);
147extern s32 osRecvMesg(OSMesgQueue*, OSMesg*, s32);
148
149/* Event operations */
150
151extern void osSetEventMesg(OSEvent, OSMesgQueue*, OSMesg);
152
153#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
154
155#ifdef _LANGUAGE_C_PLUS_PLUS
156}
157#endif
158
159#endif /* !_OS_MESSAGE_H_ */
s32 osRecvMesg(OSMesgQueue *, OSMesg *, s32)
Definition osRecvMesg.c:3
void osSetEventMesg(OSEvent, OSMesgQueue *, OSMesg)
Definition osSetEventMesg.c:10
void osCreateMesgQueue(OSMesgQueue *mq, OSMesg *msgBuf, s32 count)
Definition osCreateMesgQueue.c:3
s32 osJamMesg(OSMesgQueue *mq, OSMesg msg, s32 flag)
Definition osJamMesg.c:3
s32 osSendMesg(OSMesgQueue *mq, OSMesg msg, s32 flag)
Definition osSendMesg.c:3
Definition os_thread.h:50
signed int s32
Definition ultratypes.h:15
unsigned int u32
Definition ultratypes.h:16