TT Zephyr Platforms 18.11.99
Tenstorrent Firmware
Loading...
Searching...
No Matches
log_backend_ringbuf.c File Reference

Ring buffer log backend. More...

Functions

 RING_BUF_DECLARE (ringbuf_output_buf, CONFIG_LOG_BACKEND_RINGBUF_BUFFER_SIZE)
int log_backend_ringbuf_get_claim (uint8_t **data, size_t length)
int log_backend_ringbuf_finish_claim (size_t length)
void log_backend_ringbuf_clear (void)
size_t log_backend_ringbuf_get_used (void)
static int char_out (uint8_t *data, size_t length, void *ctx)
 LOG_OUTPUT_DEFINE (log_output_ringbuf, char_out, buf, sizeof(buf))
static void log_backend_ringbuf_process (const struct log_backend *const backend, union log_msg_generic *msg)
static int format_set (const struct log_backend *const backend, uint32_t log_type)
static void log_backend_ringbuf_panic (struct log_backend const *const backend)
static void dropped (const struct log_backend *const backend, uint32_t cnt)
 LOG_BACKEND_DEFINE (log_backend_ringbuf, log_backend_ringbuf_api, true)

Variables

static uint8_t buf [1]
static uint32_t log_format_current = CONFIG_LOG_BACKEND_RINGBUF_OUTPUT_DEFAULT
const struct log_backend_api log_backend_ringbuf_api

Detailed Description

Ring buffer log backend.

This backend logs into a ring buffer, which can be read via the log_backend_ringbuf_get_data() API. Applications can call this API to stream log data to an external consumer.

Function Documentation

◆ char_out()

int char_out ( uint8_t * data,
size_t length,
void * ctx )
static

◆ dropped()

void dropped ( const struct log_backend *const backend,
uint32_t cnt )
static

◆ format_set()

int format_set ( const struct log_backend *const backend,
uint32_t log_type )
static

◆ LOG_BACKEND_DEFINE()

LOG_BACKEND_DEFINE ( log_backend_ringbuf ,
log_backend_ringbuf_api ,
true  )

◆ log_backend_ringbuf_clear()

void log_backend_ringbuf_clear ( void )

Clear the ring buffer log backend. Resets the ring buffer to empty, so new log messages will be written

◆ log_backend_ringbuf_finish_claim()

int log_backend_ringbuf_finish_claim ( size_t length)

Finish claiming data from the ring buffer log backend. internally calls ring_buf_get_finish() on the logging ring buffer.

Parameters
lengthNumber of bytes read from the buffer.
Returns
0 on success, negative error code on failure.

◆ log_backend_ringbuf_get_claim()

int log_backend_ringbuf_get_claim ( uint8_t ** data,
size_t length )

Get address of ring buffer log backend buffer. internally calls ring_buf_get_claim() on the logging ring buffer.

Parameters
dataPointer to address. Will be set to location within ring buffer
lengthRequested length of data to claim
Returns
Number of valid bytes claimed. May be less than requested length.

◆ log_backend_ringbuf_get_used()

size_t log_backend_ringbuf_get_used ( void )

Get the number of bytes currently stored in the ring buffer log backend.

Returns
Number of bytes currently stored in the ring buffer

◆ log_backend_ringbuf_panic()

void log_backend_ringbuf_panic ( struct log_backend const *const backend)
static

◆ log_backend_ringbuf_process()

void log_backend_ringbuf_process ( const struct log_backend *const backend,
union log_msg_generic * msg )
static

◆ LOG_OUTPUT_DEFINE()

LOG_OUTPUT_DEFINE ( log_output_ringbuf ,
char_out ,
buf ,
sizeof(buf)  )

◆ RING_BUF_DECLARE()

RING_BUF_DECLARE ( ringbuf_output_buf ,
CONFIG_LOG_BACKEND_RINGBUF_BUFFER_SIZE  )

Variable Documentation

◆ buf

uint8_t buf[1]
static

◆ log_backend_ringbuf_api

const struct log_backend_api log_backend_ringbuf_api
Initial value:
= {
.dropped = IS_ENABLED(CONFIG_LOG_MODE_IMMEDIATE) ? NULL : dropped,
.format_set = format_set,
}
#define NULL
Definition avs.c:45
#define IS_ENABLED(config_macro)
static void log_backend_ringbuf_process(const struct log_backend *const backend, union log_msg_generic *msg)
Definition log_backend_ringbuf.c:87
static int format_set(const struct log_backend *const backend, uint32_t log_type)
Definition log_backend_ringbuf.c:97
static void dropped(const struct log_backend *const backend, uint32_t cnt)
Definition log_backend_ringbuf.c:107
static void log_backend_ringbuf_panic(struct log_backend const *const backend)
Definition log_backend_ringbuf.c:103

◆ log_format_current

uint32_t log_format_current = CONFIG_LOG_BACKEND_RINGBUF_OUTPUT_DEFAULT
static