OS Queue

API 介绍

This section introduces OS QUEUE reference api.

Typedefs

typedef void *os_queue_h

queue handle definition

Functions

os_queue_h os_queue_create(module_id_t module_id, uint32_t queue_lenth, uint32_t item_size)

This function is used to create a queue.

参数:
  • module_id -- is the module that creates the queue.

  • queue_lenth -- is the module that the depth of queue.

  • item_size -- is the module that each item size.

返回:

os_queue_h NULL(failure), otherwise(queue handle).

bool os_queue_send(os_queue_h queue, void *queue_tx_msg)

This function is used to send a queue.

参数:
  • queue -- is queue handle.

  • queue_tx_msg -- is queue msg to be send.

返回:

bool true(successfully), false(failed).

bool os_queue_send_from_isr(os_queue_h queue, void *queue_tx_msg)

This function is used to send a queue.This function can be called in ISR context.

参数:
  • queue -- is queue handle.

  • queue_tx_msg -- is queue msg to be send.

返回:

bool true(successfully), false(failed).

bool os_queue_receive(os_queue_h queue, void *queue_rx_msg)

This function is used to receive a queue.This function is blocking when called.

参数:
  • queue -- is queue handle.

  • queue_rx_msg -- is queue msg to be received.

返回:

bool true(successfully), false(failed)..

bool os_queue_peek(os_queue_h queue, void *queue_rx_msg)

This function is used to peek a queue.This function is non-blocking when called.

参数:
  • queue -- is queue handle.

  • queue_rx_msg -- is queue msg to be received.

返回:

bool true(successfully), false(failed).

bool os_queue_receive_timeout(os_queue_h queue, void *queue_rx_msg, uint32_t timeout)

This function is used to receive a queue with timeout.This function is blocking when called.

参数:
  • queue -- is queue handle.

  • queue_rx_msg -- is queue msg to be received.

  • timeout -- max wait time.

返回:

bool true(successfully), false(failed).

bool os_queue_receive_from_isr(os_queue_h queue, void *queue_rx_msg)

This function is used to receive a queue.This function is blocking when called.This function can be called in ISR context.

参数:
  • queue -- is queue handle.

  • queue_rx_msg -- is queue msg to be received.

返回:

bool trues(uccessfully), false(failed).

uint32_t os_queue_items_get(os_queue_h queue)

This function is used to get a queue item numbers available.

参数:

queue -- is queue handle.

返回:

uint32_t queue available items numbers.

void os_queue_delete(os_queue_h queue)

This function is used to delete a queue.

参数:

queue -- is queue handle.