circbuf support write or read buffer direct

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao
2023-03-28 22:13:23 +08:00
committed by Xiang Xiao
parent 781a34da94
commit 9971dfd0c1
2 changed files with 178 additions and 0 deletions
+66
View File
@@ -337,6 +337,72 @@ ssize_t circbuf_write(FAR struct circbuf_s *circ,
ssize_t circbuf_overwrite(FAR struct circbuf_s *circ,
FAR const void *src, size_t bytes);
/****************************************************************************
* Name: circbuf_get_writeptr
*
* Description:
* Get the write pointer of the circbuf.
*
* Input Parameters:
* circ - Address of the circular buffer to be used.
* size - Returns the maximum size that can be written consecutively.
*
* Returned Value:
* The write pointer of the circbuf.
*
****************************************************************************/
FAR void *circbuf_get_writeptr(FAR struct circbuf_s *circ, FAR size_t *size);
/****************************************************************************
* Name: circbuf_get_readptr
*
* Description:
* Get the read pointer of the circbuf.
*
* Input Parameters:
* circ - Address of the circular buffer to be used.
* size - Returns the maximum size that can be read consecutively.
*
* Returned Value:
* The read pointer of the circbuf.
*
****************************************************************************/
FAR void *circbuf_get_readptr(FAR struct circbuf_s *circ, FAR size_t *size);
/****************************************************************************
* Name: circbuf_writecommit
*
* Description:
* After writing data using the buf returned by circbuf_writebuf,
* you need to use this function to update the internal structure
* of cricbuf.
*
* Input Parameters:
* circ - Address of the circular buffer to be used.
* writtensize - The data that has been written to the buffer.
*
****************************************************************************/
void circbuf_writecommit(FAR struct circbuf_s *circ, size_t writtensize);
/****************************************************************************
* Name: circbuf_readcommit
*
* Description:
* After reading data using the buf returned by circbuf_readbuf,
* you need to use this function to update the internal structure
* of cricbuf.
*
* Input Parameters:
* circ - Address of the circular buffer to be used.
* readsize - The data that has been read to the buffer.
*
****************************************************************************/
void circbuf_readcommit(FAR struct circbuf_s *circ, size_t readsize);
#undef EXTERN
#if defined(__cplusplus)
}