MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_ringbuffer_init

Function rt_ringbuffer_init

components/drivers/ipc/ringbuffer.c:37–51  ·  view source on GitHub ↗

* @brief Initialize the ring buffer object. * * @param rb A pointer to the ring buffer object. * @param pool A pointer to the buffer. * @param size The size of the buffer in bytes. */

Source from the content-addressed store, hash-verified

35 * @param size The size of the buffer in bytes.
36 */
37void rt_ringbuffer_init(struct rt_ringbuffer *rb,
38 rt_uint8_t *pool,
39 rt_int32_t size)
40{
41 RT_ASSERT(rb != RT_NULL);
42 RT_ASSERT(size > 0);
43
44 /* initialize read and write index */
45 rb->read_mirror = rb->read_index = 0;
46 rb->write_mirror = rb->write_index = 0;
47
48 /* set buffer pool and size */
49 rb->buffer_ptr = pool;
50 rb->buffer_size = RT_ALIGN_DOWN(size, RT_ALIGN_SIZE);
51}
52RTM_EXPORT(rt_ringbuffer_init);
53
54/**

Callers 12

rt_usb_vcom_initFunction · 0.85
rt_serial_tx_enableFunction · 0.85
rt_serial_rx_enableFunction · 0.85
rt_can_openFunction · 0.85
rt_audio_pipe_initFunction · 0.85
usbd_adb_shell_initFunction · 0.85
usbh_serial_registerFunction · 0.85
usbd_serial_registerFunction · 0.85
rt_ringbuffer_createFunction · 0.85
rt_hw_usart_initFunction · 0.85
hpm_uart_controlFunction · 0.85
uart_console_initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected