Intel

Developer Zone

DebugPrint

com.intel.util

Class DebugPrint

  • java.lang.Object
    • com.intel.util.DebugPrint


  • public class DebugPrint
    extends java.lang.Object

    This class uses the CSME North Peak (NPK) mechanism to send debug messages. This debug information can be captured and displayed on the host. 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 NPK message capturing software. The user has the option to call methods that fill these fields automatically, or specify these values explicitly.

    NPK 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 NPK 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.

    • Method Summary

      Methods
      Modifier and Type Method and Description
      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, getClass, 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
      • SEVERITY_NORMAL

        public static final int SEVERITY_NORMAL
        Message severity that indicates a normal error.
        See Also:
        Constant Field Values
      • SEVERITY_GLOBAL

        public static final int SEVERITY_GLOBAL
        Message severity that indicates a global error.
        See Also:
        Constant Field Values
      • SEVERITY_VERBOSE

        public static final int SEVERITY_VERBOSE
        Message severity that indicates a verbose 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 NPK 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 NPK configuration.
        Parameters:
        type - this argument is deprecated and does not have any effect.
        severity - one of values in DebugPrint.SEVERITY_XXX 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 NPK 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 NPK 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 - this argument is deprecated and does not have any effect.
        severity - one of values in DebugPrint.SEVERITY_XXX used to filter and identify the debug message.
        str - the string to print.
        Throws:
        IllegalParameterException - If NPK 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 NPK 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 - This argument is deprecated and does not have any effect.
        severity - one of values in DebugPrint.SEVERITY_XXX used to filter and identify the debug message.
        value - the integer to send
        Throws:
        IllegalParameterException - If NPK 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 NPK debug interface. When using Intel(R) DAL Emulator data will also be printed to the console. This method sets the NPK message type to 0 and the NPK 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 NPK configuration. If NPK 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 NPK 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 NPK 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 NPK 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 NPK message type to 0 and the NPK 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 NPK 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 NPK 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 NPK message type to 0 and the NPK severity to the lowest value.
        Parameters:
        value - the integer to send
        Throws:
        IllegalParameterException - If NPK fails to send the message due to invalid parameters, or if the buffer is too large.
        UtilException
        See Also:
        printInt(int, int, int)