Super Mario 64s source code (from a leak on 4chan so be careful)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

163 lines
5.1 KiB

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