MOS Source Code
Loading...
Searching...
No Matches
libs.RingBuffer

A ring buffer. More...

+ Collaboration diagram for libs.RingBuffer:

Classes

struct  ring_buffer_pos_t
 
struct  ring_buffer_t
 

Functions

MOSAPI ring_buffer_tring_buffer_create (size_t capacity)
 
MOSAPI ring_buffer_tring_buffer_create_at (void *data, size_t capacity)
 
MOSAPI void ring_buffer_pos_init (ring_buffer_pos_t *pos, size_t capacity)
 
MOSAPI void ring_buffer_destroy (ring_buffer_t *buffer)
 
MOSAPI bool ring_buffer_resize (ring_buffer_t *buffer, size_t new_capacity)
 
MOSAPI size_t ring_buffer_pos_push_back (u8 *buffer, ring_buffer_pos_t *pos, const u8 *data, size_t size)
 
MOSAPI size_t ring_buffer_pos_pop_back (u8 *buffer, ring_buffer_pos_t *pos, u8 *buf, size_t size)
 
MOSAPI size_t ring_buffer_pos_push_front (u8 *buffer, ring_buffer_pos_t *pos, const u8 *data, size_t size)
 
MOSAPI size_t ring_buffer_pos_pop_front (u8 *buffer, ring_buffer_pos_t *pos, u8 *buf, size_t size)
 
should_inline u8 ring_buffer_pos_pop_back_byte (u8 *buffer, ring_buffer_pos_t *pos)
 
should_inline u8 ring_buffer_pos_pop_front_byte (u8 *buffer, ring_buffer_pos_t *pos)
 
should_inline bool ring_buffer_pos_is_full (ring_buffer_pos_t *pos)
 
should_inline bool ring_buffer_pos_is_empty (ring_buffer_pos_t *pos)
 
should_inline size_t ring_buffer_pos_push_back_byte (u8 *buffer, ring_buffer_pos_t *pos, u8 data)
 
should_inline size_t ring_buffer_pos_push_front_byte (u8 *buffer, ring_buffer_pos_t *pos, u8 data)
 
should_inline bool ring_buffer_is_full (ring_buffer_t *buffer)
 
should_inline bool ring_buffer_is_empty (ring_buffer_t *buffer)
 
should_inline size_t ring_buffer_push_back (ring_buffer_t *buffer, const u8 *data, size_t size)
 
should_inline size_t ring_buffer_pop_back (ring_buffer_t *buffer, u8 *buf, size_t size)
 
should_inline size_t ring_buffer_push_front (ring_buffer_t *buffer, const u8 *data, size_t size)
 
should_inline size_t ring_buffer_pop_front (ring_buffer_t *buffer, u8 *buf, size_t size)
 
should_inline size_t ring_buffer_push_front_byte (ring_buffer_t *buffer, u8 byte)
 
should_inline size_t ring_buffer_push_back_byte (ring_buffer_t *buffer, u8 byte)
 
should_inline u8 ring_buffer_pop_back_byte (ring_buffer_t *buffer)
 
should_inline u8 ring_buffer_pop_front_byte (ring_buffer_t *buffer)
 

Detailed Description

A ring buffer.

Function Documentation

◆ ring_buffer_create()

MOSAPI ring_buffer_t * ring_buffer_create ( size_t capacity)

Definition at line 13 of file ring_buffer.c.

Referenced by MOS_TEST_CASE(), MOS_TEST_CASE(), MOS_TEST_CASE(), MOS_TEST_CASE(), MOS_TEST_CASE(), MOS_TEST_CASE(), and MOS_TEST_CASE().

+ Here is the call graph for this function:

◆ ring_buffer_create_at()

MOSAPI ring_buffer_t * ring_buffer_create_at ( void * data,
size_t capacity )

Definition at line 31 of file ring_buffer.c.

+ Here is the call graph for this function:

◆ ring_buffer_pos_init()

MOSAPI void ring_buffer_pos_init ( ring_buffer_pos_t * pos,
size_t capacity )

◆ ring_buffer_destroy()

MOSAPI void ring_buffer_destroy ( ring_buffer_t * buffer)

Definition at line 52 of file ring_buffer.c.

Referenced by MOS_TEST_CASE(), MOS_TEST_CASE(), MOS_TEST_CASE(), and MOS_TEST_CASE().

◆ ring_buffer_resize()

MOSAPI bool ring_buffer_resize ( ring_buffer_t * buffer,
size_t new_capacity )

Definition at line 58 of file ring_buffer.c.

+ Here is the call graph for this function:

◆ ring_buffer_pos_push_back()

MOSAPI size_t ring_buffer_pos_push_back ( u8 * buffer,
ring_buffer_pos_t * pos,
const u8 * data,
size_t size )

Definition at line 80 of file ring_buffer.c.

Referenced by pipe_write(), ring_buffer_pos_push_back_byte(), and ring_buffer_push_back().

+ Here is the call graph for this function:

◆ ring_buffer_pos_pop_back()

MOSAPI size_t ring_buffer_pos_pop_back ( u8 * buffer,
ring_buffer_pos_t * pos,
u8 * buf,
size_t size )

Definition at line 95 of file ring_buffer.c.

Referenced by ring_buffer_pop_back(), and ring_buffer_pos_pop_back_byte().

+ Here is the call graph for this function:

◆ ring_buffer_pos_push_front()

MOSAPI size_t ring_buffer_pos_push_front ( u8 * buffer,
ring_buffer_pos_t * pos,
const u8 * data,
size_t size )

Definition at line 115 of file ring_buffer.c.

Referenced by ring_buffer_pos_push_front_byte(), and ring_buffer_push_front().

+ Here is the call graph for this function:

◆ ring_buffer_pos_pop_front()

MOSAPI size_t ring_buffer_pos_pop_front ( u8 * buffer,
ring_buffer_pos_t * pos,
u8 * buf,
size_t size )

Definition at line 134 of file ring_buffer.c.

Referenced by console_io_read(), pipe_read(), ring_buffer_pop_front(), and ring_buffer_pos_pop_front_byte().

+ Here is the call graph for this function:

◆ ring_buffer_pos_pop_back_byte()

should_inline u8 ring_buffer_pos_pop_back_byte ( u8 * buffer,
ring_buffer_pos_t * pos )

Definition at line 44 of file ring_buffer.h.

Referenced by ring_buffer_pop_back_byte().

+ Here is the call graph for this function:

◆ ring_buffer_pos_pop_front_byte()

should_inline u8 ring_buffer_pos_pop_front_byte ( u8 * buffer,
ring_buffer_pos_t * pos )

Definition at line 51 of file ring_buffer.h.

Referenced by ring_buffer_pop_front_byte().

+ Here is the call graph for this function:

◆ ring_buffer_pos_is_full()

should_inline bool ring_buffer_pos_is_full ( ring_buffer_pos_t * pos)

Definition at line 59 of file ring_buffer.h.

Referenced by ring_buffer_is_full().

◆ ring_buffer_pos_is_empty()

should_inline bool ring_buffer_pos_is_empty ( ring_buffer_pos_t * pos)

Definition at line 60 of file ring_buffer.h.

Referenced by console_io_read(), pipe_read(), and ring_buffer_is_empty().

◆ ring_buffer_pos_push_back_byte()

should_inline size_t ring_buffer_pos_push_back_byte ( u8 * buffer,
ring_buffer_pos_t * pos,
u8 data )

Definition at line 62 of file ring_buffer.h.

Referenced by console_putc(), and ring_buffer_push_back_byte().

+ Here is the call graph for this function:

◆ ring_buffer_pos_push_front_byte()

should_inline size_t ring_buffer_pos_push_front_byte ( u8 * buffer,
ring_buffer_pos_t * pos,
u8 data )

Definition at line 63 of file ring_buffer.h.

Referenced by ring_buffer_push_front_byte().

+ Here is the call graph for this function:

◆ ring_buffer_is_full()

should_inline bool ring_buffer_is_full ( ring_buffer_t * buffer)

Definition at line 67 of file ring_buffer.h.

Referenced by MOS_TEST_CASE(), and MOS_TEST_CASE().

+ Here is the call graph for this function:

◆ ring_buffer_is_empty()

should_inline bool ring_buffer_is_empty ( ring_buffer_t * buffer)

Definition at line 68 of file ring_buffer.h.

Referenced by MOS_TEST_CASE(), and MOS_TEST_CASE().

+ Here is the call graph for this function:

◆ ring_buffer_push_back()

should_inline size_t ring_buffer_push_back ( ring_buffer_t * buffer,
const u8 * data,
size_t size )

Definition at line 70 of file ring_buffer.h.

Referenced by MOS_TEST_CASE().

+ Here is the call graph for this function:

◆ ring_buffer_pop_back()

should_inline size_t ring_buffer_pop_back ( ring_buffer_t * buffer,
u8 * buf,
size_t size )

Definition at line 71 of file ring_buffer.h.

Referenced by MOS_TEST_CASE().

+ Here is the call graph for this function:

◆ ring_buffer_push_front()

should_inline size_t ring_buffer_push_front ( ring_buffer_t * buffer,
const u8 * data,
size_t size )

Definition at line 73 of file ring_buffer.h.

Referenced by MOS_TEST_CASE().

+ Here is the call graph for this function:

◆ ring_buffer_pop_front()

should_inline size_t ring_buffer_pop_front ( ring_buffer_t * buffer,
u8 * buf,
size_t size )

Definition at line 74 of file ring_buffer.h.

Referenced by MOS_TEST_CASE().

+ Here is the call graph for this function:

◆ ring_buffer_push_front_byte()

should_inline size_t ring_buffer_push_front_byte ( ring_buffer_t * buffer,
u8 byte )

Definition at line 76 of file ring_buffer.h.

Referenced by MOS_TEST_CASE(), and MOS_TEST_CASE().

+ Here is the call graph for this function:

◆ ring_buffer_push_back_byte()

should_inline size_t ring_buffer_push_back_byte ( ring_buffer_t * buffer,
u8 byte )

Definition at line 78 of file ring_buffer.h.

Referenced by MOS_TEST_CASE(), MOS_TEST_CASE(), MOS_TEST_CASE(), and MOS_TEST_CASE().

+ Here is the call graph for this function:

◆ ring_buffer_pop_back_byte()

should_inline u8 ring_buffer_pop_back_byte ( ring_buffer_t * buffer)

Definition at line 79 of file ring_buffer.h.

Referenced by MOS_TEST_CASE(), MOS_TEST_CASE(), MOS_TEST_CASE(), and MOS_TEST_CASE().

+ Here is the call graph for this function:

◆ ring_buffer_pop_front_byte()

should_inline u8 ring_buffer_pop_front_byte ( ring_buffer_t * buffer)

Definition at line 80 of file ring_buffer.h.

Referenced by MOS_TEST_CASE(), and MOS_TEST_CASE().

+ Here is the call graph for this function: