|
coastline 0.0.4
|
Public interface of the libultra operating system, as the game links it. More...
#include <PR/ultratypes.h>

Go to the source code of this file.
Classes | |
| struct | OSThread_s |
| A thread: its place in the queues, its state, and the registers saved when it last stopped. More... | |
| struct | OSMesgQueue_s |
| A message queue: a ring of messages and the threads blocked sending or receiving. More... | |
| struct | OSTimer_s |
| A timer that sends a message when it expires, once or periodically. More... | |
| struct | OSPiHandle_s |
| A device on the peripheral interface, with the timing of its PI domain. More... | |
| struct | OSPiInfo |
| The type and base address of a device on the peripheral interface. More... | |
| struct | OSIoMesgHdr |
| The header of an I/O request to a device manager. More... | |
| struct | OSIoMesg |
| An I/O request to a device manager: a DMA between RDRAM and a device. More... | |
| struct | OSDevMgr |
| A device manager: the thread and queues that serve the I/O requests of one interface. More... | |
| struct | OSViCommonRegs |
| The video interface registers a video mode sets for both fields. More... | |
| struct | OSViFieldRegs |
| The video interface registers a video mode sets for one field. More... | |
| struct | OSViMode |
| A video mode: the registers of the video interface for a resolution and television standard. More... | |
Macros | |
| #define | OS_STATE_STOPPED 1 |
| #define | OS_STATE_RUNNABLE 2 |
| #define | OS_STATE_RUNNING 4 |
| #define | OS_STATE_WAITING 8 |
| #define | OS_PRIORITY_MAX 255 |
| #define | OS_PRIORITY_VIMGR 254 |
| #define | OS_PRIORITY_RMON 250 |
| #define | OS_PRIORITY_RMONSPIN 200 |
| #define | OS_PRIORITY_PIMGR 150 |
| #define | OS_PRIORITY_SIMGR 140 |
| #define | OS_PRIORITY_APPMAX 127 |
| #define | OS_PRIORITY_IDLE 0 |
| #define | OS_MESG_NOBLOCK 0 |
| #define | OS_MESG_BLOCK 1 |
| #define | OS_EVENT_SW1 0 |
| #define | OS_EVENT_SW2 1 |
| #define | OS_EVENT_CART 2 |
| #define | OS_EVENT_COUNTER 3 |
| #define | OS_EVENT_SP 4 |
| #define | OS_EVENT_SI 5 |
| #define | OS_EVENT_AI 6 |
| #define | OS_EVENT_VI 7 |
| #define | OS_EVENT_PI 8 |
| #define | OS_EVENT_DP 9 |
| #define | OS_EVENT_CPU_BREAK 10 |
| #define | OS_EVENT_SP_BREAK 11 |
| #define | OS_EVENT_FAULT 12 |
| #define | OS_EVENT_THREADSTATUS 13 |
| #define | OS_EVENT_PRENMI 14 |
| #define | MQ_GET_COUNT(mq) |
| The number of messages in a queue. | |
| #define | MQ_IS_EMPTY(mq) |
| Whether a queue has no messages. | |
| #define | MQ_IS_FULL(mq) |
| Whether a queue has no room for another message. | |
| #define | OS_IM_NONE 0x00000001 |
| #define | OS_IM_SW1 0x00000501 |
| #define | OS_IM_SW2 0x00000601 |
| #define | OS_IM_RCP 0x00000401 |
| #define | OS_IM_CART 0x00000C01 |
| #define | OS_IM_PRENMI 0x00001401 |
| #define | OS_IM_RDBWRITE 0x00002401 |
| #define | OS_IM_RDBREAD 0x00004401 |
| #define | OS_IM_COUNTER 0x00008401 |
| #define | OS_IM_CPU 0x0000FF01 |
| #define | OS_IM_SP 0x00010401 |
| #define | OS_IM_SI 0x00020401 |
| #define | OS_IM_AI 0x00040401 |
| #define | OS_IM_VI 0x00080401 |
| #define | OS_IM_PI 0x00100401 |
| #define | OS_IM_DP 0x00200401 |
| #define | OS_IM_ALL 0x003FFF01 |
| #define | OS_CLOCK_RATE 62500000LL |
| The clock rate of the RCP, in hertz. | |
| #define | OS_CPU_COUNTER (OS_CLOCK_RATE * 3 / 4) |
| The rate of the CPU counter, in cycles a second. | |
| #define | OS_NSEC_TO_CYCLES(n) |
| Convert nanoseconds to cycles of the CPU counter. | |
| #define | OS_USEC_TO_CYCLES(n) |
| Convert microseconds to cycles of the CPU counter. | |
| #define | OS_CYCLES_TO_NSEC(c) |
| Convert cycles of the CPU counter to nanoseconds. | |
| #define | OS_CYCLES_TO_USEC(c) |
| Convert cycles of the CPU counter to microseconds. | |
| #define | OS_READ 0 |
| #define | OS_WRITE 1 |
| #define | OS_OTHERS 2 |
| #define | OS_MESG_PRI_NORMAL 0 |
| #define | OS_MESG_PRI_HIGH 1 |
| #define | OS_MESG_TYPE_BASE 10 |
| #define | OS_MESG_TYPE_LOOPBACK (OS_MESG_TYPE_BASE + 0) |
| #define | OS_MESG_TYPE_DMAREAD (OS_MESG_TYPE_BASE + 1) |
| #define | OS_MESG_TYPE_DMAWRITE (OS_MESG_TYPE_BASE + 2) |
| #define | OS_MESG_TYPE_VRETRACE (OS_MESG_TYPE_BASE + 3) |
| #define | OS_MESG_TYPE_COUNTER (OS_MESG_TYPE_BASE + 4) |
| #define | OS_MESG_TYPE_EDMAREAD (OS_MESG_TYPE_BASE + 5) |
| #define | OS_MESG_TYPE_EDMAWRITE (OS_MESG_TYPE_BASE + 6) |
| #define | DEVICE_TYPE_CART 0 |
| #define | DEVICE_TYPE_BULK 1 |
| #define | DEVICE_TYPE_64DD 2 |
| #define | DEVICE_TYPE_SRAM 3 |
| #define | DEVICE_TYPE_INIT 7 |
| #define | PI_DOMAIN1 0 |
| #define | PI_DOMAIN2 1 |
| #define | OS_TV_PAL 0 |
| #define | OS_TV_NTSC 1 |
| #define | OS_TV_MPAL 2 |
| #define | VI_NTSC_CLOCK 48681812 |
| #define | VI_PAL_CLOCK 49656530 |
| #define | VI_MPAL_CLOCK 48628316 |
| #define | OS_VI_GAMMA_ON 0x0001 |
| #define | OS_VI_GAMMA_OFF 0x0002 |
| #define | OS_VI_GAMMA_DITHER_ON 0x0004 |
| #define | OS_VI_GAMMA_DITHER_OFF 0x0008 |
| #define | OS_VI_DIVOT_ON 0x0010 |
| #define | OS_VI_DIVOT_OFF 0x0020 |
| #define | OS_VI_DITHER_FILTER_ON 0x0040 |
| #define | OS_VI_DITHER_FILTER_OFF 0x0080 |
Typedefs | |
| typedef s32 | OSPri |
| typedef s32 | OSId |
| typedef struct OSThread_s | OSThread |
| A thread: its place in the queues, its state, and the registers saved when it last stopped. | |
| typedef u32 | OSEvent |
| typedef u32 | OSIntMask |
| typedef u32 | OSPageMask |
| typedef void * | OSMesg |
| typedef struct OSMesgQueue_s | OSMesgQueue |
| A message queue: a ring of messages and the threads blocked sending or receiving. | |
| typedef u64 | OSTime |
| typedef struct OSTimer_s | OSTimer |
| A timer that sends a message when it expires, once or periodically. | |
| typedef struct OSPiHandle_s | OSPiHandle |
| A device on the peripheral interface, with the timing of its PI domain. | |
Functions | |
| void | osCreateThread (OSThread *t, OSId id, void(*entry)(void *), void *arg, void *sp, OSPri pri) |
| Create a stopped thread on the active queue. | |
| void | osDestroyThread (OSThread *t) |
| Remove a thread from its queue and from the active queue. | |
| void | osYieldThread (void) |
| Put the running thread at the end of the threads of its priority and dispatch. | |
| void | osStartThread (OSThread *t) |
| Make a stopped or waiting thread runnable, and yield to it when its priority is higher. | |
| void | osSetThreadPri (OSThread *t, OSPri pri) |
| Change the priority of a thread, a NULL thread being the running one, and yield when a runnable thread now has a higher priority than the running one. | |
| OSPri | osGetThreadPri (OSThread *t) |
| Return the priority of a thread, a NULL thread being the running one. | |
| void | osCreateMesgQueue (OSMesgQueue *mq, OSMesg *msg, s32 count) |
| Initialise an empty message queue over a buffer of count messages. | |
| s32 | osSendMesg (OSMesgQueue *mq, OSMesg msg, s32 flag) |
| Append a message to a queue and make its first receiver runnable. | |
| s32 | osJamMesg (OSMesgQueue *mq, OSMesg msg, s32 flag) |
| Insert a message at the front of a queue and make its first receiver runnable. | |
| s32 | osRecvMesg (OSMesgQueue *mq, OSMesg *msg, s32 flag) |
| Take the first message of a queue, store it unless msg is NULL, and make its first sender runnable. | |
| void | osSetEventMesg (OSEvent e, OSMesgQueue *mq, OSMesg m) |
| Register the queue and message that event e sends. | |
| OSIntMask | osGetIntMask (void) |
| Return the CPU and RCP interrupts that may occur. | |
| OSIntMask | osSetIntMask (OSIntMask im) |
| Set the CPU and RCP interrupts that may occur, within the global mask. | |
| u32 | osGetCount (void) |
| Read the CPU counter, or advance the emulated counter on Windows. | |
| void | osInvalDCache (void *vaddr, s32 nbytes) |
| Invalidate the data cache over a range. | |
| void | osInvalICache (void *vaddr, s32 nbytes) |
| Invalidate the instruction cache over a range. | |
| void | osWritebackDCache (void *vaddr, s32 nbytes) |
| Write back the data cache over a range. | |
| void | osWritebackDCacheAll (void) |
| Write back the whole data cache. | |
| u32 | osVirtualToPhysical (void *vaddr) |
| Translate a virtual address to a physical one. | |
| void | osMapTLBRdb (void) |
| Map the RDB port of the development hardware. | |
| OSTime | osGetTime (void) |
| Return the time since the VI manager started, in CPU counter cycles. | |
| int | osSetTimer (OSTimer *t, OSTime countdown, OSTime interval, OSMesgQueue *mq, OSMesg msg) |
| Start a timer that sends msg to mq after countdown cycles, or after interval cycles when countdown is 0, and again every interval cycles unless interval is 0. | |
| void | osCreateViManager (OSPri pri) |
| Start the VI manager thread at priority pri. | |
| void | osViBlack (u8 active) |
| Blank the screen from the next field on, or show it again. | |
| void | osViSetMode (OSViMode *modep) |
| Select the video mode from the next field on. | |
| void | osViSwapBuffer (void *frameBufPtr) |
| Show a frame buffer from the next field on. | |
| void * | osViGetCurrentFramebuffer (void) |
| Return the frame buffer the screen shows. | |
| void | osViSetEvent (OSMesgQueue *mq, OSMesg m, u32 retraceCount) |
| Send m to mq every retraceCount vertical retraces. | |
| void | osViSetSpecialFeatures (u32 func) |
| Turn the gamma, gamma dither, divot, and dither filter features on and off, from the OS_VI_* flags. | |
| OSPiHandle * | osCartRomInit (void) |
| Return the handle of the cartridge ROM, creating it from the timing its first word records. | |
| OSPiHandle * | osLeoDiskInit (void) |
| Create the handle of the 64DD and select its domain 2 timing. | |
| void | osCreatePiManager (OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf, s32 cmdMsgCnt) |
| Start the PI manager thread at priority pri, serving the requests of cmdQ. | |
| OSMesgQueue * | osPiGetCmdQueue (void) |
| Return the command queue of the PI manager, or NULL when it does not run. | |
| s32 | osPiRawReadIo (u32 devAddr, u32 *data) |
| Read a word of the cartridge domain at an offset from the ROM base. | |
| s32 | osPiRawStartDma (s32 direction, u32 devAddr, void *dramAddr, u32 size) |
| Start a DMA between RDRAM and the cartridge domain at an offset from the ROM base. | |
| s32 | osPiStartDma (OSIoMesg *mb, s32 priority, s32 direction, u32 devAddr, void *vAddr, u32 nbytes, OSMesgQueue *mq) |
| Queue a DMA request with the PI manager. | |
| s32 | osEPiRawReadIo (OSPiHandle *pihandle, u32 devAddr, u32 *data) |
| Read a word of the device a handle describes. | |
| s32 | osEPiRawWriteIo (OSPiHandle *pihandle, u32 devAddr, u32 data) |
| Write a word of the device a handle describes. | |
| s32 | osEPiRawStartDma (OSPiHandle *pihandle, s32 direction, u32 devAddr, void *dramAddr, u32 size) |
| Start a DMA with the device a handle describes, selecting its domain timing when another handle selected different timing. | |
| s32 | osAiSetFrequency (u32 frequency) |
| Set the sample rate of the audio DAC to the nearest the video clock allows. | |
| s32 | osAiSetNextBuffer (void *bufPtr, u32 size) |
| Queue a buffer of samples for the audio DMA. | |
| u32 | osAiGetStatus (void) |
| Return the audio status register. | |
| u32 | osAiGetLength (void) |
| Return the remaining length of the buffer the audio DMA plays. | |
| void | osInitialize (void) |
| Initialise the system: the FPU, the PIF, the exception vectors and the clock rates. | |
| void | osSyncPrintf (const char *fmt,...) |
| Print to the debugger. | |
| void | rmonPrintf (const char *fmt,...) |
| Print to the remote monitor. | |
Variables | |
| u32 | osTvType |
| The television standard reported by IPL3. | |
| u32 | osRomType |
| The cartridge ROM type reported by IPL3. | |
| u32 | osRomBase |
| The cartridge ROM base address reported by IPL3. | |
| u32 | osResetType |
| The reset type reported by IPL3. | |
| u32 | osCicId |
| The cartridge CIC identifier reported by IPL3. | |
| u32 | osVersion |
| The operating-system version reported by IPL3. | |
| u32 | osMemSize |
| The installed memory size reported by IPL3. | |
| u8 | osAppNMIBuffer [64] |
| The application buffer retained across an NMI reset. | |
| OSViMode | osViModePalLan1 |
| The low-resolution PAL video mode with anti-aliasing. | |
| OSViMode | osViModePalHaf1 |
| The high-resolution PAL video mode with anti-aliasing. | |
| OSViMode | osViModeMpalLan1 |
| The low-resolution MPAL video mode with anti-aliasing. | |
| OSViMode | osViModeNtscLan1 |
| The low-resolution NTSC video mode with anti-aliasing. | |
| u64 | osClockRate |
| The rate of the CPU counter, OS_CPU_COUNTER until osInitialize() sets it. | |
| s32 | osViClock |
| The frequency of the video clock. | |
| u8 | aiHdwrBugFlag |
| Whether the last buffer osAiSetNextBuffer() queued ended 0x2000 bytes into a 16 KiB page, a case the audio DMA mishandles. | |
Public interface of the libultra operating system, as the game links it.
The layouts are those of libultra 2.0 before 2.0L. A thread has no profiling pointer, and its context begins at 0x20.
| #define OS_STATE_STOPPED 1 |
The thread is stopped.
| #define OS_STATE_RUNNABLE 2 |
The thread waits to run.
| #define OS_STATE_RUNNING 4 |
The thread runs.
| #define OS_STATE_WAITING 8 |
The thread waits on a message queue.
| #define OS_PRIORITY_MAX 255 |
The highest priority.
| #define OS_PRIORITY_VIMGR 254 |
The priority of the VI manager.
| #define OS_PRIORITY_RMON 250 |
The priority of the remote monitor.
| #define OS_PRIORITY_RMONSPIN 200 |
The priority of the remote monitor while it spins.
| #define OS_PRIORITY_PIMGR 150 |
The priority of the PI manager.
| #define OS_PRIORITY_SIMGR 140 |
The priority of the SI manager.
| #define OS_PRIORITY_APPMAX 127 |
The highest priority of a thread of the game.
| #define OS_PRIORITY_IDLE 0 |
The priority of the idle thread.
| #define OS_MESG_NOBLOCK 0 |
Return at once when the queue is full or empty.
| #define OS_MESG_BLOCK 1 |
Wait until the queue has room or a message.
| #define OS_EVENT_SW1 0 |
Software interrupt 1.
| #define OS_EVENT_SW2 1 |
Software interrupt 2.
| #define OS_EVENT_CART 2 |
The cartridge interrupt.
| #define OS_EVENT_COUNTER 3 |
The CPU counter reached the compare register.
| #define OS_EVENT_SP 4 |
The RSP finished.
| #define OS_EVENT_SI 5 |
The serial interface finished.
| #define OS_EVENT_AI 6 |
The audio interface needs a buffer.
| #define OS_EVENT_VI 7 |
The video interface reached its interrupt line.
| #define OS_EVENT_PI 8 |
The peripheral interface finished.
| #define OS_EVENT_DP 9 |
The RDP finished.
| #define OS_EVENT_CPU_BREAK 10 |
The CPU hit a breakpoint.
| #define OS_EVENT_SP_BREAK 11 |
The RSP hit a breakpoint.
| #define OS_EVENT_FAULT 12 |
A thread faulted.
| #define OS_EVENT_THREADSTATUS 13 |
The status of a thread changed.
| #define OS_EVENT_PRENMI 14 |
The reset button was pressed.
| #define MQ_GET_COUNT | ( | mq | ) |
The number of messages in a queue.
| #define MQ_IS_EMPTY | ( | mq | ) |
Whether a queue has no messages.
| #define MQ_IS_FULL | ( | mq | ) |
Whether a queue has no room for another message.
| #define OS_IM_NONE 0x00000001 |
No interrupts.
| #define OS_IM_SW1 0x00000501 |
Software interrupt 1.
| #define OS_IM_SW2 0x00000601 |
Software interrupt 2.
| #define OS_IM_RCP 0x00000401 |
The interrupts of the RCP.
| #define OS_IM_CART 0x00000C01 |
The cartridge interrupt.
| #define OS_IM_PRENMI 0x00001401 |
The reset button.
| #define OS_IM_RDBWRITE 0x00002401 |
A write of the debugger port.
| #define OS_IM_RDBREAD 0x00004401 |
A read of the debugger port.
| #define OS_IM_COUNTER 0x00008401 |
The CPU counter.
| #define OS_IM_CPU 0x0000FF01 |
Every interrupt of the CPU.
| #define OS_IM_SP 0x00010401 |
The RSP.
| #define OS_IM_SI 0x00020401 |
The serial interface.
| #define OS_IM_AI 0x00040401 |
The audio interface.
| #define OS_IM_VI 0x00080401 |
The video interface.
| #define OS_IM_PI 0x00100401 |
The peripheral interface.
| #define OS_IM_DP 0x00200401 |
The RDP.
| #define OS_IM_ALL 0x003FFF01 |
Every interrupt.
| #define OS_CLOCK_RATE 62500000LL |
The clock rate of the RCP, in hertz.
| #define OS_CPU_COUNTER (OS_CLOCK_RATE * 3 / 4) |
The rate of the CPU counter, in cycles a second.
| #define OS_NSEC_TO_CYCLES | ( | n | ) |
Convert nanoseconds to cycles of the CPU counter.
| #define OS_USEC_TO_CYCLES | ( | n | ) |
Convert microseconds to cycles of the CPU counter.
| #define OS_CYCLES_TO_NSEC | ( | c | ) |
Convert cycles of the CPU counter to nanoseconds.
| #define OS_CYCLES_TO_USEC | ( | c | ) |
Convert cycles of the CPU counter to microseconds.
| #define OS_READ 0 |
From the device to memory.
| #define OS_WRITE 1 |
From memory to the device.
| #define OS_OTHERS 2 |
Neither, for a request that moves no data.
| #define OS_MESG_PRI_NORMAL 0 |
The request joins the end of the queue.
| #define OS_MESG_PRI_HIGH 1 |
The request jumps to the front of the queue.
| #define OS_MESG_TYPE_BASE 10 |
The first type.
| #define OS_MESG_TYPE_LOOPBACK (OS_MESG_TYPE_BASE + 0) |
A request sent back unchanged.
| #define OS_MESG_TYPE_DMAREAD (OS_MESG_TYPE_BASE + 1) |
A DMA from the cartridge.
| #define OS_MESG_TYPE_DMAWRITE (OS_MESG_TYPE_BASE + 2) |
A DMA to the cartridge.
| #define OS_MESG_TYPE_VRETRACE (OS_MESG_TYPE_BASE + 3) |
A vertical retrace.
| #define OS_MESG_TYPE_COUNTER (OS_MESG_TYPE_BASE + 4) |
An expiry of the counter.
| #define OS_MESG_TYPE_EDMAREAD (OS_MESG_TYPE_BASE + 5) |
A DMA from a device handle.
| #define OS_MESG_TYPE_EDMAWRITE (OS_MESG_TYPE_BASE + 6) |
A DMA to a device handle.
| #define DEVICE_TYPE_CART 0 |
The cartridge ROM.
| #define DEVICE_TYPE_BULK 1 |
Bulk storage.
| #define DEVICE_TYPE_64DD 2 |
The 64DD.
| #define DEVICE_TYPE_SRAM 3 |
Battery-backed SRAM.
| #define DEVICE_TYPE_INIT 7 |
A device not yet probed.
| #define PI_DOMAIN1 0 |
Domain 1, the cartridge ROM.
| #define PI_DOMAIN2 1 |
Domain 2, SRAM and the 64DD.
| #define OS_TV_PAL 0 |
PAL.
| #define OS_TV_NTSC 1 |
NTSC.
| #define OS_TV_MPAL 2 |
PAL-M.
| #define VI_NTSC_CLOCK 48681812 |
The video clock of NTSC, in hertz.
| #define VI_PAL_CLOCK 49656530 |
The video clock of PAL, in hertz.
| #define VI_MPAL_CLOCK 48628316 |
The video clock of PAL-M, in hertz.
| #define OS_VI_GAMMA_ON 0x0001 |
Turn the gamma correction on.
| #define OS_VI_GAMMA_OFF 0x0002 |
Turn the gamma correction off.
| #define OS_VI_GAMMA_DITHER_ON 0x0004 |
Turn the gamma dither on.
| #define OS_VI_GAMMA_DITHER_OFF 0x0008 |
Turn the gamma dither off.
| #define OS_VI_DIVOT_ON 0x0010 |
Turn the divot removal on.
| #define OS_VI_DIVOT_OFF 0x0020 |
Turn the divot removal off.
| #define OS_VI_DITHER_FILTER_ON 0x0040 |
Turn the dither filter on.
| #define OS_VI_DITHER_FILTER_OFF 0x0080 |
Turn the dither filter off.
| typedef struct OSThread_s OSThread |
A thread: its place in the queues, its state, and the registers saved when it last stopped.
| typedef u32 OSPageMask |
A mask of the page size of a TLB entry.
| typedef void* OSMesg |
A message, a word sent through a message queue.
| typedef struct OSMesgQueue_s OSMesgQueue |
A message queue: a ring of messages and the threads blocked sending or receiving.
A timer that sends a message when it expires, once or periodically.
| typedef struct OSPiHandle_s OSPiHandle |
A device on the peripheral interface, with the timing of its PI domain.
| void osCreateThread | ( | OSThread * | t, |
| OSId | id, | ||
| void(* | entry )(void *), | ||
| void * | arg, | ||
| void * | sp, | ||
| OSPri | pri ) |
Create a stopped thread on the active queue.
It runs entry(arg) on the stack that ends at sp, and destroys itself when entry returns.
| t | The thread to create. |
| id | The identifier of the thread, for the debugger. |
| entry | The routine the thread runs. |
| arg | The argument passed to entry. |
| sp | The end of the stack of the thread, aligned to 8 bytes. |
| pri | The priority, from OS_PRIORITY_IDLE to OS_PRIORITY_MAX. |
| void osDestroyThread | ( | OSThread * | t | ) |
Remove a thread from its queue and from the active queue.
A NULL thread is the running one, and destroying the running thread dispatches the next.
| t | The thread to destroy, or NULL for the running thread. |
| void osYieldThread | ( | void | ) |
Put the running thread at the end of the threads of its priority and dispatch.
| void osStartThread | ( | OSThread * | t | ) |
Make a stopped or waiting thread runnable, and yield to it when its priority is higher.
| t | The thread to start. |
Change the priority of a thread, a NULL thread being the running one, and yield when a runnable thread now has a higher priority than the running one.
| t | The thread, or NULL for the running thread. |
| pri | The new priority, from OS_PRIORITY_IDLE to OS_PRIORITY_MAX. |
Return the priority of a thread, a NULL thread being the running one.
| t | The thread, or NULL for the running thread. |
| void osCreateMesgQueue | ( | OSMesgQueue * | mq, |
| OSMesg * | msg, | ||
| s32 | count ) |
Initialise an empty message queue over a buffer of count messages.
| mq | The queue to initialise. |
| msg | The buffer of the messages. |
| count | The number of messages the buffer has room for. |
| s32 osSendMesg | ( | OSMesgQueue * | mq, |
| OSMesg | msg, | ||
| s32 | flag ) |
Append a message to a queue and make its first receiver runnable.
| mq | The queue. |
| msg | The message. |
| flag | OS_MESG_BLOCK to wait while the queue is full, or OS_MESG_NOBLOCK to return. |
| s32 osJamMesg | ( | OSMesgQueue * | mq, |
| OSMesg | msg, | ||
| s32 | flag ) |
Insert a message at the front of a queue and make its first receiver runnable.
| mq | The queue. |
| msg | The message. |
| flag | OS_MESG_BLOCK to wait while the queue is full, or OS_MESG_NOBLOCK to return. |
| s32 osRecvMesg | ( | OSMesgQueue * | mq, |
| OSMesg * | msg, | ||
| s32 | flag ) |
Take the first message of a queue, store it unless msg is NULL, and make its first sender runnable.
| mq | The queue. |
| msg | Receives the message, unless it is NULL. |
| flag | OS_MESG_BLOCK to wait while the queue is empty, or OS_MESG_NOBLOCK to return. |
| void osSetEventMesg | ( | OSEvent | e, |
| OSMesgQueue * | mq, | ||
| OSMesg | m ) |
Register the queue and message that event e sends.
| e | The event, such as OS_EVENT_SI or OS_EVENT_PI. |
| mq | The queue the event sends to. |
| m | The message the event sends. |
| OSIntMask osGetIntMask | ( | void | ) |
Return the CPU and RCP interrupts that may occur.
The game does not link this routine.
Set the CPU and RCP interrupts that may occur, within the global mask.
| im | The new interrupt mask, from the OS_IM_* bits. |
| u32 osGetCount | ( | void | ) |
Read the CPU counter, or advance the emulated counter on Windows.
| void osInvalDCache | ( | void * | vaddr, |
| s32 | nbytes ) |
Invalidate the data cache over a range.
| vaddr | The start of the range, a virtual address. |
| nbytes | The length of the range in bytes. A length of 0 or less does nothing. |
| void osInvalICache | ( | void * | vaddr, |
| s32 | nbytes ) |
Invalidate the instruction cache over a range.
| vaddr | The start of the range, a virtual address. |
| nbytes | The length of the range in bytes. A length of 0 or less does nothing. |
| void osWritebackDCache | ( | void * | vaddr, |
| s32 | nbytes ) |
Write back the data cache over a range.
| vaddr | The start of the range, a virtual address. |
| nbytes | The length of the range in bytes. A length of 0 or less does nothing. |
| void osWritebackDCacheAll | ( | void | ) |
Write back the whole data cache.
| u32 osVirtualToPhysical | ( | void * | vaddr | ) |
Translate a virtual address to a physical one.
| vaddr | The virtual address, in KSEG0, KSEG1, or a segment the TLB maps. |
| void osMapTLBRdb | ( | void | ) |
Map the RDB port of the development hardware.
| OSTime osGetTime | ( | void | ) |
Return the time since the VI manager started, in CPU counter cycles.
| int osSetTimer | ( | OSTimer * | t, |
| OSTime | countdown, | ||
| OSTime | interval, | ||
| OSMesgQueue * | mq, | ||
| OSMesg | msg ) |
Start a timer that sends msg to mq after countdown cycles, or after interval cycles when countdown is 0, and again every interval cycles unless interval is 0.
| t | The timer, not reused until it expires for the last time. |
| countdown | The cycles of the CPU counter until the first message. |
| interval | The cycles between later messages, or 0 for a single message. |
| mq | The queue the timer sends to. |
| msg | The message the timer sends. |
| void osCreateViManager | ( | OSPri | pri | ) |
Start the VI manager thread at priority pri.
The call raises the calling thread to pri while it creates the manager, and does nothing once the manager runs.
| pri | The priority of the manager thread. |
| void osViBlack | ( | u8 | active | ) |
Blank the screen from the next field on, or show it again.
| active | TRUE to blank the screen, FALSE to show it. |
| void osViSetMode | ( | OSViMode * | modep | ) |
Select the video mode from the next field on.
| modep | The mode, such as osViModeNtscLan1. |
| void osViSwapBuffer | ( | void * | frameBufPtr | ) |
Show a frame buffer from the next field on.
| frameBufPtr | The virtual address of the frame buffer. |
| void * osViGetCurrentFramebuffer | ( | void | ) |
Return the frame buffer the screen shows.
| void osViSetEvent | ( | OSMesgQueue * | mq, |
| OSMesg | m, | ||
| u32 | retraceCount ) |
Send m to mq every retraceCount vertical retraces.
| mq | The queue the VI manager sends to. |
| m | The message the VI manager sends. |
| retraceCount | The number of retraces between messages, 1 for every retrace. |
| void osViSetSpecialFeatures | ( | u32 | func | ) |
Turn the gamma, gamma dither, divot, and dither filter features on and off, from the OS_VI_* flags.
| func | The OS_VI_*_ON and OS_VI_*_OFF flags to apply. |
| OSPiHandle * osCartRomInit | ( | void | ) |
Return the handle of the cartridge ROM, creating it from the timing its first word records.
| OSPiHandle * osLeoDiskInit | ( | void | ) |
Create the handle of the 64DD and select its domain 2 timing.
| void osCreatePiManager | ( | OSPri | pri, |
| OSMesgQueue * | cmdQ, | ||
| OSMesg * | cmdBuf, | ||
| s32 | cmdMsgCnt ) |
Start the PI manager thread at priority pri, serving the requests of cmdQ.
The call raises the calling thread to pri while it creates the manager, and does nothing once the manager runs.
| pri | The priority of the manager thread. |
| cmdQ | The queue the manager receives requests on, created by the call. |
| cmdBuf | The buffer of the messages of cmdQ. |
| cmdMsgCnt | The number of messages cmdBuf has room for. |
| OSMesgQueue * osPiGetCmdQueue | ( | void | ) |
Return the command queue of the PI manager, or NULL when it does not run.
Read a word of the cartridge domain at an offset from the ROM base.
| devAddr | The offset from the ROM base, a multiple of 4. |
| data | Receives the word. |
Start a DMA between RDRAM and the cartridge domain at an offset from the ROM base.
| direction | OS_READ to read the cartridge, OS_WRITE to write it. |
| devAddr | The offset from the ROM base, a multiple of 2. |
| dramAddr | The virtual address of the buffer in RDRAM, aligned to 8 bytes. |
| size | The count of bytes to move. |
| s32 osPiStartDma | ( | OSIoMesg * | mb, |
| s32 | priority, | ||
| s32 | direction, | ||
| u32 | devAddr, | ||
| void * | vAddr, | ||
| u32 | nbytes, | ||
| OSMesgQueue * | mq ) |
Queue a DMA request with the PI manager.
A request of priority OS_MESG_PRI_HIGH goes to the front of the queue.
| mb | The request, not reused until the manager sends it to mq. |
| priority | OS_MESG_PRI_NORMAL or OS_MESG_PRI_HIGH. |
| direction | OS_READ to read the cartridge, OS_WRITE to write it. |
| devAddr | The offset from the ROM base, a multiple of 2. |
| vAddr | The virtual address of the buffer in RDRAM, aligned to 8 bytes. |
| nbytes | The count of bytes to move. |
| mq | The queue the manager sends mb to when the transfer ends. |
| s32 osEPiRawReadIo | ( | OSPiHandle * | pihandle, |
| u32 | devAddr, | ||
| u32 * | data ) |
Read a word of the device a handle describes.
| pihandle | The handle of the device. |
| devAddr | The offset from the base address of the device, a multiple of 4. |
| data | Receives the word. |
| s32 osEPiRawWriteIo | ( | OSPiHandle * | pihandle, |
| u32 | devAddr, | ||
| u32 | data ) |
Write a word of the device a handle describes.
| pihandle | The handle of the device. |
| devAddr | The offset from the base address of the device, a multiple of 4. |
| data | The word to write. |
| s32 osEPiRawStartDma | ( | OSPiHandle * | pihandle, |
| s32 | direction, | ||
| u32 | devAddr, | ||
| void * | dramAddr, | ||
| u32 | size ) |
Start a DMA with the device a handle describes, selecting its domain timing when another handle selected different timing.
| pihandle | The handle of the device. |
| direction | OS_READ to read the device, OS_WRITE to write it. |
| devAddr | The offset from the base address of the device, a multiple of 2. |
| dramAddr | The virtual address of the buffer in RDRAM, aligned to 8 bytes. |
| size | The count of bytes to move. |
Set the sample rate of the audio DAC to the nearest the video clock allows.
| frequency | The requested sample rate in hertz. |
Queue a buffer of samples for the audio DMA.
| bufPtr | The virtual address of the samples, aligned to 8 bytes. |
| size | The length of the buffer in bytes, a multiple of 8. |
| u32 osAiGetStatus | ( | void | ) |
Return the audio status register.
| u32 osAiGetLength | ( | void | ) |
Return the remaining length of the buffer the audio DMA plays.
| void osInitialize | ( | void | ) |
Initialise the system: the FPU, the PIF, the exception vectors and the clock rates.
| void osSyncPrintf | ( | const char * | fmt, |
| ... ) |
Print to the debugger.
The retail library discards the output.
| fmt | The printf format, followed by its arguments. |
| void rmonPrintf | ( | const char * | fmt, |
| ... ) |
Print to the remote monitor.
The retail library discards the output.
| fmt | The printf format, followed by its arguments. |
|
extern |
The television standard reported by IPL3.
|
extern |
The cartridge ROM type reported by IPL3.
|
extern |
The cartridge ROM base address reported by IPL3.
|
extern |
The reset type reported by IPL3.
|
extern |
The cartridge CIC identifier reported by IPL3.
|
extern |
The operating-system version reported by IPL3.
|
extern |
The installed memory size reported by IPL3.
|
extern |
The application buffer retained across an NMI reset.
|
extern |
The low-resolution PAL video mode with anti-aliasing.
|
extern |
The high-resolution PAL video mode with anti-aliasing.
|
extern |
The low-resolution MPAL video mode with anti-aliasing.
|
extern |
The low-resolution NTSC video mode with anti-aliasing.
|
extern |
The rate of the CPU counter, OS_CPU_COUNTER until osInitialize() sets it.
|
extern |
The frequency of the video clock.
osInitialize() selects it by television standard.
|
extern |
Whether the last buffer osAiSetNextBuffer() queued ended 0x2000 bytes into a 16 KiB page, a case the audio DMA mishandles.