22 *(
volatile u8 *)0x0e005555 = 0xaa;
23 *(
volatile u8 *)0x0e002aaa = 0x55;
24 *(
volatile u8 *)0x0e005555 = 0x90;
27 volatile u16 *delay = &locals.delay;
35 result = (
u16)readByte((
u8 *)0x0e000001) << 8;
36 result |= readByte((
u8 *)0x0e000000);
38 *(
volatile u8 *)0x0e005555 = 0xaa;
39 *(
volatile u8 *)0x0e002aaa = 0x55;
40 *(
volatile u8 *)0x0e005555 = 0xf0;
43 volatile u16 *delay = &locals.delay;
70 while (((
u8 *)&(*chip)->type.id)[0] != 0) {
71 if (
id == (*chip)->type.id) {
99 if (((
u32)ticksRemaining << 16) == 0) {
131 *timerRegister = *timing;
134 *timerRegister = timing[1];
142 u16 *timerRegister = *savedTimerAddress;
146 *savedTimerAddress = timerRegister;
149 *savedTimerAddress = timerRegister;
162 u16 *destinationCode = destination;
164 u16 halfwordsRemaining;
168 sourceCode = (
u16 *)((
s32)sourceCode ^ 1);
171 while (halfwordsRemaining != 0) {
172 *destinationCode++ = *sourceCode++;
173 halfwordsRemaining--;
191 *(
volatile u8 *)0x0e005555 = 0xf0;
192 result = timingIndex | 0xc000;
202 u32 remaining = size - 1;
206 *destination++ = *source++;
207 }
while (remaining-- != 0);
217 u16 *destinationCode;
218 u16 halfwordsRemaining;
223 sourceCode = (
u16 *)((
u32)sourceCode ^ 1);
224 destinationCode = code;
226 while (halfwordsRemaining != 0) {
227 *destinationCode++ = *sourceCode++;
228 halfwordsRemaining--;
239 u16 index = size - 1;
241 while (index != 0xFFFF) {
242 u8 rightByte = *right;
247 if (rightByte != leftByte) {
255typedef u8 *(*FlashVerifyCore)(
u8 *source,
u8 *flash,
u16 size);
262 u16 *destinationCode;
263 u16 halfwordsRemaining;
268 sourceCode = (
u16 *)((
u32)sourceCode ^ 1);
269 destinationCode = code;
271 while (halfwordsRemaining != 0) {
272 *destinationCode++ = *sourceCode++;
273 halfwordsRemaining--;
276 return (
s32)core((
u8 *)source,
u16 gFlash_Handler3
Credits scroll position in pixels, in the low half of a flash work cell.
void StopFlashTimer(void)
Stops the flash timer and restores the saved interrupt-enable state.
u16 WaitForFlashWrite(u8 timingIndex, volatile u8 *address, u8 expected)
Polls for the expected byte until success or timeout, returning an operation error.
u8 * VerifyFlashCore(u8 *left, u8 *right, u16 size)
Returns the first differing byte in the right buffer, or NULL when all bytes match.
s32 ReadFlashId(void)
Enters flash ID mode, waits for the chip and reads its device and manufacturer IDs.
void(*) FlashReadCore(const u8 *source, u8 *destination, u32 size)
s32 SetFlashTimerIntr(u8 timerIndex, void(**callback)(void))
Selects a hardware timer and returns its timeout interrupt callback.
void FlashTimerIntr(void)
Counts down the active flash timeout and marks its expiration.
void ReadFlash(u16 sector, u32 offset, u8 *destination, s32 size)
Copies the RAM reader and reads a range using the standard sector geometry.
void CopyFlashReadRoutineToRam(void *destination)
Copies the byte reader to RAM and installs its Thumb entry point.
void StartFlashTimer(u8 timingIndex)
Starts the selected operation timeout, saving the interrupt-enable state.
s32 Flash_VerifySector(u16 sector, s32 source)
Copies the verifier to RAM and compares a standard flash sector with source data.
void ReadFlashCore(const u8 *source, u8 *destination, u32 size)
Copies flash bytes into RAM; this routine executes from a RAM copy.
u8 ReadFlashByte(u8 *source)
Reads one byte; copied into RAM so the cartridge can be polled during a write.
s32 IdentifyFlash(void)
Selects matching chip handlers, falling back to the final table entry when unknown.
volatile u16 gFlashTimerCount
u8 *(*) FlashVerifyCore(u8 *source, u8 *flash, u16 size)
const struct FlashSetupInfo *const gFlash_Chips[]
u8(*) FlashByteRead(u8 *address)
Flash memory: erasing, programming and reading sectors.
u8(*) gFlashReadRoutine(u8 *source)
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
const struct FlashSetupInfo gFlash_ChipUnknown
The hardware's I/O registers and their bits, as pret names them.
Settings for each flash chip model (44 bytes), in flash_setup's field order from flashset....
struct FlashSector sector
The integer types, TRUE, UNUSED and the fixed-address macros.