refactor osal queue API

This commit is contained in:
hathach
2018-02-28 16:45:54 +07:00
parent c961bb47fe
commit 30124b9b02
11 changed files with 81 additions and 369 deletions

View File

@@ -78,13 +78,15 @@
*/
typedef struct
{
uint8_t* const buffer ; ///< buffer pointer
uint16_t const depth ; ///< max items
uint16_t const item_size ; ///< size of each item
volatile uint16_t count ; ///< number of items in queue
volatile uint16_t wr_idx ; ///< write pointer
volatile uint16_t rd_idx ; ///< read pointer
bool overwritable ;
uint8_t* buffer ; ///< buffer pointer
uint16_t depth ; ///< max items
uint16_t item_size ; ///< size of each item
volatile uint16_t count ; ///< number of items in queue
volatile uint16_t wr_idx ; ///< write pointer
volatile uint16_t rd_idx ; ///< read pointer
bool overwritable ;
#if CFG_FIFO_MUTEX
fifo_mutex_t * const mutex;
@@ -118,12 +120,12 @@ static inline bool fifo_peek(fifo_t* f, void * p_buffer)
return fifo_peek_at(f, 0, p_buffer);
}
static inline bool fifo_is_empty(fifo_t* f)
static inline bool fifo_empty(fifo_t* f)
{
return (f->count == 0);
}
static inline bool fifo_is_full(fifo_t* f)
static inline bool fifo_full(fifo_t* f)
{
return (f->count == f->depth);
}