Disable FIFO IRQ when doing reset of core1 (same as with launching) (#1447)

* fifo irq disabled during core1 reset

* silence warning about unused variable in multicore.c
This commit is contained in:
Mr. Jake 2024-05-19 02:53:37 +02:00 committed by GitHub
parent 5941969380
commit f1f3bd6bf6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -109,9 +109,23 @@ void multicore_reset_core1() {
*power_off_set = PSM_FRCE_OFF_PROC1_BITS;
while (!(*power_off & PSM_FRCE_OFF_PROC1_BITS)) tight_loop_contents();
// Allow for the fact that the caller may have already enabled the FIFO IRQ for their
// own purposes (expecting FIFO content after core 1 is launched). We must disable
// the IRQ during the handshake, then restore afterwards.
bool enabled = irq_is_enabled(SIO_IRQ_PROC0);
irq_set_enabled(SIO_IRQ_PROC0, false);
// Bring core 1 back out of reset. It will drain its own mailbox FIFO, then push
// a 0 to our mailbox to tell us it has done this.
*power_off_clr = PSM_FRCE_OFF_PROC1_BITS;
// check the pushed value
uint32_t value = multicore_fifo_pop_blocking();
assert(value == 0);
(void) value; // silence warning
// restore interrupt state
irq_set_enabled(SIO_IRQ_PROC0, enabled);
}
void multicore_launch_core1_with_stack(void (*entry)(void), uint32_t *stack_bottom, size_t stack_size_bytes) {