Message Queue
This is the Message Queue implementation with fixed size of user initialization.
The main buffer structure variable and the internal data buffer both should be declared on the application side and the pointers of the variables are used in the module.
Usage
All API functions have the first argument as the buffer instance.
Internal data buffer size and pointer are initialized with module init function.
Module read and module write functions are used to read/write data bytes.
Other API functions to return the status of buffer whether empty or full.
Return codes of API functions are defined in header file.
Function |
Description |
|---|---|
rs_msg_queue_init |
Function to initialize the message queue |
rs_msg_queue_push |
Function to push the data into the message queue buffer |
rs_msg_queue_pop |
Function to pop the data from the message queue buffer |
rs_msg_queue_peek |
Function to get top of the data from the buffer |
rs_msg_queue_get_used_space |
Function to get buffer count |
rs_msg_queue_get_free_size |
Function to get remaining bytes |
rs_msg_queue_get_msg_size |
Function to get next message or else to get the full message size. |
rs_msg_queue_is_full |
Function to know the buffer is full or not |
rs_msg_queue_is_empty |
Function to know the buffer is empty or not |
rs_msg_queue_flush |
Function to reset the elements of the ring buffer structure |
Feature Supported
Message queue supports two different types of queues - FIFO and LIFO
See also
- Macro’s are
RS_MSG_QUEUE_TYPE_FIFO 1
RS_MSG_QUEUE_TYPE_LIFO 2
Message queue supports to get the full message size in the queue as well as next message size in the queue
See also
- Macro’s are
RS_MSG_QUEUE_GET_NEXT_MSG_SIZE 1
RS_MSG_QUEUE_GET_FULL_MSG_SIZE 2
Message queue supports Push, Pop, Peek operations.
Message queue supports overwrite feature in the queue for both LIFO and FIFO
It supports Reset feature to reset the queue elements
Message queue supports data size format
See also
It has fixed data size. In queue it contains data with fixed length.
It also supports varying data size. In queue it contains both data length and data message.
Limitations
See also
1.Message queue doesn’t support overwrite feature for LIFO queue type of varying data size. 2.For fixed data size, push, pop and other opeation should be with fixed data size
Error Code
Every API’s for the message queue module returns some success or failure values. Please refer below section,
Example Demo
Please refer below section,
Message Queue Header Details
Documentation from the relevant header as follows:
Warning
doxygenfile: Cannot find file “rs_msg_queue.h