osd_systracelogger class

Obtain and decode a system trace (high-level API).

System traces are typically obtained by a STM module, which in turn gathers this information using processor-specific mechanisms (such as observing nop instructions, or writes to special registers). System traces are streams of (id, value) tuples. Some ids have a specification-defined meaning and can be decoded in a special way. Most commonly, id 4 is used to transmit a single printed character from the software, providing an easy way to “print” data from software through the debug system to the host PC. osd_systracelogger contains functions to decode such streams of characeters and write them to a file.

Usage

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

Public Interface

Functions

osd_result osd_systracelogger_new(struct osd_systracelogger_ctx ** ctx, struct osd_log_ctx * log_ctx, const char * host_controller_address, uint16_t stm_di_addr)

Create a new context object

osd_result osd_systracelogger_connect(struct osd_systracelogger_ctx * ctx)

Connect to the host controller

Return
OSD_OK on success, any other value indicates an error
See
osd_hostmod_disconnect()
Parameters
  • ctx: the osd_hostmod_ctx context object

osd_result osd_systracelogger_disconnect(struct osd_systracelogger_ctx * ctx)

Shut down all communication with the device

Return
OSD_OK on success, any other value indicates an error
See
osd_hostmod_run()
Parameters
  • ctx: the osd_hostmod context object

bool osd_systracelogger_is_connected(struct osd_systracelogger_ctx * ctx)

Is the connection to the device active?

Return
1 if connected, 0 if not connected
See
osd_hostmod_connect()
See
osd_hostmod_disconnect()
Parameters
  • ctx: the osd_hostmod context object

void osd_systracelogger_free(struct osd_systracelogger_ctx ** ctx_p)

Free the context object

osd_result osd_systracelogger_start(struct osd_systracelogger_ctx * ctx)

Start collecting system logs

Instruct the STM module to start sending traces to us.

osd_result osd_systracelogger_stop(struct osd_systracelogger_ctx * ctx)

Stop collecting system logs

osd_result osd_systracelogger_set_sysprint_log(struct osd_systracelogger_ctx * ctx, FILE * fp)

Set a file to write all sysprint output to

osd_result osd_systracelogger_set_event_log(struct osd_systracelogger_ctx * ctx, FILE * fp)

Set a file to write all received STM events to