openaliro
Aliro reader: UWB/CCC core and ESP32-S3/C5/C6 port
Loading...
Searching...
No Matches
woz_logfmt.c File Reference

— PRETTY-gated high-res timestamp + compact colored log line. More...

#include <stdint.h>
#include <stddef.h>
#include <zephyr/init.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/cbprintf.h>
#include <zephyr/logging/log.h>
#include <zephyr/logging/log_backend.h>
#include <zephyr/logging/log_ctrl.h>
#include <zephyr/logging/log_msg.h>
#include <zephyr/logging/log_output.h>
#include <zephyr/logging/log_output_custom.h>
#include <cmsis_core.h>
Include dependency graph for woz_logfmt.c:

Data Structures

struct  woz_sink
 Small bounded sink so cbpprintf can render into a stack buffer. More...
 

Functions

static log_timestamp_t woz_timestamp_get (void)
 Advance + read the 64-bit cycle accumulator (irq-safe; any context).
 
static void woz_wrap_sample (struct k_timer *t)
 Periodic sampler so a CYCCNT wrap is never missed during console idle.
 
static int woz_sink_out (int c, void *ctx)
 Sink callback for formatted output: append one character to the buffer if space remains.
 
static void woz_sink_str (struct woz_sink *s, const char *str)
 Append a null-terminated string to the sink buffer one character at a time, stopping at end of string or exhausted buffer space.
 
static const char * module_color (const char *name)
 Stable per-module colour from a name hash (djb2).
 
static void woz_msg_format (const struct log_output *output, struct log_msg *msg, uint32_t flags)
 Render one message as SEC.NS module message, or delegate hexdumps.
 
static int woz_logfmt_init (void)
 Initialize the DWT cycle counter and log formatting on startup.
 

Detailed Description

— PRETTY-gated high-res timestamp + compact colored log line.

Function Documentation

◆ woz_logfmt_init()

static int woz_logfmt_init ( void  )
static

Initialize the DWT cycle counter and log formatting on startup.

Returns
0 on success.

◆ woz_sink_out()

static int woz_sink_out ( int  c,
void *  ctx 
)
static

Sink callback for formatted output: append one character to the buffer if space remains.

Parameters
cCharacter to append.
ctxPointer to woz_sink context.
Returns
Character appended.

◆ woz_sink_str()

static void woz_sink_str ( struct woz_sink s,
const char *  str 
)
static

Append a null-terminated string to the sink buffer one character at a time, stopping at end of string or exhausted buffer space.

Parameters
sSink context.
strString to append (null-terminated).