mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-22 20:15:17 +00:00
164 lines
5.1 KiB
C
164 lines
5.1 KiB
C
|
|
/*====================================================================
|
|
* os_message.h
|
|
*
|
|
* Copyright 1995, Silicon Graphics, Inc.
|
|
* All Rights Reserved.
|
|
*
|
|
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
|
|
* Inc.; the contents of this file may not be disclosed to third
|
|
* parties, copied or duplicated in any form, in whole or in part,
|
|
* without the prior written permission of Silicon Graphics, Inc.
|
|
*
|
|
* RESTRICTED RIGHTS LEGEND:
|
|
* Use, duplication or disclosure by the Government is subject to
|
|
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
|
|
* in Technical Data and Computer Software clause at DFARS
|
|
* 252.227-7013, and/or in similar or successor clauses in the FAR,
|
|
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
|
|
* Copyright Laws of the United States.
|
|
*====================================================================*/
|
|
|
|
/*---------------------------------------------------------------------*
|
|
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
|
|
|
$RCSfile: os_message.h,v $
|
|
$Revision: 1.1 $
|
|
$Date: 1998/10/09 08:01:15 $
|
|
*---------------------------------------------------------------------*/
|
|
|
|
#ifndef _OS_MESSAGE_H_
|
|
#define _OS_MESSAGE_H_
|
|
|
|
#ifdef _LANGUAGE_C_PLUS_PLUS
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <PR/ultratypes.h>
|
|
#include <PR/os_thread.h>
|
|
|
|
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
|
|
|
/**************************************************************************
|
|
*
|
|
* Type definitions
|
|
*
|
|
*/
|
|
|
|
typedef u32 OSEvent;
|
|
|
|
/*
|
|
* Structure for message
|
|
*/
|
|
typedef void * OSMesg;
|
|
|
|
/*
|
|
* Structure for message queue
|
|
*/
|
|
typedef struct OSMesgQueue_s {
|
|
OSThread *mtqueue; /* Queue to store threads blocked
|
|
on empty mailboxes (receive) */
|
|
OSThread *fullqueue; /* Queue to store threads blocked
|
|
on full mailboxes (send) */
|
|
s32 validCount; /* Contains number of valid message */
|
|
s32 first; /* Points to first valid message */
|
|
s32 msgCount; /* Contains total # of messages */
|
|
OSMesg *msg; /* Points to message buffer array */
|
|
} OSMesgQueue;
|
|
|
|
|
|
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
|
|
|
/**************************************************************************
|
|
*
|
|
* Global definitions
|
|
*
|
|
*/
|
|
|
|
/* Events */
|
|
#ifdef _FINALROM
|
|
#define OS_NUM_EVENTS 15
|
|
#else
|
|
#define OS_NUM_EVENTS 23
|
|
#endif
|
|
|
|
#define OS_EVENT_SW1 0 /* CPU SW1 interrupt */
|
|
#define OS_EVENT_SW2 1 /* CPU SW2 interrupt */
|
|
#define OS_EVENT_CART 2 /* Cartridge interrupt: used by rmon */
|
|
#define OS_EVENT_COUNTER 3 /* Counter int: used by VI/Timer Mgr */
|
|
#define OS_EVENT_SP 4 /* SP task done interrupt */
|
|
#define OS_EVENT_SI 5 /* SI (controller) interrupt */
|
|
#define OS_EVENT_AI 6 /* AI interrupt */
|
|
#define OS_EVENT_VI 7 /* VI interrupt: used by VI/Timer Mgr */
|
|
#define OS_EVENT_PI 8 /* PI interrupt: used by PI Manager */
|
|
#define OS_EVENT_DP 9 /* DP full sync interrupt */
|
|
#define OS_EVENT_CPU_BREAK 10 /* CPU breakpoint: used by rmon */
|
|
#define OS_EVENT_SP_BREAK 11 /* SP breakpoint: used by rmon */
|
|
#define OS_EVENT_FAULT 12 /* CPU fault event: used by rmon */
|
|
#define OS_EVENT_THREADSTATUS 13 /* CPU thread status: used by rmon */
|
|
#define OS_EVENT_PRENMI 14 /* Pre NMI interrupt */
|
|
#ifndef _FINALROM
|
|
#define OS_EVENT_RDB_READ_DONE 15 /* RDB read ok event: used by rmon */
|
|
#define OS_EVENT_RDB_LOG_DONE 16 /* read of log data complete */
|
|
#define OS_EVENT_RDB_DATA_DONE 17 /* read of hostio data complete */
|
|
#define OS_EVENT_RDB_REQ_RAMROM 18 /* host needs ramrom access */
|
|
#define OS_EVENT_RDB_FREE_RAMROM 19 /* host is done with ramrom access */
|
|
#define OS_EVENT_RDB_DBG_DONE 20
|
|
#define OS_EVENT_RDB_FLUSH_PROF 21
|
|
#define OS_EVENT_RDB_ACK_PROF 22
|
|
#endif
|
|
|
|
/* Flags to turn blocking on/off when sending/receiving message */
|
|
|
|
#define OS_MESG_NOBLOCK 0
|
|
#define OS_MESG_BLOCK 1
|
|
|
|
|
|
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
|
|
|
/**************************************************************************
|
|
*
|
|
* Macro definitions
|
|
*
|
|
*/
|
|
|
|
/* Get count of valid messages in queue */
|
|
#define MQ_GET_COUNT(mq) ((mq)->validCount)
|
|
|
|
/* Figure out if message queue is empty or full */
|
|
#define MQ_IS_EMPTY(mq) (MQ_GET_COUNT(mq) == 0)
|
|
#define MQ_IS_FULL(mq) (MQ_GET_COUNT(mq) >= (mq)->msgCount)
|
|
|
|
|
|
/**************************************************************************
|
|
*
|
|
* Extern variables
|
|
*
|
|
*/
|
|
|
|
|
|
/**************************************************************************
|
|
*
|
|
* Function prototypes
|
|
*
|
|
*/
|
|
|
|
/* Message operations */
|
|
|
|
extern void osCreateMesgQueue(OSMesgQueue *, OSMesg *, s32);
|
|
extern s32 osSendMesg(OSMesgQueue *, OSMesg, s32);
|
|
extern s32 osJamMesg(OSMesgQueue *, OSMesg, s32);
|
|
extern s32 osRecvMesg(OSMesgQueue *, OSMesg *, s32);
|
|
|
|
/* Event operations */
|
|
|
|
extern void osSetEventMesg(OSEvent, OSMesgQueue *, OSMesg);
|
|
|
|
|
|
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
|
|
|
#ifdef _LANGUAGE_C_PLUS_PLUS
|
|
}
|
|
#endif
|
|
|
|
#endif /* !_OS_MESSAGE_H_ */
|