javax.realtime
Class PhysicalMemoryManager

java.lang.Object
  |
  +--javax.realtime.PhysicalMemoryManager

public final class PhysicalMemoryManager
extends java.lang.Object

The PhysicalMemoryManager is available for use by the various physical memory accessor objects (VTPhysicalMemory, LTPhysicalMemory, ImmortalPhysicalMemory, RawMemoryAccess, and RawMemoryFloatAccess) to create objects of the correct type that are bound to areas of physical memory with the appropriate characteristics -- or with appropriate accessor behavior. Examples of characteristics that might be specified are: DMA memory, accessors with byte swapping, etc.

The base implementation will provide a PhysicalMemoryManager and a set of PhysicalMemoryTypeFilter classes that correctly identify memory classes that are standard for the (OS, JVM, and processor) platform.

OEMs may provide PhysicalMemoryTypeFilter classes that allow additional characteristics of memory devices to be specified.

Memory attributes that are configured may not be compatible with one another. For instance, copy-back cache enable may be incompatible with execute-only. In this case, the implementation of memory filters may detect conflicts and throw a MemoryTypeConflictException, but since filters are not part of the normative RTSJ, this exception is at best advisory.


Field Summary
static java.lang.String ALIGNED
          Specify this to identify aligned memory.
static java.lang.String BYTESWAP
          Specify this if byte swapping should be used.
static java.lang.String DMA
          Specify this to identify DMA memory.
static java.lang.String SHARED
          Specify this to identify shared memory.
 
Method Summary
static boolean isRemovable(long address, long size)
          Is the specified range of memory removable?
static boolean isRemoved(long address, long size)
          Is any part of the specified range of memory presently removed? This method is used for devices that lie in the memory address space and can be removed while the system is running.
static void onInsertion(long base, long size, AsyncEventHandler aeh)
          Register the specified AsyncEventHandler to run when any memory in the range is added to the system.
static void onRemoval(long base, long size, AsyncEventHandler aeh)
          Register the specified AEH to run when any memory in the range is removed from the system.
static void registerFilter(java.lang.Object name, PhysicalMemoryTypeFilter filter)
          Register a memory type filter with the physical memory manager.
static void removeFilter(java.lang.Object name)
          Remove the identified filter from the set of registered filters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DMA

public static final java.lang.String DMA
Specify this to identify DMA memory.

SHARED

public static final java.lang.String SHARED
Specify this to identify shared memory.

ALIGNED

public static final java.lang.String ALIGNED
Specify this to identify aligned memory.

BYTESWAP

public static final java.lang.String BYTESWAP
Specify this if byte swapping should be used.
Method Detail

registerFilter

public static final void registerFilter(java.lang.Object name,
                                        PhysicalMemoryTypeFilter filter)
                                 throws DuplicateFilterException,
                                        java.lang.IllegalArgumentException
Register a memory type filter with the physical memory manager.
Parameters:
name - The type of memory handled by this filter
filter - The filter object
Throws:
DuplicateFilterException - A filter for this type of memory already exists
java.lang.RuntimeException - The system is configured for a bounded number of filters. This filter exceeds the bound.
java.lang.IllegalArgumentException - The name parameter must not be an array of objects.
java.lang.IllegalArgumentException - The name and filter must both be in immortal memory.

removeFilter

public static final void removeFilter(java.lang.Object name)
Remove the identified filter from the set of registered filters.
Parameters:
name - The identifying object for this memory attribute.

isRemovable

public static boolean isRemovable(long address,
                                  long size)
Is the specified range of memory removable?
Parameters:
address - The starting address in physical memory
size - The size of the memory area
Returns:
true if any part of the specified range can be removed

isRemoved

public static boolean isRemoved(long address,
                                long size)
Is any part of the specified range of memory presently removed? This method is used for devices that lie in the memory address space and can be removed while the system is running. (Such as PC cards)
Parameters:
address - The starting address in physical memory
size - The size of the memory area
Returns:
true if any part of the specified range is currently not usable

onRemoval

public static void onRemoval(long base,
                             long size,
                             AsyncEventHandler aeh)
Register the specified AEH to run when any memory in the range is removed from the system. If the specified range of physical memory contains multiple different types of removable memory, the aeh will be registered with any one of them. If the size or the base is less than 0, remove all "remove" references to the aeh.
Parameters:
base - The starting address in physical memory
size - The size of the memory area
aeh - Register this aeh.
Throws:
java.lang.IllegalArgumentException - if the specified range contains no removable memory.

onInsertion

public static void onInsertion(long base,
                               long size,
                               AsyncEventHandler aeh)
Register the specified AsyncEventHandler to run when any memory in the range is added to the system. If the specified range of physical memory contains multiple different types of removable memory, the AEH will be registered with any one of them. If the size or the base is less than 0, unregister all "remove" references to the AEH.
Parameters:
base - The starting address in physical memory
size - The size of the memory area
aeh - Register this AEH.
Throws:
java.lang.IllegalArgumentException - If the specified range contains no removable memory.