mirror of https://github.com/zeldaret/tmc.git
45 lines
972 B
C
45 lines
972 B
C
#ifndef GUARD_GBA_FLASH_INTERNAL_H
|
|
#define GUARD_GBA_FLASH_INTERNAL_H
|
|
|
|
#define FLASH_BASE ((u8*)0xE000000)
|
|
|
|
#define FLASH_WRITE(addr, data) ((*(vu8*)(FLASH_BASE + (addr))) = (data))
|
|
|
|
#define FLASH_ROM_SIZE_1M 131072 // 1 megabit ROM
|
|
|
|
#define SECTORS_PER_BANK 16
|
|
|
|
struct FlashSector {
|
|
u32 size;
|
|
u8 shift;
|
|
u16 count;
|
|
u16 top;
|
|
};
|
|
|
|
struct FlashType {
|
|
u32 romSize;
|
|
struct FlashSector sector;
|
|
u16 wait[2]; // game pak bus read/write wait
|
|
|
|
// TODO: add support for anonymous unions/structs if possible
|
|
union {
|
|
struct {
|
|
u8 makerId;
|
|
u8 deviceId;
|
|
} separate;
|
|
u16 joined;
|
|
} ids;
|
|
};
|
|
|
|
struct FlashSetupInfo {
|
|
u16 (*programFlashByte)(u16, u32, u8);
|
|
u16 (*programFlashSector)(u16, void*);
|
|
u16 (*eraseFlashChip)(void);
|
|
u16 (*eraseFlashSector)(u16);
|
|
u16 (*WaitForFlashWrite)(u8, u8*, u8);
|
|
const u16* maxTime;
|
|
struct FlashType type;
|
|
};
|
|
|
|
#endif // GUARD_GBA_FLASH_INTERNAL_H
|