sched.c OK (#248)

* sched

* Minor fixes

* Format headers in the ultra64 folder, bitshifts in defines

* Fix PI_STATUS_ERROR

* Update variables
This commit is contained in:
Tharo 2021-08-07 17:43:11 +01:00 committed by GitHub
parent 1836844ea8
commit 1c544d2351
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 1129 additions and 429 deletions

View File

@ -1,88 +0,0 @@
#ifndef _ULTRA64_HARDWARE_H_
#define _ULTRA64_HARDWARE_H_
#define AI_DRAM_ADDR_REG 0x04500000
#define AI_LEN_REG 0x04500004
#define AI_CONTROL_REG 0x04500008
#define AI_STATUS_REG 0x0450000C
#define AI_STATUS_AI_FULL (1 << 31)
#define AI_STATUS_AI_BUSY (1 << 30)
#define AI_DACRATE_REG 0x04500010
#define AI_BITRATE_REG 0x04500014
#define VI_STATUS_REG 0x04400000
#define VI_CONTROL_REG 0x04400000
#define VI_ORIGIN_REG 0x04400004
#define VI_DRAM_ADDR_REG 0x04400004
#define VI_WIDTH_REG 0x04400008
#define VI_H_WIDTH_REG 0x04400008
#define VI_INTR_REG 0x0440000C
#define VI_V_INTER_REG 0x0440000C
#define VI_CURRENT_REG 0x04400010
#define VI_V_CURRENT_LINE_REG 0x04400010
#define VI_BURST_REG 0x04400014
#define VI_TIMING_REG 0x04400014
#define VI_V_SYNC_REG 0x04400018 //VI vertical sync
#define VI_H_SYNC_REG 0x0440001C //VI horizontal sync
#define VI_LEAP_REG 0x04400020 //VI horizontal sync leap
#define VI_H_SYNC_LEAP_REG 0x04400020
#define VI_H_START_REG 0x04400024 //VI horizontal video
#define VI_H_VIDEO_REG 0x04400024
#define VI_V_START_REG 0x04400028 //VI vertical video
#define VI_V_VIDEO_REG 0x04400028
#define VI_V_BURST_REG 0x0440002C //VI vertical burst
#define VI_X_SCALE_REG 0x04400030 //VI x-scale
#define VI_Y_SCALE_REG 0x04400034 //VI y-scale
#define SP_IMEM_START 0x04001000
#define SP_DMEM_START 0x04000000
#define SP_MEM_ADDR_REG 0x04040000
#define SP_DRAM_ADDR_REG 0x04040004
#define SP_RD_LEN_REG 0x04040008
#define SP_WR_LEN_REG 0x0404000C
#define SP_STATUS_REG 0x04040010
#define SP_PC_REG 0x04080000
#define PI_DRAM_ADDR_REG 0x04600000 //PI DRAM address
#define PI_CART_ADDR_REG 0x04600004 //PI pbus (cartridge) address
#define PI_RD_LEN_REG 0x04600008 //PI read length
#define PI_WR_LEN_REG 0x0460000C //PI write length
#define PI_STATUS_REG 0x04600010 //PI status
#define PI_BSD_DOM1_LAT_REG 0x04600014 //PI dom1 latency
#define PI_DOMAIN1_REG 0x04600014
#define PI_BSD_DOM1_PWD_REG 0x04600018 //PI dom1 pulse width
#define PI_BSD_DOM1_PGS_REG 0x0460001C //PI dom1 page size
#define PI_BSD_DOM1_RLS_REG 0x04600020 //PI dom1 release
#define PI_BSD_DOM2_LAT_REG 0x04600024 //PI dom2 latency
#define PI_DOMAIN2_REG 0x04600024
#define PI_BSD_DOM2_PWD_REG 0x04600028 //PI dom2 pulse width
#define PI_BSD_DOM2_PGS_REG 0x0460002C //PI dom2 page size
#define PI_BSD_DOM2_RLS_REG 0x04600030 //PI dom2 release
#define PI_STATUS_BUSY 0x1
#define PI_STATUS_IOBUSY 0x2
#define PI_STATUS_ERROR 0x3
#define PI_STATUS_RESET_CONTROLLER 0x1
#define PI_STATUS_CLEAR_INTR 0x2
#define SI_DRAM_ADDR_REG 0x04800000
#define SI_PIF_ADDR_RD64B_REG 0x04800004
#define SI_PIF_ADDR_WR64B_REG 0x04800010
#define SI_STATUS_REG 0x04800018
#define SI_STATUS_DMA_BUSY 0x1
#define SI_STATUS_IO_READ_BUSY 0x2
#define SI_STATUS_DMA_ERROR 0x8
#define SI_STATUS_INTERRUPT (1 << 12)
#define PIF_RAM_START 0x1FC007C0
#define MI_INIT_MODE_REG 0x04300000
#define MI_MODE_REG MI_INIT_MODE_REG
#define MI_VERSION_REG 0x04300004
#define MI_INTR_REG 0x04300008
#define MI_INTR_MASK_REG 0x0430000C
#endif

View File

@ -1,49 +0,0 @@
#ifndef _SCHED_H_
#define _SCHED_H_
#include "os.h"
#include "sptask.h"
typedef struct {
/* 0x0 */ short type;
/* 0x2 */ unsigned char misc[30];
} OSScMsg;
typedef struct OSScTask_s {
/* 0x0 */ struct OSScTask_s* next;
/* 0x4 */ u32 state;
/* 0x8 */ u32 flags;
/* 0xC */ void* framebuffer;
/* 0x10 */ OSTask list;
/* 0x50 */ OSMesgQueue* msgQ;
/* 0x54 */ OSMesg msg;
} OSScTask;
typedef struct OSScClient_s {
/* 0x0 */ struct OSScClient_s* next;
/* 0x4 */ OSMesgQueue* msgQ;
} OSScClient;
typedef struct {
/* 0x0 */ OSScMsg retraceMsg;
/* 0x20 */ OSScMsg prenmiMsg;
/* 0x40 */ OSMesgQueue interruptQ;
/* 0x58 */ OSMesg intBuf[8];
/* 0x78 */ OSMesgQueue cmdQ;
/* 0x90 */ OSMesg cmdMsgBuf[8];
/* 0xB0 */ OSThread thread;
/* 0x260 */ OSScClient* clientList;
/* 0x264 */ OSScTask* audioListHead;
/* 0x268 */ OSScTask* gfxListHead;
/* 0x26C */ OSScTask* audioListTail;
/* 0x270 */ OSScTask* gfxListTail;
/* 0x274 */ OSScTask* curRSPTask;
/* 0x278 */ OSScTask* curRDPTask;
/* 0x27C */ u32 frameCount;
/* 0x280 */ s32 doAudio;
} OSSched;
#endif

View File

@ -482,7 +482,7 @@ float __ull_to_f(unsigned long long l);
// void osVoiceCheckWord(void);
// void osVoiceControlGain(void);
// void osVoiceStartReadData(void);
// void osViGetCurrentFramebuffer(void);
void* osViGetCurrentFramebuffer(void);
s32 __osSpSetPc(u32 data);
// void __osVoiceContWrite4(void);
void __osGetHWIntrRoutine(s32 idx, OSMesgQueue** outQueue, OSMesg* outMsg);
@ -3220,30 +3220,28 @@ void Padmgr_GetInput(Input* input, s32 param_2);
void Padmgr_GetInput2(Input* input, s32 param_2);
void Padmgr_ThreadEntry(PadMgr* padmgr);
void Padmgr_Start(OSMesgQueue* siEventCallbackQueue, IrqMgr* irqmgr, OSId threadId, OSPri threadPri, void* stack);
// void func_80176280(void);
// void func_80176314(void);
void Sched_Nop80176364(SchedContext* sched);
void func_80176370(SchedContext* sched);
void func_80176394(SchedContext* sched);
void func_801764F0(SchedContext* sched);
void func_8017668C(SchedContext* sched, UNK_PTR puParm2);
// void func_801766F0(void);
// void func_80176748(void);
// void func_801767B8(void);
// void func_801768E0(void);
// void func_8017691C(void);
// void func_80176988(void);
void func_80176B34(SchedContext* sched);
void func_80176C24(SchedContext* sched);
void func_80176CF4(SchedContext* sched);
void func_80176F2C(SchedContext* sched);
void Sched_SwapFramebuffer(CfbInfo* cfbInfo);
void Sched_RetraceUpdateFramebuffer(SchedContext* sched, CfbInfo* cfbInfo);
void Sched_HandleReset(SchedContext* sched);
void Sched_HandleStop(SchedContext* sched);
void Sched_HandleAudioCancel(SchedContext* sched);
void Sched_HandleGfxCancel(SchedContext* sched);
void Sched_QueueTask(SchedContext* sched, OSScTask* task);
void Sched_Yield(SchedContext* sched);
s32 Sched_Schedule(SchedContext* sched, OSScTask** spTask, OSScTask** dpTask, s32 state);
void Sched_TaskUpdateFramebuffer(SchedContext* sched, OSScTask* task);
void Sched_NotifyDone(SchedContext* sched, OSScTask* task);
void Sched_RunTask(SchedContext* sched, OSScTask* spTask, OSScTask* dpTask);
void Sched_HandleEntry(SchedContext* sched);
void Sched_HandleRetrace(SchedContext* sched);
void Sched_HandleRSPDone(SchedContext* sched);
void Sched_HandleRDPDone(SchedContext* sched);
void Sched_SendEntryMsg(SchedContext* sched);
void func_8017703C(SchedContext* sched);
void func_80177060(SchedContext* sched);
void func_80177084(SchedContext* sched);
void Sched_ThreadEntry(SchedContext* sched);
// void func_80177280(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5, UNK_TYPE1 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11, UNK_TYPE4 param_12);
// void Sched_Start(SchedContext* sched, void* stack, OSPri pri, UNK_TYPE4 param_4, UNK_TYPE4 param_5, IrqMgr* irqmgrStruct);
void Sched_SendAudioCancelMsg(SchedContext* sched);
void Sched_SendGfxCancelMsg(SchedContext* sched);
void Sched_FaultClient(void* param1, void* param2);
void Sched_ThreadEntry(void* arg);
void Sched_Init(SchedContext* sched, void* stack, OSPri pri, UNK_TYPE arg3, UNK_TYPE arg4, IrqMgr* irqMgr);
// void func_80177390(void);
void func_801773A0(void* arg0);
void func_801773C4(void* arg0);

View File

@ -1,114 +1,16 @@
#ifndef _OS_H_
#define _OS_H_
#include "PR/ultratypes.h"
typedef s32 OSPri;
typedef s32 OSId;
#include "ultra64/thread.h"
#include "ultra64/message.h"
#define OS_READ 0
#define OS_WRITE 1
typedef union {
/* 0x0 */ struct {
/* 0x0 */ f32 f_odd;
/* 0x4 */ f32 f_even;
} f;
/* 0x0 */ f64 d;
} __OSfp;
typedef struct {
/* 0x0 */ u64 at;
/* 0x8 */ u64 v0;
/* 0x10 */ u64 v1;
/* 0x18 */ u64 a0;
/* 0x20 */ u64 a1;
/* 0x28 */ u64 a2;
/* 0x30 */ u64 a3;
/* 0x38 */ u64 t0;
/* 0x40 */ u64 t1;
/* 0x48 */ u64 t2;
/* 0x50 */ u64 t3;
/* 0x58 */ u64 t4;
/* 0x60 */ u64 t5;
/* 0x68 */ u64 t6;
/* 0x70 */ u64 t7;
/* 0x78 */ u64 s0;
/* 0x80 */ u64 s1;
/* 0x88 */ u64 s2;
/* 0x90 */ u64 s3;
/* 0x98 */ u64 s4;
/* 0xA0 */ u64 s5;
/* 0xA8 */ u64 s6;
/* 0xB0 */ u64 s7;
/* 0xB8 */ u64 t8;
/* 0xC0 */ u64 t9;
/* 0xC8 */ u64 gp;
/* 0xD0 */ u64 sp;
/* 0xD8 */ u64 s8;
/* 0xE0 */ u64 ra;
/* 0xE8 */ u64 lo;
/* 0xF0 */ u64 hi;
/* 0xF8 */ u32 sr;
/* 0xFC */ u32 pc;
/* 0x100 */ u32 cause;
/* 0x104 */ u32 badvaddr;
/* 0x108 */ u32 rcp;
/* 0x10C */ u32 fpcsr;
/* 0x110 */ __OSfp fp0;
/* 0x118 */ __OSfp fp2;
/* 0x120 */ __OSfp fp4;
/* 0x128 */ __OSfp fp6;
/* 0x130 */ __OSfp fp8;
/* 0x138 */ __OSfp fp10;
/* 0x140 */ __OSfp fp12;
/* 0x148 */ __OSfp fp14;
/* 0x150 */ __OSfp fp16;
/* 0x158 */ __OSfp fp18;
/* 0x160 */ __OSfp fp20;
/* 0x168 */ __OSfp fp22;
/* 0x170 */ __OSfp fp24;
/* 0x178 */ __OSfp fp26;
/* 0x180 */ __OSfp fp28;
/* 0x188 */ __OSfp fp30;
} __OSThreadContext;
typedef struct OSThread_s {
/* 0x0 */ struct OSThread_s* next;
/* 0x4 */ OSPri priority;
/* 0x8 */ struct OSThread_s** queue;
/* 0xC */ struct OSThread_s* tlnext;
/* 0x10 */ u16 state;
/* 0x12 */ u16 flags;
/* 0x14 */ OSId id;
/* 0x18 */ int fp;
/* 0x20 */ __OSThreadContext context;
} OSThread;
typedef u32 OSEvent;
typedef u32 OSIntMask;
typedef u32 OSPageMask;
#define OS_MESG_NOBLOCK 0
#define OS_MESG_BLOCK 1
typedef void* OSMesg;
typedef struct {
/* 0x00 */ OSThread* mtqueue;
/* 0x04 */ OSThread* fullqueue;
/* 0x08 */ s32 validCount;
/* 0x0C */ s32 first;
/* 0x10 */ s32 msgCount;
/* 0x14 */ OSMesg* msg;
} OSMesgQueue; // size = 0x20
typedef struct {
/* 0x00 */ u32 errStatus;
/* 0x04 */ void* dramAddr;

View File

@ -8,7 +8,6 @@
#include "os_internal.h"
#include "ultraerror.h"
#include "ultralog.h"
#include "sptask.h"
typedef struct {
/* 0x0 */ OSMesgQueue* messageQueue;

View File

@ -1,35 +0,0 @@
#ifndef _SPTASK_H_
#define _SPTASK_H_
#include "PR/ultratypes.h"
#define OS_YIELD_DATA_SIZE 0xC00
typedef struct {
/* 0x0 */ u32 type;
/* 0x4 */ u32 flags;
/* 0x8 */ u64* ucode_boot;
/* 0xC */ u32 ucode_boot_size;
/* 0x10 */ u64* ucode;
/* 0x14 */ u32 ucode_size;
/* 0x18 */ u64* ucode_data;
/* 0x1C */ u32 ucode_data_size;
/* 0x20 */ u64* dram_stack;
/* 0x24 */ u32 dram_stack_size;
/* 0x28 */ u64* output_buff;
/* 0x2C */ u64* output_buff_size;
/* 0x30 */ u64* data_ptr;
/* 0x34 */ u32 data_size;
/* 0x38 */ u64* yield_data_ptr;
/* 0x3C */ u32 yield_data_size;
} OSTask_t;
typedef union {
/* 0x0 */ OSTask_t t;
/* 0x0 */ long long force_structure_alignment;
} OSTask;
typedef u32 OSYieldResult;
#endif

View File

@ -6,4 +6,10 @@
#include "unk.h"
#include "ultra64/hardware.h"
#include "ultra64/message.h"
#include "ultra64/sptask.h"
#include "ultra64/thread.h"
#include "ultra64/rsp.h"
#endif

106
include/ultra64/hardware.h Normal file
View File

@ -0,0 +1,106 @@
#ifndef _ULTRA64_HARDWARE_H_
#define _ULTRA64_HARDWARE_H_
#define HW_REG(reg, type) *(volatile type*)((reg) | 0xa0000000)
#define AI_DRAM_ADDR_REG 0x04500000
#define AI_LEN_REG 0x04500004
#define AI_CONTROL_REG 0x04500008
#define AI_STATUS_REG 0x0450000C
#define AI_DACRATE_REG 0x04500010
#define AI_BITRATE_REG 0x04500014
#define AI_STATUS_AI_BUSY (1 << 30)
#define AI_STATUS_AI_FULL (1 << 31)
#define VI_STATUS_REG 0x04400000
#define VI_CONTROL_REG 0x04400000
#define VI_ORIGIN_REG 0x04400004
#define VI_DRAM_ADDR_REG 0x04400004
#define VI_WIDTH_REG 0x04400008
#define VI_H_WIDTH_REG 0x04400008
#define VI_INTR_REG 0x0440000C
#define VI_V_INTER_REG 0x0440000C
#define VI_CURRENT_REG 0x04400010
#define VI_V_CURRENT_LINE_REG 0x04400010
#define VI_BURST_REG 0x04400014
#define VI_TIMING_REG 0x04400014
#define VI_V_SYNC_REG 0x04400018 //VI vertical sync
#define VI_H_SYNC_REG 0x0440001C //VI horizontal sync
#define VI_LEAP_REG 0x04400020 //VI horizontal sync leap
#define VI_H_SYNC_LEAP_REG 0x04400020
#define VI_H_START_REG 0x04400024 //VI horizontal video
#define VI_H_VIDEO_REG 0x04400024
#define VI_V_START_REG 0x04400028 //VI vertical video
#define VI_V_VIDEO_REG 0x04400028
#define VI_V_BURST_REG 0x0440002C //VI vertical burst
#define VI_X_SCALE_REG 0x04400030 //VI x-scale
#define VI_Y_SCALE_REG 0x04400034 //VI y-scale
#define SP_IMEM_START 0x04001000
#define SP_IMEM_SIZE 0x1000
#define SP_DMEM_START 0x04000000
#define SP_DMEM_SIZE 0x1000
#define SP_MEM_ADDR_REG 0x04040000
#define SP_DRAM_ADDR_REG 0x04040004
#define SP_RD_LEN_REG 0x04040008
#define SP_WR_LEN_REG 0x0404000C
#define SP_STATUS_REG 0x04040010
#define SP_DMA_FULL_REG 0x04040014
#define SP_DMA_BUSY_REG 0x04040018
#define SP_PC_REG 0x04080000
#define PI_DRAM_ADDR_REG 0x04600000 //PI DRAM address
#define PI_CART_ADDR_REG 0x04600004 //PI pbus (cartridge) address
#define PI_RD_LEN_REG 0x04600008 //PI read length
#define PI_WR_LEN_REG 0x0460000C //PI write length
#define PI_STATUS_REG 0x04600010 //PI status
#define PI_BSD_DOM1_LAT_REG 0x04600014 //PI dom1 latency
#define PI_DOMAIN1_REG 0x04600014
#define PI_BSD_DOM1_PWD_REG 0x04600018 //PI dom1 pulse width
#define PI_BSD_DOM1_PGS_REG 0x0460001C //PI dom1 page size
#define PI_BSD_DOM1_RLS_REG 0x04600020 //PI dom1 release
#define PI_BSD_DOM2_LAT_REG 0x04600024 //PI dom2 latency
#define PI_DOMAIN2_REG 0x04600024
#define PI_BSD_DOM2_PWD_REG 0x04600028 //PI dom2 pulse width
#define PI_BSD_DOM2_PGS_REG 0x0460002C //PI dom2 page size
#define PI_BSD_DOM2_RLS_REG 0x04600030 //PI dom2 release
#define PI_STATUS_BUSY (1 << 0)
#define PI_STATUS_IOBUSY (1 << 1)
#define PI_STATUS_ERROR (PI_STATUS_BUSY | PI_STATUS_IOBUSY)
#define PI_STATUS_RESET_CONTROLLER (1 << 0)
#define PI_STATUS_CLEAR_INTR (1 << 1)
#define SI_DRAM_ADDR_REG 0x04800000
#define SI_PIF_ADDR_RD64B_REG 0x04800004
#define SI_PIF_ADDR_WR64B_REG 0x04800010
#define SI_STATUS_REG 0x04800018
#define SI_STATUS_DMA_BUSY (1 << 0)
#define SI_STATUS_IO_READ_BUSY (1 << 1)
#define SI_STATUS_DMA_ERROR (1 << 3)
#define SI_STATUS_INTERRUPT (1 << 12)
#define PIF_RAM_START 0x1FC007C0
#define MI_INIT_MODE_REG 0x04300000
#define MI_MODE_REG MI_INIT_MODE_REG
#define MI_VERSION_REG 0x04300004
#define MI_INTR_REG 0x04300008
#define MI_INTR_MASK_REG 0x0430000C
/* Interrupt pending bits */
#define CAUSE_IP8 0x00008000 /* External level 8 pending - COMPARE */
#define CAUSE_IP7 0x00004000 /* External level 7 pending - INT4 */
#define CAUSE_IP6 0x00002000 /* External level 6 pending - INT3 */
#define CAUSE_IP5 0x00001000 /* External level 5 pending - INT2 */
#define CAUSE_IP4 0x00000800 /* External level 4 pending - INT1 */
#define CAUSE_IP3 0x00000400 /* External level 3 pending - INT0 */
#define CAUSE_SW2 0x00000200 /* Software level 2 pending */
#define CAUSE_SW1 0x00000100 /* Software level 1 pending */
#endif

53
include/ultra64/message.h Normal file
View File

@ -0,0 +1,53 @@
#ifndef _ULTRA64_MESSAGE_H_
#define _ULTRA64_MESSAGE_H_
#include "ultra64/thread.h"
#define OS_NUM_EVENTS 15
#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 */
#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 host io 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
typedef void* OSMesg;
typedef u32 OSEvent;
#define OS_MESG_NOBLOCK 0
#define OS_MESG_BLOCK 1
typedef struct OSMesgQueue {
/* 0x00 */ OSThread* mtQueue;
/* 0x04 */ OSThread* fullQueue;
/* 0x08 */ s32 validCount;
/* 0x0C */ s32 first;
/* 0x10 */ s32 msgCount;
/* 0x14 */ OSMesg* msg;
} OSMesgQueue; // size = 0x18
#define MQ_COUNT(mq) ((mq)->validCount)
#define MQ_IS_EMPTY(mq) (MQ_COUNT(mq) == 0)
#define MQ_IS_FULL(mq) (MQ_COUNT(mq) >= (mq)->msgCount)
#endif

47
include/ultra64/rsp.h Normal file
View File

@ -0,0 +1,47 @@
#ifndef _ULTRA64_RSP_H_
#define _ULTRA64_RSP_H_
/* SP Status Flags */
#define SP_STATUS_HALT (1 << 0)
#define SP_STATUS_BROKE (1 << 1)
#define SP_STATUS_DMA_BUSY (1 << 2)
#define SP_STATUS_DMA_FULL (1 << 3)
#define SP_STATUS_IO_FULL (1 << 4)
#define SP_STATUS_SSTEP (1 << 5)
#define SP_STATUS_INTR_BREAK (1 << 6)
#define SP_STATUS_YIELD (1 << 7) // SIG0
#define SP_STATUS_YIELDED (1 << 8) // SIG1
#define SP_STATUS_TASKDONE (1 << 9) // SIG2
#define SP_STATUS_SIG3 (1 << 10)
#define SP_STATUS_SIG4 (1 << 11)
#define SP_STATUS_SIG5 (1 << 12)
#define SP_STATUS_SIG6 (1 << 13)
#define SP_STATUS_SIG7 (1 << 14)
#define SP_CLR_HALT (1 << 0)
#define SP_SET_HALT (1 << 1)
#define SP_CLR_BROKE (1 << 2)
#define SP_CLR_INTR (1 << 3)
#define SP_SET_INTR (1 << 4)
#define SP_CLR_SSTEP (1 << 5)
#define SP_SET_SSTEP (1 << 6)
#define SP_CLR_INTR_BREAK (1 << 7)
#define SP_SET_INTR_BREAK (1 << 8)
#define SP_CLR_SIG0 (1 << 9)
#define SP_SET_SIG0 (1 << 10)
#define SP_CLR_SIG1 (1 << 11)
#define SP_SET_SIG1 (1 << 12)
#define SP_CLR_SIG2 (1 << 13)
#define SP_SET_SIG2 (1 << 14)
#define SP_CLR_SIG3 (1 << 15)
#define SP_SET_SIG3 (1 << 16)
#define SP_CLR_SIG4 (1 << 17)
#define SP_SET_SIG4 (1 << 18)
#define SP_CLR_SIG5 (1 << 19)
#define SP_SET_SIG5 (1 << 20)
#define SP_CLR_SIG6 (1 << 21)
#define SP_SET_SIG6 (1 << 22)
#define SP_CLR_SIG7 (1 << 23)
#define SP_SET_SIG7 (1 << 24)
#endif

112
include/ultra64/sptask.h Normal file
View File

@ -0,0 +1,112 @@
#ifndef _SPTASK_H_
#define _SPTASK_H_
#include "PR/ultratypes.h"
/* Task Types */
#define M_NULTASK 0
#define M_GFXTASK 1
#define M_AUDTASK 2
#define M_VIDTASK 3
#define M_NJPEGTASK 4
#define M_HVQTASK 6
#define M_HVQMTASK 7
/* Task Flags */
#define M_TASK_FLAG0 (1 << 0)
#define M_TASK_FLAG1 (1 << 1)
/* Task Flag Fields */
#define OS_TASK_YIELDED (1 << 0)
#define OS_TASK_DP_WAIT (1 << 1)
#define OS_TASK_LOADABLE (1 << 2)
#define OS_TASK_SP_ONLY (1 << 3)
#define OS_TASK_USR0 (1 << 4)
#define OS_TASK_USR1 (1 << 5)
#define OS_TASK_USR2 (1 << 6)
#define OS_TASK_USR3 (1 << 7)
#define OS_YIELD_DATA_SIZE 0xC00
#define OS_YIELD_AUDIO_SIZE 0x400
/* SpStatus */
/* Write */
#define SPSTATUS_CLEAR_HALT (1 << 0)
#define SPSTATUS_SET_HALT (1 << 1)
#define SPSTATUS_CLEAR_BROKE (1 << 2)
#define SPSTATUS_CLEAR_INTR (1 << 3)
#define SPSTATUS_SET_INTR (1 << 4)
#define SPSTATUS_CLEAR_SSTEP (1 << 5)
#define SPSTATUS_SET_SSTEP (1 << 6)
#define SPSTATUS_CLEAR_INTR_ON_BREAK (1 << 7)
#define SPSTATUS_SET_INTR_ON_BREAK (1 << 8)
#define SPSTATUS_CLEAR_SIGNAL0 (1 << 9)
#define SPSTATUS_SET_SIGNAL0 (1 << 10)
#define SPSTATUS_CLEAR_SIGNAL1 (1 << 11)
#define SPSTATUS_SET_SIGNAL1 (1 << 12)
#define SPSTATUS_CLEAR_SIGNAL2 (1 << 13)
#define SPSTATUS_SET_SIGNAL2 (1 << 14)
#define SPSTATUS_CLEAR_SIGNAL3 (1 << 15)
#define SPSTATUS_SET_SIGNAL3 (1 << 16)
#define SPSTATUS_CLEAR_SIGNAL4 (1 << 17)
#define SPSTATUS_SET_SIGNAL4 (1 << 18)
#define SPSTATUS_CLEAR_SIGNAL5 (1 << 19)
#define SPSTATUS_SET_SIGNAL5 (1 << 20)
#define SPSTATUS_CLEAR_SIGNAL6 (1 << 21)
#define SPSTATUS_SET_SIGNAL6 (1 << 23)
#define SPSTATUS_CLEAR_SIGNAL7 (1 << 24)
#define SPSTATUS_SET_SIGNAL7 (1 << 25)
/* Read */
#define SPSTATUS_HALT (1 << 0)
#define SPSTATUS_BROKE (1 << 1)
#define SPSTATUS_DMA_BUSY (1 << 2)
#define SPSTATUS_DMA_FULL (1 << 3)
#define SPSTATUS_IO_FULL (1 << 4)
#define SPSTATUS_SINGLE_STEP (1 << 5)
#define SPSTATUS_INTERRUPT_ON_BREAK (1 << 6)
#define SPSTATUS_SIGNAL0_SET (1 << 7)
#define SPSTATUS_SIGNAL1_SET (1 << 8)
#define SPSTATUS_SIGNAL2_SET (1 << 9)
#define SPSTATUS_SIGNAL3_SET (1 << 10)
#define SPSTATUS_SIGNAL4_SET (1 << 11)
#define SPSTATUS_SIGNAL5_SET (1 << 12)
#define SPSTATUS_SIGNAL6_SET (1 << 13)
#define SPSTATUS_SIGNAL7_SET (1 << 14)
typedef struct {
/* 0x00 */ u32 type;
/* 0x04 */ u32 flags;
/* 0x08 */ u64* ucode_boot;
/* 0x0C */ u32 ucode_boot_size;
/* 0x10 */ u64* ucode;
/* 0x14 */ u32 ucode_size;
/* 0x18 */ u64* ucode_data;
/* 0x1C */ u32 ucode_data_size;
/* 0x20 */ u64* dram_stack;
/* 0x24 */ u32 dram_stack_size;
/* 0x28 */ u64* output_buff;
/* 0x2C */ u64* output_buff_size;
/* 0x30 */ u64* data_ptr;
/* 0x34 */ u32 data_size;
/* 0x38 */ u64* yield_data_ptr;
/* 0x3C */ u32 yield_data_size;
} OSTask_t; // size = 0x40
typedef union
{
OSTask_t t;
long long int force_structure_alignment;
} OSTask;
typedef u32 OSYieldResult;
#endif

69
include/ultra64/thread.h Normal file
View File

@ -0,0 +1,69 @@
#ifndef _ULTRA64_THREAD_H_
#define _ULTRA64_THREAD_H_
#include "PR/ultratypes.h"
#define OS_PRIORITY_IDLE 10
#define OS_PRIORITY_MAIN 10
#define OS_PRIORITY_GRAPH 11
#define OS_PRIORITY_AUDIOMGR 12
#define OS_PRIORITY_PADMGR 14
#define OS_PRIORITY_SCHED 15
#define OS_PRIORITY_DMAMGR 16
#define OS_PRIORITY_IRQMGR 17
#define OS_PRIORITY_PIMGR 150
#define OS_PRIORITY_FAULTCLIENT 126
#define OS_PRIORITY_FAULT 127
#define OS_PRIORITY_APPMAX 127
#define OS_PRIORITY_RMONSPIN 200
#define OS_PRIORITY_RMON 250
#define OS_PRIORITY_VIMGR 254
#define OS_PRIORITY_MAX 255
#define OS_STATE_STOPPED (1 << 0)
#define OS_STATE_RUNNABLE (1 << 1)
#define OS_STATE_RUNNING (1 << 2)
#define OS_STATE_WAITING (1 << 3)
typedef s32 OSPri;
typedef s32 OSId;
typedef union {
struct {
/* 0x00 */ f32 f_odd;
/* 0x04 */ f32 f_even;
} f;
} __OSfp; // size = 0x08
typedef struct {
/* 0x000 */ u64 at, v0, v1, a0, a1, a2, a3;
/* 0x038 */ u64 t0, t1, t2, t3, t4, t5, t6, t7;
/* 0x078 */ u64 s0, s1, s2, s3, s4, s5, s6, s7;
/* 0x0B8 */ u64 t8, t9, gp, sp, s8, ra;
/* 0x0E8 */ u64 lo, hi;
/* 0x0F8 */ u32 sr, pc, cause, badvaddr, rcp;
/* 0x10C */ u32 fpcsr;
/* 0x110 */ __OSfp fp0, fp2, fp4, fp6, fp8, fp10, fp12, fp14;
/* 0x150 */ __OSfp fp16, fp18, fp20, fp22, fp24, fp26, fp28, fp30;
} __OSThreadContext; // size = 0x190
typedef struct {
/* 0x00 */ u32 flag;
/* 0x04 */ u32 count;
/* 0x08 */ u64 time;
} __OSThreadprofile; // size = 0x10
typedef struct OSThread {
/*0x00*/ struct OSThread* next;
/*0x04*/ OSPri priority;
/*0x08*/ struct OSThread** queue;
/*0x0C*/ struct OSThread* tlnext;
/*0x10*/ u16 state;
/*0x12*/ u16 flags;
/*0x14*/ OSId id;
/*0x18*/ s32 fp;
/*0x1C*/ __OSThreadprofile* thprof;
/*0x20*/ __OSThreadContext context;
} OSThread; // size = 0x1B0
#endif

View File

@ -3455,28 +3455,22 @@ extern StackEntry audioStackEntry;
extern StackEntry padmgrStackEntry;
extern AudioMgr audioContext;
extern PadMgr D_801FB620;
// extern UNK_TYPE1 D_801FBAA0;
// extern UNK_TYPE1 D_801FBAB0;
// extern UNK_TYPE1 D_801FBAB4;
// extern UNK_TYPE1 D_801FBAB8;
// extern UNK_TYPE1 D_801FBABC;
// extern UNK_TYPE1 D_801FBAC0;
// extern UNK_TYPE1 D_801FBAC4;
// extern UNK_TYPE1 D_801FBAC8;
// extern UNK_TYPE1 D_801FBACC;
// extern UNK_TYPE1 D_801FBAD0;
// extern UNK_TYPE1 D_801FBAD4;
extern FaultClient sSchedFaultClient;
extern OSTime sRSPGFXStartTime;
extern OSTime sRSPAudioStartTime;
extern OSTime sRSPOtherStartTime;
extern OSTime sRDPStartTime;
extern u64* gAudioSPDataPtr;
extern u32 gAudioSPDataSize;
// extern UNK_TYPE1 D_801FBAE0;
// extern UNK_TYPE1 D_801FBAE8;
extern volatile OSTime D_801FBAF0;
extern volatile OSTime lastRenderFrameDuration;
// extern UNK_TYPE1 D_801FBB00;
// extern UNK_TYPE1 D_801FBB04;
// extern UNK_TYPE1 D_801FBB08;
// extern UNK_TYPE1 D_801FBB0C;
// extern UNK_TYPE1 D_801FBB10;
// extern UNK_TYPE1 D_801FBB14;
// extern UNK_TYPE1 D_801FBB20;
extern volatile OSTime gRSPAudioTotalTime;
extern volatile OSTime sRSPGFXTotalTime;
extern volatile OSTime sRSPOtherTotalTime;
// extern UNK_TYPE1 D_801FBB18;
extern volatile OSTime gRDPTotalTime;
// extern UNK_TYPE1 D_801FBB28;
extern OSViMode D_801FBB30;
extern u32* gFramebuffers[2];

View File

@ -7,7 +7,6 @@
#include "PR/ultratypes.h"
#include "PR/gbi.h"
#include "PR/sched.h"
#include "io/controller.h"
#include "osint.h"
#include "viint.h"
@ -46,6 +45,7 @@
#define Z_THREAD_ID_IDLE 1
#define Z_THREAD_ID_SLOWLY 2
#define Z_THREAD_ID_MAIN 3
#define Z_THREAD_ID_SCHED 5
#define Z_THREAD_ID_DMAMGR 18
#define Z_THREAD_ID_IRQMGR 19
@ -267,6 +267,19 @@ typedef struct {
/* 0x20308 */ u16 tailMagic; // 5678
} GfxPool; // size = 0x20310
typedef struct {
/* 0x00 */ u16* fb1;
/* 0x04 */ u16* swapBuffer;
/* 0x08 */ OSViMode* viMode;
/* 0x0C */ u32 features;
/* 0x10 */ u8 unk_10;
/* 0x11 */ s8 updateRate;
/* 0x12 */ s8 updateRate2;
/* 0x13 */ u8 unk_13;
/* 0x14 */ f32 xScale;
/* 0x18 */ f32 yScale;
} CfbInfo; // size = 0x1C
typedef struct GraphicsContext {
/* 0x000 */ Gfx* polyOpaBuffer;
/* 0x004 */ Gfx* polyXluBuffer;
@ -1234,6 +1247,11 @@ typedef struct IrqMgrClient_t {
/* 0x4 */ OSMesgQueue* queue;
} IrqMgrClient; // size = 0x8
typedef struct {
/* 0x0 */ s16 type;
/* 0x2 */ u8 misc[30];
} OSScMsg;
typedef struct {
/* 0x000 */ OSScMsg verticalRetraceMesg;
/* 0x020 */ OSScMsg prenmiMsg;
@ -1281,25 +1299,41 @@ typedef struct {
#define OS_SC_RCP_MASK 0x0003
#define OS_SC_TYPE_MASK 0x0007
#define OS_SC_DP 0x0001
#define OS_SC_SP 0x0002
#define OS_SC_YIELD 0x0010
#define OS_SC_YIELDED 0x0020
typedef struct OSScTask {
/* 0x00 */ struct OSScTask* next;
/* 0x04 */ u32 state;
/* 0x08 */ u32 flags;
/* 0x0C */ CfbInfo* framebuffer;
/* 0x10 */ OSTask list;
/* 0x50 */ OSMesgQueue* msgQ;
/* 0x54 */ OSMesg msg;
} OSScTask; // size = 0x58
typedef struct {
/* 0x000 */ OSMesgQueue interruptQ;
/* 0x018 */ OSMesg intMsgBuf[64];
/* 0x118 */ OSMesgQueue cmdQ;
/* 0x130 */ OSMesg cmdMsgBuf[8];
/* 0x150 */ OSThread thread;
/* 0x300 */ UNK_TYPE4 unk300;
/* 0x304 */ UNK_TYPE4 unk304;
/* 0x308 */ UNK_TYPE4 unk308;
/* 0x30C */ UNK_TYPE4 unk30C;
/* 0x310 */ UNK_TYPE4 unk310;
/* 0x314 */ UNK_TYPE4 unk314;
/* 0x318 */ s32 unk318;
/* 0x31C */ UNK_TYPE1 pad31C[0x4];
/* 0x320 */ UNK_TYPE4 unk320;
/* 0x324 */ UNK_TYPE4 unk324;
/* 0x328 */ UNK_TYPE1 pad328[0x7];
/* 0x32F */ s8 unk32F;
/* 0x330 */ IrqMgrClient irqClient;
/* 0x0000 */ OSMesgQueue interruptQ;
/* 0x0018 */ OSMesg intBuf[64];
/* 0x0118 */ OSMesgQueue cmdQ;
/* 0x0130 */ OSMesg cmdMsgBuf[8];
/* 0x0150 */ OSThread thread;
/* 0x0300 */ OSScTask* audioListHead;
/* 0x0304 */ OSScTask* gfxListHead;
/* 0x0308 */ OSScTask* audioListTail;
/* 0x030C */ OSScTask* gfxListTail;
/* 0x0310 */ OSScTask* curRSPTask;
/* 0x0314 */ OSScTask* curRDPTask;
/* 0x0318 */ s32 retraceCount;
/* 0x0318 */ s32 doAudio;
/* 0x0320 */ CfbInfo* curBuf;
/* 0x0324 */ CfbInfo* pendingSwapBuf1;
/* 0x0328 */ CfbInfo* pendingSwapBuf2;
/* 0x032C */ char unk_32C[0x3];
/* 0x032F */ u8 shouldUpdateVi;
/* 0x0330 */ IrqMgrClient irqClient;
} SchedContext; // size = 0x338
typedef struct StackEntry_t {

1
spec
View File

@ -634,7 +634,6 @@ beginseg
include "build/src/code/padmgr.o"
include "build/data/code/padmgr.data.o"
include "build/src/code/sched.o"
include "build/data/code/sched.bss.o"
include "build/src/code/speed_meter.o"
include "build/data/code/speed_meter.data.o"
include "build/data/code/speed_meter.bss.o"

View File

@ -712,7 +712,10 @@ void Fault_ProcessClients(void) {
if (iter->callback) {
Fault_FillScreenBlack();
FaultDrawer_SetCharPad(-2, 0);
FaultDrawer_Printf("8CallBack (%d) %08x %08x %08x\n7", idx++, iter, iter->param0, iter->param1);
FaultDrawer_Printf("\x1A\x38"
"CallBack (%d) %08x %08x %08x\n"
"\x1A\x37",
idx++, iter, iter->param0, iter->param1);
FaultDrawer_SetCharPad(0, 0);
iter->callback(iter->param0, iter->param1);
Fault_WaitForInput();

View File

@ -51,7 +51,7 @@ void AudioMgr_HandleRetrace(AudioMgr* audioMgr) {
osSyncPrintf("AUDIO SP TIMEOUT %08x %08x\n", audioMgr->rspTask, audioMgr->rspTask->task);
if (retryCount >= 0) {
retryCount--;
func_8017703C(audioMgr->sched);
Sched_SendAudioCancelMsg(audioMgr->sched);
} else {
osSyncPrintf("audioMgr.c:もうダメ!死ぬ!\n");
osDestroyThread(NULL);

View File

@ -1,47 +1,602 @@
#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_80176280.s")
#define RSP_DONE_MSG 667
#define RDP_DONE_MSG 668
#define ENTRY_MSG 670
#define RDP_AUDIO_CANCEL_MSG 671
#define RSP_GFX_CANCEL_MSG 672
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_80176314.s")
FaultClient sSchedFaultClient;
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/Sched_Nop80176364.s")
OSTime sRSPGFXStartTime;
OSTime sRSPAudioStartTime;
OSTime sRSPOtherStartTime;
OSTime sRDPStartTime;
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_80176370.s")
u64* gAudioSPDataPtr;
u32 gAudioSPDataSize;
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_80176394.s")
void Sched_SwapFramebuffer(CfbInfo* cfbInfo) {
s32 one = 1;
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_801764F0.s")
if (cfbInfo->swapBuffer != NULL) {
osViSwapBuffer(cfbInfo->swapBuffer);
cfbInfo->updateRate2 = cfbInfo->updateRate;
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_8017668C.s")
if (SREG(62) == 0 && cfbInfo->viMode != NULL) {
D_80096B20 = one;
osViSetMode(cfbInfo->viMode);
osViSetSpecialFeatures(cfbInfo->features);
osViSetXScale(cfbInfo->xScale);
osViSetYScale(cfbInfo->yScale);
cfbInfo->viMode = NULL;
}
}
cfbInfo->unk_10 = 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_801766F0.s")
void Sched_RetraceUpdateFramebuffer(SchedContext* sched, CfbInfo* cfbInfo) {
if (sched->shouldUpdateVi) {
sched->shouldUpdateVi = false;
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_80176748.s")
if (gIrqMgrResetStatus == 0) {
ViConfig_UpdateVi(0);
}
}
Sched_SwapFramebuffer(cfbInfo);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_801767B8.s")
void Sched_HandleReset(SchedContext* sched) {
}
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_801768E0.s")
void Sched_HandleStop(SchedContext* sched) {
ViConfig_UpdateVi(1);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_8017691C.s")
/**
* Attempt to stop the RSP, if it is not already halted, by setting the halt bit in the
* SP status register and waiting. Regardless of the result, the scheduler will send an
* RSP_DONE_MSG back to itself.
* If there was no currently running audio task, it will dequeue the currently waiting
* audio task and notify the sender if the task is associated with a message queue.
*/
void Sched_HandleAudioCancel(SchedContext* sched) {
s32 i;
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_80176988.s")
// AUDIO SP Cancel
osSyncPrintf("AUDIO SP キャンセルします\n");
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_80176B34.s")
if (sched->curRSPTask != NULL && sched->curRSPTask->list.t.type == M_AUDTASK) {
if (!(HW_REG(SP_STATUS_REG, u32) & SP_STATUS_HALT)) {
// Attempts to stop AUDIO SP
osSyncPrintf("AUDIO SP止めようとします\n");
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_80176C24.s")
HW_REG(SP_STATUS_REG, u32) = SP_SET_HALT;
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_80176CF4.s")
i = 0;
while (!(HW_REG(SP_STATUS_REG, u32) & SP_STATUS_HALT)) {
if (i++ > 100) {
// AUDIO SP did not stop (10ms timeout)
osSyncPrintf("AUDIO SP止まりませんでした(10msタイムアウト)\n");
goto send_mesg;
}
Sleep_Usec(100);
}
// AUDIO SP stopped (% d * 100us)
osSyncPrintf("AUDIO SP止まりました(%d * 100us)\n", i);
} else {
// AUDIO SP seems to be stopped
osSyncPrintf("AUDIO SP止まっているようです\n");
}
send_mesg:
osSendMesg(&sched->interruptQ, RSP_DONE_MSG, OS_MESG_NOBLOCK);
return;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_80176F2C.s")
if (sched->audioListHead != NULL) {
OSScTask* cur = sched->audioListHead;
OSScTask* next = cur->next;
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/Sched_SendEntryMsg.s")
sched->audioListHead = next;
if (next == NULL) {
sched->audioListTail = NULL;
}
if (cur->msgQ != NULL) {
osSendMesg(cur->msgQ, cur->msg, OS_MESG_BLOCK);
}
// Removed AUDIO SP task from pending list
osSyncPrintf("AUDIO SP タスクを実行待ちリストから削除しました\n");
return;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_8017703C.s")
// There are no AUDIO SP tasks to cancel
osSyncPrintf("キャンセルすべき AUDIO SP タスクがありません\n");
}
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_80177060.s")
/**
* Attempt to stop the RSP, if it is not already halted, by setting the halt bit in the
* SP status register and waiting. Regardless of the result, the scheduler will send an
* RSP_DONE_MSG back to itself and attempt to stop the RDP.
* If there was no currently running gfx task, it will dequeue the currently waiting gfx
* task and notify the sender if the task is associated with a message queue.
* If there is an RDP task, the output buffer will be cleared and the scheduler will send
* an RDP_DONE_MSG back to itself.
*/
void Sched_HandleGfxCancel(SchedContext* sched) {
s32 i;
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_80177084.s")
// GRAPH SP Cancel
osSyncPrintf("GRAPH SP キャンセルします\n");
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/Sched_ThreadEntry.s")
if (sched->curRSPTask != NULL && sched->curRSPTask->list.t.type == M_GFXTASK) {
if (!(HW_REG(SP_STATUS_REG, u32) & SP_STATUS_HALT)) {
// GRAPH SP tries to stop
osSyncPrintf("GRAPH SP止めようとします\n");
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/Sched_Start.s")
HW_REG(SP_STATUS_REG, u32) = SP_SET_HALT;
i = 0;
while (!(HW_REG(SP_STATUS_REG, u32) & SP_STATUS_HALT)) {
if (i++ > 100) {
// GRAPH SP did not stop (10ms timeout)
osSyncPrintf("GRAPH SP止まりませんでした(10msタイムアウト)\n");
goto send_mesg;
}
Sleep_Usec(100);
}
// GRAPH SP stopped (%d * 100us)
osSyncPrintf("GRAPH SP止まりました(%d * 100us)\n", i);
} else {
// GRAPH SP seems to be stopped
osSyncPrintf("GRAPH SP止まっているようです\n");
}
send_mesg:
osSendMesg(&sched->interruptQ, RSP_DONE_MSG, OS_MESG_NOBLOCK);
goto halt_rdp;
}
if (sched->gfxListHead != NULL) {
OSScTask* cur = sched->gfxListHead;
OSScTask* next = cur->next;
sched->gfxListHead = next;
if (next == NULL) {
sched->gfxListTail = NULL;
}
if (cur->msgQ != NULL) {
osSendMesg(cur->msgQ, cur->msg, OS_MESG_BLOCK);
}
goto halt_rdp;
}
// There are no GRAPH SP tasks to cancel
osSyncPrintf("キャンセルすべき GRAPH SP タスクがありません\n");
halt_rdp:
if (sched->curRDPTask != NULL) {
OSTask_t* dpTask = &sched->curRDPTask->list.t;
if (dpTask->type == M_GFXTASK) {
// Try to stop DP
osSyncPrintf("DP止めようとします\n");
bzero(dpTask->output_buff, (u32)dpTask->output_buff_size - (u32)dpTask->output_buff);
osSendMesg(&sched->interruptQ, RDP_DONE_MSG, OS_MESG_NOBLOCK);
}
}
}
/**
* Adds a scheduler task to the appropriate linked list.
*/
void Sched_QueueTask(SchedContext* sched, OSScTask* task) {
s32 type = task->list.t.type;
if (type == M_AUDTASK) {
if (sched->audioListTail != NULL) {
sched->audioListTail->next = task;
} else {
sched->audioListHead = task;
}
sched->audioListTail = task;
} else {
if (sched->gfxListTail != NULL) {
sched->gfxListTail->next = task;
} else {
sched->gfxListHead = task;
}
sched->gfxListTail = task;
}
task->next = NULL;
task->state = task->flags & OS_SC_RCP_MASK;
}
void Sched_Yield(SchedContext* sched) {
// Don't yield audio tasks
if (sched->curRSPTask->list.t.type == M_AUDTASK) {
// A new audio task has been entered even though the previous audio task has not been completed yet
osSyncPrintf("まだ前回のオーディオタスクが完了していないのに新たなオーディオタスクがエントリされた\n");
} else if (!(sched->curRSPTask->state & OS_SC_YIELD)) {
sched->curRSPTask->state |= OS_SC_YIELD;
osSpTaskYield();
}
}
s32 Sched_TaskCheckFramebuffers(SchedContext* sched, OSScTask* task) {
void* nextFB = osViGetNextFramebuffer();
void* curFB = osViGetCurrentFramebuffer();
if (task == NULL || sched->pendingSwapBuf1 != NULL || (curFB == task->framebuffer->fb1 && curFB != nextFB)) {
return 0;
}
return 1;
}
/**
* Pops the next task from the appropriate linked list and returns it through spTask and dpTask.
*/
s32 Sched_Schedule(SchedContext* sched, OSScTask** spTask, OSScTask** dpTask, s32 state) {
s32 ret = state;
OSScTask* gfxTask = sched->gfxListHead;
OSScTask* audioTask = sched->audioListHead;
if ((ret & OS_SC_SP) && sched->audioListHead != NULL) {
*spTask = audioTask;
ret &= ~OS_SC_SP;
sched->audioListHead = sched->audioListHead->next;
if (sched->audioListHead == NULL) {
sched->audioListTail = NULL;
}
} else if (gfxTask != NULL) {
if (gfxTask->state & OS_SC_YIELDED || !(gfxTask->flags & OS_SC_NEEDS_RDP)) {
if (ret & OS_SC_SP) {
*spTask = gfxTask;
ret &= ~OS_SC_SP;
sched->gfxListHead = sched->gfxListHead->next;
if (sched->gfxListHead == NULL) {
sched->gfxListTail = NULL;
}
}
} else if (ret == (OS_SC_SP | OS_SC_DP)) {
if (gfxTask->framebuffer == NULL || Sched_TaskCheckFramebuffers(sched, gfxTask)) {
*spTask = *dpTask = gfxTask;
ret &= ~(OS_SC_SP | OS_SC_DP);
sched->gfxListHead = sched->gfxListHead->next;
if (sched->gfxListHead == NULL) {
sched->gfxListTail = NULL;
}
}
}
}
return ret;
}
void Sched_TaskUpdateFramebuffer(SchedContext* sched, OSScTask* task) {
sched->pendingSwapBuf1 = task->framebuffer;
if (sched->curBuf != NULL && sched->curBuf->updateRate2 > 0) {
return;
}
Sched_RetraceUpdateFramebuffer(sched, sched->pendingSwapBuf1);
}
/**
* If the task has been marked as completed, notify the sender through the task's
* associated message queue (if it has one) that the task has been completed. If the task
* flags dictate it should swap the framebuffer, do so.
*/
void Sched_NotifyDone(SchedContext* sched, OSScTask* task) {
if (!(task->state & (OS_SC_DP | OS_SC_SP))) {
if (task->msgQ != NULL) {
osSendMesg(task->msgQ, task->msg, OS_MESG_BLOCK);
}
if (task->flags & OS_SC_SWAPBUFFER) {
Sched_TaskUpdateFramebuffer(sched, task);
}
}
}
void Sched_RunTask(SchedContext* sched, OSScTask* spTask, OSScTask* dpTask) {
u64 time;
if (spTask != NULL) {
if (spTask->list.t.type == M_NULTASK) {
if (spTask->flags & OS_SC_NEEDS_RSP) {
spTask->state &= ~OS_SC_SP;
sched->curRSPTask = NULL;
}
if (spTask->flags & OS_SC_NEEDS_RDP) {
spTask->state &= ~OS_SC_DP;
sched->curRDPTask = NULL;
}
Sched_NotifyDone(sched, spTask);
return;
}
// Write back the data cache to ensure imminent SP DMA does not miss anything
if (spTask->list.t.type != M_AUDTASK && !(spTask->state & OS_SC_YIELDED)) {
osWritebackDCacheAll();
}
spTask->state &= ~(OS_SC_YIELD | OS_SC_YIELDED);
// Have the RSP download the task and prepare the RSP program counter
osSpTaskLoad(&spTask->list);
// Log the start time based on the type of task
time = osGetTime();
switch (spTask->list.t.type) {
case M_AUDTASK:
sRSPAudioStartTime = time;
break;
case M_GFXTASK:
sRSPGFXStartTime = time;
break;
default:
if (1) {}
sRSPOtherStartTime = time;
break;
}
if (spTask->list.t.type == M_AUDTASK) {
// Set global pointers to audio task data for use in audio processing
gAudioSPDataPtr = spTask->list.t.data_ptr;
gAudioSPDataSize = spTask->list.t.data_size;
}
// Begin task execution
osSpTaskStartGo(&spTask->list);
sched->curRSPTask = spTask;
if (spTask == dpTask && sched->curRDPTask == NULL) {
sched->curRDPTask = dpTask;
sRDPStartTime = sRSPGFXStartTime;
}
}
}
/**
* Enqueues any tasks that have been sent to the scheduler down the command queue.
*/
void Sched_HandleEntry(SchedContext* sched) {
OSScTask* spTask = NULL;
OSScTask* dpTask = NULL;
OSMesg msg = NULL;
s32 state;
// Fetch and enqueue waiting tasks
while (osRecvMesg(&sched->cmdQ, &msg, OS_MESG_NOBLOCK) != -1) {
Sched_QueueTask(sched, msg);
}
// If there is an audio task pending and an RSP task is running, yield the current task.
if (sched->audioListHead != NULL && sched->curRSPTask != NULL) {
Sched_Yield(sched);
return;
}
// Schedule and run the next task
state = ((sched->curRSPTask == NULL) << 1) | (sched->curRDPTask == NULL);
if (Sched_Schedule(sched, &spTask, &dpTask, state) != state) {
Sched_RunTask(sched, spTask, dpTask);
}
}
void Sched_HandleRetrace(SchedContext* sched) {
ViConfig_UpdateBlack();
sched->retraceCount++;
if (osViGetCurrentFramebuffer() ==
(void*)((sched->pendingSwapBuf1 != NULL) ? sched->pendingSwapBuf1->swapBuffer : NULL)) {
if (sched->curBuf != NULL) {
sched->curBuf->unk_10 = 0;
}
if (sched->pendingSwapBuf1 != NULL) {
sched->pendingSwapBuf1->unk_10 = 0;
}
sched->curBuf = sched->pendingSwapBuf1;
sched->pendingSwapBuf1 = NULL;
}
if (sched->curBuf != NULL) {
if (sched->curBuf->updateRate2 > 0) {
sched->curBuf->updateRate2--;
}
if (sched->curBuf->updateRate2 <= 0 && sched->pendingSwapBuf1 != NULL) {
Sched_RetraceUpdateFramebuffer(sched, sched->pendingSwapBuf1);
}
}
Sched_HandleEntry(sched);
}
void Sched_HandleRSPDone(SchedContext* sched) {
OSScTask* curRSP;
OSScTask* nextRSP = NULL;
OSScTask* nextRDP = NULL;
s32 state;
u64 time;
if (sched->curRSPTask == NULL) {
osSyncPrintf("__scHandleRSP:sc->curRSPTask == NULL\n");
return;
}
// Log the time based on the type of task
time = osGetTime();
switch (sched->curRSPTask->list.t.type) {
case M_AUDTASK:
gRSPAudioTotalTime += time - sRSPAudioStartTime;
break;
case M_GFXTASK:
sRSPGFXTotalTime += time - sRSPGFXStartTime;
break;
default:
if (1) {}
sRSPOtherTotalTime += time - sRSPOtherStartTime;
break;
}
curRSP = sched->curRSPTask;
sched->curRSPTask = NULL;
if (curRSP->list.t.type == M_AUDTASK) {
// Reset the global audio task data pointers
gAudioSPDataPtr = NULL;
gAudioSPDataSize = 0;
}
if ((curRSP->state & OS_SC_YIELD) && osSpTaskYielded(&curRSP->list)) {
// If the task was yielded, re-queue the task
curRSP->state |= OS_SC_YIELDED;
curRSP->next = sched->gfxListHead;
sched->gfxListHead = curRSP;
if (sched->gfxListTail == NULL) {
sched->gfxListTail = curRSP;
}
} else {
// Mark task completed
curRSP->state &= ~OS_SC_SP;
Sched_NotifyDone(sched, curRSP);
}
// Schedule and run next task
state = ((sched->curRSPTask == NULL) << 1) | (sched->curRDPTask == NULL);
if (Sched_Schedule(sched, &nextRSP, &nextRDP, state) != state) {
Sched_RunTask(sched, nextRSP, nextRDP);
}
}
void Sched_HandleRDPDone(SchedContext* sched) {
OSScTask* curRDP;
OSScTask* nextRSP = NULL;
OSScTask* nextRDP = NULL;
s32 state;
if (sched->curRDPTask == NULL) {
osSyncPrintf("__scHandleRDP:sc->curRDPTask == NULL\n");
return;
}
// Log run time
gRDPTotalTime = osGetTime() - sRDPStartTime;
// Mark task done
curRDP = sched->curRDPTask;
sched->curRDPTask = NULL;
curRDP->state &= ~OS_SC_DP;
Sched_NotifyDone(sched, curRDP);
// Schedule and run next task
state = ((sched->curRSPTask == NULL) << 1) | (sched->curRDPTask == NULL);
if (Sched_Schedule(sched, &nextRSP, &nextRDP, state) != state) {
Sched_RunTask(sched, nextRSP, nextRDP);
}
}
/**
* Sends a message to the scheduler to inform it that a new task has
* been sent down the command queue.
*/
void Sched_SendEntryMsg(SchedContext* sched) {
osSendMesg(&sched->interruptQ, ENTRY_MSG, OS_MESG_BLOCK);
}
/**
* Sends a message to the scheduler to inform it that it should attempt
* to stop the last dispatched audio task.
*/
void Sched_SendAudioCancelMsg(SchedContext* sched) {
osSendMesg(&sched->interruptQ, RDP_AUDIO_CANCEL_MSG, OS_MESG_BLOCK);
}
/**
* Sends a message to the scheduler to inform it that it should attempt
* to stop the last dispatched gfx task.
*/
void Sched_SendGfxCancelMsg(SchedContext* sched) {
osSendMesg(&sched->interruptQ, RSP_GFX_CANCEL_MSG, OS_MESG_BLOCK);
}
/**
* Fault Client for the scheduler. Reports information about the state of the scheduler
* and any current tasks in the crash debugger.
*/
void Sched_FaultClient(void* param1, void* param2) {
SchedContext* sched = (SchedContext*)param1;
OSScTask* spTask;
OSScTask* dpTask;
FaultDrawer_Printf("sched info\n", sched->gfxListHead, sched->gfxListTail, sched->audioListHead,
sched->audioListTail);
FaultDrawer_Printf("GRAPH %08x %08x\n", sched->gfxListHead, sched->gfxListTail);
FaultDrawer_Printf("AUDIO %08x %08x\n\n", sched->audioListHead, sched->audioListTail);
spTask = sched->curRSPTask;
if (spTask != NULL) {
FaultDrawer_Printf("RSPTask %08x %08x %02x %02x\n%01x %08x %08x\n", spTask, spTask->next, spTask->state,
spTask->flags, spTask->list.t.type, spTask->list.t.data_ptr, spTask->list.t.data_size);
}
dpTask = sched->curRDPTask;
if (dpTask != NULL) {
FaultDrawer_Printf("RDPTask %08x %08x %02x %02x\n", dpTask, dpTask->next, dpTask->state, dpTask->flags);
}
}
/**
* The main loop of the scheduler thread. Processes interrupt messages from
* the IrqMgr received through its IrqClient and messages sent to it from other
* threads or the OS.
*/
void Sched_ThreadEntry(void* arg) {
OSMesg msg = NULL;
SchedContext* sched = (SchedContext*)arg;
while (true) {
osRecvMesg(&sched->interruptQ, &msg, OS_MESG_BLOCK);
// Check if it's a message from another thread or the OS
switch ((s32)msg) {
case RDP_AUDIO_CANCEL_MSG:
Sched_HandleAudioCancel(sched);
continue;
case RSP_GFX_CANCEL_MSG:
Sched_HandleGfxCancel(sched);
continue;
case ENTRY_MSG:
Sched_HandleEntry(sched);
continue;
case RSP_DONE_MSG:
Sched_HandleRSPDone(sched);
continue;
case RDP_DONE_MSG:
Sched_HandleRDPDone(sched);
continue;
}
// Check if it's a message from the IrqMgr
switch (((OSScMsg*)msg)->type) {
case OS_SC_RETRACE_MSG:
Sched_HandleRetrace(sched);
continue;
case OS_SC_PRE_NMI_MSG:
Sched_HandleReset(sched);
continue;
case OS_SC_NMI_MSG:
Sched_HandleStop(sched);
continue;
}
}
}
/**
* Initializes the SchedContext and scheduler thread.
* Registers an IrqClient for the thread and fault client for the SchedContext.
* Directs the OS to send SP and DP OS messages to interruptQ when the RSP or RDP signal task completion.
*/
void Sched_Init(SchedContext* sched, void* stack, OSPri pri, UNK_TYPE arg3, UNK_TYPE arg4, IrqMgr* irqMgr) {
bzero(sched, sizeof(SchedContext));
sched->shouldUpdateVi = true;
osCreateMesgQueue(&sched->interruptQ, sched->intBuf, ARRAY_COUNT(sched->intBuf));
osCreateMesgQueue(&sched->cmdQ, sched->cmdMsgBuf, ARRAY_COUNT(sched->cmdMsgBuf));
osSetEventMesg(OS_EVENT_SP, &sched->interruptQ, RSP_DONE_MSG);
osSetEventMesg(OS_EVENT_DP, &sched->interruptQ, RDP_DONE_MSG);
IrqMgr_AddClient(irqMgr, &sched->irqClient, &sched->interruptQ);
Fault_AddClient(&sSchedFaultClient, Sched_FaultClient, sched, NULL);
osCreateThread(&sched->thread, Z_THREAD_ID_SCHED, Sched_ThreadEntry, sched, stack, pri);
osStartThread(&sched->thread);
}

View File

@ -1,5 +1,4 @@
#include "global.h"
#include "PR/hardware.h"
s32 __osEPiRawWriteIo(OSPiHandle* handle, u32 devAddr, u32 data) {
s32 status;

View File

@ -1,8 +1,8 @@
#include "global.h"
void osCreateMesgQueue(OSMesgQueue* mq, OSMesg* msq, s32 count) {
mq->mtqueue = (OSThread*)&__osThreadTail;
mq->fullqueue = (OSThread*)&__osThreadTail;
mq->mtQueue = (OSThread*)&__osThreadTail;
mq->fullQueue = (OSThread*)&__osThreadTail;
mq->validCount = 0;
mq->first = 0;
mq->msgCount = count;

View File

@ -8,7 +8,7 @@ s32 osJamMesg(OSMesgQueue* mq, OSMesg msg, s32 flag) {
while (mq->validCount >= mq->msgCount) {
if (flag == 1) {
__osRunningThread->state = 8;
__osEnqueueAndYield(&mq->fullqueue);
__osEnqueueAndYield(&mq->fullQueue);
} else {
__osRestoreInt(saveMask);
return -1;
@ -20,8 +20,8 @@ s32 osJamMesg(OSMesgQueue* mq, OSMesg msg, s32 flag) {
mq->msg[mq->first] = msg;
mq->validCount++;
if (mq->mtqueue->next != NULL) {
osStartThread(__osPopThread(&mq->mtqueue));
if (mq->mtQueue->next != NULL) {
osStartThread(__osPopThread(&mq->mtQueue));
}
__osRestoreInt(saveMask);

View File

@ -11,7 +11,7 @@ s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flags) {
return -1;
}
__osRunningThread->state = 8;
__osEnqueueAndYield(&mq->mtqueue);
__osEnqueueAndYield(&mq->mtQueue);
}
if (msg != NULL) {
@ -21,8 +21,8 @@ s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flags) {
mq->first = (mq->first + 1) % mq->msgCount;
mq->validCount--;
if (mq->fullqueue->next != NULL) {
osStartThread(__osPopThread(&mq->fullqueue));
if (mq->fullQueue->next != NULL) {
osStartThread(__osPopThread(&mq->fullQueue));
}
__osRestoreInt(saveMask);

View File

@ -9,7 +9,7 @@ s32 osSendMesg(OSMesgQueue* mq, OSMesg msg, s32 flags) {
while (mq->validCount >= mq->msgCount) {
if (flags == 1) {
__osRunningThread->state = 8;
__osEnqueueAndYield(&mq->fullqueue);
__osEnqueueAndYield(&mq->fullQueue);
} else {
__osRestoreInt(saveMask);
return -1;
@ -21,8 +21,8 @@ s32 osSendMesg(OSMesgQueue* mq, OSMesg msg, s32 flags) {
mq->msg[last] = msg;
mq->validCount++;
if (mq->mtqueue->next != NULL) {
osStartThread(__osPopThread(&mq->mtqueue));
if (mq->mtQueue->next != NULL) {
osStartThread(__osPopThread(&mq->mtQueue));
}
__osRestoreInt(saveMask);

View File

@ -3192,29 +3192,29 @@
0x80175FD4:("Padmgr_GetInput2",),
0x80176010:("Padmgr_ThreadEntry",),
0x80176194:("Padmgr_Start",),
0x80176280:("func_80176280",),
0x80176314:("func_80176314",),
0x80176364:("Sched_Nop80176364",),
0x80176370:("func_80176370",),
0x80176394:("func_80176394",),
0x801764F0:("func_801764F0",),
0x8017668C:("func_8017668C",),
0x801766F0:("func_801766F0",),
0x80176748:("func_80176748",),
0x801767B8:("func_801767B8",),
0x801768E0:("func_801768E0",),
0x8017691C:("func_8017691C",),
0x80176988:("func_80176988",),
0x80176B34:("func_80176B34",),
0x80176C24:("func_80176C24",),
0x80176CF4:("func_80176CF4",),
0x80176F2C:("func_80176F2C",),
0x80176280:("Sched_SwapFramebuffer",),
0x80176314:("Sched_RetraceUpdateFramebuffer",),
0x80176364:("Sched_HandleReset",),
0x80176370:("Sched_HandleStop",),
0x80176394:("Sched_HandleAudioCancel",),
0x801764F0:("Sched_HandleGfxCancel",),
0x8017668C:("Sched_QueueTask",),
0x801766F0:("Sched_Yield",),
0x80176748:("Sched_TaskCheckFramebuffers",),
0x801767B8:("Sched_Schedule",),
0x801768E0:("Sched_TaskUpdateFramebuffer",),
0x8017691C:("Sched_NotifyDone",),
0x80176988:("Sched_RunTask",),
0x80176B34:("Sched_HandleEntry",),
0x80176C24:("Sched_HandleRetrace",),
0x80176CF4:("Sched_HandleRSPDone",),
0x80176F2C:("Sched_HandleRDPDone",),
0x80177018:("Sched_SendEntryMsg",),
0x8017703C:("func_8017703C",),
0x80177060:("func_80177060",),
0x80177084:("func_80177084",),
0x8017703C:("Sched_SendAudioCancelMsg",),
0x80177060:("Sched_SendGfxCancelMsg",),
0x80177084:("Sched_FaultClient",),
0x8017715C:("Sched_ThreadEntry",),
0x801772A0:("Sched_Start",),
0x801772A0:("Sched_Init",),
0x80177390:("func_80177390",),
0x801773A0:("func_801773A0",),
0x801773C4:("func_801773C4",),

View File

@ -4217,28 +4217,24 @@
0x801FB318:("padmgrStackEntry","StackEntry","",0x1c),
0x801FB338:("audioContext","AudioMgr","",0x2e0),
0x801FB620:("D_801FB620","PadMgr","",0x480),
0x801FBAA0:("D_801FBAA0","UNK_TYPE1","",0x1),
0x801FBAB0:("D_801FBAB0","UNK_TYPE1","",0x1),
0x801FBAB4:("D_801FBAB4","UNK_TYPE1","",0x1),
0x801FBAB8:("D_801FBAB8","UNK_TYPE1","",0x1),
0x801FBABC:("D_801FBABC","UNK_TYPE1","",0x1),
0x801FBAC0:("D_801FBAC0","UNK_TYPE1","",0x1),
0x801FBAC4:("D_801FBAC4","UNK_TYPE1","",0x1),
0x801FBAC8:("D_801FBAC8","UNK_TYPE1","",0x1),
0x801FBACC:("D_801FBACC","UNK_TYPE1","",0x1),
0x801FBAD0:("D_801FBAD0","UNK_TYPE1","",0x1),
0x801FBAD4:("D_801FBAD4","UNK_TYPE1","",0x1),
0x801FBAA0:("sSchedFaultClient","UNK_TYPE1","",0x1),
0x801FBAB0:("sRSPGFXStartTime","OSTime","",0x8),
0x801FBAB8:("sRSPAudioStartTime","OSTime","",0x8),
0x801FBAC0:("sRSPOtherStartTime","OSTime","",0x8),
0x801FBAC8:("sRDPStartTime","OSTime","",0x8),
0x801FBAD0:("gAudioSPDataPtr","u64*","",0x4),
0x801FBAD4:("gAudioSPDataSize","u32","",0x4),
0x801FBAE0:("D_801FBAE0","UNK_TYPE1","",0x1),
0x801FBAE8:("D_801FBAE8","UNK_TYPE1","",0x1),
0x801FBAF0:("D_801FBAF0","volatile OSTime","",0x8),
0x801FBAF8:("lastRenderFrameDuration","volatile OSTime","",0x8),
0x801FBB00:("D_801FBB00","UNK_TYPE1","",0x1),
0x801FBB00:("gRSPAudioTotalTime","UNK_TYPE1","",0x1),
0x801FBB04:("D_801FBB04","UNK_TYPE1","",0x1),
0x801FBB08:("D_801FBB08","UNK_TYPE1","",0x1),
0x801FBB08:("sRSPGFXTotalTime","UNK_TYPE1","",0x1),
0x801FBB0C:("D_801FBB0C","UNK_TYPE1","",0x1),
0x801FBB10:("D_801FBB10","UNK_TYPE1","",0x1),
0x801FBB10:("sRSPOtherTotalTime","UNK_TYPE1","",0x1),
0x801FBB14:("D_801FBB14","UNK_TYPE1","",0x1),
0x801FBB20:("D_801FBB20","UNK_TYPE1","",0x1),
0x801FBB20:("gRDPTotalTime","UNK_TYPE1","",0x1),
0x801FBB28:("D_801FBB28","UNK_TYPE1","",0x1),
0x801FBB30:("D_801FBB30","OSViMode","",0x50),
0x801FBB80:("gFramebuffers","u32*","[2]",0x8),

View File

@ -2706,29 +2706,29 @@ asm/non_matchings/code/padmgr/Padmgr_GetInput.s,Padmgr_GetInput,0x80175F98,0xF
asm/non_matchings/code/padmgr/Padmgr_GetInput2.s,Padmgr_GetInput2,0x80175FD4,0xF
asm/non_matchings/code/padmgr/Padmgr_ThreadEntry.s,Padmgr_ThreadEntry,0x80176010,0x61
asm/non_matchings/code/padmgr/Padmgr_Start.s,Padmgr_Start,0x80176194,0x3B
asm/non_matchings/code/sched/func_80176280.s,func_80176280,0x80176280,0x25
asm/non_matchings/code/sched/func_80176314.s,func_80176314,0x80176314,0x14
asm/non_matchings/code/sched/Sched_Nop80176364.s,Sched_Nop80176364,0x80176364,0x3
asm/non_matchings/code/sched/func_80176370.s,func_80176370,0x80176370,0x9
asm/non_matchings/code/sched/func_80176394.s,func_80176394,0x80176394,0x57
asm/non_matchings/code/sched/func_801764F0.s,func_801764F0,0x801764F0,0x67
asm/non_matchings/code/sched/func_8017668C.s,func_8017668C,0x8017668C,0x19
asm/non_matchings/code/sched/func_801766F0.s,func_801766F0,0x801766F0,0x16
asm/non_matchings/code/sched/func_80176748.s,func_80176748,0x80176748,0x1C
asm/non_matchings/code/sched/func_801767B8.s,func_801767B8,0x801767B8,0x4A
asm/non_matchings/code/sched/func_801768E0.s,func_801768E0,0x801768E0,0xF
asm/non_matchings/code/sched/func_8017691C.s,func_8017691C,0x8017691C,0x1B
asm/non_matchings/code/sched/func_80176988.s,func_80176988,0x80176988,0x6B
asm/non_matchings/code/sched/func_80176B34.s,func_80176B34,0x80176B34,0x3C
asm/non_matchings/code/sched/func_80176C24.s,func_80176C24,0x80176C24,0x34
asm/non_matchings/code/sched/func_80176CF4.s,func_80176CF4,0x80176CF4,0x8E
asm/non_matchings/code/sched/func_80176F2C.s,func_80176F2C,0x80176F2C,0x3B
asm/non_matchings/code/sched/Sched_SwapFramebuffer.s,Sched_SwapFramebuffer,0x80176280,0x25
asm/non_matchings/code/sched/Sched_RetraceUpdateFramebuffer.s,Sched_RetraceUpdateFramebuffer,0x80176314,0x14
asm/non_matchings/code/sched/Sched_HandleReset.s,Sched_HandleReset,0x80176364,0x3
asm/non_matchings/code/sched/Sched_HandleStop.s,Sched_HandleStop,0x80176370,0x9
asm/non_matchings/code/sched/Sched_HandleAudioCancel.s,Sched_HandleAudioCancel,0x80176394,0x57
asm/non_matchings/code/sched/Sched_HandleGfxCancel.s,Sched_HandleGfxCancel,0x801764F0,0x67
asm/non_matchings/code/sched/Sched_QueueTask.s,Sched_QueueTask,0x8017668C,0x19
asm/non_matchings/code/sched/Sched_Yield.s,Sched_Yield,0x801766F0,0x16
asm/non_matchings/code/sched/Sched_TaskCheckFramebuffers.s,Sched_TaskCheckFramebuffers,0x80176748,0x1C
asm/non_matchings/code/sched/Sched_Schedule.s,Sched_Schedule,0x801767B8,0x4A
asm/non_matchings/code/sched/Sched_TaskUpdateFramebuffer.s,Sched_TaskUpdateFramebuffer,0x801768E0,0xF
asm/non_matchings/code/sched/Sched_NotifyDone.s,Sched_NotifyDone,0x8017691C,0x1B
asm/non_matchings/code/sched/Sched_RunTask.s,Sched_RunTask,0x80176988,0x6B
asm/non_matchings/code/sched/Sched_HandleEntry.s,Sched_HandleEntry,0x80176B34,0x3C
asm/non_matchings/code/sched/Sched_HandleRetrace.s,Sched_HandleRetrace,0x80176C24,0x34
asm/non_matchings/code/sched/Sched_HandleRSPDone.s,Sched_HandleRSPDone,0x80176CF4,0x8E
asm/non_matchings/code/sched/Sched_HandleRDPDone.s,Sched_HandleRDPDone,0x80176F2C,0x3B
asm/non_matchings/code/sched/Sched_SendEntryMsg.s,Sched_SendEntryMsg,0x80177018,0x9
asm/non_matchings/code/sched/func_8017703C.s,func_8017703C,0x8017703C,0x9
asm/non_matchings/code/sched/func_80177060.s,func_80177060,0x80177060,0x9
asm/non_matchings/code/sched/func_80177084.s,func_80177084,0x80177084,0x36
asm/non_matchings/code/sched/Sched_SendAudioCancelMsg.s,Sched_SendAudioCancelMsg,0x8017703C,0x9
asm/non_matchings/code/sched/Sched_SendGfxCancelMsg.s,Sched_SendGfxCancelMsg,0x80177060,0x9
asm/non_matchings/code/sched/Sched_FaultClient.s,Sched_FaultClient,0x80177084,0x36
asm/non_matchings/code/sched/Sched_ThreadEntry.s,Sched_ThreadEntry,0x8017715C,0x51
asm/non_matchings/code/sched/Sched_Start.s,Sched_Start,0x801772A0,0x3C
asm/non_matchings/code/sched/Sched_Init.s,Sched_Init,0x801772A0,0x3C
asm/non_matchings/code/speed_meter/func_80177390.s,func_80177390,0x80177390,0x4
asm/non_matchings/code/speed_meter/func_801773A0.s,func_801773A0,0x801773A0,0x9
asm/non_matchings/code/speed_meter/func_801773C4.s,func_801773C4,0x801773C4,0x3

1 asm/non_matchings/code/z_en_a_keep/EnAObj_Init.s EnAObj_Init 0x800A5AC0 0x2B
2706 asm/non_matchings/code/padmgr/Padmgr_GetInput2.s Padmgr_GetInput2 0x80175FD4 0xF
2707 asm/non_matchings/code/padmgr/Padmgr_ThreadEntry.s Padmgr_ThreadEntry 0x80176010 0x61
2708 asm/non_matchings/code/padmgr/Padmgr_Start.s Padmgr_Start 0x80176194 0x3B
2709 asm/non_matchings/code/sched/func_80176280.s asm/non_matchings/code/sched/Sched_SwapFramebuffer.s func_80176280 Sched_SwapFramebuffer 0x80176280 0x25
2710 asm/non_matchings/code/sched/func_80176314.s asm/non_matchings/code/sched/Sched_RetraceUpdateFramebuffer.s func_80176314 Sched_RetraceUpdateFramebuffer 0x80176314 0x14
2711 asm/non_matchings/code/sched/Sched_Nop80176364.s asm/non_matchings/code/sched/Sched_HandleReset.s Sched_Nop80176364 Sched_HandleReset 0x80176364 0x3
2712 asm/non_matchings/code/sched/func_80176370.s asm/non_matchings/code/sched/Sched_HandleStop.s func_80176370 Sched_HandleStop 0x80176370 0x9
2713 asm/non_matchings/code/sched/func_80176394.s asm/non_matchings/code/sched/Sched_HandleAudioCancel.s func_80176394 Sched_HandleAudioCancel 0x80176394 0x57
2714 asm/non_matchings/code/sched/func_801764F0.s asm/non_matchings/code/sched/Sched_HandleGfxCancel.s func_801764F0 Sched_HandleGfxCancel 0x801764F0 0x67
2715 asm/non_matchings/code/sched/func_8017668C.s asm/non_matchings/code/sched/Sched_QueueTask.s func_8017668C Sched_QueueTask 0x8017668C 0x19
2716 asm/non_matchings/code/sched/func_801766F0.s asm/non_matchings/code/sched/Sched_Yield.s func_801766F0 Sched_Yield 0x801766F0 0x16
2717 asm/non_matchings/code/sched/func_80176748.s asm/non_matchings/code/sched/Sched_TaskCheckFramebuffers.s func_80176748 Sched_TaskCheckFramebuffers 0x80176748 0x1C
2718 asm/non_matchings/code/sched/func_801767B8.s asm/non_matchings/code/sched/Sched_Schedule.s func_801767B8 Sched_Schedule 0x801767B8 0x4A
2719 asm/non_matchings/code/sched/func_801768E0.s asm/non_matchings/code/sched/Sched_TaskUpdateFramebuffer.s func_801768E0 Sched_TaskUpdateFramebuffer 0x801768E0 0xF
2720 asm/non_matchings/code/sched/func_8017691C.s asm/non_matchings/code/sched/Sched_NotifyDone.s func_8017691C Sched_NotifyDone 0x8017691C 0x1B
2721 asm/non_matchings/code/sched/func_80176988.s asm/non_matchings/code/sched/Sched_RunTask.s func_80176988 Sched_RunTask 0x80176988 0x6B
2722 asm/non_matchings/code/sched/func_80176B34.s asm/non_matchings/code/sched/Sched_HandleEntry.s func_80176B34 Sched_HandleEntry 0x80176B34 0x3C
2723 asm/non_matchings/code/sched/func_80176C24.s asm/non_matchings/code/sched/Sched_HandleRetrace.s func_80176C24 Sched_HandleRetrace 0x80176C24 0x34
2724 asm/non_matchings/code/sched/func_80176CF4.s asm/non_matchings/code/sched/Sched_HandleRSPDone.s func_80176CF4 Sched_HandleRSPDone 0x80176CF4 0x8E
2725 asm/non_matchings/code/sched/func_80176F2C.s asm/non_matchings/code/sched/Sched_HandleRDPDone.s func_80176F2C Sched_HandleRDPDone 0x80176F2C 0x3B
2726 asm/non_matchings/code/sched/Sched_SendEntryMsg.s Sched_SendEntryMsg 0x80177018 0x9
2727 asm/non_matchings/code/sched/func_8017703C.s asm/non_matchings/code/sched/Sched_SendAudioCancelMsg.s func_8017703C Sched_SendAudioCancelMsg 0x8017703C 0x9
2728 asm/non_matchings/code/sched/func_80177060.s asm/non_matchings/code/sched/Sched_SendGfxCancelMsg.s func_80177060 Sched_SendGfxCancelMsg 0x80177060 0x9
2729 asm/non_matchings/code/sched/func_80177084.s asm/non_matchings/code/sched/Sched_FaultClient.s func_80177084 Sched_FaultClient 0x80177084 0x36
2730 asm/non_matchings/code/sched/Sched_ThreadEntry.s Sched_ThreadEntry 0x8017715C 0x51
2731 asm/non_matchings/code/sched/Sched_Start.s asm/non_matchings/code/sched/Sched_Init.s Sched_Start Sched_Init 0x801772A0 0x3C
2732 asm/non_matchings/code/speed_meter/func_80177390.s func_80177390 0x80177390 0x4
2733 asm/non_matchings/code/speed_meter/func_801773A0.s func_801773A0 0x801773A0 0x9
2734 asm/non_matchings/code/speed_meter/func_801773C4.s func_801773C4 0x801773C4 0x3