summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshinyquagsire23 <mtinc2@gmail.com>2017-09-12 20:11:51 -0600
committershinyquagsire23 <mtinc2@gmail.com>2017-09-12 20:11:51 -0600
commitdd316b28e017d24567a86e972d780a43d42cd140 (patch)
tree925a3a1f2fa41db8eb67bbf9f5937357742943a5 /src
parenta8a6816f0e6e6c20aa1ae23bf8030153c147b075 (diff)
Decompile up to ARM functions in librfu, split ARM interrupt functions into their own .s
Diffstat (limited to 'src')
-rw-r--r--src/librfu.c49
1 files changed, 47 insertions, 2 deletions
diff --git a/src/librfu.c b/src/librfu.c
index 37b76ec3e..e647b9178 100644
--- a/src/librfu.c
+++ b/src/librfu.c
@@ -115,8 +115,8 @@ int STWI_start_Command(void);
void STWI_intr_timer(void);
void STWI_set_timer(u8 unk);
extern void STWI_stop_timer(void);
-extern void STWI_restart_Command(void);
-extern void STWI_reset_ClockCounter(void);
+int STWI_restart_Command(void);
+int STWI_reset_ClockCounter(void);
void STWI_init_all(struct RfuIntrStruct *interruptStruct, IntrFunc *interrupt, bool8 copyInterruptToRam)
{
@@ -741,3 +741,48 @@ int STWI_start_Command()
return 0;
}
+
+int STWI_restart_Command(void)
+{
+ if (gRfuState->unk_15 <= 1)
+ {
+ gRfuState->unk_15++;
+ STWI_start_Command();
+ }
+ else
+ {
+ if (gRfuState->activeCommand == RFU_MS_CHANGE || gRfuState->activeCommand == RFU_DATA_TX_AND_CHANGE || gRfuState->activeCommand == RFU_UNK35 || gRfuState->activeCommand == RFU_RESUME_RETRANSMIT_AND_CHANGE)
+ {
+ gRfuState->unk_12 = 1;
+ gRfuState->unk_2c = 0;
+
+ if (gRfuState->callbackM)
+ gRfuState->callbackM(gRfuState->activeCommand, gRfuState->unk_12);
+ }
+ else
+ {
+ gRfuState->unk_12 = 1;
+ gRfuState->unk_2c = 0;
+
+ if (gRfuState->callbackM)
+ gRfuState->callbackM(gRfuState->activeCommand, gRfuState->unk_12);
+
+ gRfuState->unk_0 = 4; //TODO: what's 4
+ }
+ }
+
+ return 0;
+}
+
+int STWI_reset_ClockCounter()
+{
+ gRfuState->unk_0 = 5; //TODO: what is 5
+ gRfuState->txParams = 0;
+ gRfuState->unk_5 = 0;
+ REG_SIODATA32 = (1 << 31);
+ REG_SIOCNT = 0;
+ REG_SIOCNT = SIO_INTR_ENABLE | SIO_32BIT_MODE | SIO_115200_BPS;
+ REG_SIOCNT = (SIO_INTR_ENABLE | SIO_32BIT_MODE | SIO_115200_BPS) + 0x7F;
+
+ return 0;
+}