From 664fa0130a5381c5f647565a71f8fe248a0ebafa Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 29 Jan 2020 16:10:52 -0500 Subject: More doccing of linkManager --- include/librfu.h | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'include/librfu.h') diff --git a/include/librfu.h b/include/librfu.h index 97fd8044e..8fdee7317 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -473,16 +473,6 @@ struct RfuSIO32Id u16 unkA; }; -struct RfuAPIBuffer -{ - struct RfuLinkStatus linkStatus; - struct RfuStatic static_; - struct RfuFixed fixed; - struct RfuSlotStatusNI NI[RFU_CHILD_MAX]; - struct RfuSlotStatusUNI UNI[RFU_CHILD_MAX]; - struct RfuIntrStruct intr; -}; - extern struct STWIStatus *gSTWIStatus; extern struct RfuLinkStatus *gRfuLinkStatus; extern struct RfuStatic *gRfuStatic; @@ -499,7 +489,7 @@ s32 AgbRFU_checkID(u8); // librfu_rfu // API Initialization and Initial Settings // API Initialization -u16 rfu_initializeAPI(struct RfuAPIBuffer *APIBuffer, u16 buffByteSize, IntrFunc *sioIntrTable_p, bool8 copyInterruptToRam); +u16 rfu_initializeAPI(u32 *APIBuffer, u16 buffByteSize, IntrFunc *sioIntrTable_p, bool8 copyInterruptToRam); // Set Timer Interrupt void rfu_setTimerInterrupt(u8 timerNo, IntrFunc *timerIntrTable_p); // Resident Function called from within a V-Blank Interrupt @@ -600,7 +590,7 @@ u16 rfu_MBOOT_CHILD_inheritanceLinkStatus(void); // For Debug // Obtain address of the SWTI-layer receive buffer -struct RfuIntrStruct *rfu_getSTWIRecvBuffer(void); +u8 *rfu_getSTWIRecvBuffer(void); // Obtain RFU state void rfu_REQ_RFUStatus(void); u16 rfu_getRFUStatus(u8 *rfuState); -- cgit v1.2.3 From e3307a5b7abc9df8dcd6a0726e0b8fff3188c703 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 30 Jan 2020 14:54:21 -0500 Subject: Still more documentation of RFU --- include/librfu.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include/librfu.h') diff --git a/include/librfu.h b/include/librfu.h index 8fdee7317..f93006627 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -90,8 +90,9 @@ #define RFU_MBOOT_DOWNLOADER_SERIAL_NO 0x0000 // The game serial number of the multi-boot downloader (programs that boot without a Game Pak) -#define RFU_API_BUFF_SIZE_RAM 0x0e8c // Necessary size for buffer specified by rfu_initializeAPI (fast communication version that operates the library SIO interrupt routines in RAM) -#define RFU_API_BUFF_SIZE_ROM 0x052c // Necessary size for buffer specified by rfu_initializeAPI (fast communication version that operates the library SIO interrupt routines in ROM) +// Sizes are 0x28 larger in v1028 +#define RFU_API_BUFF_SIZE_RAM 0x0e64 // Necessary size for buffer specified by rfu_initializeAPI (fast communication version that operates the library SIO interrupt routines in RAM) +#define RFU_API_BUFF_SIZE_ROM 0x0504 // Necessary size for buffer specified by rfu_initializeAPI (fast communication version that operates the library SIO interrupt routines in ROM) #define RFU_CHILD_MAX 4 // Maximum number of slaves that can be connected to one parent device -- cgit v1.2.3 From 7e894aa4d0b6440ca34b590a2a9f86dc834ea400 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 31 Jan 2020 09:26:00 -0500 Subject: Decompile librfu_intr against agbcc_arm --- include/librfu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/librfu.h') diff --git a/include/librfu.h b/include/librfu.h index f93006627..2b5b39620 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -315,7 +315,7 @@ struct STWIStatus u8 unk_17; void (*callbackM)(); void (*callbackS)(u16); - void (*unk_20)(void); + void (*callbackID)(void); union RfuPacket *txPacket; union RfuPacket *rxPacket; vu8 unk_2c; -- cgit v1.2.3 From 7d77b9312365e0282d7546c514859ac20e2fea51 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 31 Jan 2020 13:27:10 -0500 Subject: Use SIO_ defines in librfu_intr --- include/librfu.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/librfu.h') diff --git a/include/librfu.h b/include/librfu.h index 2b5b39620..4b41e9a71 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -71,6 +71,7 @@ #define ID_CPR_POLL_REQ 0x0033 #define ID_CPR_END_REQ 0x0034 #define ID_UNK35_REQ 0x0035 // not defined in SDK header +#define ID_UNK36_REQ 0x0036 // not defined in SDK header #define ID_RESUME_RETRANSMIT_AND_CHANGE_REQ 0x0037 #define ID_STOP_MODE_REQ 0x003d #define ID_CLOCK_SLAVE_MS_CHANGE_ERROR_BY_DMA_REQ 0x00ff // When the AGB is the clock slave, the RFU generates an informational notice, and an automatically started DMA, such as HDMA, is generated at the instant the AGB is being returned as the clock master. This ID is notified by a REQ callback when the exchange of this information (REQ command) fails. -- cgit v1.2.3 From 2d4c0040040908809c5fc1ff33faf6a2b693d1ab Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 31 Jan 2020 15:30:52 -0500 Subject: More documentation and symbol propagation --- include/librfu.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'include/librfu.h') diff --git a/include/librfu.h b/include/librfu.h index 4b41e9a71..f0f6aefee 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -4,11 +4,8 @@ #include "global.h" #include "main.h" -/* TODOs: - * - split files +/* TODOs: * - documentation - * - decompile librfu_intr.s once arm support is back again - (for internal structs not documented in SDK) * - check if any field needs to be volatile * - check if field names make sense */ -- cgit v1.2.3 From 88bda9fabd069ed281d845568b7d3c748bdea0e4 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 31 Jan 2020 16:23:04 -0500 Subject: Dcoument args to two STWI routines --- include/librfu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/librfu.h') diff --git a/include/librfu.h b/include/librfu.h index f0f6aefee..c7dc0574d 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -615,14 +615,14 @@ void STWI_send_DataRxREQ(void); void STWI_send_MS_ChangeREQ(void); void STWI_send_StopModeREQ(void); void STWI_send_SystemStatusREQ(void); -void STWI_send_GameConfigREQ(const u8 *unk1, const u8 *data); +void STWI_send_GameConfigREQ(const u8 *serial_uname, const u8 *gname); void STWI_send_ResetREQ(void); void STWI_send_LinkStatusREQ(void); void STWI_send_VersionStatusREQ(void); void STWI_send_SlotStatusREQ(void); void STWI_send_ConfigStatusREQ(void); void STWI_send_ResumeRetransmitAndChangeREQ(void); -void STWI_send_SystemConfigREQ(u16 unk1, u8 unk2, u8 unk3); +void STWI_send_SystemConfigREQ(u16 availSlotFlag, u8 maxMFrame, u8 mcTimer); void STWI_send_SC_StartREQ(void); void STWI_send_SC_PollingREQ(void); void STWI_send_SC_EndREQ(void); -- cgit v1.2.3 From 5ca03c0e32a723f9551b93e5aceb7b39d8ea10e6 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 31 Jan 2020 16:57:52 -0500 Subject: name STWIStatus.unk_2c --- include/librfu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/librfu.h') diff --git a/include/librfu.h b/include/librfu.h index c7dc0574d..33f370bf0 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -316,7 +316,7 @@ struct STWIStatus void (*callbackID)(void); union RfuPacket *txPacket; union RfuPacket *rxPacket; - vu8 unk_2c; + vu8 sending; }; // This struct is used as u8 array in SDK. -- cgit v1.2.3 From 08aafe093caecf160417edb6b0635a9707a30989 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 1 Feb 2020 15:34:33 -0500 Subject: More rfu documentation --- include/librfu.h | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'include/librfu.h') diff --git a/include/librfu.h b/include/librfu.h index 33f370bf0..cf738486e 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -461,27 +461,15 @@ struct RfuStatic u32 totalPacketSize; }; -struct RfuSIO32Id -{ - u8 unk0; - u8 unk1; - u16 unk2; - u16 unk4; - u16 unk6; - u16 unk8; // unused - u16 unkA; -}; - extern struct STWIStatus *gSTWIStatus; extern struct RfuLinkStatus *gRfuLinkStatus; extern struct RfuStatic *gRfuStatic; extern struct RfuFixed *gRfuFixed; extern struct RfuSlotStatusNI *gRfuSlotStatusNI[RFU_CHILD_MAX]; extern struct RfuSlotStatusUNI *gRfuSlotStatusUNI[RFU_CHILD_MAX]; -extern struct RfuSIO32Id gRfuSIO32Id; // librfu_s32id -s32 AgbRFU_checkID(u8); +s32 AgbRFU_checkID(u8 maxTries); // Arguments with "bm..." specify slots of the form (0x01 << slot number) that are the object of a function operation. -- cgit v1.2.3 From 0d60939fd7c58354552d8482980a8acf481aa4e2 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 1 Feb 2020 16:46:52 -0500 Subject: Some small fixes --- include/librfu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/librfu.h') diff --git a/include/librfu.h b/include/librfu.h index cf738486e..df5a5b79a 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -454,7 +454,7 @@ struct RfuStatic u8 linkEmergencyFlag[4]; u8 lsFixedCount[4]; u16 cidBak[4]; - u16 unk_1a; + u16 linkEmergencyLimit; u16 reqResult; u16 tryPid; u16 watchdogTimer; -- cgit v1.2.3 From a59d87837836606dbcdb234ac1ca7ff025a02f6a Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 1 Feb 2020 17:01:29 -0500 Subject: Use RFU_CHILD_MAX for four arrays --- include/librfu.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/librfu.h') diff --git a/include/librfu.h b/include/librfu.h index df5a5b79a..83523433c 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -451,9 +451,9 @@ struct RfuStatic u8 nullFrameCount; u8 emberCount; u8 SCStartFlag; - u8 linkEmergencyFlag[4]; - u8 lsFixedCount[4]; - u16 cidBak[4]; + u8 linkEmergencyFlag[RFU_CHILD_MAX]; + u8 lsFixedCount[RFU_CHILD_MAX]; + u16 cidBak[RFU_CHILD_MAX]; u16 linkEmergencyLimit; u16 reqResult; u16 tryPid; -- cgit v1.2.3 From fafcdf3c60d34d09d6cac0058c5a679783cbb11c Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 10 Feb 2020 13:19:15 -0500 Subject: Multiversion support for api buff size --- include/librfu.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/librfu.h') diff --git a/include/librfu.h b/include/librfu.h index 83523433c..50dd1c3db 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -88,9 +88,13 @@ #define RFU_MBOOT_DOWNLOADER_SERIAL_NO 0x0000 // The game serial number of the multi-boot downloader (programs that boot without a Game Pak) -// Sizes are 0x28 larger in v1028 +#if LIBRFU_VERSION >= 1028 +#define RFU_API_BUFF_SIZE_RAM 0x0e8c // Necessary size for buffer specified by rfu_initializeAPI (fast communication version that operates the library SIO interrupt routines in RAM) +#define RFU_API_BUFF_SIZE_ROM 0x052c // Necessary size for buffer specified by rfu_initializeAPI (fast communication version that operates the library SIO interrupt routines in ROM) +#else #define RFU_API_BUFF_SIZE_RAM 0x0e64 // Necessary size for buffer specified by rfu_initializeAPI (fast communication version that operates the library SIO interrupt routines in RAM) #define RFU_API_BUFF_SIZE_ROM 0x0504 // Necessary size for buffer specified by rfu_initializeAPI (fast communication version that operates the library SIO interrupt routines in ROM) +#endif #define RFU_CHILD_MAX 4 // Maximum number of slaves that can be connected to one parent device -- cgit v1.2.3 From fb8ac4af93c238155d8f8e8076b4a7f3aa24914b Mon Sep 17 00:00:00 2001 From: jiangzhengwenjz Date: Sun, 16 Feb 2020 11:51:04 +0800 Subject: match RFU SDK v1.0.26 --- include/librfu.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'include/librfu.h') diff --git a/include/librfu.h b/include/librfu.h index 50dd1c3db..3c9d776f1 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -4,6 +4,8 @@ #include "global.h" #include "main.h" +#define LIBRFU_VERSION 1024 + /* TODOs: * - documentation * - check if any field needs to be volatile @@ -307,7 +309,11 @@ struct STWIStatus u8 ackActiveCommand; u8 timerSelect; u8 unk_b; - u32 timerState; // this field is s32 in emerald +#if LIBRFU_VERSION >= 1026 + s32 timerState; +#else + u32 timerState; +#endif vu8 timerActive; u8 unk_11; vu16 error; @@ -472,7 +478,7 @@ extern struct RfuFixed *gRfuFixed; extern struct RfuSlotStatusNI *gRfuSlotStatusNI[RFU_CHILD_MAX]; extern struct RfuSlotStatusUNI *gRfuSlotStatusUNI[RFU_CHILD_MAX]; -// librfu_s32id +// librfu_sio32id s32 AgbRFU_checkID(u8 maxTries); // Arguments with "bm..." specify slots of the form (0x01 << slot number) that are the object of a function operation. -- cgit v1.2.3