Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
queues.h
Go to the documentation of this file.
1
5// do not use pragma once here, has this can be mocked
6#ifndef HAL_QUEUES_H
7#define HAL_QUEUES_H
8
9#ifdef __cplusplus
10
11#include <cstddef>
12#include <cstdint>
13
14namespace lampda {
15namespace hal {
17namespace queues {
18
19extern "C" {
20#endif
21
22 typedef void* QueueHandle_t;
23
25 static constexpr uint32_t MaxStaticQueues = 5;
26
30 typedef enum
31 {
32 HAL_QUEUE_OK = 0,
33 HAL_QUEUE_ERR_INVALID_PARAM = -1,
34 HAL_QUEUE_ERR_TIMEOUT = -2,
35 HAL_QUEUE_ERR_FULL = -3,
36 HAL_QUEUE_ERR_EMPTY = -4,
37 HAL_QUEUE_ERR_OTHER = -5
39
49 QueueHandle_t HAL_create_queue(size_t itemSize, uint32_t queueLength, uint32_t staticIndex, uint8_t* buffer);
50
55 void HAL_delete_queue(QueueHandle_t handle);
56
64 HAL_queue_status_t HAL_queue_send(QueueHandle_t handle, const void* item, uint32_t timeoutMs);
65
73 HAL_queue_status_t HAL_queue_receive(QueueHandle_t handle, void* const outItem, uint32_t timeoutMs);
74
78 size_t HAL_queue_get_number_of_items(QueueHandle_t handle);
79
80#ifdef __cplusplus
81}
82} // namespace queues
83} // namespace hal
84} // namespace lampda
85#endif
86
87#endif
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.
QueueHandle_t HAL_create_queue(size_t itemSize, uint32_t queueLength, uint32_t staticIndex, uint8_t *buffer)
Create a queue with the specified item size and maximum length.
HAL_queue_status_t HAL_queue_send(QueueHandle_t handle, const void *item, uint32_t timeoutMs)
Send an item to the queue.
size_t HAL_queue_get_number_of_items(QueueHandle_t handle)
Return the number of items currently in a queue.
void HAL_delete_queue(QueueHandle_t handle)
Delete/free a queue and release its underlying resources.
static constexpr uint32_t MaxStaticQueues
Define the max number of queue objets that can be defined.
Definition: queues.h:25
HAL_queue_status_t
Queue operation status codes.
Definition: queues.h:31
Program scope.
Definition: control_fixed_modes.hpp:12