Skip to content

Commit 340fd77

Browse files
committed
post-tuxedo fixup
1 parent 6361f0d commit 340fd77

1 file changed

Lines changed: 8 additions & 13 deletions

File tree

‎libogc/stm.c‎

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ distribution.
3434
#include "ipc.h"
3535
#include "system.h"
3636
#include "asm.h"
37-
#include "processor.h"
38-
#include "cache.h"
37+
#include "tuxedo/ppc/intrinsics.h"
38+
#include "tuxedo/ppc/cache.h"
3939
#include "stm.h"
4040

4141
//#define DEBUG_STM
@@ -132,17 +132,17 @@ s32 __STM_SendCommand(s32 ioctl, const void *inbuf, u32 inlen, void *outbuf, u32
132132
s32 __STM_SetEventHook(void)
133133
{
134134
s32 ret;
135-
u32 level;
135+
PPCIrqState irq;
136136

137137
if(__stm_initialized==0) return STM_ENOTINIT;
138138

139139
__stm_ehclear = 0;
140140

141-
_CPU_ISR_Disable(level);
141+
irq = PPCIrqLockByMsr();
142142
ret = IOS_IoctlAsync(__stm_eh_fd,IOCTL_STM_EVENTHOOK,__stm_ehbufin,0x20,__stm_ehbufout,0x20,__STMEventHandler,NULL);
143143
if(ret<0) __stm_ehregistered = 0;
144144
else __stm_ehregistered = 1;
145-
_CPU_ISR_Restore(level);
145+
PPCIrqUnlockByMsr(irq);
146146

147147
return ret;
148148
}
@@ -195,10 +195,9 @@ stmcallback STM_RegisterEventHandler(stmcallback newhandler)
195195

196196
__attribute__((noreturn))
197197
static void WaitForImpendingDoom(void) {
198-
u32 level;
199-
_CPU_ISR_Disable(level);
200-
ICFlashInvalidate();
201-
ppchalt();
198+
// PPCIrqState irq = PPCIrqLockByMsr();
199+
// PPCICacheInvalidate();
200+
for (;;);
202201
}
203202

204203
s32 STM_ShutdownToStandby(void)
@@ -296,7 +295,6 @@ struct STM_LedFlashConfig
296295
u16 patterns[STM_MAX_LED_PATTERNS];
297296
};
298297

299-
// capitalization of LED is debatable. libogc currently has STM_SetLedMode, meanwhile this function is internally called ISTM_StartLEDFlashLoop
300298
s32 STM_StartLedFlashLoop(u8 pattern_id, u8 priority, u8 flags, const u16* patterns, u32 num_patterns)
301299
{
302300
s32 ret;
@@ -323,9 +321,6 @@ s32 STM_StartLedFlashLoop(u8 pattern_id, u8 priority, u8 flags, const u16* patte
323321
return ret;
324322
}
325323

326-
// This is where __stm_vdinuse would come into play
327-
// https://github.com/koopthekoopa/wii-ipl/blob/main/libs/RVL_SDK/src/os/OSStateTM.c#L176
328-
// I guess it's to prevent the function from being called 0ms after it was called the first time. Not sure why.
329324
s32 STM_VIDimming(bool enable, u32 luma, u32 chroma)
330325
{
331326
s32 ret;

0 commit comments

Comments
 (0)