public final class MMIODeviceConfig extends java.lang.Object implements DeviceConfig<MMIODevice>, DeviceConfig.HardwareAddressing
MMIODeviceConfig
class encapsulates the hardware addressing information, and static and dynamic
configuration parameters of an MMIO device.
Some hardware addressing, static or dynamic configuration parameters may be
set to UNASSIGNED
or null
(see
Unassigned, Default or Unused Parameter Values).
An instance of MMIODeviceConfig
can be passed to the open(DeviceConfig, ...)
and
open(Class, DeviceConfig, ...)
methods of the DeviceManager
to open the designated MMIO device with the specified
configuration. A InvalidDeviceConfigException
is thrown when attempting to open a device with
an invalid or unsupported configuration.
Modifier and Type | Class and Description |
---|---|
static class |
MMIODeviceConfig.Builder
The
Builder class allows for creating and initializing
MMIODeviceConfig objects. |
static class |
MMIODeviceConfig.RawBlockConfig
The
RawBlockConfig class encapsulates the configuration parameters of a memory block. |
static class |
MMIODeviceConfig.RawMemoryConfig
The
RawMemoryConfig class encapsulates the configuration parameters of a generic raw memory area. |
static class |
MMIODeviceConfig.RawRegisterConfig<T extends java.lang.Number>
The
RawRegisterConfig class encapsulates the configuration parameters of a register. |
DeviceConfig.HardwareAddressing
DEFAULT, UNASSIGNED
Constructor and Description |
---|
MMIODeviceConfig(int controllerNumber,
long address,
int size,
int byteOrdering,
MMIODeviceConfig.RawMemoryConfig... memConfigs)
Deprecated.
As of 1.1, use
MMIODeviceConfig.Builder instead. |
MMIODeviceConfig(long address,
int size,
int byteOrdering,
MMIODeviceConfig.RawMemoryConfig... memConfigs)
Deprecated.
As of 1.1, use
MMIODeviceConfig.Builder instead. |
MMIODeviceConfig(java.lang.String controllerName,
long address,
int size,
int byteOrdering,
MMIODeviceConfig.RawMemoryConfig... memConfigs)
Deprecated.
As of 1.1, use
MMIODeviceConfig.Builder instead. |
Modifier and Type | Method and Description |
---|---|
static MMIODeviceConfig |
deserialize(java.io.InputStream in)
Creates a new
MMIODeviceConfig whose state is deserialized from the specified InputStream . |
boolean |
equals(java.lang.Object obj)
Checks two
MMIODeviceConfig objects for equality. |
long |
getAddress()
Gets the configured memory address of the MMIO device.
|
java.nio.ByteOrder |
getByteOrder()
Gets the configured byte order of the MMIO device.
|
int |
getByteOrdering()
Deprecated.
As of 1.1, replaced by
getByteOrder() . |
java.lang.String |
getControllerName()
Gets the configured controller name (such as its device file name on UNIX systems).
|
int |
getControllerNumber()
Gets the configured controller number (the PWM controller or generator number).
|
MMIODeviceConfig.RawMemoryConfig[] |
getRawMemoryConfigs()
Gets the set of configured registers and memory blocks.
|
int |
getSize()
Gets the configured size of the memory-mapped area of the MMIO device.
|
int |
hashCode()
Returns the hash code value for this object.
|
int |
serialize(java.io.OutputStream out)
Serializes the state of this
MMIODeviceConfig object to the specified OutputStream . |
@Deprecated public MMIODeviceConfig(long address, int size, int byteOrdering, MMIODeviceConfig.RawMemoryConfig... memConfigs)
MMIODeviceConfig.Builder
instead.MMIODeviceConfig
with the specified hardware addressing information and configuration
parameters.
If no raw block and raw register configuration is provided, the specified memory area will be mapped to
the RawBlock
instance returned by a call to MMIODevice.getAsRawBlock
.
If the designated memory region is protected or if it overlaps with that of an existing
MMIO device configuration and the requested access mode (DeviceManager.EXCLUSIVE
or
DeviceManager.SHARED
) is incompatible or unsupported, attempting to open an MMIODevice
device using this configuration may result in either a SecurityException
or
a InvalidDeviceConfigException
to be thrown.
The controller name is set to null
.
The controller number is set to UNASSIGNED
.
address
- the memory address of the device (a positive or zero integer).size
- the size of the memory-mapped area of the device (a positive integer).byteOrdering
- the byte ordering of the device, one of: Device.BIG_ENDIAN
,
Device.LITTLE_ENDIAN
, Device.MIXED_ENDIAN
or DeviceConfig.UNASSIGNED
;
if set to UNASSIGNED
then the native byte order of the underlying platform as returned by
ByteOrder.nativeOrder()
is assumed.memConfigs
- the raw block and raw register configurations (may be null
or empty).java.lang.IllegalArgumentException
- if any of the following is true:
address
is not in the defined range;size
is not in the defined range;byteOrdering
is not one of the defined values.java.lang.IndexOutOfBoundsException
- if any of the memConfigs
elements is pointing outside of the defined address range ([
0
- (size - 1)
]).java.lang.NullPointerException
- if any component of the (non-null, non-empty) memConfigs
array is
null
.@Deprecated public MMIODeviceConfig(java.lang.String controllerName, long address, int size, int byteOrdering, MMIODeviceConfig.RawMemoryConfig... memConfigs)
MMIODeviceConfig.Builder
instead.MMIODeviceConfig
with the specified hardware addressing information and configuration
parameters.
If no raw block and raw register configuration is provided, the specified memory area will be mapped to
the RawBlock
instance returned by a call to MMIODevice.getAsRawBlock
.
The controller number is set to UNASSIGNED
.
controllerName
- the controller name (such as its device file name on UNIX systems).address
- the memory address of the device (a positive or zero integer)or DeviceConfig.UNASSIGNED
.size
- the size of the memory-mapped area of the device (a positive integer).byteOrdering
- the byte ordering of the device, one of: Device.BIG_ENDIAN
,
Device.LITTLE_ENDIAN
, Device.MIXED_ENDIAN
or DeviceConfig.UNASSIGNED
;
if set to UNASSIGNED
then the native byte order of the underlying platform as returned by
ByteOrder.nativeOrder()
is assumed.memConfigs
- the raw block and raw register configurations (may be null
or empty).java.lang.IllegalArgumentException
- if any of the following is true:
address
is not in the defined range;size
is not in the defined range;byteOrdering
is not one of the defined values.java.lang.NullPointerException
- if controllerName
is null
or if any component of the (non-null, non-empty) memConfigs
array is
null
.java.lang.IndexOutOfBoundsException
- if any of the memConfigs
elements is pointing outside of the defined address range ([
0
- (size - 1)
]).@Deprecated public MMIODeviceConfig(int controllerNumber, long address, int size, int byteOrdering, MMIODeviceConfig.RawMemoryConfig... memConfigs)
MMIODeviceConfig.Builder
instead.MMIODeviceConfig
with the specified hardware addressing information and configuration
parameters.
If no raw block and raw register configuration is provided, the specified memory area will be mapped to
the RawBlock
instance returned by a call to MMIODevice.getAsRawBlock
.
The controller name is set to null
.
controllerNumber
- the hardware controller's number (a positive or zero integer) or UNASSIGNED
.address
- the memory address of the device (a positive or zero integer)or DeviceConfig.UNASSIGNED
.size
- the size of the memory-mapped area of the device (a positive integer).byteOrdering
- the byte ordering of the device, one of: Device.BIG_ENDIAN
,
Device.LITTLE_ENDIAN
, Device.MIXED_ENDIAN
or DeviceConfig.UNASSIGNED
;
if set to UNASSIGNED
then the native byte order of the underlying platform as returned by
ByteOrder.nativeOrder()
is assumed.memConfigs
- the raw block and raw register configurations (may be null
or empty).java.lang.IllegalArgumentException
- if any of the following is true:
controllerNumber
is not in the defined range;address
is not in the defined range;size
is not in the defined range;byteOrdering
is not one of the defined values.java.lang.IndexOutOfBoundsException
- if any of the memConfigs
elements is pointing outside of the defined address range ([
0
- (size - 1)
]).java.lang.NullPointerException
- if any component of the (non-null, non-empty) memConfigs
array is
null
.public static MMIODeviceConfig deserialize(java.io.InputStream in) throws java.io.IOException
MMIODeviceConfig
whose state is deserialized from the specified InputStream
.
This method may be invoked to restore the state of a MMIODeviceConfig
object from a persistent store.in
- the stream to read from.MMIODeviceConfig
instance.java.io.IOException
- if an I/O error occurs or if the provided stream does not
contain a representation of a MMIODeviceConfig
object.public int serialize(java.io.OutputStream out) throws java.io.IOException
MMIODeviceConfig
object to the specified OutputStream
.
This method may be invoked by the DeviceManager
to save the state of this MMIODeviceConfig
object to a persistent store.serialize
in interface DeviceConfig<MMIODevice>
out
- the stream to write to.java.io.IOException
- if an I/O error occurs.DeviceProvider.deserialize(java.io.InputStream)
public long getAddress()
DeviceConfig.UNASSIGNED
..public java.lang.String getControllerName()
getControllerName
in interface DeviceConfig.HardwareAddressing
null
.public int getControllerNumber()
getControllerNumber
in interface DeviceConfig.HardwareAddressing
UNASSIGNED
.@Deprecated public int getByteOrdering()
getByteOrder()
.Device.BIG_ENDIAN
,
Device.LITTLE_ENDIAN
, Device.MIXED_ENDIAN
.public java.nio.ByteOrder getByteOrder()
public MMIODeviceConfig.RawMemoryConfig[] getRawMemoryConfigs()
null
if none is defined.public int getSize()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
MMIODeviceConfig
objects for equality.equals
in class java.lang.Object
obj
- the object to test for equality with this object.true
if obj
is a MMIODeviceConfig
and has
the same hardware addressing information and configuration parameter values
as this MMIODeviceConfig
object; false
otherwise.Copyright © 2012, 2015, Oracle and/or its affiliates. All rights reserved.
Legal Notices