# swmTrace Reference Function Documentation

## swmTrace_init

void swmTrace_init(const uint32_t * configuration, uint32_t size)

Trace initialization function.

This method allows the tracing functions to be initialized in a general way, allowing different trace options to be supplied, depending on the type of trace library selected.

Location: swmTrace_api.h:79

Parameters

Direction | Name | Description
--- | --- | ---
in | configuration | Consists of an array of 32-bit words that define the selected initialization options.
in | size | Indicates the number of options provided.

NOTE: The list of options can be set up as a superset of all the possible options, and only the ones required for a given trace library are used. The possible options are defined in the swmTrace_options.h file.

## swmTrace_txInProgress

bool swmTrace_txInProgress()

Provides indication if transmission is in progress.

Location: swmTrace_api.h:85

Return

True if a string is being transmitted; false otherwise.

## swmTrace_printf

void swmTrace_printf(const char * sFormat, ... )

This provides a printf-like implementation for all possible trace mechanisms.

Location: swmTrace_api.h:93

Parameters

Direction | Name | Description
--- | --- | ---
in | sFormat | Defines the format of the string to print. This is followed by a variable number of arguments.

## swmTrace_vprintf

void swmTrace_vprintf(const char * sFormat, va_list * pParamList)

This provides a vprintf-like implementation for all possible trace mechanisms.

Location: swmTrace_api.h:102

Parameters

Direction | Name | Description
--- | --- | ---
in | sFormat | Defines the format of the string to print.
in | pParamList | Defines a pointer to a va_list object in a form similar to vprintf.

## swmTrace_getch

bool swmTrace_getch(char * ch)

A method to allow characters to be passed from the logging target to the traced application.

Location: swmTrace_api.h:111

Parameters

Direction | Name | Description
--- | --- | ---
in | ch | A pointer to a character object which holds the returned character.

Return

True if a valid character has been returned; false otherwise.

## swmLog

void swmLog(uint32_t level, const char * sFormat, ... )

A general logging method that allows us to output only trace messages if a particular log level has been selected.

Location: swmTrace_api.h:120

Parameters

Direction | Name | Description
--- | --- | ---
in | level | The level of this log message. Only messages which have a level equal to or higher than the currently selected level are output.
in | sFormat | The format of the output string, as per printf.