Class RegisterDescriptor
java.lang.Object
cbsw.RegisterDescriptor
A bit-field descriptor
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringA human-readable description.protected intThe length in bits of the bit-field.protected StringA short, unique name for the bit-field.protected StringThe offset in bits of the bit-field.protected booleanUsed to mark the bit-field as read-only. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClone this register descriptor with prefix to name.Returns a hex String representation of the register bitsgetAsBitSet(BitSet regBits, int newOffset) Returns a BitSet of the register bits with new offset.byte[]Returns an array of bytes spanning the register bitsbyte[]Returns an array of bytes spanning the register bitsReturns the bit-field descriptionintReturns the bit-field lengthgetName()Returns the bit-field nameReturns the bit-field offsetbooleanWhether the underlying bit-field is marked read-only.booleanTest whether the bit-field name matches the regex.voidSet the register bits for all offsetsvoidSet the register bits for all offsets
-
Field Details
-
description
A human-readable description. Preferably terse.
-
name
A short, unique name for the bit-field. Used as the key to locate it.
-
offset
The offset in bits of the bit-field. Can be a comma-separated list.
-
length
protected int lengthThe length in bits of the bit-field.
-
ro
protected boolean roUsed to mark the bit-field as read-only.
-
-
Constructor Details
-
RegisterDescriptor
public RegisterDescriptor()No-argument constructor called by unmarshaller
-
-
Method Details
-
clone
Clone this register descriptor with prefix to name.
- Parameters:
prefix- A prefix added the the descriptor name.- Returns:
- The cloned RegisterDescriptor.
-
getDescription
-
getName
-
matches
Test whether the bit-field name matches the regex.
- Parameters:
regex- The regex pattern to match.- Returns:
- true if match else false.
-
getOffset
-
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
Returns an array of bytes spanning the register bits
- Parameters:
regBits- The register bits- Returns:
- The array of bytes containing the register values
-
getBytes
Returns an array of bytes spanning the register bits
- Parameters:
regBits- The register bitsoffset- The bit-field offset- Returns:
- The array of bytes containing the register values
-
get
-
getAsBitSet
-
set
Set the register bits for all offsets
- Parameters:
regBits- The register bitsflag- boolean representation of value to set
-
set
-