add a set of dyn(create / destroy) interface
1. tos_ring_q_create_dyn 2. tos_chr_fifo_create_dyn 3. tos_msg_q_create_dyn 4. tos_mail_q_create_dyn 5. tos_bin_heap_create_dyn 6. tos_prio_q_create_dyn 7. tos_prio_msg_q_create_dyn 8. tos_prio_mail_q_create_dyn
This commit is contained in:
@@ -19,9 +19,7 @@
|
||||
#define _TOS_RING_QUEUE_H_
|
||||
|
||||
typedef struct k_ring_queue_st {
|
||||
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
|
||||
knl_obj_t knl_obj;
|
||||
#endif
|
||||
|
||||
uint16_t head;
|
||||
uint16_t tail;
|
||||
@@ -62,10 +60,46 @@ __API__ k_err_t tos_ring_q_create(k_ring_q_t *ring_q, void *pool, size_t item_cn
|
||||
* @param[in] ring_q pointer to the handler of the ring queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
* @retval #K_ERR_OBJ_INVALID_ALLOC_TYPE invalid alloc type(is dynamic allocated not static)
|
||||
*/
|
||||
__API__ k_err_t tos_ring_q_destroy(k_ring_q_t *ring_q);
|
||||
|
||||
#if TOS_CFG_MMHEAP_EN > 0u
|
||||
|
||||
/**
|
||||
* @brief Create a ring queue with dynamic allocated pool.
|
||||
* create a ring queue with dynamic allocated pool.
|
||||
*
|
||||
* @attention pool inside is dynamic allocated.
|
||||
*
|
||||
* @param[in] ring_q pointer to the handler of the ring queue.
|
||||
* @param[in] item_cnt item count of the ring queue.
|
||||
* @param[in] item_size size of each item of the ring queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
* @retval #K_ERR_OUT_OF_MEMORY out of memory
|
||||
*/
|
||||
__API__ k_err_t tos_ring_q_create_dyn(k_ring_q_t *ring_q, size_t item_cnt, size_t item_size);
|
||||
|
||||
/**
|
||||
* @brief Destroy a ring queue with a dynamic allocated pool.
|
||||
* destroy a ring queue with a dynamic allocated pool.
|
||||
*
|
||||
* @attention None
|
||||
*
|
||||
* @param[in] ring_q pointer to the handler of the ring queue.
|
||||
*
|
||||
* @return errcode
|
||||
* @retval #K_ERR_NONE return successfully.
|
||||
* @retval #K_ERR_OBJ_INVALID_ALLOC_TYPE invalid alloc type(is static allocated not dynamic)
|
||||
*/
|
||||
__API__ k_err_t tos_ring_q_destroy_dyn(k_ring_q_t *ring_q);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @brief Enqueue an item.
|
||||
* enqueue an item into the ring queue.
|
||||
|
Reference in New Issue
Block a user