Package cbsw

Class RegisterDescriptor


  • public class RegisterDescriptor
    extends java.lang.Object

    A bit-field descriptor

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String description
      A human-readable description.
      protected int length
      The length in bits of the bit-field.
      protected java.lang.String name
      A short, unique name for the bit-field.
      protected java.lang.String offset
      The offset in bits of the bit-field.
      protected boolean ro
      Used to mark the bit-field as read-only.
    • Constructor Summary

      Constructors 
      Constructor Description
      RegisterDescriptor()
      No-argument constructor called by unmarshaller
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String get​(Io io)
      Reads a register bit-field from hardware
      java.lang.String get​(java.util.BitSet regBits)
      Returns a hex String representation of the register bits
      byte[] getBytes​(java.util.BitSet regBits)
      Returns an array of bytes spanning the register bits
      byte[] getBytes​(java.util.BitSet regBits, int offset)
      Returns an array of bytes spanning the register bits
      java.lang.String getDescription()
      Returns the bit-field description
      int getLength()
      Returns the bit-field length
      java.lang.String getName()
      Returns the bit-field name
      java.lang.String getOffset()
      Returns the bit-field offset
      boolean isReadOnly()
      Whether the underlying bit-field is marked read-only.
      boolean matches​(java.lang.String regex)
      Test whether the bit-field name matches the regex.
      void put​(java.util.BitSet bits, java.lang.String regValue, Io io)
      Writes a register bit-field to the hardware
      void set​(java.util.BitSet regBits, boolean flag)
      Set the register bits for all offsets
      void set​(java.util.BitSet regBits, java.lang.String regString)
      Set the register bits for all offsets
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • description

        protected java.lang.String description

        A human-readable description. Preferably terse.

      • name

        protected java.lang.String name

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

      • offset

        protected java.lang.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 Detail

      • RegisterDescriptor

        public RegisterDescriptor()

        No-argument constructor called by unmarshaller

    • Method Detail

      • getDescription

        public java.lang.String getDescription()

        Returns the bit-field description

        Returns:
        The descriptive text
      • getName

        public java.lang.String getName()

        Returns the bit-field name

        Returns:
        The name
      • matches

        public boolean matches​(java.lang.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 java.lang.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​(java.util.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​(java.util.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 java.lang.String get​(java.util.BitSet regBits)

        Returns a hex String representation of the register bits

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

        public void set​(java.util.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​(java.util.BitSet regBits,
                        java.lang.String regString)

        Set the register bits for all offsets

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

        public void put​(java.util.BitSet bits,
                        java.lang.String regValue,
                        Io io)

        Writes a register bit-field to the hardware

        Parameters:
        bits - The register bits
        regValue - Hex representation of value to write
        io - The IO interface
      • get

        public java.lang.String get​(Io io)

        Reads a register bit-field from hardware

        Parameters:
        io - The IO interface
        Returns:
        Hex encoded String register value