mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-15 17:43:51 +01:00
sys/tsrb: fix some style and linter complains
This commit is contained in:
parent
b04752eb30
commit
c06db62666
@ -33,7 +33,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief thread-safe ringbuffer struct
|
||||
* @brief thread-safe ringbuffer struct
|
||||
*/
|
||||
typedef struct tsrb {
|
||||
uint8_t *buf; /**< Buffer to operate on. */
|
||||
@ -43,22 +43,22 @@ typedef struct tsrb {
|
||||
} tsrb_t;
|
||||
|
||||
/**
|
||||
* @brief Static initializer
|
||||
* @brief Static initializer
|
||||
*
|
||||
* @note The size of the buffer (`sizeof(@p BUF)`) must be a power of two.
|
||||
*
|
||||
* @param[in] BUF Buffer to use by tsrb.
|
||||
* @param[in] BUF Buffer to use by tsrb.
|
||||
*/
|
||||
#define TSRB_INIT(BUF) { (BUF), sizeof (BUF), 0, 0 }
|
||||
|
||||
/**
|
||||
* @brief Initialize a tsrb.
|
||||
* @brief Initialize a tsrb.
|
||||
*
|
||||
* @note The size of the buffer (@p bufsize) must be a power of two.
|
||||
*
|
||||
* @param[out] rb Datum to initialize.
|
||||
* @param[in] buffer Buffer to use by tsrb.
|
||||
* @param[in] bufsize Size of @p buffer.
|
||||
* @param[out] rb Datum to initialize.
|
||||
* @param[in] buffer Buffer to use by tsrb.
|
||||
* @param[in] bufsize Size of @p buffer.
|
||||
*/
|
||||
static inline void tsrb_init(tsrb_t *rb, uint8_t *buffer, unsigned bufsize)
|
||||
{
|
||||
@ -74,8 +74,8 @@ static inline void tsrb_init(tsrb_t *rb, uint8_t *buffer, unsigned bufsize)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear a tsrb.
|
||||
* @param[out] rb Ringbuffer to operate on
|
||||
* @brief Clear a tsrb.
|
||||
* @param[out] rb Ringbuffer to operate on
|
||||
*/
|
||||
static inline void tsrb_clear(tsrb_t *rb)
|
||||
{
|
||||
@ -106,7 +106,7 @@ static inline int tsrb_empty(const tsrb_t *rb)
|
||||
static inline unsigned int tsrb_avail(const tsrb_t *rb)
|
||||
{
|
||||
unsigned irq_state = irq_disable();
|
||||
int retval = (rb->writes - rb->reads);
|
||||
unsigned int retval = (rb->writes - rb->reads);
|
||||
irq_restore(irq_state);
|
||||
return retval;
|
||||
}
|
||||
@ -133,7 +133,7 @@ static inline int tsrb_full(const tsrb_t *rb)
|
||||
static inline unsigned int tsrb_free(const tsrb_t *rb)
|
||||
{
|
||||
unsigned irq_state = irq_disable();
|
||||
int retval = (rb->size - rb->writes + rb->reads);
|
||||
unsigned int retval = (rb->size - rb->writes + rb->reads);
|
||||
irq_restore(irq_state);
|
||||
return retval;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user