Browse Source

core/cib: add peek capabilities

pr/spi.typo
Victor Arino 7 years ago
parent
commit
de173ff48f
  1. 16
      core/include/cib.h

16
core/include/cib.h

@ -86,6 +86,22 @@ static inline int cib_get(cib_t *__restrict cib)
return -1;
}
/**
* @brief Get the index of the next item in buffer without removing it.
*
* @param[in,out] cib corresponding *cib* to buffer.
* Must not be NULL.
* @return index of next item, -1 if the buffer is empty
*/
static inline int cib_peek(cib_t *__restrict cib)
{
if (cib->write_count > cib->read_count) {
return (int) (cib->read_count & cib->mask);
}
return -1;
}
/**
* @brief Get index for item in buffer to put to.
*

Loading…
Cancel
Save