Skip to content

File syn_trace.c

FileList > debug > syn_trace.c

Go to the source code of this file

Trace buffer implementation.

  • #include "../util/syn_assert.h"
  • #include "../util/syn_fmt.h"
  • #include "syn_trace.h"
  • #include <string.h>

Public Functions

Type Name
void syn_trace_clear (SYN_Trace * trace)
Clear the trace buffer.
void syn_trace_dump (const SYN_Trace * trace, SYN_TracePrintFunc print)
Dump all entries via a print callback.
void syn_trace_enable (SYN_Trace * trace, bool enable)
Enable/disable recording.
void syn_trace_init (SYN_Trace * trace, SYN_TraceEntry * entries, uint16_t capacity)
Initialize the trace buffer.
bool syn_trace_read (const SYN_Trace * trace, uint32_t index, SYN_TraceEntry * entry)
Read an entry by index (0 = oldest available).
void syn_trace_record (SYN_Trace * trace, uint16_t event_id, uint16_t value)
Record a trace event.

Public Functions Documentation

function syn_trace_clear

Clear the trace buffer.

void syn_trace_clear (
    SYN_Trace * trace
) 

Parameters:

  • trace Trace instance to reset.

function syn_trace_dump

Dump all entries via a print callback.

void syn_trace_dump (
    const SYN_Trace * trace,
    SYN_TracePrintFunc print
) 

Output format: "[tick] event_id=0xNNNN value=0xNNNN\n"

Parameters:

  • trace Trace instance.
  • print Print function (e.g., write to UART).

function syn_trace_enable

Enable/disable recording.

void syn_trace_enable (
    SYN_Trace * trace,
    bool enable
) 

Parameters:

  • trace Trace instance.
  • enable True to enable recording, false to pause.

function syn_trace_init

Initialize the trace buffer.

void syn_trace_init (
    SYN_Trace * trace,
    SYN_TraceEntry * entries,
    uint16_t capacity
) 

Parameters:

  • trace Trace instance to initialize.
  • entries Array of trace entries (caller-owned).
  • capacity Number of entries in the array.

function syn_trace_read

Read an entry by index (0 = oldest available).

bool syn_trace_read (
    const SYN_Trace * trace,
    uint32_t index,
    SYN_TraceEntry * entry
) 

Parameters:

  • trace Trace instance.
  • index Index from oldest available.
  • entry Output entry.

Returns:

true if a valid entry was read.


function syn_trace_record

Record a trace event.

void syn_trace_record (
    SYN_Trace * trace,
    uint16_t event_id,
    uint16_t value
) 

Parameters:

  • trace Trace instance.
  • event_id Application-defined event ID.
  • value Optional 16-bit payload.


The documentation for this class was generated from the following file src/syntropic/debug/syn_trace.c