summaryrefslogtreecommitdiff
path: root/arm9/lib/include
diff options
context:
space:
mode:
Diffstat (limited to 'arm9/lib/include')
-rw-r--r--arm9/lib/include/MB_mb.h45
-rw-r--r--arm9/lib/include/OS_init.h1
-rw-r--r--arm9/lib/include/OS_reset.h20
-rw-r--r--arm9/lib/include/OS_system.h1
-rw-r--r--arm9/lib/include/PXI_fifo.h33
-rw-r--r--arm9/lib/include/consts.h2
-rw-r--r--arm9/lib/include/mmap.h2
7 files changed, 104 insertions, 0 deletions
diff --git a/arm9/lib/include/MB_mb.h b/arm9/lib/include/MB_mb.h
new file mode 100644
index 00000000..128ea480
--- /dev/null
+++ b/arm9/lib/include/MB_mb.h
@@ -0,0 +1,45 @@
+//
+// Created by red031000 on 2020-05-06.
+//
+
+#ifndef POKEDIAMOND_MB_MB_H
+#define POKEDIAMOND_MB_MB_H
+
+#include "consts.h"
+
+#define MB_TYPE_ILLEGAL 0
+#define MB_TYPE_NORMAL 1
+#define MB_TYPE_MULTIBOOT 2
+
+typedef struct {
+ u16 length;
+ u16 rssi;
+ u16 bssid[3];
+ u16 ssidLength;
+ u8 ssid[32];
+ u16 capaInfo;
+ struct {
+ u16 basic;
+ u16 support;
+ } rateSet;
+ u16 beaconperiod;
+ u16 dtimPeriod;
+ u16 channel;
+ u16 cfpPeriod;
+ u16 cfpMaxDuration;
+} MBParentBssDesc;
+
+typedef struct {
+ u16 boot_type;
+ MBParentBssDesc parent_bss_desc;
+} MBParam;
+
+static inline const MBParam *MB_GetMultiBootParam() {
+ return (const MBParam *)HW_WM_BOOT_BUF;
+}
+
+static inline BOOL MB_IsMultiBootChild() {
+ return MB_GetMultiBootParam()->boot_type == MB_TYPE_MULTIBOOT;
+}
+
+#endif //POKEDIAMOND_MB_MB_H
diff --git a/arm9/lib/include/OS_init.h b/arm9/lib/include/OS_init.h
index 6fbfc826..0c74035d 100644
--- a/arm9/lib/include/OS_init.h
+++ b/arm9/lib/include/OS_init.h
@@ -16,6 +16,7 @@
#include "OS_arena.h"
#include "OS_alloc.h"
#include "OS_system.h"
+#include "OS_reset.h"
void OS_Init();
diff --git a/arm9/lib/include/OS_reset.h b/arm9/lib/include/OS_reset.h
new file mode 100644
index 00000000..c3b60c98
--- /dev/null
+++ b/arm9/lib/include/OS_reset.h
@@ -0,0 +1,20 @@
+//
+// Created by red031000 on 2020-05-06.
+//
+
+#ifndef POKEDIAMOND_OS_RESET_H
+#define POKEDIAMOND_OS_RESET_H
+
+#include "consts.h"
+#include "PXI_fifo.h"
+
+#define OS_PXI_COMMAND_MASK 0x7f00
+#define OS_PXI_COMMAND_SHIFT 8
+#define OS_PXI_COMMAND_RESET 0x10
+
+void OS_InitReset();
+void OSi_CommonCallback(PXIFifoTag tag, u32 data, BOOL err);
+void OSi_SendToPxi(u16 data);
+void OS_ResetSystem(u32 parameter);
+
+#endif //POKEDIAMOND_OS_RESET_H
diff --git a/arm9/lib/include/OS_system.h b/arm9/lib/include/OS_system.h
index 794e16d2..65c58f57 100644
--- a/arm9/lib/include/OS_system.h
+++ b/arm9/lib/include/OS_system.h
@@ -7,6 +7,7 @@
#include "function_target.h"
#include "consts.h"
+#include "function_target.h"
typedef enum {
OS_PROCMODE_USER=16,
diff --git a/arm9/lib/include/PXI_fifo.h b/arm9/lib/include/PXI_fifo.h
new file mode 100644
index 00000000..1d45dda2
--- /dev/null
+++ b/arm9/lib/include/PXI_fifo.h
@@ -0,0 +1,33 @@
+//
+// Created by red031000 on 2020-05-06.
+//
+
+#ifndef POKEDIAMOND_PXI_FIFO_H
+#define POKEDIAMOND_PXI_FIFO_H
+
+#include "function_target.h"
+
+ENUMS_ALWAYS_INT_ON
+typedef enum {
+ PXI_FIFO_TAG_EX = 0, // Extension format
+ PXI_FIFO_TAG_USER_0, // for application programmer, use it in free
+ PXI_FIFO_TAG_USER_1, // for application programmer, use it in free
+ PXI_FIFO_TAG_SYSTEM, // SDK inner usage
+ PXI_FIFO_TAG_NVRAM, // NVRAM
+ PXI_FIFO_TAG_RTC, // RTC
+ PXI_FIFO_TAG_TOUCHPANEL, // Touch Panel
+ PXI_FIFO_TAG_SOUND, // Sound
+ PXI_FIFO_TAG_PM, // Power Management
+ PXI_FIFO_TAG_MIC, // Microphone
+ PXI_FIFO_TAG_WM, // Wireless Manager
+ PXI_FIFO_TAG_FS, // File System
+ PXI_FIFO_TAG_OS, // OS
+ PXI_FIFO_TAG_CTRDG, // Cartridge
+ PXI_FIFO_TAG_CARD, // Card
+ PXI_FIFO_TAG_WVR, // Control driving wireless library
+ PXI_FIFO_TAG_CTRDG_Ex, // Cartridge Ex
+ PXI_MAX_FIFO_TAG = 32 // MAX FIFO TAG
+} PXIFifoTag;
+ENUMS_ALWAYS_INT_RESET
+
+#endif //POKEDIAMOND_PXI_FIFO_H
diff --git a/arm9/lib/include/consts.h b/arm9/lib/include/consts.h
index 0e5066de..c37d6269 100644
--- a/arm9/lib/include/consts.h
+++ b/arm9/lib/include/consts.h
@@ -48,6 +48,8 @@
#define HW_C6_PR_2GB 0x3c
#define HW_C6_PR_4GB 0x3e
+#define PXI_PROC_ARM7 0x01
+
#define OSi_CONSOLE_NOT_DETECT 0xffffffff
#define OS_CONSOLE_NITRO 0x80000000
diff --git a/arm9/lib/include/mmap.h b/arm9/lib/include/mmap.h
index 56ae08c8..27255115 100644
--- a/arm9/lib/include/mmap.h
+++ b/arm9/lib/include/mmap.h
@@ -25,6 +25,8 @@ extern u32 SDK_AUTOLOAD_DTCM_START[];
#define HW_CARD_ROM_HEADER_SIZE 0x00000160
#define HW_DOWNLOAD_PARAMETER_SIZE 0x00000020
+#define HW_RESET_PARAMETER_BUF (HW_MAIN_MEM + 0x007ffc20)
+#define HW_WM_BOOT_BUF (HW_MAIN_MEM + 0x007ffc40)
#define HW_ARENA_INFO_BUF (HW_MAIN_MEM + 0x007ffda0) // Arena data structure
#define HW_ROM_HEADER_BUF (HW_MAIN_MEM + 0x007ffe00) // ROM registration area data buffer
#define HW_RED_RESERVED (HW_MAIN_MEM + 0x007ff800) // Some kind of reserved data for shared memory