CSP Queue

File: csp/arch/csp_queue.h

Description: CSP queue

csp_queue_handle_t csp_queue_create_static(int length, size_t item_size, char *buffer, csp_static_queue_t *queue)
[source]

Create static queue.

Parameters:
  • length – Number of items in static queue.

  • item_size – Size of each item in static queue.

  • buffer – Memory buffer that will hold the static queue items. Must be at least length * item_size bytes in size.

  • queue – Pointer to static queue.

Returns:

Static queue handle on success, otherwise NULL.

int csp_queue_dequeue(csp_queue_handle_t handle, void *buf, uint32_t timeout)
[source]

Dequeue value (front).

Parameters:
  • handle – queue.

  • buf – extracted element (by copy).

  • timeout – timeout, time to wait for element in queue.

Returns:

#CSP_QUEUE_OK on success, otherwise a queue error code.

int csp_queue_dequeue_isr(csp_queue_handle_t handle, void *buf, int *pxTaskWoken)
[source]

Dequeue value (front) from ISR.

Parameters:
  • handle – queue.

  • buf – extracted element (by copy).

  • pxTaskWoken – Valid reference if called from ISR, otherwise NULL!

Returns:

#CSP_QUEUE_OK on success, otherwise a queue error code.

void csp_queue_empty(csp_queue_handle_t handle)
[source]

Empty queue object by removing all items (handle).

Parameters:
  • handle – handle queue.

int csp_queue_enqueue(csp_queue_handle_t handle, const void *value, uint32_t timeout)
[source]

Enqueue (back) value.

Parameters:
  • handle – queue.

  • value – value to add (by copy)

  • timeout – timeout, time to wait for free space

Returns:

#CSP_QUEUE_OK on success, otherwise a queue error code.

int csp_queue_enqueue_isr(csp_queue_handle_t handle, const void *value, int *pxTaskWoken)
[source]

Enqueue (back) value from ISR.

Parameters:
  • handle – queue.

  • value – value to add (by copy)

  • pxTaskWoken – Valid reference if called from ISR, otherwise NULL!

Returns:

#CSP_QUEUE_OK on success, otherwise a queue error code.

int csp_queue_free(csp_queue_handle_t handle)
[source]

Free queue object (handle).

Parameters:
  • handle – handle queue.

int csp_queue_size(csp_queue_handle_t handle)
[source]

Queue size.

Parameters:
  • handle – handle queue.

Returns:

Number of elements in the queue.

int csp_queue_size_isr(csp_queue_handle_t handle)
[source]

Queue size from ISR.

Parameters:
  • handle – handle queue.

Returns:

Number of elements in the queue.