19 lines
617 B
C
19 lines
617 B
C
// SPDX-License-Identifier: MPL-2.0
|
|
#ifndef SH_LIB_RING_H
|
|
#define SH_LIB_RING_H
|
|
#include "std/type.h"
|
|
#include "std/status.h"
|
|
// Ring buffer header structure
|
|
typedef struct {
|
|
sh_uint32 head;
|
|
sh_uint32 tail;
|
|
sh_uint32 buffer_bytes_size;
|
|
sh_uint8* data_start;
|
|
sh_uint64 total_bytes_written;
|
|
} sh_ring_RING_BUFFER_HEADER;
|
|
// Write a byte into the provided ring buffer
|
|
SH_STATUS sh_ring_write_byte(sh_ring_RING_BUFFER_HEADER *ring_buffer,sh_uint8 byte);
|
|
// Write a null terminated string into the provided ring buffer
|
|
SH_STATUS sh_ring_write_string(sh_ring_RING_BUFFER_HEADER *ring_buffer,char *string);
|
|
#endif
|