Skip to content

Commit

Permalink
firmware: fpga: added a check to make sure the result we get back fro…
Browse files Browse the repository at this point in the history
…m `read_squishy_register` when getting the IRQ is not `0xFF` if it is, something is wrong
  • Loading branch information
lethalbit committed Jan 12, 2025
1 parent f9610af commit 56720bf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions firmware/fpga.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ bool fpga_handle_irq() noexcept {
*/
const auto squishy_irq{read_squishy_register(squishy::registers::IRQ)};

if (squishy_irq == 0xFFU) {
/* Invalid IRQ Response, bail */
active_fault = fault_code_t::SQUISHY_IRQ_RESP_BAD;
return false;
}

if (squishy_irq & squishy::registers::IRQ_WANT_DFU) {
/* FPGA wants to be in bootloader mode, yeet it. */
fpga_enter_cfg();
Expand Down

0 comments on commit 56720bf

Please sign in to comment.