APIs for creating and working with Queues.
cy_rslt_t | cy_rtos_queue_init (cy_queue_t *queue, size_t length, size_t itemsize) |
Create a queue. More... | |
cy_rslt_t | cy_rtos_queue_put (cy_queue_t *queue, const void *item_ptr, cy_time_t timeout_ms) |
Put an item in a queue. More... | |
cy_rslt_t | cy_rtos_queue_get (cy_queue_t *queue, void *item_ptr, cy_time_t timeout_ms) |
Gets an item in a queue. More... | |
cy_rslt_t | cy_rtos_queue_count (cy_queue_t *queue, size_t *num_waiting) |
Return the number of items in the queue. More... | |
cy_rslt_t | cy_rtos_queue_space (cy_queue_t *queue, size_t *num_spaces) |
Return the amount of empty space in the queue. More... | |
cy_rslt_t | cy_rtos_queue_reset (cy_queue_t *queue) |
Reset the queue. More... | |
cy_rslt_t | cy_rtos_queue_deinit (cy_queue_t *queue) |
Deinitialize the queue handle. More... | |
#define | CY_RTOS_QUEUE_FULL CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_ABSTRACTION_OS, 3) |
The Queue is already full and can't accept any more items at this time. | |
#define | CY_RTOS_QUEUE_EMPTY CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_ABSTRACTION_OS, 4) |
The Queue is empty and has nothing to remove. | |
#define | cy_rtos_init_queue(queue, length, itemsize) cy_rtos_queue_init(queue, length, itemsize) |
Create a queue. More... | |
#define | cy_rtos_put_queue(queue, item_ptr, timeout_ms, in_isr) cy_rtos_queue_put(queue, item_ptr, timeout_ms) |
Put an item in a queue. More... | |
#define | cy_rtos_get_queue(queue, item_ptr, timeout_ms, in_isr) cy_rtos_queue_get(queue, item_ptr, timeout_ms) |
Gets an item in a queue. More... | |
#define | cy_rtos_count_queue(queue, num_waiting) cy_rtos_queue_count(queue, num_waiting) |
Return the number of items in the queue. More... | |
#define | cy_rtos_space_queue(queue, num_spaces) cy_rtos_queue_space(queue, num_spaces) |
Return the amount of empty space in the queue. More... | |
#define | cy_rtos_reset_queue(queue) cy_rtos_queue_reset(queue) |
Reset the queue. More... | |
#define | cy_rtos_deinit_queue(queue) cy_rtos_queue_deinit(queue) |
Deinitialize the queue handle. More... | |
#define cy_rtos_init_queue | ( | queue, | |
length, | |||
itemsize | |||
) | cy_rtos_queue_init(queue, length, itemsize) |
Create a queue.
This is a queue of data where entries are placed on the back of the queue and removed from the front of the queue.
[out] | queue | Pointer to the queue handle |
[in] | length | The maximum length of the queue in items |
[in] | itemsize | The size of each item in the queue. |
#define cy_rtos_put_queue | ( | queue, | |
item_ptr, | |||
timeout_ms, | |||
in_isr | |||
) | cy_rtos_queue_put(queue, item_ptr, timeout_ms) |
Put an item in a queue.
This function puts an item in the queue. The item is copied into the queue using a memory copy and the data pointed to by item_ptr is no longer referenced once the call returns.
[in] | queue | Pointer to the queue handle |
[in] | item_ptr | Pointer to the item to place in the queue |
[in] | timeout_ms | The time to wait to place the item in the queue |
[in] | in_isr | If true this is being called from within and ISR |
#define cy_rtos_get_queue | ( | queue, | |
item_ptr, | |||
timeout_ms, | |||
in_isr | |||
) | cy_rtos_queue_get(queue, item_ptr, timeout_ms) |
Gets an item in a queue.
This function gets an item from the queue. The item is copied out of the queue into the memory provide by item_ptr. This space must be large enough to hold a queue entry as defined when the queue was initialized.
[in] | queue | Pointer to the queue handle |
[in] | item_ptr | Pointer to the memory for the item from the queue |
[in] | timeout_ms | The time to wait to get an item from the queue |
[in] | in_isr | If true this is being called from within an ISR |
#define cy_rtos_count_queue | ( | queue, | |
num_waiting | |||
) | cy_rtos_queue_count(queue, num_waiting) |
Return the number of items in the queue.
This function returns the number of items currently in the queue.
[in] | queue | Pointer to the queue handle |
[out] | num_waiting | Pointer to the return count |
#define cy_rtos_space_queue | ( | queue, | |
num_spaces | |||
) | cy_rtos_queue_space(queue, num_spaces) |
Return the amount of empty space in the queue.
This function returns the amount of empty space in the queue. For instance, if the queue was created with 10 entries max and there are currently 2 entries in the queue, this will return 8.
[in] | queue | Pointer to the queue handle |
[out] | num_spaces | Pointer to the return count. |
#define cy_rtos_reset_queue | ( | queue | ) | cy_rtos_queue_reset(queue) |
Reset the queue.
This function sets the queue to empty.
[in] | queue | pointer to the queue handle |
#define cy_rtos_deinit_queue | ( | queue | ) | cy_rtos_queue_deinit(queue) |
Deinitialize the queue handle.
This function de-initializes the queue and returns all resources used by the queue.
[in] | queue | Pointer to the queue handle |
cy_rslt_t cy_rtos_queue_init | ( | cy_queue_t * | queue, |
size_t | length, | ||
size_t | itemsize | ||
) |
Create a queue.
This is a queue of data where entries are placed on the back of the queue and removed from the front of the queue.
[out] | queue | Pointer to the queue handle |
[in] | length | The maximum length of the queue in items |
[in] | itemsize | The size of each item in the queue. |
cy_rslt_t cy_rtos_queue_put | ( | cy_queue_t * | queue, |
const void * | item_ptr, | ||
cy_time_t | timeout_ms | ||
) |
Put an item in a queue.
This function puts an item in the queue. The item is copied into the queue using a memory copy and the data pointed to by item_ptr is no longer referenced once the call returns.
[in] | queue | Pointer to the queue handle |
[in] | item_ptr | Pointer to the item to place in the queue |
[in] | timeout_ms | The time to wait to place the item in the queue |
cy_rslt_t cy_rtos_queue_get | ( | cy_queue_t * | queue, |
void * | item_ptr, | ||
cy_time_t | timeout_ms | ||
) |
Gets an item in a queue.
This function gets an item from the queue. The item is copied out of the queue into the memory provide by item_ptr. This space must be large enough to hold a queue entry as defined when the queue was initialized.
[in] | queue | Pointer to the queue handle |
[in] | item_ptr | Pointer to the memory for the item from the queue |
[in] | timeout_ms | The time to wait to get an item from the queue |
cy_rslt_t cy_rtos_queue_count | ( | cy_queue_t * | queue, |
size_t * | num_waiting | ||
) |
Return the number of items in the queue.
This function returns the number of items currently in the queue.
[in] | queue | Pointer to the queue handle |
[out] | num_waiting | Pointer to the return count |
cy_rslt_t cy_rtos_queue_space | ( | cy_queue_t * | queue, |
size_t * | num_spaces | ||
) |
Return the amount of empty space in the queue.
This function returns the amount of empty space in the queue. For instance, if the queue was created with 10 entries max and there are currently 2 entries in the queue, this will return 8.
[in] | queue | Pointer to the queue handle |
[out] | num_spaces | Pointer to the return count. |
cy_rslt_t cy_rtos_queue_reset | ( | cy_queue_t * | queue | ) |
Reset the queue.
This function sets the queue to empty.
[in] | queue | pointer to the queue handle |
cy_rslt_t cy_rtos_queue_deinit | ( | cy_queue_t * | queue | ) |
Deinitialize the queue handle.
This function de-initializes the queue and returns all resources used by the queue.
[in] | queue | Pointer to the queue handle |