disable core 0 SIO FIFO IRQ handler during core 1 launch in case someone has already installed one (#375)

This commit is contained in:
Graham Sanderson 2021-05-04 07:43:25 -05:00 committed by GitHub
parent d35d1b331e
commit c979ca591f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -129,6 +129,9 @@ void multicore_launch_core1(void (*entry)(void)) {
void multicore_launch_core1_raw(void (*entry)(void), uint32_t *sp, uint32_t vector_table) { void multicore_launch_core1_raw(void (*entry)(void), uint32_t *sp, uint32_t vector_table) {
uint32_t cmd_sequence[] = {0, 0, 1, (uintptr_t) vector_table, (uintptr_t) sp, (uintptr_t) entry}; uint32_t cmd_sequence[] = {0, 0, 1, (uintptr_t) vector_table, (uintptr_t) sp, (uintptr_t) entry};
bool enabled = irq_is_enabled(SIO_IRQ_PROC0);
irq_set_enabled(SIO_IRQ_PROC0, false);
uint seq = 0; uint seq = 0;
do { do {
uint cmd = cmd_sequence[seq]; uint cmd = cmd_sequence[seq];
@ -142,6 +145,8 @@ void multicore_launch_core1_raw(void (*entry)(void), uint32_t *sp, uint32_t vect
// move to next state on correct response otherwise start over // move to next state on correct response otherwise start over
seq = cmd == response ? seq + 1 : 0; seq = cmd == response ? seq + 1 : 0;
} while (seq < count_of(cmd_sequence)); } while (seq < count_of(cmd_sequence));
irq_set_enabled(SIO_IRQ_PROC0, enabled);
} }
#define LOCKOUT_MAGIC_START 0x73a8831eu #define LOCKOUT_MAGIC_START 0x73a8831eu