Class RegisterDescriptor

java.lang.Object
cbsw.RegisterDescriptor

public class RegisterDescriptor extends Object

A bit-field descriptor

  • Field Details

    • description

      protected String description

      A human-readable description. Preferably terse.

    • name

      protected String name

      A short, unique name for the bit-field. Used as the key to locate it.

    • offset

      protected String offset

      The offset in bits of the bit-field. Can be a comma-separated list.

    • length

      protected int length

      The length in bits of the bit-field.

    • ro

      protected boolean ro

      Used to mark the bit-field as read-only.

  • Constructor Details

    • RegisterDescriptor

      public RegisterDescriptor()

      No-argument constructor called by unmarshaller

  • Method Details

    • clone

      public RegisterDescriptor clone(String prefix)

      Clone this register descriptor with prefix to name.

      Parameters:
      prefix - A prefix added the the descriptor name.
      Returns:
      The cloned RegisterDescriptor.
    • getDescription

      public String getDescription()

      Returns the bit-field description

      Returns:
      The descriptive text
    • getName

      public String getName()

      Returns the bit-field name

      Returns:
      The name
    • matches

      public boolean matches(String regex)

      Test whether the bit-field name matches the regex.

      Parameters:
      regex - The regex pattern to match.
      Returns:
      true if match else false.
    • getOffset

      public String getOffset()

      Returns the bit-field offset

      Returns:
      The offset
    • getLength

      public int getLength()

      Returns the bit-field length

      Returns:
      The length
    • isReadOnly

      public boolean isReadOnly()

      Whether the underlying bit-field is marked read-only.

      Returns:
      True if the bit-field is marked read-only
    • getBytes

      public byte[] getBytes(BitSet regBits)

      Returns an array of bytes spanning the register bits

      Parameters:
      regBits - The register bits
      Returns:
      The array of bytes containing the register values
    • getBytes

      public byte[] getBytes(BitSet regBits, int offset)

      Returns an array of bytes spanning the register bits

      Parameters:
      regBits - The register bits
      offset - The bit-field offset
      Returns:
      The array of bytes containing the register values
    • get

      public String get(BitSet regBits)

      Returns a hex String representation of the register bits

      Parameters:
      regBits - The register bits
      Returns:
      Hex String representation of register bits
    • getAsBitSet

      public BitSet getAsBitSet(BitSet regBits, int newOffset)

      Returns a BitSet of the register bits with new offset.

      Parameters:
      regBits - The register bits
      Returns:
      BitSet representation of register bits
    • set

      public void set(BitSet regBits, boolean flag)

      Set the register bits for all offsets

      Parameters:
      regBits - The register bits
      flag - boolean representation of value to set
    • set

      public void set(BitSet regBits, String regString)

      Set the register bits for all offsets

      Parameters:
      regBits - The register bits
      regString - Hex String representation of value to set