33#ifdef _LANGUAGE_C_PLUS_PLUS
40#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
54 OSMesgQueue* cmdQueue;
55 OSMesgQueue* evtQueue;
56 OSMesgQueue* acsQueue;
110#define OS_STATE_STOPPED 1
111#define OS_STATE_RUNNABLE 2
112#define OS_STATE_RUNNING 4
113#define OS_STATE_WAITING 8
117#define OS_NUM_EVENTS 15
119#define OS_NUM_EVENTS 23
122#define OS_EVENT_SW1 0
123#define OS_EVENT_SW2 1
124#define OS_EVENT_CART 2
125#define OS_EVENT_COUNTER 3
132#define OS_EVENT_CPU_BREAK 10
133#define OS_EVENT_SP_BREAK 11
134#define OS_EVENT_FAULT 12
135#define OS_EVENT_THREADSTATUS 13
136#define OS_EVENT_PRENMI 14
138#define OS_EVENT_RDB_READ_DONE 15
139#define OS_EVENT_RDB_LOG_DONE 16
140#define OS_EVENT_RDB_DATA_DONE 17
141#define OS_EVENT_RDB_REQ_RAMROM 18
142#define OS_EVENT_RDB_FREE_RAMROM 19
143#define OS_EVENT_RDB_DBG_DONE 20
144#define OS_EVENT_RDB_FLUSH_PROF 21
145#define OS_EVENT_RDB_ACK_PROF 22
150#define OS_FLAG_CPU_BREAK 1
151#define OS_FLAG_FAULT 2
155#define OS_IM_NONE 0x00000001
156#define OS_IM_SW1 0x00000501
157#define OS_IM_SW2 0x00000601
158#define OS_IM_CART 0x00000c01
159#define OS_IM_PRENMI 0x00001401
160#define OS_IM_RDBWRITE 0x00002401
161#define OS_IM_RDBREAD 0x00004401
162#define OS_IM_COUNTER 0x00008401
163#define OS_IM_CPU 0x0000ff01
164#define OS_IM_SP 0x00010401
165#define OS_IM_SI 0x00020401
166#define OS_IM_AI 0x00040401
167#define OS_IM_VI 0x00080401
168#define OS_IM_PI 0x00100401
169#define OS_IM_DP 0x00200401
170#define OS_IM_ALL 0x003fff01
171#define RCP_IMASK 0x003f0000
172#define RCP_IMASKSHIFT 16
176#define OS_PRIORITY_MAX 255
177#define OS_PRIORITY_VIMGR 254
178#define OS_PRIORITY_RMON 250
179#define OS_PRIORITY_RMONSPIN 200
180#define OS_PRIORITY_PIMGR 150
181#define OS_PRIORITY_SIMGR 140
182#define OS_PRIORITY_APPMAX 127
183#define OS_PRIORITY_IDLE 0
187#define OS_MESG_NOBLOCK 0
188#define OS_MESG_BLOCK 1
199#define OS_MESG_TYPE_BASE (10)
200#define OS_MESG_TYPE_LOOPBACK (OS_MESG_TYPE_BASE + 0)
201#define OS_MESG_TYPE_DMAREAD (OS_MESG_TYPE_BASE + 1)
202#define OS_MESG_TYPE_DMAWRITE (OS_MESG_TYPE_BASE + 2)
203#define OS_MESG_TYPE_VRETRACE (OS_MESG_TYPE_BASE + 3)
204#define OS_MESG_TYPE_COUNTER (OS_MESG_TYPE_BASE + 4)
205#define OS_MESG_TYPE_EDMAREAD (OS_MESG_TYPE_BASE + 5)
206#define OS_MESG_TYPE_EDMAWRITE (OS_MESG_TYPE_BASE + 6)
211#define OS_MESG_PRI_NORMAL 0
212#define OS_MESG_PRI_HIGH 1
217#define OS_PM_4K 0x0000000
218#define OS_PM_16K 0x0006000
219#define OS_PM_64K 0x001e000
220#define OS_PM_256K 0x007e000
221#define OS_PM_1M 0x01fe000
222#define OS_PM_4M 0x07fe000
223#define OS_PM_16M 0x1ffe000
230#define OS_PIM_STACKSIZE 4096
231#define OS_VIM_STACKSIZE 4096
232#define OS_SIM_STACKSIZE 4096
234#define OS_MIN_STACKSIZE 72
246#define OS_VI_NTSC_LPN1 0
247#define OS_VI_NTSC_LPF1 1
248#define OS_VI_NTSC_LAN1 2
249#define OS_VI_NTSC_LAF1 3
250#define OS_VI_NTSC_LPN2 4
251#define OS_VI_NTSC_LPF2 5
252#define OS_VI_NTSC_LAN2 6
253#define OS_VI_NTSC_LAF2 7
254#define OS_VI_NTSC_HPN1 8
255#define OS_VI_NTSC_HPF1 9
256#define OS_VI_NTSC_HAN1 10
257#define OS_VI_NTSC_HAF1 11
258#define OS_VI_NTSC_HPN2 12
259#define OS_VI_NTSC_HPF2 13
261#define OS_VI_PAL_LPN1 14
262#define OS_VI_PAL_LPF1 15
263#define OS_VI_PAL_LAN1 16
264#define OS_VI_PAL_LAF1 17
265#define OS_VI_PAL_LPN2 18
266#define OS_VI_PAL_LPF2 19
267#define OS_VI_PAL_LAN2 20
268#define OS_VI_PAL_LAF2 21
269#define OS_VI_PAL_HPN1 22
270#define OS_VI_PAL_HPF1 23
271#define OS_VI_PAL_HAN1 24
272#define OS_VI_PAL_HAF1 25
273#define OS_VI_PAL_HPN2 26
274#define OS_VI_PAL_HPF2 27
276#define OS_VI_MPAL_LPN1 28
277#define OS_VI_MPAL_LPF1 29
278#define OS_VI_MPAL_LAN1 30
279#define OS_VI_MPAL_LAF1 31
280#define OS_VI_MPAL_LPN2 32
281#define OS_VI_MPAL_LPF2 33
282#define OS_VI_MPAL_LAN2 34
283#define OS_VI_MPAL_LAF2 35
284#define OS_VI_MPAL_HPN1 36
285#define OS_VI_MPAL_HPF1 37
286#define OS_VI_MPAL_HAN1 38
287#define OS_VI_MPAL_HAF1 39
288#define OS_VI_MPAL_HPN2 40
289#define OS_VI_MPAL_HPF2 41
294#define OS_VI_GAMMA_ON 0x0001
295#define OS_VI_GAMMA_OFF 0x0002
296#define OS_VI_GAMMA_DITHER_ON 0x0004
297#define OS_VI_GAMMA_DITHER_OFF 0x0008
298#define OS_VI_DIVOT_ON 0x0010
299#define OS_VI_DIVOT_OFF 0x0020
300#define OS_VI_DITHER_FILTER_ON 0x0040
301#define OS_VI_DITHER_FILTER_OFF 0x0080
306#define OS_VI_BIT_NONINTERLACE 0x0001
307#define OS_VI_BIT_INTERLACE 0x0002
308#define OS_VI_BIT_NORMALINTERLACE 0x0004
309#define OS_VI_BIT_DEFLICKINTERLACE 0x0008
310#define OS_VI_BIT_ANTIALIAS 0x0010
311#define OS_VI_BIT_POINTSAMPLE 0x0020
312#define OS_VI_BIT_16PIXEL 0x0040
313#define OS_VI_BIT_32PIXEL 0x0080
314#define OS_VI_BIT_LORES 0x0100
315#define OS_VI_BIT_HIRES 0x0200
316#define OS_VI_BIT_NTSC 0x0400
317#define OS_VI_BIT_PAL 0x0800
325#define LEO_BLOCK_MODE 1
326#define LEO_TRACK_MODE 2
327#define LEO_SECTOR_MODE 3
334#define MAXCONTROLLERS 4
336#define MAXCONTROLLERS 6
340#define CONT_NO_RESPONSE_ERROR 0x8
341#define CONT_OVERRUN_ERROR 0x4
343#define CONT_FRAME_ERROR 0x2
344#define CONT_COLLISION_ERROR 0x1
349#define CONT_ABSOLUTE 0x0001
350#define CONT_RELATIVE 0x0002
351#define CONT_JOYPORT 0x0004
352#define CONT_EEPROM 0x8000
353#define CONT_EEP16K 0x4000
354#define CONT_TYPE_MASK 0x1f07
355#define CONT_TYPE_NORMAL 0x0005
356#define CONT_TYPE_MOUSE 0x0002
360#define CONT_CARD_ON 0x01
361#define CONT_CARD_PULL 0x02
362#define CONT_ADDR_CRC_ER 0x04
363#define CONT_EEPROM_BUSY 0x80
367#define EEPROM_TYPE_4K 0x01
368#define EEPROM_TYPE_16K 0x02
375#define CONT_START 0x1000
376#define CONT_UP 0x0800
377#define CONT_DOWN 0x0400
378#define CONT_LEFT 0x0200
379#define CONT_RIGHT 0x0100
389#define A_BUTTON CONT_A
390#define B_BUTTON CONT_B
394#define START_BUTTON CONT_START
395#define U_JPAD CONT_UP
396#define L_JPAD CONT_LEFT
397#define R_JPAD CONT_RIGHT
398#define D_JPAD CONT_DOWN
399#define U_CBUTTONS CONT_E
400#define L_CBUTTONS CONT_C
401#define R_CBUTTONS CONT_F
402#define D_CBUTTONS CONT_D
405#define OS_PFS_VERSION 0x0200
406#define OS_PFS_VERSION_HI (OS_PFS_VERSION >> 8)
407#define OS_PFS_VERSION_LO (OS_PFS_VERSION & 255)
409#define PFS_FILE_NAME_LEN 16
410#define PFS_FILE_EXT_LEN 4
412#define PFS_ONE_PAGE 8
413#define PFS_MAX_BANKS 62
422#define PFS_INITIALIZED 0x1
423#define PFS_CORRUPTED 0x2
427#define PFS_ERR_NOPACK 1
428#define PFS_ERR_NEW_PACK 2
430#define PFS_ERR_INCONSISTENT 3
431#define PFS_ERR_CONTRFAIL CONT_OVERRUN_ERROR
432#define PFS_ERR_INVALID 5
433#define PFS_ERR_BAD_DATA 6
434#define PFS_DATA_FULL 7
435#define PFS_DIR_FULL 8
436#define PFS_ERR_EXIST 9
437#define PFS_ERR_ID_FATAL 10
438#define PFS_ERR_DEVICE 11
442#define EEPROM_MAXBLOCKS 64
443#define EEP16K_MAXBLOCKS 256
444#define EEPROM_BLOCK_SIZE 8
455#define PROF_MIN_INTERVAL 50
460#define BOOT_ADDRESS_ULTRA 0x80000400
461#define BOOT_ADDRESS_COSIM 0x80002000
462#define BOOT_ADDRESS_EMU 0x20010000
463#define BOOT_ADDRESS_INDY 0x88100000
468#define OS_APP_NMI_BUFSIZE 64
470#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
480#define osReadHost osReadHost_pt
481#define osWriteHost osWriteHost_pt
485#define MQ_GET_COUNT(mq) ((mq)->validCount)
488#define MQ_IS_EMPTY(mq) (MQ_GET_COUNT(mq) == 0)
489#define MQ_IS_FULL(mq) (MQ_GET_COUNT(mq) >= (mq)->msgCount)
500#define OS_CLOCK_RATE 62500000LL
501#define OS_CPU_COUNTER (OS_CLOCK_RATE * 3 / 4)
502#define OS_NSEC_TO_CYCLES(n) (((u64) (n) * (OS_CPU_COUNTER / 15625000LL)) / (1000000000LL / 15625000LL))
503#define OS_USEC_TO_CYCLES(n) (((u64) (n) * (OS_CPU_COUNTER / 15625LL)) / (1000000LL / 15625LL))
504#define OS_CYCLES_TO_NSEC(c) (((u64) (c) * (1000000000LL / 15625000LL)) / (OS_CPU_COUNTER / 15625000LL))
505#define OS_CYCLES_TO_USEC(c) (((u64) (c) * (1000000LL / 15625LL)) / (OS_CPU_COUNTER / 15625LL))
566extern s32 osAppNMIBuffer[];
602extern OSIntMask osGetIntMask(
void);
603extern OSIntMask osSetIntMask(OSIntMask);
607extern void osInitRdb(
u8* sendBuf,
u32 sendSize);
611extern void osInvalDCache(
void*,
size_t);
612extern void osInvalICache(
void*,
size_t);
613extern void osWritebackDCache(
void*,
size_t);
614extern void osWritebackDCacheAll(
void);
616#define OS_DCACHE_ROUNDUP_ADDR(x) (void*) (((((u32) (x) + 0xf) / 0x10) * 0x10))
617#define OS_DCACHE_ROUNDUP_SIZE(x) (u32)(((((u32) (x) + 0xf) / 0x10) * 0x10))
621extern void osMapTLB(
s32, OSPageMask,
void*,
u32,
u32,
s32);
622extern void osMapTLBRdb(
void);
623extern void osUnmapTLB(
s32);
624extern void osUnmapTLBAll(
void);
625extern void osSetTLBASID(
s32);
630extern void* osPhysicalToVirtual(
u32);
632#define OS_K0_TO_PHYSICAL(x) (u32)(((char*) (x) - 0x80000000))
633#define OS_K1_TO_PHYSICAL(x) (u32)(((char*) (x) - 0xa0000000))
635#define OS_PHYSICAL_TO_K0(x) (void*) (((u32) (x) + 0x80000000))
636#define OS_PHYSICAL_TO_K1(x) (void*) (((u32) (x) + 0xa0000000))
641extern u32 osAiGetStatus(
void);
647extern u32 osDpGetStatus(
void);
648extern void osDpSetStatus(
u32);
649extern void osDpGetCounters(
u32*);
650extern s32 osDpSetNextBuffer(
void*,
u64);
653extern u32 osPiGetStatus(
void);
654extern s32 osPiGetDeviceType(
void);
664extern u32 osViGetStatus(
void);
665extern u32 osViGetCurrentMode(
void);
666extern u32 osViGetCurrentLine(
void);
667extern u32 osViGetCurrentField(
void);
668extern void* osViGetCurrentFramebuffer(
void);
669extern void* osViGetNextFramebuffer(
void);
670extern void osViSetXScale(
f32);
671extern void osViSetYScale(
f32);
677extern void osViFade(
u8,
u16);
678extern void osViRepeatLine(
u8);
686extern int osStopTimer(
OSTimer*);
691extern s32 osContReset(OSMesgQueue*, OSContStatus*);
692extern s32 osContStartQuery(OSMesgQueue*);
695extern s32 osContSetCh(
u8);
697extern void osContGetQuery(OSContStatus*);
702extern s32 osPfsInitPak(OSMesgQueue*, OSPfs*,
int);
703extern s32 osPfsRepairId(OSPfs*);
705extern s32 osPfsReFormat(OSPfs*, OSMesgQueue*,
int);
712extern s32 osPfsGetLabel(OSPfs*,
u8*,
int*);
713extern s32 osPfsSetLabel(OSPfs*,
u8*);
728extern s32 osMotorInit(OSMesgQueue*, OSPfs*,
int);
729extern s32 osMotorStop(OSPfs*);
730extern s32 osMotorStart(OSPfs*);
749extern void osProfileInit(OSProf*,
u32 profcnt);
750extern void osProfileStart(
u32);
751extern void osProfileFlush(
void);
752extern void osProfileStop(
void);
756extern s32 osTestHost(
void);
757extern void osReadHost(
void*,
u32);
758extern void osWriteHost(
void*,
u32);
759extern void osAckRamromRead(
void);
760extern void osAckRamromWrite(
void);
764extern void bcopy(
const void*,
void*,
size_t);
765extern int bcmp(
const void*,
const void*,
int);
766extern void bzero(
void*,
size_t);
772extern void osExit(
void);
773extern u32 osGetMemSize(
void);
777extern int sprintf(
char* s,
const char* fmt, ...);
779extern void osAsyncPrintf(
const char* fmt, ...);
780extern int osSyncGetChars(
char* buf);
781extern int osAsyncGetChars(
char* buf);
785#ifdef _LANGUAGE_C_PLUS_PLUS
void osYieldThread(void)
Definition osYieldThread.c:4
OSViMode osViModePalLan1
Definition osViData.c:3
OSViMode osViModeNtscLan1
Definition osViData.c:62
OSViMode osViModeMpalLan1
Definition osViData.c:37
int bcmp(const void *, const void *, int)
void bcopy(const void *, void *, size_t)
void bzero(void *, size_t)
s32 osRecvMesg(OSMesgQueue *, OSMesg *, s32)
Definition osRecvMesg.c:3
void osSetEventMesg(OSEvent, OSMesgQueue *, OSMesg)
Definition osSetEventMesg.c:10
u64 osClockRate
Definition osInitialize.c:16
void osSyncPrintf(const char *fmt,...)
Definition is_debug.c:74
s32 osEPiWriteIo(OSPiHandle *handle, u32 devAddr, u32 data)
Definition is_debug.c:48
s32 osEPiReadIo(OSPiHandle *handle, u32 devAddr, u32 *data)
Definition is_debug.c:38
s32 osPiRawReadIo(u32 a0, u32 *a1)
Definition osPiRawReadIo.c:6
unsigned long long int u64
Definition llconv.c:2
s32 osEPiRawStartDma(OSPiHandle *arg0, s32 dir, u32 cart_addr, void *dram_addr, u32 size)
Definition osEPiRawStartDma.c:14
volatile u32 __OSGlobalIntMask
Definition osInitialize.c:18
OSPiHandle * __osDiskHandle
Definition osLeoDiskInit.c:12
s32 osAiSetNextBuffer(void *, u32)
Definition osAiSetNextBuffer.c:21
s32 osAiSetFrequency(u32)
Definition osAiSetFrequency.c:7
u32 osAiGetLength(void)
Definition osAiGetLength.c:5
OSPiHandle * osCartRomInit(void)
Definition osCartRomInit.c:12
s32 osContInit(OSMesgQueue *mq, u8 *bitpattern, OSContStatus *status)
Definition osContInit.c:18
void osContGetReadData(OSContPad *pad)
Definition osContStartReadData.c:33
s32 osContStartReadData(OSMesgQueue *mesg)
Definition osContStartReadData.c:9
void osCreateMesgQueue(OSMesgQueue *mq, OSMesg *msgBuf, s32 count)
Definition osCreateMesgQueue.c:3
void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf, s32 cmdMsgCnt)
Definition osCreatePiManager.c:23
OSPiHandle * __osPiTable
Definition osCreatePiManager.c:12
void osCreateThread(OSThread *thread, OSId id, void(*entry)(void *), void *arg, void *sp, OSPri pri)
Definition osCreateThread.c:9
void osCreateViManager(OSPri pri)
Definition osCreateViManager.c:22
void osDestroyThread(OSThread *thread)
Definition osDestroyThread.c:3
s32 osEepromLongRead(OSMesgQueue *mq, u8 address, u8 *buffer, s32 nbytes)
Definition osEepromLongRead.c:10
s32 osEepromLongWrite(OSMesgQueue *mq, u8 address, u8 *buffer, s32 nbytes)
Definition osEepromLongWrite.c:10
s32 osEepromProbe(OSMesgQueue *mq)
Definition osEepromProbe.c:6
s32 osEepromRead(OSMesgQueue *mq, u8 address, u8 *buffer)
Definition osEepromRead.c:12
s32 osEepromWrite(OSMesgQueue *mq, u8 address, u8 *buffer)
Definition osEepromWrite.c:12
OSPri osGetThreadPri(OSThread *thread)
Definition osGetThreadPri.c:3
OSTime osGetTime()
Definition osGetTime.c:6
void osInitialize(void)
Definition osInitialize.c:29
s32 osJamMesg(OSMesgQueue *mq, OSMesg msg, s32 flag)
Definition osJamMesg.c:3
OSPiHandle * osLeoDiskInit(void)
Definition osLeoDiskInit.c:14
s32 osPfsAllocateFile(OSPfs *pfs, u16 company_code, u32 game_code, u8 *game_name, u8 *ext_name, int file_size_in_bytes, s32 *file_no)
Definition osPfsAllocateFile.c:5
s32 osPfsChecker(OSPfs *pfs)
Definition osPfsChecker.c:6
s32 osPfsDeleteFile(OSPfs *pfs, u16 company_code, u32 game_code, u8 *game_name, u8 *ext_name)
Definition osPfsDeleteFile.c:4
s32 osPfsFileState(OSPfs *pfs, s32 file_no, OSPfsState *state)
Definition osPfsFileState.c:4
s32 osPfsFreeBlocks(OSPfs *pfs, s32 *bytes_not_used)
Definition osPfsFreeBlocks.c:4
s32 osPfsInit(OSMesgQueue *queue, OSPfs *pfs, int channel)
Definition osPfsInit.c:5
s32 osPfsIsPlug(OSMesgQueue *queue, u8 *pattern)
Definition osPfsIsPlug.c:8
s32 osPfsNumFiles(OSPfs *pfs, s32 *max_files, s32 *files_used)
Definition osPfsNumFiles.c:5
s32 osPfsReadWriteFile(OSPfs *pfs, s32 file_no, u8 flag, int offset, int size_in_bytes, u8 *data_buffer)
Definition osPfsReadWriteFile.c:20
s32 osPfsFindFile(OSPfs *pfs, u16 company_code, u32 game_code, u8 *game_name, u8 *ext_name, s32 *file_no)
Definition osPfsSearchFile.c:4
s32 osPiRawStartDma(s32 dir, u32 cart_addr, void *dram_addr, size_t size)
Definition osPiRawStartDma.c:7
s32 osPiStartDma(OSIoMesg *mb, s32 priority, s32 direction, uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQueue *mq)
Definition osPiStartDma.c:5
s32 osSendMesg(OSMesgQueue *mq, OSMesg msg, s32 flag)
Definition osSendMesg.c:3
void osSetThreadPri(OSThread *thread, OSPri pri)
Definition osSetThreadPri.c:3
void osSetTime(OSTime time)
Definition osSetTime.c:5
u32 osSetTimer(OSTimer *a0, OSTime a1, u64 a2, OSMesgQueue *a3, OSMesg a4)
Definition osSetTimer.c:6
void osStartThread(OSThread *thread)
Definition osStartThread.c:3
void osViBlack(u8 active)
Definition osViBlack.c:6
void osViSetEvent(OSMesgQueue *mq, OSMesg msg, u32 retraceCount)
Definition osViSetEvent.c:5
void osViSetMode(OSViMode *mode)
Definition osViSetMode.c:5
void osViSetSpecialFeatures(u32 func)
Definition osViSetSpecialFeatures.c:5
void osViSwapBuffer(void *vaddr)
Definition osViSwapBuffer.c:5
OSViMode osViModeTable[]
Definition osViTable.c:3
uintptr_t osVirtualToPhysical(void *addr)
Definition osVirtualToPhysical.c:3
s32 osPiWriteIo(uintptr_t devAddr, u32 data)
s32 osPiReadIo(uintptr_t devAddr, u32 *data)
void osStopThread(OSThread *thread)
s32 OSId
Definition os_thread.h:22
OSId osGetThreadId(OSThread *thread)
s32 OSPri
Definition os_thread.h:21
u64 OSTime
Definition os_time.h:18
int sprintf(char *dst, const char *fmt,...)
Definition sprintf.c:8
Definition os_thread.h:50
signed int s32
Definition ultratypes.h:15
unsigned int u32
Definition ultratypes.h:16
float f32
Definition ultratypes.h:34
unsigned short int u16
Definition ultratypes.h:14
unsigned char u8
Definition ultratypes.h:12