From 0d8802035b955caa61a476a994f8744019925a67 Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Fri, 19 Jul 2024 22:31:25 -0700 Subject: [PATCH] 7D140 OK (#50) * Split 7D140 * func_8007C540 OK * func_8007C5EC OK * func_8007C61C OK * func_8007C640 OK * bss * Reorder global.h --- include/global.h | 3 +++ include/ys64thread.h | 2 ++ linker_scripts/us/symbol_addrs.txt | 5 +++++ src/main/7D140.c | 30 ++++++++++++++++++++++++++++++ yamls/us/main.yaml | 7 +++++-- 5 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 src/main/7D140.c diff --git a/include/global.h b/include/global.h index bd7418e..92c04e0 100644 --- a/include/global.h +++ b/include/global.h @@ -69,6 +69,7 @@ OSMesgQueue* func_800744B0(UNK_PTR arg0); void func_800748B0(UNK_PTR arg0); void func_8007451C(UNK_PTR arg0, OSMesgQueue* arg1); void func_80074C88(UNK_PTR, struct Input*, s32); +void func_80075020(UNK_PTR, OSMesgQueue*, UNK_PTR, s32, s32, void*); // dma void DmaMgr_RequestSync(void* ram, u32 vrom, u32 size); @@ -101,9 +102,11 @@ extern MallocRecord D_800F8E58; extern u8 D_800FAAF8; extern u8 D_800FAB1C; extern u8 D_800FAB20; +extern UNK_TYPE D_801001F8; extern UNK_TYPE D_80108620; extern UNK_TYPE D_80108624; extern UNK_TYPE D_80108628; +extern struct Input D_8010DEE0; extern UNK_TYPE D_8010DF40; diff --git a/include/ys64thread.h b/include/ys64thread.h index 9f7f414..65585c6 100644 --- a/include/ys64thread.h +++ b/include/ys64thread.h @@ -4,11 +4,13 @@ #define Y_THREAD_ID_IDLE 1 #define Y_THREAD_ID_FAULT 2 #define Y_THREAD_ID_MAIN 3 +#define Y_THREAD_ID_PAD 7 #define Y_THREAD_ID_DMA 18 #define Y_THREAD_ID_EEPMGR 20 #define Y_PRIORITY_IDLE 10 #define Y_PRIORITY_MAIN 10 +#define Y_PRIORITY_PAD 15 #define Y_PRIORITY_EEPMGR 16 #define Y_PRIORITY_DMA 18 #define Y_PRIORITY_FAULT OS_PRIORITY_APPMAX diff --git a/linker_scripts/us/symbol_addrs.txt b/linker_scripts/us/symbol_addrs.txt index a803684..75a6988 100644 --- a/linker_scripts/us/symbol_addrs.txt +++ b/linker_scripts/us/symbol_addrs.txt @@ -146,3 +146,8 @@ sMainStack = 0x800FD5B8; sMainStackInfo = 0x800FFCB8; sPiMgrCmdQueue = 0x80100490; sPiMgrCmdBuff = 0x80100470; +sSerialEventQueue = 0x8010DAA0; +sSerialMsgBuff = 0x8010DAB8; +sPadStack = 0x8010DAC0; +sPadStackInfo = 0x8010DEC0; +D_8010DEE0 = 0x8010DEE0; diff --git a/src/main/7D140.c b/src/main/7D140.c new file mode 100644 index 0000000..3993d9c --- /dev/null +++ b/src/main/7D140.c @@ -0,0 +1,30 @@ +#include "global.h" + +#include "pad.h" +#include "stack.h" +#include "stackcheck.h" +#include "ys64thread.h" + +OSMesgQueue sSerialEventQueue; +OSMesg sSerialMsgBuff[1]; +STACK(sPadStack, 0x400); +StackEntry sPadStackInfo; + +void func_8007C540(void) { + osCreateMesgQueue(&sSerialEventQueue, sSerialMsgBuff, ARRAY_COUNT(sSerialMsgBuff)); + osSetEventMesg(OS_EVENT_SI, &sSerialEventQueue, NULL); + StackCheck_Init(&sPadStackInfo, sPadStack, STACK_TOP(sPadStack), 0, 0x100, "padmgr"); + func_80075020(&D_8010DF40, &sSerialEventQueue, &D_801001F8, Y_THREAD_ID_PAD, Y_PRIORITY_PAD, STACK_TOP(sPadStack)); +} + +void func_8007C5EC(void) { + func_80074C88(&D_8010DF40, &D_8010DEE0, 1); +} + +void func_8007C61C(void) { + func_800744B0(&D_8010DF40); +} + +void func_8007C640(OSMesgQueue* arg0) { + func_8007451C(&D_8010DF40, arg0); +} diff --git a/yamls/us/main.yaml b/yamls/us/main.yaml index 28c756b..a59001c 100644 --- a/yamls/us/main.yaml +++ b/yamls/us/main.yaml @@ -80,7 +80,7 @@ - [0x79D60, asm] # Probably has at least 2 file split - [0x7CA70, asm] - [0x7CC30, asm] - - [0x7D140, asm] + - [0x7D140, c, 7D140] - [0x7D270, asm] - [0x7D9A0, c, eepmgr] - [0x7E1E0, asm] @@ -349,7 +349,8 @@ - [0xB3600, rodata] - [0xB3640, rodata, 7CA70] - [0xB3690, rodata, 7CC30] - - [0xB36A0, rodata, 7D140] + - [0xB36A0, .rodata, 7D140] + - [0xB36B0, rodata, 7D270] - [0xB36E0, .rodata, eepmgr] - [0xB39F0, .rodata, dmamgr] - [0xB3AA0, rodata, 7EC30] @@ -382,6 +383,8 @@ - {type: bss, vram: 0x800B4CB0, name: 800B4CB0} - {type: .bss, vram: 0x80108630, name: fault} - {type: bss, vram: 0x801090D0, name: 801090D0} + - {type: .bss, vram: 0x8010DAA0, name: 7D140} + - {type: bss, vram: 0x8010DEE0, name: 8010DEE0} - {type: .bss, vram: 0x8010E840, name: dmamgr} - {type: .bss, vram: 0x8010ED90, name: 7EFD0}