Files
ultrasm64-2/lib/src/func_802F4A20.c

41 lines
1.2 KiB
C
Raw Normal View History

2020-02-03 00:51:26 -05:00
#include "new_func.h"
2020-06-02 12:44:34 -04:00
void func_802F4A20(void) {
2020-02-03 00:51:26 -05:00
__OSTranxInfo *sp1c;
volatile u32 sp18;
sp1c = &__osDiskHandle->transferInfo;
WAIT_ON_IOBUSY(sp18);
HW_REG(ASIC_BM_CTL, u32) = BUFFER_MANAGER_RESET | sp1c->bmCtlShadow; //should be unk10??
WAIT_ON_IOBUSY(sp18);
HW_REG(ASIC_BM_CTL, u32) = sp1c->bmCtlShadow;
func_802F4B08();
HW_REG(PI_STATUS_REG, u32) = PI_STATUS_CLEAR_INTR;
2020-12-03 14:26:38 -05:00
__OSGlobalIntMask |= 0x00100401; // TODO: fix magic numbers
2020-02-03 00:51:26 -05:00
}
typedef struct OSEventMessageStruct_0_s {
OSMesgQueue *queue;
OSMesg msg;
} OSEventMessageStruct_0;
2020-12-03 14:26:38 -05:00
extern OSEventMessageStruct_0 __osEventStateTab[16]; // should be OS_NUM_EVENTS + 1 I think
2020-06-02 12:44:34 -04:00
void func_802F4B08(void) {
2020-02-03 00:51:26 -05:00
OSEventMessageStruct_0 *sp2c;
OSMesgQueue *sp28;
u32 sp24;
register OSThread *s0;
2020-12-03 14:26:38 -05:00
sp2c = &__osEventStateTab[OS_EVENT_PI];
2020-02-03 00:51:26 -05:00
sp28 = sp2c->queue;
2020-12-03 14:26:38 -05:00
if (!sp28 || sp28->validCount >= sp28->msgCount) {
2020-02-03 00:51:26 -05:00
return;
2020-12-03 14:26:38 -05:00
}
2020-02-03 00:51:26 -05:00
sp24 = (sp28->first + sp28->validCount) % sp28->msgCount;
sp28->msg[sp24] = sp2c->msg;
2021-10-14 15:25:30 -04:00
sp28->validCount++;
2020-02-03 00:51:26 -05:00
if (sp28->mtqueue->next != NULL) {
s0 = __osPopThread(&sp28->mtqueue);
__osEnqueueThread(&D_80334898, s0);
}
}