osd_cl_stm class

API to access the functionality of the System Trace Module (STM).

Usage

#include <osd/osd.h>
#include <osd/cl_stm.h>

Public Interface

Typedefs

typedef void(* osd_cl_stm_handler_fn)(void *, const struct osd_stm_desc *, const struct osd_stm_event *)

Functions

osd_result osd_cl_stm_get_desc(struct osd_hostmod_ctx * hostmod_ctx, unsigned int stm_di_addr, struct osd_stm_desc * stm_desc)

Populate the STM descriptor with data from the debug module

Return
OSD_OK on success OSD_ERROR_WRONG_MODULE if the module at stm_di_addr is not a STM any other value indicates an error
Parameters
  • hostmod_ctx: the host module handling the communication
  • stm_di_addr: DI address of the STM module to get describe
  • [out] stm_desc: pre-allocated memory descriptor for the result

osd_result osd_cl_stm_handle_event(void * arg, struct osd_packet * pkg)

Event handler to process STM event, to be passed to a hostmod instance

bool osd_cl_stm_is_print_event(const struct osd_stm_event * ev)

Is the given STM event a sysprint event?

osd_result osd_cl_stm_print_buf_new(struct osd_cl_stm_print_buf ** print_buf_p)

Allocate memory for a new osd_cl_stm_print_buf struct

void osd_cl_stm_print_buf_free(struct osd_cl_stm_print_buf ** print_buf_p)

Free a osd_cl_stm_print_buf struct

osd_result osd_cl_stm_add_to_print_buf(const struct osd_stm_event * ev, struct osd_cl_stm_print_buf * buf, bool * should_flush)

Add a STM event to the print buffer

struct osd_stm_desc
#include <cl_stm.h>

Information a System Trace Module

Public Members

unsigned int di_addr

DI address of the memory.

uint16_t value_width_bit

Size of the value in a trace event in bit.

struct osd_stm_event
#include <cl_stm.h>

A single event emitted by the STM module

In case of an overflow in the system an overflow even is generated, containing the number of missed events. If the overflow value is set to a non-zero value, id and value are invalid.

Public Members

uint32_t timestamp

timestamp

uint16_t id

event identifier

uint64_t value

traced value

uint16_t overflow

Number of lost packets due to overflow.

struct osd_stm_event_handler

Public Members

const struct osd_stm_desc* stm_desc
osd_cl_stm_handler_fn cb_fn
void* cb_arg
struct osd_cl_stm_print_buf

Public Members

char* buf

data buffer

size_t len_buf

allocated size of |buf|

size_t len_str

length of the string inside |buf|, excluding the zero termination