Functions to enable one core to force the other core to pause execution in a known state. More...
Functions | |
void | multicore_lockout_victim_init (void) |
Initialize the current core such that it can be a "victim" of lockout (i.e. forced to pause in a known state by the other core) More... | |
void | multicore_lockout_start_blocking (void) |
Request the other core to pause in a known state and wait for it to do so. More... | |
bool | multicore_lockout_start_timeout_us (uint64_t timeout_us) |
Request the other core to pause in a known state and wait up to a time limit for it to do so. More... | |
void | multicore_lockout_end_blocking (void) |
Release the other core from a locked out state amd wait for it to acknowledge. More... | |
bool | multicore_lockout_end_timeout_us (uint64_t timeout_us) |
Release the other core from a locked out state amd wait up to a time limit for it to acknowledge. More... | |
Functions to enable one core to force the other core to pause execution in a known state.
Sometimes it is useful to enter a critical section on both cores at once. On a single core system a critical section can trivially be entered by disabling interrupts, however on a multi-core system that is not sufficient, and unless the other core is polling in some way, then it will need to be interrupted in order to cooperatively enter a blocked state.
These "lockout" functions use the inter core FIFOs to cause an interrupt on one core from the other, and manage waiting for the other core to enter the "locked out" state.
The usage is that the "victim" core ... i.e the core that can be "locked out" by the other core calls multicore_lockout_victim_init to hook the FIFO interrupt. Note that either or both cores may do this.
The core which wishes to lockout the other core calls multicore_lockout_start_blocking or multicore_lockout_start_timeout_us to interrupt the other "victim" core and wait for it to be in a "locked out" state. Once the lockout is no longer needed it calls multicore_lockout_end_blocking or multicore_lockout_end_timeout_us to release the lockout and wait for confirmation.
void multicore_lockout_end_blocking | ( | void | ) |
Release the other core from a locked out state amd wait for it to acknowledge.
multicore_lockout_start_
function from this core bool multicore_lockout_end_timeout_us | ( | uint64_t | timeout_us | ) |
Release the other core from a locked out state amd wait up to a time limit for it to acknowledge.
The other core must previously have been "locked out" by calling a multicore_lockout_start_
function from this core
timeout_us | the timeout in microseconds |
void multicore_lockout_start_blocking | ( | void | ) |
Request the other core to pause in a known state and wait for it to do so.
The other (victim) core must have previously executed multicore_lockout_victim_init()
bool multicore_lockout_start_timeout_us | ( | uint64_t | timeout_us | ) |
Request the other core to pause in a known state and wait up to a time limit for it to do so.
The other core must have previously executed multicore_lockout_victim_init()
timeout_us | the timeout in microseconds |
void multicore_lockout_victim_init | ( | void | ) |
Initialize the current core such that it can be a "victim" of lockout (i.e. forced to pause in a known state by the other core)
This code hooks the intercore FIFO IRQ, and the FIFO may not be used for any other purpose after this.