mm/circbuf: add circbuf_is_init to indicate circbuf state

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
Jiuzhu Dong 2022-07-21 02:31:18 +00:00 committed by Xiang Xiao
parent 3132f169ef
commit a853c70093
2 changed files with 27 additions and 0 deletions

View File

@ -126,6 +126,18 @@ void circbuf_uninit(FAR struct circbuf_s *circ);
void circbuf_reset(FAR struct circbuf_s *circ);
/****************************************************************************
* Name: circbuf_is_init
*
* Description:
* Return true if the circular buffer had been initialized.
*
* Input Parameters:
* circ - Address of the circular buffer to be used.
****************************************************************************/
bool circbuf_is_init(FAR struct circbuf_s *circ);
/****************************************************************************
* Name: circbuf_is_full
*

View File

@ -227,6 +227,21 @@ size_t circbuf_space(FAR struct circbuf_s *circ)
return circbuf_size(circ) - circbuf_used(circ);
}
/****************************************************************************
* Name: circbuf_is_init
*
* Description:
* Return true if the circular buffer had been initialized.
*
* Input Parameters:
* circ - Address of the circular buffer to be used.
****************************************************************************/
bool circbuf_is_init(FAR struct circbuf_s *circ)
{
return !!circ->base;
}
/****************************************************************************
* Name: circbuf_is_empty
*