diff --git a/drivers/rc/Kconfig b/drivers/rc/Kconfig index bc580ed107f..9e4a5d42611 100644 --- a/drivers/rc/Kconfig +++ b/drivers/rc/Kconfig @@ -5,7 +5,7 @@ menuconfig DRIVERS_RC bool "Remote Control Device Support" - select MM_CIRC_BUF + select MM_CIRCBUF default n ---help--- Drivers for various remote control diff --git a/drivers/rc/lirc_dev.c b/drivers/rc/lirc_dev.c index 73e66ddcb5d..d68a1d8eab0 100644 --- a/drivers/rc/lirc_dev.c +++ b/drivers/rc/lirc_dev.c @@ -30,8 +30,8 @@ #include #include +#include #include -#include /**************************************************************************** * Pre-processor Definitions @@ -63,7 +63,7 @@ struct lirc_fh_s { struct list_node node; /* list of open file handles */ FAR struct lirc_lowerhalf_s *lower; /* the pointer to lirc_lowerhalf_s */ - struct circ_buf_s buffer; /* buffer for incoming IR */ + struct circbuf_s buffer; /* buffer for incoming IR */ FAR struct pollfd *fd; /* poll structures of threads waiting for driver events */ sem_t waitsem; /* sem of wait buffer for ready */ int carrier_low; /* when setting the carrier range, first the low end must be @@ -164,7 +164,7 @@ static int lirc_open(FAR struct file *filep) fh->send_mode = LIRC_MODE_PULSE; } - ret = circ_buf_init(&fh->buffer, NULL, lower->buffer_bytes); + ret = circbuf_init(&fh->buffer, NULL, lower->buffer_bytes); if (ret < 0) { goto buffer_err; @@ -194,7 +194,7 @@ static int lirc_open(FAR struct file *filep) open_err: nxsem_destroy(&fh->waitsem); - circ_buf_uninit(&fh->buffer); + circbuf_uninit(&fh->buffer); buffer_err: kmm_free(fh); return ret; @@ -213,7 +213,7 @@ static int lirc_close(FAR struct file *filep) leave_critical_section(flags); nxsem_destroy(&fh->waitsem); - circ_buf_uninit(&fh->buffer); + circbuf_uninit(&fh->buffer); kmm_free(fh); if (list_is_empty(&upper->fh)) @@ -244,7 +244,7 @@ static int lirc_poll(FAR struct file *filep, fh->fd = fds; fds->priv = &fh->fd; - if (!circ_buf_is_empty(&fh->buffer)) + if (!circbuf_is_empty(&fh->buffer)) { eventset = (fds->events & (POLLIN | POLLRDNORM)); } @@ -688,7 +688,7 @@ static ssize_t lirc_read_scancode(FAR struct file *filep, FAR char *buffer, flags = enter_critical_section(); do { - if (circ_buf_is_empty(&fh->buffer)) + if (circbuf_is_empty(&fh->buffer)) { if (filep->f_oflags & O_NONBLOCK) { @@ -703,7 +703,7 @@ static ssize_t lirc_read_scancode(FAR struct file *filep, FAR char *buffer, } } - len = circ_buf_read(&fh->buffer, buffer, length); + len = circbuf_read(&fh->buffer, buffer, length); } while (len <= 0); @@ -728,7 +728,7 @@ static ssize_t lirc_read_mode2(FAR struct file *filep, FAR char *buffer, flags = enter_critical_section(); do { - if (circ_buf_is_empty(&fh->buffer)) + if (circbuf_is_empty(&fh->buffer)) { if (filep->f_oflags & O_NONBLOCK) { @@ -743,7 +743,7 @@ static ssize_t lirc_read_mode2(FAR struct file *filep, FAR char *buffer, } } - len = circ_buf_read(&fh->buffer, buffer, length); + len = circbuf_read(&fh->buffer, buffer, length); } while (len <= 0); @@ -936,7 +936,7 @@ void lirc_raw_event(FAR struct lirc_lowerhalf_s *lower, list_for_every_safe(&upper->fh, node, tmp) { fh = (FAR struct lirc_fh_s *)node; - if (circ_buf_write(&fh->buffer, &gap, sizeof(int)) > 0) + if (circbuf_write(&fh->buffer, &gap, sizeof(int)) > 0) { lirc_pollnotify(fh, POLLIN | POLLRDNORM); nxsem_get_value(&fh->waitsem, &semcount); @@ -964,7 +964,7 @@ void lirc_raw_event(FAR struct lirc_lowerhalf_s *lower, continue; } - if (circ_buf_write(&fh->buffer, &sample, sizeof(unsigned int)) > 0) + if (circbuf_write(&fh->buffer, &sample, sizeof(unsigned int)) > 0) { lirc_pollnotify(fh, POLLIN | POLLRDNORM); nxsem_get_value(&fh->waitsem, &semcount); @@ -1008,7 +1008,7 @@ void lirc_scancode_event(FAR struct lirc_lowerhalf_s *lower, list_for_every_safe(&upper->fh, node, tmp) { fh = (FAR struct lirc_fh_s *)node; - if (circ_buf_write(&fh->buffer, lsc, sizeof(*lsc)) > 0) + if (circbuf_write(&fh->buffer, lsc, sizeof(*lsc)) > 0) { lirc_pollnotify(fh, POLLIN | POLLRDNORM); nxsem_get_value(&fh->waitsem, &semcount); @@ -1054,7 +1054,7 @@ void lirc_sample_event(FAR struct lirc_lowerhalf_s *lower, list_for_every_safe(&upper->fh, node, tmp) { fh = (FAR struct lirc_fh_s *)node; - if (circ_buf_write(&fh->buffer, &sample, sizeof(unsigned int)) > 0) + if (circbuf_write(&fh->buffer, &sample, sizeof(unsigned int)) > 0) { lirc_pollnotify(fh, POLLIN | POLLRDNORM); nxsem_get_value(&fh->waitsem, &semcount); diff --git a/drivers/sensors/Kconfig b/drivers/sensors/Kconfig index 3be0d010f53..c69578bd4d3 100644 --- a/drivers/sensors/Kconfig +++ b/drivers/sensors/Kconfig @@ -5,7 +5,7 @@ menuconfig SENSORS bool "Sensor Device Support" - select MM_CIRC_BUF + select MM_CIRCBUF default n ---help--- Drivers for various sensors diff --git a/drivers/sensors/sensor.c b/drivers/sensors/sensor.c index 5c27eac04a7..b12d7674780 100644 --- a/drivers/sensors/sensor.c +++ b/drivers/sensors/sensor.c @@ -34,8 +34,8 @@ #include #include #include +#include #include -#include /**************************************************************************** * Pre-processor Definitions @@ -68,7 +68,7 @@ struct sensor_upperhalf_s FAR struct pollfd *fds[CONFIG_SENSORS_NPOLLWAITERS]; FAR struct sensor_lowerhalf_s *lower; /* the handle of lower half driver */ - struct circ_buf_s buffer; /* The circular buffer of sensor device */ + struct circbuf_s buffer; /* The circular buffer of sensor device */ uint8_t esize; /* The element size of circular buffer */ uint8_t crefs; /* Number of times the device has been opened */ sem_t exclsem; /* Manages exclusive access to file operations */ @@ -195,7 +195,7 @@ static int sensor_open(FAR struct file *filep) { /* Initialize sensor buffer */ - ret = circ_buf_init(&upper->buffer, NULL, lower->buffer_size); + ret = circbuf_init(&upper->buffer, NULL, lower->buffer_size); if (ret < 0) { goto err; @@ -228,7 +228,7 @@ static int sensor_close(FAR struct file *filep) if (ret >= 0) { upper->enabled = false; - circ_buf_uninit(&upper->buffer); + circbuf_uninit(&upper->buffer); } } @@ -283,7 +283,7 @@ static ssize_t sensor_read(FAR struct file *filep, FAR char *buffer, * that have just entered the buffer. */ - while (circ_buf_is_empty(&upper->buffer)) + while (circbuf_is_empty(&upper->buffer)) { if (filep->f_oflags & O_NONBLOCK) { @@ -307,7 +307,7 @@ static ssize_t sensor_read(FAR struct file *filep, FAR char *buffer, } } - ret = circ_buf_read(&upper->buffer, buffer, len); + ret = circbuf_read(&upper->buffer, buffer, len); /* Release some buffer space when current mode isn't batch mode * and last mode is batch mode, and the number of bytes avaliable @@ -315,10 +315,10 @@ static ssize_t sensor_read(FAR struct file *filep, FAR char *buffer, */ if (upper->latency == 0 && - circ_buf_size(&upper->buffer) > lower->buffer_size && - circ_buf_used(&upper->buffer) <= lower->buffer_size) + circbuf_size(&upper->buffer) > lower->buffer_size && + circbuf_used(&upper->buffer) <= lower->buffer_size) { - ret = circ_buf_resize(&upper->buffer, lower->buffer_size); + ret = circbuf_resize(&upper->buffer, lower->buffer_size); } } @@ -404,7 +404,7 @@ static int sensor_ioctl(FAR struct file *filep, int cmd, unsigned long arg) upper->interval * upper->esize + lower->buffer_size, upper->esize); - ret = circ_buf_resize(&upper->buffer, bytes); + ret = circbuf_resize(&upper->buffer, bytes); } } } @@ -421,7 +421,7 @@ static int sensor_ioctl(FAR struct file *filep, int cmd, unsigned long arg) if (*val != 0) { lower->buffer_size = ROUNDUP(*val, upper->esize); - ret = circ_buf_resize(&upper->buffer, lower->buffer_size); + ret = circbuf_resize(&upper->buffer, lower->buffer_size); if (ret >= 0) { *val = lower->buffer_size; @@ -504,7 +504,7 @@ static int sensor_poll(FAR struct file *filep, } } } - else if (!circ_buf_is_empty(&upper->buffer)) + else if (!circbuf_is_empty(&upper->buffer)) { eventset |= (fds->events & POLLIN); } @@ -543,7 +543,7 @@ static void sensor_push_event(FAR void *priv, FAR const void *data, return; } - circ_buf_overwrite(&upper->buffer, data, bytes); + circbuf_overwrite(&upper->buffer, data, bytes); sensor_pollnotify(upper, POLLIN); nxsem_get_value(&upper->buffersem, &semcount); if (semcount < 1) diff --git a/include/nuttx/mm/circ_buf.h b/include/nuttx/mm/circbuf.h similarity index 87% rename from include/nuttx/mm/circ_buf.h rename to include/nuttx/mm/circbuf.h index 912b39bf9db..c6d291c8da6 100644 --- a/include/nuttx/mm/circ_buf.h +++ b/include/nuttx/mm/circbuf.h @@ -1,5 +1,5 @@ /**************************************************************************** - * include/nuttx/mm/circ_buf.h + * include/nuttx/mm/circbuf.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -18,8 +18,8 @@ * ****************************************************************************/ -#ifndef __INCLUDE_NUTTX_MM_CIRC_BUF_H -#define __INCLUDE_NUTTX_MM_CIRC_BUF_H +#ifndef __INCLUDE_NUTTX_MM_CIRCBUF_H +#define __INCLUDE_NUTTX_MM_CIRCBUF_H /* Note about locking: There is no locking required while only one reader * and one writer is using the circular buffer. @@ -41,7 +41,7 @@ /* This structure describes circular buffer */ -struct circ_buf_s +struct circbuf_s { FAR void *base; /* The pointer to buffer space */ size_t size; /* The size of buffer space */ @@ -64,7 +64,7 @@ extern "C" #endif /**************************************************************************** - * Name: circ_buf_init + * Name: circbuf_init * * Description: * Initialize a circular buffer. @@ -82,11 +82,11 @@ extern "C" * ****************************************************************************/ -int circ_buf_init(FAR struct circ_buf_s *circ, +int circbuf_init(FAR struct circbuf_s *circ, FAR void *base, size_t bytes); /**************************************************************************** - * Name: circ_buf_resize + * Name: circbuf_resize * * Description: * Resize a circular buffer (change buffer size). @@ -100,10 +100,10 @@ int circ_buf_init(FAR struct circ_buf_s *circ, * ****************************************************************************/ -int circ_buf_resize(FAR struct circ_buf_s *circ, size_t bytes); +int circbuf_resize(FAR struct circbuf_s *circ, size_t bytes); /**************************************************************************** - * Name: circ_buf_uninit + * Name: circbuf_uninit * * Description: * Free the circular buffer. @@ -112,10 +112,10 @@ int circ_buf_resize(FAR struct circ_buf_s *circ, size_t bytes); * circ - Address of the circular buffer to be used. ****************************************************************************/ -void circ_buf_uninit(FAR struct circ_buf_s *circ); +void circbuf_uninit(FAR struct circbuf_s *circ); /**************************************************************************** - * Name: circ_buf_reset + * Name: circbuf_reset * * Description: * Remove the entire circular buffer content. @@ -124,10 +124,10 @@ void circ_buf_uninit(FAR struct circ_buf_s *circ); * circ - Address of the circular buffer to be used. ****************************************************************************/ -void circ_buf_reset(FAR struct circ_buf_s *circ); +void circbuf_reset(FAR struct circbuf_s *circ); /**************************************************************************** - * Name: circ_buf_is_full + * Name: circbuf_is_full * * Description: * Return true if the circular buffer is full. @@ -136,10 +136,10 @@ void circ_buf_reset(FAR struct circ_buf_s *circ); * circ - Address of the circular buffer to be used. ****************************************************************************/ -bool circ_buf_is_full(FAR struct circ_buf_s *circ); +bool circbuf_is_full(FAR struct circbuf_s *circ); /**************************************************************************** - * Name: circ_buf_is_empty + * Name: circbuf_is_empty * * Description: * Return true if the circular buffer is empty. @@ -148,10 +148,10 @@ bool circ_buf_is_full(FAR struct circ_buf_s *circ); * circ - Address of the circular buffer to be used. ****************************************************************************/ -bool circ_buf_is_empty(FAR struct circ_buf_s *circ); +bool circbuf_is_empty(FAR struct circbuf_s *circ); /**************************************************************************** - * Name: circ_buf_size + * Name: circbuf_size * * Description: * Return size of the circular buffer. @@ -160,10 +160,10 @@ bool circ_buf_is_empty(FAR struct circ_buf_s *circ); * circ - Address of the circular buffer to be used. ****************************************************************************/ -size_t circ_buf_size(FAR struct circ_buf_s *circ); +size_t circbuf_size(FAR struct circbuf_s *circ); /**************************************************************************** - * Name: circ_buf_used + * Name: circbuf_used * * Description: * Return the used bytes of the circular buffer. @@ -172,10 +172,10 @@ size_t circ_buf_size(FAR struct circ_buf_s *circ); * circ - Address of the circular buffer to be used. ****************************************************************************/ -size_t circ_buf_used(FAR struct circ_buf_s *circ); +size_t circbuf_used(FAR struct circbuf_s *circ); /**************************************************************************** - * Name: circ_buf_space + * Name: circbuf_space * * Description: * Return the remaing space of the circular buffer. @@ -184,10 +184,10 @@ size_t circ_buf_used(FAR struct circ_buf_s *circ); * circ - Address of the circular buffer to be used. ****************************************************************************/ -size_t circ_buf_space(FAR struct circ_buf_s *circ); +size_t circbuf_space(FAR struct circbuf_s *circ); /**************************************************************************** - * Name: circ_buf_peek + * Name: circbuf_peek * * Description: * Get data form the circular buffer without removing @@ -206,11 +206,11 @@ size_t circ_buf_space(FAR struct circ_buf_s *circ); * A negated errno value is returned on any failure. ****************************************************************************/ -ssize_t circ_buf_peek(FAR struct circ_buf_s *circ, +ssize_t circbuf_peek(FAR struct circbuf_s *circ, FAR void *dst, size_t bytes); /**************************************************************************** - * Name: circ_buf_read + * Name: circbuf_read * * Description: * Get data form the circular buffer. @@ -229,11 +229,11 @@ ssize_t circ_buf_peek(FAR struct circ_buf_s *circ, * A negated errno value is returned on any failure. ****************************************************************************/ -ssize_t circ_buf_read(FAR struct circ_buf_s *circ, +ssize_t circbuf_read(FAR struct circbuf_s *circ, FAR void *dst, size_t bytes); /**************************************************************************** - * Name: circ_buf_skip + * Name: circbuf_skip * * Description: * Skip data form the circular buffer. @@ -251,10 +251,10 @@ ssize_t circ_buf_read(FAR struct circ_buf_s *circ, * A negated errno value is returned on any failure. ****************************************************************************/ -ssize_t circ_buf_skip(FAR struct circ_buf_s *circ, size_t bytes); +ssize_t circbuf_skip(FAR struct circbuf_s *circ, size_t bytes); /**************************************************************************** - * Name: circ_buf_write + * Name: circbuf_write * * Description: * Write data to the circular buffer. @@ -273,18 +273,18 @@ ssize_t circ_buf_skip(FAR struct circ_buf_s *circ, size_t bytes); * A negated errno value is returned on any failure. ****************************************************************************/ -ssize_t circ_buf_write(FAR struct circ_buf_s *circ, +ssize_t circbuf_write(FAR struct circbuf_s *circ, FAR const void *src, size_t bytes); /**************************************************************************** - * Name: circ_buf_overwrite + * Name: circbuf_overwrite * * Description: * Write data to the circular buffer. It can overwrite old data when * circular buffer don't have enough space to store data. * * Note: - * Usage circ_buf_overwrite () is dangerous. It should be only called + * Usage circbuf_overwrite () is dangerous. It should be only called * when the buffer is exclusived locked or when it is secured that no * other thread is accessing the buffer. * @@ -298,7 +298,7 @@ ssize_t circ_buf_write(FAR struct circ_buf_s *circ, * A negated errno value is returned on any failure. ****************************************************************************/ -ssize_t circ_buf_overwrite(FAR struct circ_buf_s *circ, +ssize_t circbuf_overwrite(FAR struct circbuf_s *circ, FAR const void *src, size_t bytes); #undef EXTERN diff --git a/mm/Kconfig b/mm/Kconfig index ea928eb0073..788ae473c87 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -155,7 +155,7 @@ config MM_FILL_ALLOCATIONS Fill all malloc() allocations with 0xAA. This helps detecting uninitialized variable errors. -config MM_CIRC_BUF +config MM_CIRCBUF bool "Circular buffer support" default n ---help--- diff --git a/mm/Makefile b/mm/Makefile index 6281c0a9446..ae04d1980af 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -43,7 +43,7 @@ include kmm_heap/Make.defs include mm_gran/Make.defs include shm/Make.defs include iob/Make.defs -include circ_buf/Make.defs +include circbuf/Make.defs BINDIR ?= bin diff --git a/mm/circ_buf/Make.defs b/mm/circbuf/Make.defs similarity index 89% rename from mm/circ_buf/Make.defs rename to mm/circbuf/Make.defs index 6d14e3f996f..1d71c24fbc5 100644 --- a/mm/circ_buf/Make.defs +++ b/mm/circbuf/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# mm/circ_buf/Make.defs +# mm/circbuf/Make.defs # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -20,11 +20,11 @@ # Circular buffer management -ifeq ($(CONFIG_MM_CIRC_BUF),y) -CSRCS += circ_buf.c +ifeq ($(CONFIG_MM_CIRCBUF),y) +CSRCS += circbuf.c # Add the circular buffer directory to the build -DEPPATH += --dep-path circ_buf -VPATH += :circ_buf +DEPPATH += --dep-path circbuf +VPATH += :circbuf endif diff --git a/mm/circ_buf/circ_buf.c b/mm/circbuf/circbuf.c similarity index 87% rename from mm/circ_buf/circ_buf.c rename to mm/circbuf/circbuf.c index bc638f38017..cef8e136922 100644 --- a/mm/circ_buf/circ_buf.c +++ b/mm/circbuf/circbuf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * mm/circ_buf/circ_buf.c + * mm/circbuf/circbuf.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -32,7 +32,7 @@ #include #include -#include +#include /**************************************************************************** * Private Types @@ -43,7 +43,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: circ_buf_init + * Name: circbuf_init * * Description: * Initialize a circular buffer. @@ -61,7 +61,7 @@ * ****************************************************************************/ -int circ_buf_init(FAR struct circ_buf_s *circ, FAR void *base, size_t bytes) +int circbuf_init(FAR struct circbuf_s *circ, FAR void *base, size_t bytes) { DEBUGASSERT(circ); DEBUGASSERT(!base || bytes); @@ -86,7 +86,7 @@ int circ_buf_init(FAR struct circ_buf_s *circ, FAR void *base, size_t bytes) } /**************************************************************************** - * Name: circ_buf_resize + * Name: circbuf_resize * * Description: * Resize a circular buffer (change buffer size). @@ -100,7 +100,7 @@ int circ_buf_init(FAR struct circ_buf_s *circ, FAR void *base, size_t bytes) * ****************************************************************************/ -int circ_buf_resize(FAR struct circ_buf_s *circ, size_t bytes) +int circbuf_resize(FAR struct circbuf_s *circ, size_t bytes) { FAR void *tmp; size_t len; @@ -114,14 +114,14 @@ int circ_buf_resize(FAR struct circ_buf_s *circ, size_t bytes) return -ENOMEM; } - len = circ_buf_used(circ); + len = circbuf_used(circ); if (bytes < len) { - circ_buf_skip(circ, len - bytes); + circbuf_skip(circ, len - bytes); len = bytes; } - circ_buf_read(circ, tmp, len); + circbuf_read(circ, tmp, len); kmm_free(circ->base); @@ -134,7 +134,7 @@ int circ_buf_resize(FAR struct circ_buf_s *circ, size_t bytes) } /**************************************************************************** - * Name: circ_buf_reset + * Name: circbuf_reset * * Description: * Remove the entire circular buffer content. @@ -143,14 +143,14 @@ int circ_buf_resize(FAR struct circ_buf_s *circ, size_t bytes) * circ - Address of the circular buffer to be used. ****************************************************************************/ -void circ_buf_reset(FAR struct circ_buf_s *circ) +void circbuf_reset(FAR struct circbuf_s *circ) { DEBUGASSERT(circ); circ->head = circ->tail = 0; } /**************************************************************************** - * Name: circ_buf_uninit + * Name: circbuf_uninit * * Description: * Free the circular buffer. @@ -159,7 +159,7 @@ void circ_buf_reset(FAR struct circ_buf_s *circ) * circ - Address of the circular buffer to be used. ****************************************************************************/ -void circ_buf_uninit(FAR struct circ_buf_s *circ) +void circbuf_uninit(FAR struct circbuf_s *circ) { DEBUGASSERT(circ); @@ -172,7 +172,7 @@ void circ_buf_uninit(FAR struct circ_buf_s *circ) } /**************************************************************************** - * Name: circ_buf_size + * Name: circbuf_size * * Description: * Return size of the circular buffer. @@ -181,14 +181,14 @@ void circ_buf_uninit(FAR struct circ_buf_s *circ) * circ - Address of the circular buffer to be used. ****************************************************************************/ -size_t circ_buf_size(FAR struct circ_buf_s *circ) +size_t circbuf_size(FAR struct circbuf_s *circ) { DEBUGASSERT(circ); return circ->size; } /**************************************************************************** - * Name: circ_buf_used + * Name: circbuf_used * * Description: * Return the used bytes of the circular buffer. @@ -197,14 +197,14 @@ size_t circ_buf_size(FAR struct circ_buf_s *circ) * circ - Address of the circular buffer to be used. ****************************************************************************/ -size_t circ_buf_used(FAR struct circ_buf_s *circ) +size_t circbuf_used(FAR struct circbuf_s *circ) { DEBUGASSERT(circ); return circ->head - circ->tail; } /**************************************************************************** - * Name: circ_buf_space + * Name: circbuf_space * * Description: * Return the remaing space of the circular buffer. @@ -213,13 +213,13 @@ size_t circ_buf_used(FAR struct circ_buf_s *circ) * circ - Address of the circular buffer to be used. ****************************************************************************/ -size_t circ_buf_space(FAR struct circ_buf_s *circ) +size_t circbuf_space(FAR struct circbuf_s *circ) { - return circ_buf_size(circ) - circ_buf_used(circ); + return circbuf_size(circ) - circbuf_used(circ); } /**************************************************************************** - * Name: circ_buf_is_empty + * Name: circbuf_is_empty * * Description: * Return true if the circular buffer is empty. @@ -228,13 +228,13 @@ size_t circ_buf_space(FAR struct circ_buf_s *circ) * circ - Address of the circular buffer to be used. ****************************************************************************/ -bool circ_buf_is_empty(FAR struct circ_buf_s *circ) +bool circbuf_is_empty(FAR struct circbuf_s *circ) { - return !circ_buf_used(circ); + return !circbuf_used(circ); } /**************************************************************************** - * Name: circ_buf_is_full + * Name: circbuf_is_full * * Description: * Return true if the circular buffer is full. @@ -243,13 +243,13 @@ bool circ_buf_is_empty(FAR struct circ_buf_s *circ) * circ - Address of the circular buffer to be used. ****************************************************************************/ -bool circ_buf_is_full(FAR struct circ_buf_s *circ) +bool circbuf_is_full(FAR struct circbuf_s *circ) { - return !circ_buf_space(circ); + return !circbuf_space(circ); } /**************************************************************************** - * Name: circ_buf_peek + * Name: circbuf_peek * * Description: * Get data form the circular buffer without removing @@ -268,7 +268,7 @@ bool circ_buf_is_full(FAR struct circ_buf_s *circ) * A negated errno value is returned on any failure. ****************************************************************************/ -ssize_t circ_buf_peek(FAR struct circ_buf_s *circ, +ssize_t circbuf_peek(FAR struct circbuf_s *circ, FAR void *dst, size_t bytes) { size_t len; @@ -276,7 +276,7 @@ ssize_t circ_buf_peek(FAR struct circ_buf_s *circ, DEBUGASSERT(circ); - len = circ_buf_used(circ); + len = circbuf_used(circ); off = circ->tail % circ->size; if (bytes > len) @@ -297,7 +297,7 @@ ssize_t circ_buf_peek(FAR struct circ_buf_s *circ, } /**************************************************************************** - * Name: circ_buf_read + * Name: circbuf_read * * Description: * Get data form the circular buffer. @@ -316,20 +316,20 @@ ssize_t circ_buf_peek(FAR struct circ_buf_s *circ, * A negated errno value is returned on any failure. ****************************************************************************/ -ssize_t circ_buf_read(FAR struct circ_buf_s *circ, +ssize_t circbuf_read(FAR struct circbuf_s *circ, FAR void *dst, size_t bytes) { DEBUGASSERT(circ); DEBUGASSERT(dst || !bytes); - bytes = circ_buf_peek(circ, dst, bytes); + bytes = circbuf_peek(circ, dst, bytes); circ->tail += bytes; return bytes; } /**************************************************************************** - * Name: circ_buf_skip + * Name: circbuf_skip * * Description: * Skip data form the circular buffer. @@ -347,13 +347,13 @@ ssize_t circ_buf_read(FAR struct circ_buf_s *circ, * A negated errno value is returned on any failure. ****************************************************************************/ -ssize_t circ_buf_skip(FAR struct circ_buf_s *circ, size_t bytes) +ssize_t circbuf_skip(FAR struct circbuf_s *circ, size_t bytes) { size_t len; DEBUGASSERT(circ); - len = circ_buf_used(circ); + len = circbuf_used(circ); if (bytes > len) { @@ -366,7 +366,7 @@ ssize_t circ_buf_skip(FAR struct circ_buf_s *circ, size_t bytes) } /**************************************************************************** - * Name: circ_buf_write + * Name: circbuf_write * * Description: * Write data to the circular buffer. @@ -385,7 +385,7 @@ ssize_t circ_buf_skip(FAR struct circ_buf_s *circ, size_t bytes) * A negated errno value is returned on any failure. ****************************************************************************/ -ssize_t circ_buf_write(FAR struct circ_buf_s *circ, +ssize_t circbuf_write(FAR struct circbuf_s *circ, FAR const void *src, size_t bytes) { size_t space; @@ -394,7 +394,7 @@ ssize_t circ_buf_write(FAR struct circ_buf_s *circ, DEBUGASSERT(circ); DEBUGASSERT(src || !bytes); - space = circ_buf_space(circ); + space = circbuf_space(circ); off = circ->head % circ->size; if (bytes > space) { @@ -415,14 +415,14 @@ ssize_t circ_buf_write(FAR struct circ_buf_s *circ, } /**************************************************************************** - * Name: circ_buf_overwrite + * Name: circbuf_overwrite * * Description: * Write data to the circular buffer. It can overwrite old data when * circular buffer don't have enough space to store data. * * Note: - * Usage circ_buf_overwrite () is dangerous. It should be only called + * Usage circbuf_overwrite () is dangerous. It should be only called * when the buffer is exclusived locked or when it is secured that no * other thread is accessing the buffer. * @@ -436,7 +436,7 @@ ssize_t circ_buf_write(FAR struct circ_buf_s *circ, * A negated errno value is returned on any failure. ****************************************************************************/ -ssize_t circ_buf_overwrite(FAR struct circ_buf_s *circ, +ssize_t circbuf_overwrite(FAR struct circbuf_s *circ, FAR const void *src, size_t bytes) { size_t overwrite = 0; @@ -452,7 +452,7 @@ ssize_t circ_buf_overwrite(FAR struct circ_buf_s *circ, bytes = circ->size; } - space = circ_buf_space(circ); + space = circbuf_space(circ); if (bytes > space) { overwrite = bytes - space;