diff options
Diffstat (limited to 'include/gba')
-rw-r--r-- | include/gba/flash_internal.h | 7 | ||||
-rw-r--r-- | include/gba/gba.h | 1 | ||||
-rw-r--r-- | include/gba/io_reg.h | 35 | ||||
-rw-r--r-- | include/gba/multiboot.h | 55 | ||||
-rw-r--r-- | include/gba/syscall.h | 2 |
5 files changed, 94 insertions, 6 deletions
diff --git a/include/gba/flash_internal.h b/include/gba/flash_internal.h index 6156b6c14..cbcfb5466 100644 --- a/include/gba/flash_internal.h +++ b/include/gba/flash_internal.h @@ -65,6 +65,10 @@ u16 ReadFlashId(void); void StartFlashTimer(u8 phase); void SetReadFlash1(u16 *dest); void StopFlashTimer(void); +u16 SetFlashTimerIntr(u8 timerNum, void (**intrFunc)(void)); +u32 ProgramFlashSectorAndVerify(u16 sectorNum, u8 *src); +void ReadFlash(u16 sectorNum, u32 offset, u8 *dest, u32 size); +u32 ProgramFlashSectorAndVerifyNBytes(u16 sectorNum, u8 *src, u32 n); u16 WaitForFlashWrite_Common(u8 phase, u8 *addr, u8 lastData); @@ -73,4 +77,7 @@ u16 EraseFlashSector_MX(u16 sectorNum); u16 ProgramFlashByte_MX(u16 sectorNum, u32 offset, u8 data); u16 ProgramFlashSector_MX(u16 sectorNum, u8 *src); +// agb_flash_1m +u16 IdentifyFlash(void); + #endif // GUARD_GBA_FLASH_INTERNAL_H diff --git a/include/gba/gba.h b/include/gba/gba.h index 26342cf88..42ae3cdde 100644 --- a/include/gba/gba.h +++ b/include/gba/gba.h @@ -4,6 +4,7 @@ #include "gba/defines.h" #include "gba/io_reg.h" #include "gba/types.h" +#include "gba/multiboot.h" #include "gba/syscall.h" #include "gba/macro.h" diff --git a/include/gba/io_reg.h b/include/gba/io_reg.h index 0be92fa60..c0874bcbb 100644 --- a/include/gba/io_reg.h +++ b/include/gba/io_reg.h @@ -495,12 +495,12 @@ // I/O register fields // DISPCNT -#define DISPCNT_MODE_0 0x0000 -#define DISPCNT_MODE_1 0x0001 -#define DISPCNT_MODE_2 0x0002 -#define DISPCNT_MODE_3 0x0003 -#define DISPCNT_MODE_4 0x0004 -#define DISPCNT_MODE_5 0x0005 +#define DISPCNT_MODE_0 0x0000 // BG0: text, BG1: text, BG2: text, BG3: text +#define DISPCNT_MODE_1 0x0001 // BG0: text, BG1: text, BG2: affine, BG3: off +#define DISPCNT_MODE_2 0x0002 // BG0: off, BG1: off, BG2: affine, BG3: affine +#define DISPCNT_MODE_3 0x0003 // Bitmap mode, 240x160, BGR555 color +#define DISPCNT_MODE_4 0x0004 // Bitmap mode, 240x160, 256 color palette +#define DISPCNT_MODE_5 0x0005 // Bitmap mode, 160x128, BGR555 color #define DISPCNT_OBJ_1D_MAP 0x0040 #define DISPCNT_FORCED_BLANK 0x0080 #define DISPCNT_BG0_ON 0x0100 @@ -521,6 +521,26 @@ #define DISPSTAT_HBLANK_INTR 0x0010 // H-Blank interrupt enabled #define DISPSTAT_VCOUNT_INTR 0x0020 // V-Count interrupt enabled +// BGCNT +#define BGCNT_PRIORITY(n) (n) // Values 0 - 3. Lower priority BGs will be drawn on top of higher priority BGs. +#define BGCNT_CHARBASE(n) ((n) << 2) // Values 0 - 3. Base block for tile pixel data. +#define BGCNT_MOSAIC 0x0040 +#define BGCNT_16COLOR 0x0000 // 4 bits per pixel +#define BGCNT_256COLOR 0x0080 // 8 bits per pixel +#define BGCNT_SCREENBASE(n) ((n) << 8) // Values 0 - 31. Base block for tile map. +#define BGCNT_WRAP 0x2000 // Only affects affine BGs. Text BGs wrap by default. +#define BGCNT_TXT256x256 0x0000 // Internal screen size size of text mode BG in pixels. +#define BGCNT_TXT512x256 0x4000 +#define BGCNT_TXT256x512 0x8000 +#define BGCNT_TXT512x512 0xC000 +#define BGCNT_AFF128x128 0x0000 // Internal screen size size of affine mode BG in pixels. +#define BGCNT_AFF256x256 0x4000 +#define BGCNT_AFF512x512 0x8000 +#define BGCNT_AFF1024x1024 0xC000 + +// BLDCNT + + // SOUNDCNT_H #define SOUND_CGB_MIX_QUARTER 0x0000 #define SOUND_CGB_MIX_HALF 0x0001 @@ -577,6 +597,8 @@ #define TIMER_ENABLE 0x80 // serial +#define SIO_ID 0x0030 // Communication ID + #define SIO_8BIT_MODE 0x0000 // Normal 8-bit communication mode #define SIO_32BIT_MODE 0x1000 // Normal 32-bit communication mode #define SIO_MULTI_MODE 0x2000 // Multi-player communication mode @@ -589,6 +611,7 @@ #define SIO_MULTI_SI 0x0004 // Multi-player communication SI terminal #define SIO_MULTI_SD 0x0008 // SD terminal +#define SIO_MULTI_BUSY 0x0080 #define SIO_ERROR 0x0040 // Detect error #define SIO_START 0x0080 // Start transfer diff --git a/include/gba/multiboot.h b/include/gba/multiboot.h new file mode 100644 index 000000000..e88b43a19 --- /dev/null +++ b/include/gba/multiboot.h @@ -0,0 +1,55 @@ +#ifndef GUARD_GBA_MULTIBOOT_H +#define GUARD_GBA_MULTIBOOT_H + +#define MULTIBOOT_NCHILD 3 // Maximum number of slaves +#define MULTIBOOT_HEADER_SIZE 0xc0 // Header size +#define MULTIBOOT_SEND_SIZE_MIN 0x100 // Minimum transmission size +#define MULTIBOOT_SEND_SIZE_MAX 0x40000 // Maximum transmission size + +struct MultiBootParam +{ + u32 system_work[5]; + u8 handshake_data; + u8 padding; + u16 handshake_timeout; + u8 probe_count; + u8 client_data[MULTIBOOT_NCHILD]; + u8 palette_data; + u8 response_bit; + u8 client_bit; + u8 reserved1; + u8 *boot_srcp; + u8 *boot_endp; + u8 *masterp; + u8 *reserved2[MULTIBOOT_NCHILD]; + u32 system_work2[4]; + u8 sendflag; + u8 probe_target_bit; + u8 check_wait; + u8 server_type; +}; + +#define MULTIBOOT_ERROR_04 0x04 +#define MULTIBOOT_ERROR_08 0x08 +#define MULTIBOOT_ERROR_0c 0x0c +#define MULTIBOOT_ERROR_40 0x40 +#define MULTIBOOT_ERROR_44 0x44 +#define MULTIBOOT_ERROR_48 0x48 +#define MULTIBOOT_ERROR_4c 0x4c +#define MULTIBOOT_ERROR_80 0x80 +#define MULTIBOOT_ERROR_84 0x84 +#define MULTIBOOT_ERROR_88 0x88 +#define MULTIBOOT_ERROR_8c 0x8c +#define MULTIBOOT_ERROR_NO_PROBE_TARGET 0x50 +#define MULTIBOOT_ERROR_NO_DLREADY 0x60 +#define MULTIBOOT_ERROR_BOOT_FAILURE 0x70 +#define MULTIBOOT_ERROR_HANDSHAKE_FAILURE 0x71 + +#define MULTIBOOT_CONNECTION_CHECK_WAIT 15 + +#define MULTIBOOT_SERVER_TYPE_NORMAL 0 +#define MULTIBOOT_SERVER_TYPE_QUICK 1 + +#define MULTIBOOT_HANDSHAKE_TIMEOUT 400 + +#endif // GUARD_GBA_MULTIBOOT_H diff --git a/include/gba/syscall.h b/include/gba/syscall.h index e47f964d1..deddec5ba 100644 --- a/include/gba/syscall.h +++ b/include/gba/syscall.h @@ -43,4 +43,6 @@ void RLUnCompWram(const void *src, void *dest); void RLUnCompVram(const void *src, void *dest); +int MultiBoot(struct MultiBootParam *mp); + #endif // GUARD_GBA_SYSCALL_H |