mm/circbuf: add circbuf_is_init to indicate circbuf state
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
3132f169ef
commit
a853c70093
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue