Intel

Developer Zone

DebugPrint


com.intel.util
Class DebugPrint

java.lang.Object
  extended by com.intel.util.DebugPrint

public class DebugPrint
extends java.lang.Object

This class uses the ME Debug Event Service (MDES) mechanism to send debug messages over various interfaces such as the network, HECI, and more. This debug information can be captured and displayed. When using Intel(r) DAL Emulator the debug information is also printed to the console.

Messages include parameters that can be used to identify them when captured. These parameters include a severity field and a 'type' field. The type field is just a plain number that is attached to the message and presented in the MDES message capturing software. The user has the option to call methods that fill these fields automatically, or specify these values explicitly.

MDES provides means to filter messages and organize them according to their origin, severity, sensitivity, and type. The origin of messages related to DAL can be either the FW ROM or a DAL application. Severities are pre-defined as constants in this class and match the MDES pre-defined severities. Debug messages generated by applets have their sensitivity set to 'NONE'.

The debug messages are composed of a series of bytes. These bytes can represent a chunk of memory, an integer, or a string. The messages capture software can identify 'strings' and present them in a readable manner.

This class provides several utility methods which help construct the debug message. These utility method names are prefixed with copy*. Typically, these methods copy data into a debug buffer that is provided by the caller, and can manipulate the data if needed.


Field Summary
static int SEVERITY_CRITICAL_ERROR
Message severity that indicates a critical error.
static int SEVERITY_EXPECTED_ERROR
Message severity that indicates an expected error.
static int SEVERITY_NO_ERROR
Message severity for informative messages not related to errors.
static int SEVERITY_UNEXPECTED_ERROR
Message severity that indicates an unexpected error.
Method Summary
static void printBuffer(byte[] buffer)
Prints the hexadecimal value of each byte of a buffer.
static void printBuffer(int type, int severity, byte[] buffer, int bufOffset, int bufLength)
Prints the hexadecimal value of each byte of a portion of a buffer.
static void printInt(int value)
Prints the value of a four byte integer as a string.
static void printInt(int type, int severity, int value)
Prints the value of a four byte integer as a string.
static void printString(int type, int severity, java.lang.String str)
Prints a string.
static void printString(java.lang.String str)
Prints a string.
Methods inherited from class java.lang.Object
equals, hashCode, toString

Field Detail

SEVERITY_NO_ERROR

public static final int SEVERITY_NO_ERROR
Message severity for informative messages not related to errors.

See Also:
Constant Field Values

SEVERITY_EXPECTED_ERROR

public static final int SEVERITY_EXPECTED_ERROR
Message severity that indicates an expected error.

See Also:
Constant Field Values

SEVERITY_UNEXPECTED_ERROR

public static final int SEVERITY_UNEXPECTED_ERROR
Message severity that indicates an unexpected error.

See Also:
Constant Field Values

SEVERITY_CRITICAL_ERROR

public static final int SEVERITY_CRITICAL_ERROR
Message severity that indicates a critical error.

See Also:
Constant Field Values
Method Detail

printBuffer

public static void printBuffer(int type,
                               int severity,
                               byte[] buffer,
                               int bufOffset,
                               int bufLength)
                        throws UtilException
Prints the hexadecimal value of each byte of a portion of a buffer. Sends a portion of a buffer over the MDES debug interface. When using Intel(r) DAL Emulator data will also be printed to the console. The portion of the buffer that is sent starts at buffOffset, and includes the following bugLength bytes. The sent data size is limited to 2048 bytes. The sent buffer size can be further limited according to the MDES configuration. If MDES is configured to work in non-blocking mode, the messages are stored within the FW and sent at a later stage. In such a case, the buffer size is limited by the MDES messages buffer size. This method may throw a runtime null pointer exception if the buffer is null.

Parameters:
type - user field that can be used to filter and identify the debug message when captured. Only positive values are supported.
severity - one of the four predefined severities, that can be used to filter and identify the debug message
buffer - the buffer to send. Cannot be null.
bufOffset - send buffer starting at bufOffset. Must be smaller than the buffer length.
bufLength - the number of bytes to send from buffer starting at bufOffset. Must not exceed the buffer size while including the provided bugOffset.
Throws:
IllegalParameterException - If MDES fails to send the message due to invalid parameters, or if the buffer is too large.
UtilException

printString

public static void printString(int type,
                               int severity,
                               java.lang.String str)
                        throws UtilException
Prints a string. Sends a string over the MDES debug interface. When using Intel(r) DAL Emulator, the string will also be printed to the console. The maximum string length is 128 characters. This method may throw a runtime null pointer exception if the buffer is null.

Parameters:
type - user field that can be used to filter and identify the debug message when captured. Only positive values are supported.
severity - one of the four predefined severities, that can be used to filter and identify the debug message
str - the string to print.
Throws:
IllegalParameterException - If MDES fails to send the message due to invalid parameters, or if the buffer is too large.
UtilException

printInt

public static void printInt(int type,
                            int severity,
                            int value)
                     throws UtilException
Prints the value of a four byte integer as a string. Sends a four byte integer over the MDES debug interface. When using Intel(r) DAL Emulator data will also be printed to the console. Each digit of the decimal representation of the integer is replaced with one byte containing the ASCII decimal value of the digit. The digits are ordered from most significant to least significant. The length of the generated string is the number of digits, with an additional minus sign if needed.

Parameters:
type - user field that can be used to filter and identify the debug message when captured. Only positive values are supported.
severity - one of the four predefined severities, that can be used to filter and identify the debug message
value - the integer to send
Throws:
IllegalParameterException - If MDES fails to send the message due to invalid parameters, or if the buffer is too large.
UtilException

printBuffer

public static void printBuffer(byte[] buffer)
                        throws UtilException
Prints the hexadecimal value of each byte of a buffer. Sends a buffer over the MDES debug interface. When using Intel(r) DAL Emulator data will also be printed to the console. This method sets the MDES message type to 0 and the MDES severity to the lowest value. It will send the entire buffer. The sent data size is limited to 2048 bytes. The sent buffer size can be further limited according to the MDES configuration. If MDES is configured to work in non-blocking mode, the messages are stored within the FW and sent at a later stage. In such a case, the buffer size is limited by the MDES messages buffer size. This method may throw a runtime null pointer exception if the buffer is null.

Parameters:
buffer - the buffer to send
Throws:
IllegalParameterException - If MDES fails to send the message due to invalid parameters, or if the buffer is too large.
UtilException
See Also:
printBuffer(int, int, byte[], int, int)

printString

public static void printString(java.lang.String str)
                        throws UtilException
Prints a string. Sends a string over the MDES debug interface. When using Intel(r) DAL Emulator, the string is also be printed to the console. The maximum string length is 128 characters. This method sets the MDES message type to 0 and the MDES severity to the lowest value. This method may throw a runtime null pointer exception if the buffer is null.

Parameters:
str - the string to print.
Throws:
IllegalParameterException - If MDES fails to send the message due to invalid parameters, or if the buffer is too large.
UtilException
See Also:
printString(int, int, String)

printInt

public static void printInt(int value)
                     throws UtilException
Prints the value of a four byte integer as a string. Sends a four byte integer over the MDES debug interface. When using Intel(r) DAL Emulator data will also be printed to the console. Each digit of the decimal representation of the integer is replaced with one byte containing the ASCII decimal value of the digit. The digits are ordered from most significant to least significant. The length of the generated string is the number of digits, with an additional minus sign if needed. This method sets the MDES message type to 0 and the MDES severity to the lowest value.

Parameters:
value - the integer to send
Throws:
IllegalParameterException - If MDES fails to send the message due to invalid parameters, or if the buffer is too large.
UtilException
See Also:
printInt(int, int, int)