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
70#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
71
72/**************************************************************************
73 *
74 * Global definitions
75 *
76 */
77
78/* Events */
79#ifdef _FINALROM
80#define OS_NUM_EVENTS 15
81#else
82#define OS_NUM_EVENTS 23
83#endif
84
85#define OS_EVENT_SW1 0 /* CPU SW1 interrupt */
86#define OS_EVENT_SW2 1 /* CPU SW2 interrupt */
87#define OS_EVENT_CART 2 /* Cartridge interrupt: used by rmon */
88#define OS_EVENT_COUNTER 3 /* Counter int: used by VI/Timer Mgr */
89#define OS_EVENT_SP 4 /* SP task done interrupt */
90#define OS_EVENT_SI 5 /* SI (controller) interrupt */
91#define OS_EVENT_AI 6 /* AI interrupt */
92#define OS_EVENT_VI 7 /* VI interrupt: used by VI/Timer Mgr */
93#define OS_EVENT_PI 8 /* PI interrupt: used by PI Manager */
94#define OS_EVENT_DP 9 /* DP full sync interrupt */
95#define OS_EVENT_CPU_BREAK 10 /* CPU breakpoint: used by rmon */
96#define OS_EVENT_SP_BREAK 11 /* SP breakpoint: used by rmon */
97#define OS_EVENT_FAULT 12 /* CPU fault event: used by rmon */
98#define OS_EVENT_THREADSTATUS 13 /* CPU thread status: used by rmon */
99#define OS_EVENT_PRENMI 14 /* Pre NMI interrupt */
100#ifndef _FINALROM
101#define OS_EVENT_RDB_READ_DONE 15 /* RDB read ok event: used by rmon */
102#define OS_EVENT_RDB_LOG_DONE 16 /* read of log data complete */
103#define OS_EVENT_RDB_DATA_DONE 17 /* read of hostio data complete */
104#define OS_EVENT_RDB_REQ_RAMROM 18 /* host needs ramrom access */
105#define OS_EVENT_RDB_FREE_RAMROM 19 /* host is done with ramrom access */
106#define OS_EVENT_RDB_DBG_DONE 20
107#define OS_EVENT_RDB_FLUSH_PROF 21
108#define OS_EVENT_RDB_ACK_PROF 22
109#endif
110
111/* Flags to turn blocking on/off when sending/receiving message */
112
113#define OS_MESG_NOBLOCK 0
114#define OS_MESG_BLOCK 1
115
116
117#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
118
119/**************************************************************************
120 *
121 * Macro definitions
122 *
123 */
124
125/* Get count of valid messages in queue */
126#define MQ_GET_COUNT(mq) ((mq)->validCount)
127
128/* Figure out if message queue is empty or full */
129#define MQ_IS_EMPTY(mq) (MQ_GET_COUNT(mq) == 0)
130#define MQ_IS_FULL(mq) (MQ_GET_COUNT(mq) >= (mq)->msgCount)
131
132
133/**************************************************************************
134 *
135 * Extern variables
136 *
137 */
138
139
140/**************************************************************************
141 *
142 * Function prototypes
143 *
144 */
145
146/* Message operations */
147
148extern void osCreateMesgQueue(OSMesgQueue *, OSMesg *, s32);
149extern s32 osSendMesg(OSMesgQueue *, OSMesg, s32);
150extern s32 osJamMesg(OSMesgQueue *, OSMesg, s32);
151extern s32 osRecvMesg(OSMesgQueue *, OSMesg *, s32);
152
153/* Event operations */
154
155extern void osSetEventMesg(OSEvent, OSMesgQueue *, OSMesg);
156
157
158#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
159
160#ifdef _LANGUAGE_C_PLUS_PLUS
161}
162#endif
163
164#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:51
signed int s32
Definition ultratypes.h:15
unsigned int u32
Definition ultratypes.h:16