mirror of https://github.com/zeldaret/mm.git
migrate pimgr data and cleanup on initialize.c
This commit is contained in:
parent
b2bcdce978
commit
70d92f7383
3
spec
3
spec
|
|
@ -108,7 +108,6 @@ beginseg
|
|||
include "build/src/libultra/os/stoptimer.o"
|
||||
include "build/asm/boot/probetlb.text.o"
|
||||
include "build/src/libultra/io/pimgr.o"
|
||||
include "build/data/boot/pimgr.data.o"
|
||||
include "build/src/libultra/io/piacs.o"
|
||||
pad_text
|
||||
include "build/src/libultra/io/devmgr.o"
|
||||
|
|
@ -185,7 +184,7 @@ beginseg
|
|||
include "build/src/libultra/voice/voicegetstatus.o"
|
||||
include "build/src/libultra/io/cartrominit.o"
|
||||
include "build/src/libultra/gu/guS2DInitBg.o"
|
||||
include "build/data/boot/guS2DInitBg.data.o"
|
||||
include "build/data/boot/vimodefpallan1.data.o"
|
||||
include "build/src/libultra/io/pfsselectbank.o"
|
||||
include "build/src/libultra/io/contsetch.o"
|
||||
include "build/asm/boot/setfpccsr.text.o"
|
||||
|
|
|
|||
|
|
@ -1,14 +1,16 @@
|
|||
#include "global.h"
|
||||
#include "stack.h"
|
||||
|
||||
OSPiHandle __Dom1SpeedParam;
|
||||
OSPiHandle __Dom2SpeedParam;
|
||||
OSPiHandle __Dom1SpeedParam ALIGNED8;
|
||||
OSPiHandle __Dom2SpeedParam ALIGNED8;
|
||||
OSThread sPiMgrThread;
|
||||
STACK(sPiMgrStack, 0x1000);
|
||||
OSMesgQueue D_8009E3D0;
|
||||
OSMesg D_8009E3E8[1];
|
||||
OSMesgQueue piEventQueue ALIGNED8;
|
||||
OSMesg piEventBuf[1];
|
||||
|
||||
// TODO: migrate data
|
||||
OSDevMgr __osPiDevMgr = { 0 };
|
||||
OSPiHandle* __osPiTable = NULL;
|
||||
OSPiHandle* __osCurrentHandle[2] ALIGNED8 = { &__Dom1SpeedParam, &__Dom2SpeedParam };
|
||||
|
||||
void osCreatePiManager(OSPri pri, OSMesgQueue* cmdQ, OSMesg* cmdBuf, s32 cmdMsgCnt) {
|
||||
u32 savedMask;
|
||||
|
|
@ -17,11 +19,11 @@ void osCreatePiManager(OSPri pri, OSMesgQueue* cmdQ, OSMesg* cmdBuf, s32 cmdMsgC
|
|||
|
||||
if (!__osPiDevMgr.active) {
|
||||
osCreateMesgQueue(cmdQ, cmdBuf, cmdMsgCnt);
|
||||
osCreateMesgQueue(&D_8009E3D0, D_8009E3E8, ARRAY_COUNT(D_8009E3E8));
|
||||
osCreateMesgQueue(&piEventQueue, piEventBuf, ARRAY_COUNT(piEventBuf));
|
||||
if (!__osPiAccessQueueEnabled) {
|
||||
__osPiCreateAccessQueue();
|
||||
}
|
||||
osSetEventMesg(OS_EVENT_PI, &D_8009E3D0, (OSMesg)0x22222222);
|
||||
osSetEventMesg(OS_EVENT_PI, &piEventQueue, (OSMesg)0x22222222);
|
||||
oldPri = -1;
|
||||
myPri = osGetThreadPri(NULL);
|
||||
if (myPri < pri) {
|
||||
|
|
@ -32,7 +34,7 @@ void osCreatePiManager(OSPri pri, OSMesgQueue* cmdQ, OSMesg* cmdBuf, s32 cmdMsgC
|
|||
__osPiDevMgr.active = 1;
|
||||
__osPiDevMgr.thread = &sPiMgrThread;
|
||||
__osPiDevMgr.cmdQueue = cmdQ;
|
||||
__osPiDevMgr.evtQueue = &D_8009E3D0;
|
||||
__osPiDevMgr.evtQueue = &piEventQueue;
|
||||
__osPiDevMgr.acsQueue = &__osPiAccessQueue;
|
||||
__osPiDevMgr.piDmaCallback = __osPiRawStartDma;
|
||||
__osPiDevMgr.epiDmaCallback = __osEPiRawStartDma;
|
||||
|
|
|
|||
|
|
@ -7,16 +7,16 @@ typedef struct {
|
|||
/* 0x4 */ u32 ins_04; // addiu k0, k0, 0x39E0
|
||||
/* 0x8 */ u32 ins_08; // jr k0 ; __osException
|
||||
/* 0xC */ u32 ins_0C; // nop
|
||||
} struct_exceptionPreamble; // size = 0x10
|
||||
} __osExceptionVector; // size = 0x10
|
||||
|
||||
extern struct_exceptionPreamble __osExceptionPreamble;
|
||||
extern __osExceptionVector __osExceptionPreamble;
|
||||
|
||||
u64 osClockRate = OS_CLOCK_RATE;
|
||||
s32 osViClock = VI_NTSC_CLOCK;
|
||||
u32 __osShutdown = 0;
|
||||
u32 __OSGlobalIntMask = OS_IM_ALL;
|
||||
|
||||
UNK_TYPE4 D_8009CF70;
|
||||
u32 __osFinalrom;
|
||||
|
||||
void __createSpeedParam(void) {
|
||||
__Dom1SpeedParam.type = DEVICE_TYPE_INIT;
|
||||
|
|
@ -35,28 +35,28 @@ void __createSpeedParam(void) {
|
|||
void __osInitialize_common(void) {
|
||||
u32 pifdata;
|
||||
|
||||
D_8009CF70 = 1;
|
||||
__osFinalrom = 1;
|
||||
|
||||
__osSetSR(__osGetSR() | 0x20000000);
|
||||
__osSetFpcCsr(0x01000800);
|
||||
__osSetSR(__osGetSR() | SR_CU1);
|
||||
__osSetFpcCsr(FPCSR_FS | FPCSR_EV);
|
||||
__osSetWatchLo(0x04900000);
|
||||
|
||||
while (__osSiRawReadIo(0x1FC007FC, &pifdata)) {}
|
||||
|
||||
while (__osSiRawWriteIo(0x1FC007FC, pifdata | 8)) {}
|
||||
|
||||
*(struct_exceptionPreamble*)0x80000000 = __osExceptionPreamble;
|
||||
*(struct_exceptionPreamble*)0x80000080 = __osExceptionPreamble;
|
||||
*(struct_exceptionPreamble*)0x80000100 = __osExceptionPreamble;
|
||||
*(struct_exceptionPreamble*)0x80000180 = __osExceptionPreamble;
|
||||
*(__osExceptionVector*)UT_VEC = __osExceptionPreamble;
|
||||
*(__osExceptionVector*)XUT_VEC = __osExceptionPreamble;
|
||||
*(__osExceptionVector*)ECC_VEC = __osExceptionPreamble;
|
||||
*(__osExceptionVector*)E_VEC = __osExceptionPreamble;
|
||||
|
||||
osWritebackDCache(0x80000000, 400);
|
||||
osInvalICache(0x80000000, 400);
|
||||
osWritebackDCache((void*)UT_VEC, E_VEC - UT_VEC + sizeof(__osExceptionVector));
|
||||
osInvalICache((void*)UT_VEC, E_VEC - UT_VEC + sizeof(__osExceptionVector));
|
||||
__createSpeedParam();
|
||||
osUnmapTLBAll();
|
||||
osMapTLBRdb();
|
||||
|
||||
osClockRate = (u64)((osClockRate * 3LL) / 4ULL);
|
||||
osClockRate = osClockRate * 3 / 4;
|
||||
|
||||
if (osResetType == COLD_RESET) {
|
||||
bzero(osAppNMIBuffer, OS_APP_NMI_BUFSIZE);
|
||||
|
|
@ -70,13 +70,13 @@ void __osInitialize_common(void) {
|
|||
osViClock = VI_NTSC_CLOCK;
|
||||
}
|
||||
|
||||
if (__osGetCause() & 0x1000) {
|
||||
if (__osGetCause() & CAUSE_IP5) {
|
||||
while (true) {}
|
||||
}
|
||||
|
||||
IO_WRITE(AI_CONTROL_REG, AI_CONTROL_DMA_ON);
|
||||
IO_WRITE(AI_DACRATE_REG, 0x3FFF);
|
||||
IO_WRITE(AI_BITRATE_REG, 0xF);
|
||||
IO_WRITE(AI_DACRATE_REG, AI_MAX_DAC_RATE - 1);
|
||||
IO_WRITE(AI_BITRATE_REG, AI_MAX_BIT_RATE - 1);
|
||||
}
|
||||
|
||||
void __osInitialize_autodetect(void) {
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@
|
|||
0x80097FC0 : "osViModeMpalLan1",
|
||||
0x80098060 : "vi",
|
||||
0x800980D0 : "cartrominit",
|
||||
0x800980E0 : "guS2DInitBg",
|
||||
0x800980E0 : "vimodefpallan1",
|
||||
0x80098130 : "xldtob",
|
||||
0x80098160 : "vimgr",
|
||||
0x80098180 : "voicecontrolgain",
|
||||
|
|
|
|||
|
|
@ -336,14 +336,14 @@
|
|||
0x8009CF38:("__osEepromTimerQ","OSMesgQueue","",0x18),
|
||||
0x8009CF50:("__osEepromTimerMsg","OSMesg","",0x4),
|
||||
0x8009CF60:("sHandleStatus","UNK_TYPE1","",0x1),
|
||||
0x8009CF70:("D_8009CF70","UNK_TYPE4","",0x4),
|
||||
0x8009CF70:("__osFinalrom","UNK_TYPE4","",0x4),
|
||||
0x8009CF80:("__osThreadSave","OSThread","",0x1b0),
|
||||
0x8009D130:("__Dom1SpeedParam","OSPiHandle","",0x74),
|
||||
0x8009D1A8:("__Dom2SpeedParam","OSPiHandle","",0x74),
|
||||
0x8009D220:("sPiMgrThread","OSThread","",0x1b0),
|
||||
0x8009D3D0:("sPiMgrStack","u8","[4096]",0x1000),
|
||||
0x8009E3D0:("D_8009E3D0","OSMesgQueue","",0x18),
|
||||
0x8009E3E8:("D_8009E3E8","OSMesg","[1]",0x4),
|
||||
0x8009E3D0:("piEventQueue","OSMesgQueue","",0x18),
|
||||
0x8009E3E8:("piEventBuf","OSMesg","[1]",0x4),
|
||||
0x8009E3F0:("piAccessBuf","OSMesg","[1]",0x4),
|
||||
0x8009E3F8:("__osPiAccessQueue","OSMesgQueue","",0x18),
|
||||
0x8009E410:("__osPfsInodeCache","__OSInode","",0x100),
|
||||
|
|
|
|||
Loading…
Reference in New Issue