add TU_FIFO_INIT() to help with tu_fifo declaration

tu_fifo_clear() also reset max_pointer_idx and non_used_index_space
This commit is contained in:
hathach
2021-02-19 11:57:56 +07:00
parent be9f86ca9e
commit 2a04ee68b8
4 changed files with 25 additions and 34 deletions

View File

@@ -598,6 +598,8 @@ bool tu_fifo_clear(tu_fifo_t *f)
{
tu_fifo_lock(f);
f->rd_idx = f->wr_idx = 0;
f->max_pointer_idx = 2*f->depth-1;
f->non_used_index_space = UINT16_MAX - f->max_pointer_idx;
tu_fifo_unlock(f);
return true;