Functions for the inter-core FIFOs.
More...
|
static bool | multicore_fifo_rvalid (void) |
| Check the read FIFO to see if there is data available (sent by the other core)See the note in the fifo section for considerations regarding use of the inter-core FIFOs. More...
|
|
static bool | multicore_fifo_wready (void) |
| Check the write FIFO to see if it has space for more dataSee the note in the fifo section for considerations regarding use of the inter-core FIFOs. More...
|
|
void | multicore_fifo_push_blocking (uint32_t data) |
| Push data on to the write FIFO (data to the other core).This function will block until there is space for the data to be sent. Use multicore_fifo_wready() to check if it is possible to write to the FIFO if you don't want to block. More...
|
|
bool | multicore_fifo_push_timeout_us (uint32_t data, uint64_t timeout_us) |
| Push data on to the write FIFO (data to the other core) with timeout.This function will block until there is space for the data to be sent or the timeout is reached. More...
|
|
uint32_t | multicore_fifo_pop_blocking (void) |
| Pop data from the read FIFO (data from the other core).This function will block until there is data ready to be read Use multicore_fifo_rvalid() to check if data is ready to be read if you don't want to block. More...
|
|
bool | multicore_fifo_pop_timeout_us (uint64_t timeout_us, uint32_t *out) |
| Pop data from the read FIFO (data from the other core) with timeout.This function will block until there is data ready to be read or the timeout is reached. More...
|
|
static void | multicore_fifo_drain (void) |
| Discard any data in the read FIFOSee the note in the fifo section for considerations regarding use of the inter-core FIFOs.
|
|
static void | multicore_fifo_clear_irq (void) |
| Clear FIFO interruptNote that this only clears an interrupt that was caused by the ROE or WOF flags. To clear the VLD flag you need to use one of the 'pop' or 'drain' functions. More...
|
|
static uint32_t | multicore_fifo_get_status (void) |
| Get FIFO statuses. More...
|
|
Functions for the inter-core FIFOs.
The RP2040 contains two FIFOs for passing data, messages or ordered events between the two cores. Each FIFO is 32 bits wide, and 8 entries deep. One of the FIFOs can only be written by core 0, and read by core 1. The other can only be written by core 1, and read by core 0.
- Note
- The inter-core FIFOs are a very precious resource and are frequently used for SDK functionality (e.g. during core 1 launch or by the lockout functions). Additionally they are often required for the exclusive use of an RTOS (e.g. FreeRTOS SMP). For these reasons it is suggested that you do not use the FIFO for your own purposes unless none of the above concerns apply; the majority of cases for transferring data between cores can be eqaully well handled by using a queue
◆ multicore_fifo_clear_irq()
static void multicore_fifo_clear_irq |
( |
void |
| ) |
|
|
inlinestatic |
Clear FIFO interruptNote that this only clears an interrupt that was caused by the ROE or WOF flags. To clear the VLD flag you need to use one of the 'pop' or 'drain' functions.
See the note in the fifo section for considerations regarding use of the inter-core FIFOs
- See also
- multicore_fifo_get_status
◆ multicore_fifo_get_status()
static uint32_t multicore_fifo_get_status |
( |
void |
| ) |
|
|
inlinestatic |
Get FIFO statuses.
- Returns
- The statuses as a bitfield
Bit | Description |
3 | Sticky flag indicating the RX FIFO was read when empty (ROE). This read was ignored by the FIFO. |
2 | Sticky flag indicating the TX FIFO was written when full (WOF). This write was ignored by the FIFO. |
1 | Value is 1 if this core’s TX FIFO is not full (i.e. if FIFO_WR is ready for more data) |
0 | Value is 1 if this core’s RX FIFO is not empty (i.e. if FIFO_RD is valid) |
See the note in the fifo section for considerations regarding use of the inter-core FIFOs
◆ multicore_fifo_pop_blocking()
uint32_t multicore_fifo_pop_blocking |
( |
void |
| ) |
|
Pop data from the read FIFO (data from the other core).This function will block until there is data ready to be read Use multicore_fifo_rvalid() to check if data is ready to be read if you don't want to block.
See the note in the fifo section for considerations regarding use of the inter-core FIFOs
- Returns
- 32 bit data from the read FIFO.
◆ multicore_fifo_pop_timeout_us()
bool multicore_fifo_pop_timeout_us |
( |
uint64_t |
timeout_us, |
|
|
uint32_t * |
out |
|
) |
| |
Pop data from the read FIFO (data from the other core) with timeout.This function will block until there is data ready to be read or the timeout is reached.
See the note in the fifo section for considerations regarding use of the inter-core FIFOs
- Parameters
-
timeout_us | the timeout in microseconds |
out | the location to store the popped data if available |
- Returns
- true if the data was popped and a value copied into
out
, false if the timeout occurred before data could be popped
◆ multicore_fifo_push_blocking()
void multicore_fifo_push_blocking |
( |
uint32_t |
data | ) |
|
Push data on to the write FIFO (data to the other core).This function will block until there is space for the data to be sent. Use multicore_fifo_wready() to check if it is possible to write to the FIFO if you don't want to block.
See the note in the fifo section for considerations regarding use of the inter-core FIFOs
- Parameters
-
data | A 32 bit value to push on to the FIFO |
◆ multicore_fifo_push_timeout_us()
bool multicore_fifo_push_timeout_us |
( |
uint32_t |
data, |
|
|
uint64_t |
timeout_us |
|
) |
| |
Push data on to the write FIFO (data to the other core) with timeout.This function will block until there is space for the data to be sent or the timeout is reached.
- Parameters
-
data | A 32 bit value to push on to the FIFO |
timeout_us | the timeout in microseconds |
- Returns
- true if the data was pushed, false if the timeout occurred before data could be pushed
◆ multicore_fifo_rvalid()
static bool multicore_fifo_rvalid |
( |
void |
| ) |
|
|
inlinestatic |
Check the read FIFO to see if there is data available (sent by the other core)See the note in the fifo section for considerations regarding use of the inter-core FIFOs.
- Returns
- true if the FIFO has data in it, false otherwise
◆ multicore_fifo_wready()
static bool multicore_fifo_wready |
( |
void |
| ) |
|
|
inlinestatic |
Check the write FIFO to see if it has space for more dataSee the note in the fifo section for considerations regarding use of the inter-core FIFOs.
- Returns
- true if the FIFO has room for more data, false otherwise