Morse Micro IoT SDK  2.9.7

Detailed Description

Provides queue support for inter-task communication.

Functions

struct mmosal_queue * mmosal_queue_create (size_t num_items, size_t item_size, const char *name)
 Create a new queue. More...
 
void mmosal_queue_delete (struct mmosal_queue *queue)
 Delete a queue. More...
 
bool mmosal_queue_pop (struct mmosal_queue *queue, void *item, uint32_t timeout_ms)
 Pop an item from the queue. More...
 
bool mmosal_queue_push (struct mmosal_queue *queue, const void *item, uint32_t timeout_ms)
 Push an item into the queue. More...
 
bool mmosal_queue_pop_from_isr (struct mmosal_queue *queue, void *item)
 Pop an item from the queue (from ISR context). More...
 
bool mmosal_queue_push_from_isr (struct mmosal_queue *queue, const void *item)
 Push an item into the queue (from ISR context). More...
 

Function Documentation

◆ mmosal_queue_create()

struct mmosal_queue * mmosal_queue_create ( size_t  num_items,
size_t  item_size,
const char *  name 
)

Create a new queue.

Parameters
num_itemsThe maximum number of items that may be in the queue at a time.
item_sizeThe size of each item in the queue.
nameThe name of the queue.
Returns
an opaque handle to the queue, or NULL on failure.

◆ mmosal_queue_delete()

void mmosal_queue_delete ( struct mmosal_queue *  queue)

Delete a queue.

Parameters
queuehandle of the queue to delete.

◆ mmosal_queue_pop()

bool mmosal_queue_pop ( struct mmosal_queue *  queue,
void *  item,
uint32_t  timeout_ms 
)

Pop an item from the queue.

Warning
May not be invoked from an ISR.
Parameters
queueThe queue to pop from.
itemPointer to memory to receive the popped item. The item will be copied into this memory. The memory size must match the item_size given at creation.
timeout_msTimeout after which to give up waiting for an item if the queue is empty (in milliseconds).
Returns
true if an item was successfully popped, else false.

◆ mmosal_queue_pop_from_isr()

bool mmosal_queue_pop_from_isr ( struct mmosal_queue *  queue,
void *  item 
)

Pop an item from the queue (from ISR context).

Warning
May only be invoked from an ISR.
Parameters
queueThe queue to pop from.
itemPointer to memory to receive the popped item. The item will be copied into this memory. The memory size must match the item_size given at creation.
Returns
true if an item was successfully popped, else false.

◆ mmosal_queue_push()

bool mmosal_queue_push ( struct mmosal_queue *  queue,
const void *  item,
uint32_t  timeout_ms 
)

Push an item into the queue.

Warning
May not be invoked from an ISR.
Parameters
queueThe queue to push to.
itemPointer to the item to push. This item will be copied into the queue. The size of the item must match the item_size given at creation.
timeout_msTimeout after which to give up waiting for space if the queue is full (in milliseconds).
Returns
true if an item was successfully pushed, else false.

◆ mmosal_queue_push_from_isr()

bool mmosal_queue_push_from_isr ( struct mmosal_queue *  queue,
const void *  item 
)

Push an item into the queue (from ISR context).

Warning
May only be invoked from an ISR.
Parameters
queueThe queue to push to.
itemPointer to the item to push. This item will be copied into the queue. The size of the item must match the item_size given at creation.
Returns
true if an item was successfully pushed, else false.