ITM Library
Macros | Typedefs | Enumerations | Functions
itm.h File Reference
#include <stdint.h>

Go to the source code of this file.

Macros

#define ITMLIB_MAJOR_VERSION   (0x1)
 
#define ITMLIB_MINOR_VERSION   (0x0)
 
#define ITM_NUM_PORTS   32
 

Typedefs

typedef unsigned ITM_port_t
 

Enumerations

enum  eITM_Error { eITM_Success = 0, eITM_Error_PortInvalidForOp = -1, eITM_Error_FIFOBusy = -2, eITM_Error_MaxStringExceeded = -3 }
 

Functions

eITM_Error ITM_getFirstError (void)
 
eITM_Error ITM_put_string (const char *data)
 
eITM_Error ITM_put_32 (ITM_port_t port, uint32_t data)
 
eITM_Error ITM_put_16 (ITM_port_t port, uint16_t data)
 
eITM_Error ITM_put_8 (ITM_port_t port, uint8_t data)
 

Detailed Description

ITM Library Function Prototypes

Macro Definition Documentation

#define ITMLIB_MAJOR_VERSION   (0x1)

Major version number - Incremented for API changes

#define ITMLIB_MINOR_VERSION   (0x0)

Minor version number - Incremented for bug fixes

#define ITM_NUM_PORTS   32
ITM_NUM_PORTS
Number of ITM transport ports. There are 32 transport ports.

Typedef Documentation

typedef unsigned ITM_port_t
ITM_port_t
ITM port typedef.

Note: Port 0 is reserved for string data, while binary values can be exported over ports 1 to 31.

Enumeration Type Documentation

enum eITM_Error
eITM_Error
ITM Library error codes
Enumerator
eITM_Success 

Function completed successfully

eITM_Error_PortInvalidForOp 

Port Invalid For Op - This typically means the calling function attempted to write a binary value to a port outside the range of valid binary ports (1 to 31).

eITM_Error_FIFOBusy 

FIFO Busy - Retry count exceeded

eITM_Error_MaxStringExceeded 

Max string length exceeded

Function Documentation

eITM_Error ITM_getFirstError ( void  )
ITM_getFirstError

Get the first error to occur since the last time ITM_getFirstError was called.

Returns
eITM_Error See eITM_Error for individual error details:
Details:

For every transport function (ITM_put_n), the first error that occurs is saved. When ITM_getFirstError is called the saved error is returned, and then cleared allowing the next error to be saved. If no errors have occurred eITM_Success is returned. This allows the user to make a series of ITM transport calls and then check for errors once, after the series is complete.

eITM_Error ITM_put_string ( const char *  data)
ITM_put_string

Transport a string.

Parameters
[in]dataConst char pointer to a NULL terminated string to be transported.
Returns
eITM_Error The following errors may be returned:
Details:

Each byte of the string is transported over ITM port 0. A string may contain sub-strings, each of which is terminated with a newline. Each substring will get a time-stamp. If the string length exceeds 256 characters, the string is terminated and the function returns eITM_Error_MaxStringExceeded.

Note: ITM_getFirstError() may also be used to check for errors after a series of ITM_put calls, rather than checking the error returned from every call to ITM_put_string.

eITM_Error ITM_put_32 ( ITM_port_t  port,
uint32_t  data 
)
ITM_put_32

Transport a 32-bit value.

Parameters
[in]portAn ITM port in the range of 1 to 31 (port 0 reserved for strings)
[in]data32-bit value to be transported.
Returns
eITM_Error The following errors may be returned:
Details:

The 32-bit data value is transported over the selected ITM port.

Note: ITM_getFirstError() may also be used to check for errors after a series of ITM_put calls, rather than checking the error returned from every call to ITM_put_32.

eITM_Error ITM_put_16 ( ITM_port_t  port,
uint16_t  data 
)
ITM_put_16

Transport a 16-bit value.

Parameters
[in]portAn ITM port in the range of 1 to 31 (port 0 reserved for strings)
[in]data16-bit value to be transported.
Returns
eITM_Error The following errors may be returned:
Details:

The 16-bit data value is transported over the selected ITM port.

Note: ITM_getFirstError() may also be used to check for errors after a series of ITM_put calls, rather than checking the error returned from every call to ITM_put_16.

eITM_Error ITM_put_8 ( ITM_port_t  port,
uint8_t  data 
)
ITM_put_8

Transport a 8-bit value.

Parameters
[in]portAn ITM port in the range of 1 to 31 (port 0 reserved for strings)
[in]data8-bit value to be transported.
Returns
eITM_Error The following errors may be returned:
Details:

The 8-bit data value is transported over the selected ITM port.

Note: ITM_getFirstError() may also be used to check for errors after a series of ITM_put calls, rather than checking the error returned from every call to ITM_put_8.