| 610 | } |
| 611 | |
| 612 | static 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 | |
| 630 | uint8_t mem_read_cpu(uint32_t addr, bool fetch) { |
| 631 | uint8_t value = 0; |
no test coverage detected