Loading...
Searching...
No Matches
queue.h File Reference
#include "pico.h"
#include "hardware/sync.h"
#include "pico/lock_core.h"

Go to the source code of this file.

Data Structures

struct  queue_t
 A multi-core and IRQ safe queue instance. More...

Macros

#define PICO_QUEUE_MAX_LEVEL   0

Functions

bool queue_init_with_spinlock (queue_t *q, uint element_size, uint element_count, uint spinlock_num)
 Initialise a queue with a specific spinlock for concurrency protection.
static bool queue_init (queue_t *q, uint element_size, uint element_count)
 Initialise a queue, allocating a (possibly shared) spinlock.
void queue_free (queue_t *q)
 Destroy the specified queue.
static uint queue_get_level_unsafe (queue_t *q)
 Unsafe check of level of the specified queue.
static uint queue_get_level (queue_t *q)
 Check of level of the specified queue.
static bool queue_is_empty (queue_t *q)
 Check if queue is empty.
static bool queue_is_full (queue_t *q)
 Check if queue is full.
bool queue_try_add (queue_t *q, const void *data)
 Non-blocking add value queue if not full.
bool queue_try_remove (queue_t *q, void *data)
 Non-blocking removal of entry from the queue if non empty.
bool queue_try_peek (queue_t *q, void *data)
 Non-blocking peek at the next item to be removed from the queue.
void queue_add_blocking (queue_t *q, const void *data)
 Blocking add of value to queue.
void queue_remove_blocking (queue_t *q, void *data)
 Blocking remove entry from queue.
void queue_peek_blocking (queue_t *q, void *data)
 Blocking peek at next value to be removed from queue.