#include "common.h" #include "nu/nusys.h" #include "os_pi.h" void nuSiMgrThread(void* arg); extern u64 nuStackSiMgrThread[0x2000 / sizeof(u64)]; /* 1A060 80089C60 */ u8 nuSiMgrInit(void) { u8 pattern; OSContStatus status[NU_CONT_MAXCONTROLLERS]; osCreateMesgQueue(&nuSiMesgQ, nuSiMesgBuf, NU_SC_MAX_MESGS); osSetEventMesg(OS_EVENT_SI, &nuSiMesgQ, NULL); osContInit(&nuSiMesgQ, &pattern, status); osCreateThread(&siMgrThread, 5, nuSiMgrThread, NULL, nuStackSiMgrThread + 0x2000 / sizeof(u64), NU_SI_THREAD_PRI); osStartThread(&siMgrThread); return pattern; } s32 nuSiSendMesg(NUScMsg mesg, void* dataPtr) { OSMesgQueue rtnMesgQ; NUSiCommonMesg siCommonMesg; OSMesg sp38; siCommonMesg.mesg = mesg; siCommonMesg.dataPtr = dataPtr; siCommonMesg.rtnMesgQ = &rtnMesgQ; osCreateMesgQueue(&rtnMesgQ, &sp38, 1); osSendMesg(&MQ_800E7988, &siCommonMesg, OS_MESG_BLOCK); osRecvMesg(&rtnMesgQ, NULL, OS_MESG_BLOCK); return siCommonMesg.error; } void nuSiMgrStop(void) { nuSiSendMesg(NU_SI_STOP_MGR_MSG, NULL); } void nuSiMgrRestart(void) { osStartThread(&siMgrThread); } INCLUDE_ASM(const s32, "nu/nusimgr", nuSiMgrThread);