20 *(
volatile u8 *)0x0E005555 = 0xAA;
21 *(
volatile u8 *)0x0E002AAA = 0x55;
22 *(
volatile u8 *)0x0E005555 = 0x80;
23 *(
volatile u8 *)0x0E005555 = 0xAA;
24 *(
volatile u8 *)0x0E002AAA = 0x55;
25 *(
volatile u8 *)0x0E005555 = 0x10;
45 volatile u16 *waitcnt;
55 setting = *waitcnt & 0xFFFC;
57 *waitcnt = setting | chip->
wait[0];
61 command = (
volatile u8 *)0x0E005555;
63 unlock = (
volatile u8 *)0x0E002AAA;
75 *waitcnt = (*waitcnt & 0xFFFC) | 3;
84 *(
volatile u8 *)0x0e005555 = 0xaa;
85 *(
volatile u8 *)0x0e002aaa = 0x55;
86 *(
volatile u8 *)0x0e005555 = 0xa0;
87 *destination = *source;
89 return (*
wait)(1, destination, *source);
100 u16 *destinationCode;
106 volatile u16 *waitcnt;
117 destinationCode = (
u16 *)ramCode;
120 while (remaining != 0) {
121 *destinationCode = *sourceCode;
124 remaining = remaining - 2;
137 attempt = attempt + 1;
149 while (index <= rounds) {
157 setting = *waitcnt & 0xFFFC;
159 *waitcnt = setting | chip->
wait[0];
164 while (*counter != 0) {
169 *counter = *counter - 1;
184 if (*cursor++ != 0xff)
u16 gFlashNumRemainingBytes
u16 gFlash_Handler3
Credits scroll position in pixels, in the low half of a flash work cell.
void CopyFlashReadRoutineToRam(void *destination)
Copies the byte reader to RAM and installs its Thumb entry point.
Flash memory: erasing, programming and reading sectors.
The flash chips: sector size and count, and each chip type's routines.
u16(*) FlashWaitProc(u8 timingIndex, volatile u8 *address, u8 expected)
const struct FlashType * gFlash
The hardware's I/O registers and their bits, as pret names them.
s32 _call_via_r3(s32, s32, s32, s32)
s32 RunFlashEraseVerifier(u8 *ptr, s32(*verify)(u8 *))
Converts a nonzero erased-byte remainder into the flash verification error.
u16 ProgramFlashSectorWithEraseRetry(u16 sector, u8 *source)
Erases and verifies a sector with retries, then programs its bytes.
u16 EraseFlashSector(u16 sector)
Erases one of sixteen sectors, restoring the cartridge wait setting afterward.
s32 CountRemainingErasedFlashBytes(u8 *ptr)
Returns how many bytes remain when the first non-erased byte is found.
u16 ProgramFlashByte(u8 *source, u8 *destination)
Issues a byte-program command and waits for its destination to match.
u16 EraseFlashChip(void)
Issues the chip-erase command and waits for an erased byte.
Flash chip type (the 24-byte record pointed to by gFlash).
struct FlashSector sector
u16 wait[2]
Low two bits of REG_WAITCNT.