MCPcopy Create free account
hub / github.com/CE-Programming/CEmu / detect_flash_unlock_sequence

Function detect_flash_unlock_sequence

core/mem.c:612–628  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

610}
611
612static bool detect_flash_unlock_sequence(uint8_t current) {
613 static const uint8_t flash_unlock_sequence[] = { 0xF3, 0x18, 0x00, 0xF3, 0xF3, 0xED, 0x7E, 0xED, 0x56, 0xED, 0x39, 0x28, 0xED, 0x38, 0x28, 0xCB, 0x57 };
614 uint8_t i;
615 if (current != flash_unlock_sequence[sizeof(flash_unlock_sequence) - 1] ||
616 !protected_ports_unlocked()) {
617 return false;
618 }
619 for (i = 1; i != sizeof(flash_unlock_sequence); i++) {
620 if (mem.buffer[(mem.fetch + i) & (sizeof(mem.buffer) - 1)] != flash_unlock_sequence[i - 1]) {
621 return false;
622 }
623 }
624 if (unprivileged_code()) {
625 return false;
626 }
627 return true;
628}
629
630uint8_t mem_read_cpu(uint32_t addr, bool fetch) {
631 uint8_t value = 0;

Callers 1

mem_read_cpuFunction · 0.85

Calls 2

protected_ports_unlockedFunction · 0.85
unprivileged_codeFunction · 0.85

Tested by

no test coverage detected