unleashed-firmware/furi/core/message_queue.h
あく e3c7201a20
Furi: core refactoring and CMSIS removal part 2 (#1410)
* Furi: rename and move core
* Furi: drop CMSIS_OS header and unused api, partially refactor and cleanup the rest
* Furi: CMSIS_OS drop and refactoring.
* Furi: refactoring, remove cmsis legacy
* Furi: fix incorrect assert on queue deallocation, cleanup timer
* Furi: improve delay api, get rid of floats
* hal: dropped furi_hal_crc
* Furi: move DWT based delay to cortex HAL
* Furi: update core documentation

Co-authored-by: hedger <hedger@nanode.su>
2022-07-20 13:56:33 +03:00

95 lines
2.3 KiB
C

/**
* @file message_queue.h
* FuriMessageQueue
*/
#pragma once
#include "core/base.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef void FuriMessageQueue;
/** Allocate furi message queue
*
* @param[in] msg_count The message count
* @param[in] msg_size The message size
*
* @return pointer to FuriMessageQueue instance
*/
FuriMessageQueue* furi_message_queue_alloc(uint32_t msg_count, uint32_t msg_size);
/** Free queue
*
* @param instance pointer to FuriMessageQueue instance
*/
void furi_message_queue_free(FuriMessageQueue* instance);
/** Put message into queue
*
* @param instance pointer to FuriMessageQueue instance
* @param[in] msg_ptr The message pointer
* @param[in] timeout The timeout
* @param[in] msg_prio The message prio
*
* @return The furi status.
*/
FuriStatus
furi_message_queue_put(FuriMessageQueue* instance, const void* msg_ptr, uint32_t timeout);
/** Get message from queue
*
* @param instance pointer to FuriMessageQueue instance
* @param msg_ptr The message pointer
* @param msg_prio The message prioority
* @param[in] timeout The timeout
*
* @return The furi status.
*/
FuriStatus furi_message_queue_get(FuriMessageQueue* instance, void* msg_ptr, uint32_t timeout);
/** Get queue capacity
*
* @param instance pointer to FuriMessageQueue instance
*
* @return capacity in object count
*/
uint32_t furi_message_queue_get_capacity(FuriMessageQueue* instance);
/** Get message size
*
* @param instance pointer to FuriMessageQueue instance
*
* @return Message size in bytes
*/
uint32_t furi_message_queue_get_message_size(FuriMessageQueue* instance);
/** Get message count in queue
*
* @param instance pointer to FuriMessageQueue instance
*
* @return Message count
*/
uint32_t furi_message_queue_get_count(FuriMessageQueue* instance);
/** Get queue available space
*
* @param instance pointer to FuriMessageQueue instance
*
* @return Message count
*/
uint32_t furi_message_queue_get_space(FuriMessageQueue* instance);
/** Reset queue
*
* @param instance pointer to FuriMessageQueue instance
*
* @return The furi status.
*/
FuriStatus furi_message_queue_reset(FuriMessageQueue* instance);
#ifdef __cplusplus
}
#endif