#ifndef _OS_H_ #define _OS_H_ #include "ultra64/thread.h" #include "ultra64/message.h" #define OS_READ 0 #define OS_WRITE 1 typedef u32 OSIntMask; typedef u32 OSPageMask; typedef struct { /* 0x00 */ u32 errStatus; /* 0x04 */ void* dramAddr; /* 0x08 */ void* C2Addr; /* 0x0C */ u32 sectorSize; /* 0x10 */ u32 C1ErrNum; /* 0x14 */ u32 C1ErrSector[4]; } __OSBlockInfo; typedef struct { /* 0x00 */ u32 cmdType; /* 0x04 */ u16 transferMode; /* 0x06 */ u16 blockNum; /* 0x08 */ s32 sectorNum; /* 0x0C */ u32 devAddr; /* 0x10 */ u32 bmCtlShadow; /* 0x14 */ u32 seqCtlShadow; /* 0x18 */ __OSBlockInfo block[2]; } __OSTranxInfo; typedef struct OSPiHandle_s { /* 0x00 */ struct OSPiHandle_s* next; /* 0x04 */ u8 type; /* 0x05 */ u8 latency; /* 0x06 */ u8 pageSize; /* 0x07 */ u8 relDuration; /* 0x08 */ u8 pulse; /* 0x09 */ u8 domain; /* 0x0C */ u32 baseAddress; /* 0x10 */ u32 speed; /* 0x14 */ __OSTranxInfo transferInfo; } OSPiHandle; typedef struct { /* 0x0 */ u8 type; /* 0x4 */ u32 address; } OSPiInfo; typedef struct { /* 0x0 */ u16 type; /* 0x2 */ u8 pri; /* 0x3 */ u8 status; /* 0x4 */ OSMesgQueue* retQueue; } OSIoMesgHdr; typedef struct { /* 0x00 */ OSIoMesgHdr hdr; /* 0x08 */ void* dramAddr; /* 0x0C */ u32 devAddr; /* 0x10 */ u32 size; /* 0x14 */ OSPiHandle* piHandle; } OSIoMesg; typedef struct { /* 0x00 */ s32 active; // u32 maybe? need to check /* 0x04 */ OSThread* thread; /* 0x08 */ OSMesgQueue* cmdQueue; /* 0x0C */ OSMesgQueue* evtQueue; /* 0x10 */ OSMesgQueue* acsQueue; /* 0x14 */ s32 (*piDmaCallback)(s32, u32, void*, u32); /* 0x18 */ s32 (*epiDmaCallback)(OSPiHandle*, s32, u32, void*, u32); } OSDevMgr; typedef struct { /* 0x00 */ u32 ctrl; /* 0x04 */ u32 width; /* 0x08 */ u32 burst; /* 0x0C */ u32 vSync; /* 0x10 */ u32 hSync; /* 0x14 */ u32 leap; /* 0x18 */ u32 hStart; /* 0x1C */ u32 xScale; /* 0x20 */ u32 vCurrent; } OSViCommonRegs; typedef struct { /* 0x00 */ u32 origin; /* 0x04 */ u32 yScale; /* 0x08 */ u32 vStart; /* 0x0C */ u32 vBurst; /* 0x10 */ u32 vIntr; } OSViFieldRegs; typedef struct { /* 0x00 */ u8 type; /* 0x04 */ OSViCommonRegs comRegs; /* 0x28 */ OSViFieldRegs fldRegs[2]; } OSViMode; typedef u64 OSTime; typedef struct OSTimer_s { /* 0x00 */ struct OSTimer_s* next; /* 0x04 */ struct OSTimer_s* prev; /* 0x08 */ OSTime interval; /* 0x10 */ OSTime value; /* 0x18 */ OSMesgQueue* mq; /* 0x1C */ OSMesg msg; } OSTimer; typedef struct { /* 0x0 */ u16 type; /* 0x2 */ u8 status; /* 0x3 */ u8 errno; } OSContStatus; typedef struct { /* 0x0 */ u16 button; /* 0x2 */ s8 stick_x; /* 0x3 */ s8 stick_y; /* 0x4 */ u8 errno; } OSContPad; typedef struct { /* 0x00 */ void* address; /* 0x04 */ u8 databuffer[32]; /* 0x24 */ u8 addressCrc; /* 0x25 */ u8 dataCrc; /* 0x26 */ u8 errno; } OSContRamIo; typedef struct { /* 0x0 */ u16* histo_base; /* 0x4 */ u32 histo_size; /* 0x8 */ u32* text_start; /* 0xC */ u32* text_end; } OSProf; typedef struct { /* 0x0 */ OSMesgQueue* mq; /* 0x4 */ s32 port; /* Controller port */ /* 0x8 */ s32 mode; /* 0xC */ u8 status; } OSVoiceHandle; // size = 0x10 #endif