Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
lampda::hal::queues Namespace Reference

Implementation of inter thread queues. More...

Classes

struct  QueueWrapp
 

Typedefs

typedef void * QueueHandle_t
 

Enumerations

enum  HAL_queue_status_t {
  HAL_QUEUE_OK = 0 , HAL_QUEUE_ERR_INVALID_PARAM = -1 , HAL_QUEUE_ERR_TIMEOUT = -2 , HAL_QUEUE_ERR_FULL = -3 ,
  HAL_QUEUE_ERR_EMPTY = -4 , HAL_QUEUE_ERR_OTHER = -5
}
 Queue operation status codes.
 

Functions

QueueHandle_t HAL_create_queue (size_t itemSize, uint32_t queueLength)
 Create a queue with the specified item size and maximum length.
 
void HAL_delete_queue (QueueHandle_t handle)
 Delete/free a queue and release its underlying resources.
 
HAL_queue_status_t HAL_queue_send (QueueHandle_t handle, const void *item, uint32_t timeoutMs)
 Send an item to the queue.
 
HAL_queue_status_t HAL_queue_receive (QueueHandle_t handle, void *const outItem, uint32_t timeoutMs)
 Receive an item from the queue. Blocks until an item is available or timeout expires.
 

Detailed Description

Implementation of inter thread queues.

Function Documentation

◆ HAL_create_queue()

QueueHandle_t lampda::hal::queues::HAL_create_queue ( size_t  itemSize,
uint32_t  queueLength 
)

Create a queue with the specified item size and maximum length.

Parameters
[in]itemSizeSize of each item in bytes (abstracts the data type)
[in]queueLengthMaximum number of items the queue can hold
Returns
The allocated queue handle

◆ HAL_delete_queue()

void lampda::hal::queues::HAL_delete_queue ( QueueHandle_t  handle)

Delete/free a queue and release its underlying resources.

Parameters
[in]handleHandle of the queue to delete

◆ HAL_queue_receive()

HAL_queue_status_t lampda::hal::queues::HAL_queue_receive ( QueueHandle_t  handle,
void *const  outItem,
uint32_t  timeoutMs 
)

Receive an item from the queue. Blocks until an item is available or timeout expires.

Parameters
[in]handleHandle of the queue
[out]outItemPointer to buffer to store the received item
[in]timeoutMsTimeout in milliseconds. 0 = non-blocking
Returns
HAL_QUEUE_OK on success, HAL_QUEUE_ERR_EMPTY if queue is empty, HAL_QUEUE_ERR_TIMEOUT on timeout

◆ HAL_queue_send()

HAL_queue_status_t lampda::hal::queues::HAL_queue_send ( QueueHandle_t  handle,
const void *  item,
uint32_t  timeoutMs 
)

Send an item to the queue.

Parameters
[in]handleHandle of the queue
[in]itemPointer to the item to send
[in]timeoutMsTimeout in milliseconds. 0 = non-blocking, UINT32_MAX = block indefinitely
Returns
HAL_QUEUE_OK on success, HAL_QUEUE_ERR_FULL if queue is full, HAL_QUEUE_ERR_TIMEOUT on timeout