/* * @file hv_vos_Queue.h * @brief Header file of queue. * * @verbatim * ============================================================================== * ##### How to use ##### * ============================================================================== * (+) Use () * * @endverbatim * @author HiView SoC Software Team * @version 1.0.0 * @date 2023-03-01 */ #ifndef _HV_VOS_QUEUE_H #define _HV_VOS_QUEUE_H VOS_EXTERN_C_BEGIN typedef struct _HV_VOS_QUEUE_INIT_PARAMS{ UINT32 queueLen; UINT32 itemSize; } Hv_Vos_QUEUE_INIT_PARAMS; /** @defgroup VOS_QUEUE VOS_QUEUE * VOS queue functions * @{ */ /** @brief queue forward declaration */ typedef struct _HV_VOS_QUEUE_S HV_VOS_QUEUE_S; /** @brief Create queue * * @return queue pointer, return NULL if create fail */ HV_VOS_QUEUE_S *Hv_Vos_QueueInit(Hv_Vos_QUEUE_INIT_PARAMS *param); /** @brief Destroy queue * * @param self queue pointer * @return result */ void Hv_Vos_QueueCleanup(HV_VOS_QUEUE_S *self); /** @brief Enqueue * * @param self queue pointer * @param buffer pointer to buffer * @param waitTicks wait ticks */ BOOL Hv_Vos_QueueSend(HV_VOS_QUEUE_S *self, const void *buffer); BOOL Hv_Vos_QueueTimedSend(HV_VOS_QUEUE_S *self, const void *buffer, UINT32 waitMs); /** @brief Enqueue in ISR * * @param self semaphore pointer * @param buffer pointer to buffer */ BOOL Hv_Vos_QueueSendFromISR(HV_VOS_QUEUE_S *self, const void *buffer); BOOL Hv_Vos_QueueSendFromISR_unYield(HV_VOS_QUEUE_S *self, const void *buffer); /** @brief Dequeu * * @param self queue pointer * @param buffer pointer to buffer * @param waitTicks wait ticks */ BOOL Hv_Vos_QueueRecv(HV_VOS_QUEUE_S *self, void *buffer); BOOL Hv_Vos_QueueTimedRecv(HV_VOS_QUEUE_S *self, void *buffer, UINT32 waitMs); BOOL Hv_Vos_QueueReceiveFromISR(HV_VOS_QUEUE_S *self, void *buffer); /** * @brief Dequeu Return the number of messages stored in a queue. * * @param self A handle to the queue being queried. * @return The number of messages available in the queue. */ ULONG32 Hv_Vos_QueueMessagesWaiting(const HV_VOS_QUEUE_S *self); /** * @brief Dequeu Return the number of messages stored in a queue. can use in isr. * * @param self A handle to the queue being queried. * @return The number of messages available in the queue. */ ULONG32 Hv_Vos_QueueMessagesWaitingFromISR(const HV_VOS_QUEUE_S *self); /** @} */ //end of group VOS_QUEUE VOS_EXTERN_C_END #endif