18 command = (
volatile u8 *)0x0E005555;
20 unlock = (
volatile u8 *)0x0E002AAA;
45 *(
volatile u8 *)0x0E005555 = 0xAA;
46 *(
volatile u8 *)0x0E002AAA = 0x55;
47 *(
volatile u8 *)0x0E005555 = 0xA0;
49 while (bytesRemaining != 0) {
58 result = (result & 0xFF00) | 2;
69 u16 attemptsRemaining;
78 smallSector = sector << 4;
79 smallSector = (
u16)(smallSector << 1);
82 attemptsRemaining = 2;
85 attemptsRemaining -= 1;
86 if (attemptsRemaining == 0)
96 if ((
u32)sectorsErased <= 31)
107 volatile u8 *destination;
112 sector = (
u16)sector;
114 (
volatile u8 *)(0x0e000000 +
118 *(
volatile u8 *)0x0e005555 = 0xaa;
119 *(
volatile u8 *)0x0e002aaa = 0x55;
120 *(
volatile u8 *)0x0e005555 = 0xa0;
123 if (remaining != 0) {
125 *destination++ = *input++;
127 }
while (remaining != 0);
145 u16 attemptsRemaining;
147 if ((
u32)sector > 15)
153 smallSector = sector << 5;
157 attemptsRemaining = 2;
160 attemptsRemaining -= 1;
161 if (attemptsRemaining == 0)
165 }
while (result != 0);
u16 ProgramAtmelFlashSector(u32 sector, const u8 *source)
Programs a small Atmel sector with interrupts disabled, then polls its last byte.
u16 EraseAtmelFlashSector(u16 sector)
Erases one small Atmel sector by programming every byte to 0xff.
u16 EraseAtmelFlashBlock(u16 sector)
Erases thirty-two small sectors, trying each sector at most twice.
u16 gFlashNumRemainingBytes
u16 EraseAtmelFlashChip(void)
Erases the Atmel chip and waits for completion with its configured timing.
u16 ProgramAtmelFlashBlock(u16 sector, u8 *source)
Programs an Atmel block in small sectors, trying each sector at most twice.
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)
struct FlashSetupInfo gFlash_ChipAtmel
struct FlashSetupInfo gFlash_ChipAtmelLayout
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
u16 wait[2]
Low two bits of REG_WAITCNT.