@web-font-path: "roboto-debian.css";
v2.2.0 (RP2040)
Loading...
Searching...
No Matches
fifo
pico_multicore

Functions for the inter-core FIFOs. More...

## Functions

static bool | multicore_fifo_rvalid (void)
| Check the read FIFO to see if there is data available (sent by the other core).
static bool | multicore_fifo_wready (void)
| Check the write FIFO to see if it has space for more data.
void | multicore_fifo_push_blocking (uint32_t data)
| Push data on to the write FIFO (data to the other core).
static void | multicore_fifo_push_blocking_inline (uint32_t data)
| Push data on to the write FIFO (data to the other core).
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.
uint32_t | multicore_fifo_pop_blocking (void)
| Pop data from the read FIFO (data from the other core).
static uint32_t | multicore_fifo_pop_blocking_inline (void)
| Pop data from the read FIFO (data from the other core).
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.
static void | multicore_fifo_drain (void)
| Discard any data in the read FIFO.
static void | multicore_fifo_clear_irq (void)
| Clear FIFO interrupt.
static uint32_t | multicore_fifo_get_status (void)
| Get FIFO statuses.

## Detailed Description

Functions for the inter-core FIFOs.

RP-series microcontrollers contains two FIFOs for passing data, messages or ordered events between the two cores. Each FIFO is 32 bits wide, and 8 entries deep on the RP2040, and 4 entries deep on the RP2350. 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

## Function Documentation

## multicore_fifo_clear_irq()

void multicore_fifo_clear_irq | ( | void |  | ) |

inline static

Clear FIFO interrupt.

Note 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_drain()

void multicore_fifo_drain | ( | void |  | ) |

inline static

Discard any data in the read FIFO.

See the note in the fifo section for considerations regarding use of the inter-core FIFOs

## multicore_fifo_get_status()

uint32_t multicore_fifo_get_status | ( | void |  | ) |

inline static

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_blocking_inline()

uint32_t multicore_fifo_pop_blocking_inline | ( | void |  | ) |

inline static

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_blocking_inline()

void multicore_fifo_push_blocking_inline | ( | uint32_t | data | ) |

inline static

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()

bool multicore_fifo_rvalid | ( | void |  | ) |

inline static

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()

bool multicore_fifo_wready | ( | void |  | ) |

inline static

Check the write FIFO to see if it has space for more data.

See 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