001 package javax.realtime; 002 003 /** An instance of <code>VTPhysicalMemory</code> allows objects to 004 * be allocated from a range of physical memory with particular 005 * attributes, determined by their memory type. This memory area 006 * has the same restrictive set of assignment rules as 007 * <code>ScopedMemory</code> memory areas, and the same performance 008 * restrictions as <code>VTMemory</code>. 009 */ 010 public class VTPhysicalMemory extends ScopedMemory { 011 012 private long base, size; 013 private Runnable logic; 014 015 protected void initNative(long sizeInBytes) { 016 } 017 018 /** Create an instance of <code>VTPhysicalMemory</code> with the given parameters. 019 * 020 * @param type An instance of <code>Object</code> representing the type of memory 021 * required (e.g. <i>dma, shared</i>) - used to define the base 022 * address and control the mapping. 023 * @param size The size of the area in bytes. 024 * @throws java.lang.SecurityException The application doesn't have permission to 025 * access physical memory or the given type 026 * of memory. 027 * @throws SizeOutOfBoundsException The size is negative or extends into an invalid 028 * range of memory. 029 * @throws UnsupportedPhysicalMemoryException Thrown if the underlying hardware does 030 * not support the given type. 031 * @throws MemoryTypeConflictException The specified base does not point to memory 032 * that matches the request type, or if 033 * <code>type</code> specifies attributes with a 034 * conflict. 035 */ 036 public VTPhysicalMemory(Object type, long size) 037 throws SecurityException, SizeOutOfBoundsException, 038 UnsupportedPhysicalMemoryException, 039 MemoryTypeConflictException { 040 // TODO 041 042 // This line inserted only to make everything compile! 043 super(size); 044 } 045 046 /** Create an instance of <code>VTPhysicalMemory</code> with the given parameters. 047 * 048 * @param type An instance of <code>Object</code> representing the type of memory 049 * required (e.g. <i>dma, shared</i>) - used to define the base 050 * address and control the mapping. 051 * @param base The physical memory address of the area. 052 * @param size The size of the area in bytes. 053 * @throws java.lang.SecurityException The application doesn't have permission to 054 * access physical memory or the given type 055 * of memory. 056 * @throws SizeOutOfBoundsException The size is negative or extends into an invalid 057 * range of memory. 058 * @throws UnsupportedPhysicalMemoryException Thrown if the underlying hardware does 059 * not support the given type. 060 * @throws MemoryTypeConflictException The specified base does not point to memory 061 * that matches the request type, or if 062 * <code>type</code> specifies attributes with a 063 * conflict. 064 * @throws MemoryInUseException The specified memory is already in use. 065 */ 066 public VTPhysicalMemory(Object type, long base, long size) 067 throws SecurityException, SizeOutOfBoundsException, 068 OffsetOutOfBoundsException, 069 UnsupportedPhysicalMemoryException, 070 MemoryTypeConflictException, MemoryInUseException { 071 this(type, size); 072 this.base = base; 073 } 074 075 /** Create an instance of <code>VTPhysicalMemory</code> with the given parameters. 076 * 077 * @param type An instance of <code>Object</code> representing the type of memory 078 * required (e.g. <i>dma, shared</i>) - used to define the base 079 * address and control the mapping. 080 * @param base The physical memory address of the area. 081 * @param size The size of the area in bytes. 082 * @param logic <code>enter</code> this memory area with this <code>Runnable</code> 083 * after the memory area is created. 084 * @throws java.lang.SecurityException The application doesn't have permission to 085 * access physical memory or the given type 086 * of memory. 087 * @throws SizeOutOfBoundsException The size is negative or extends into an invalid 088 * range of memory. 089 * @throws UnsupportedPhysicalMemoryException Thrown if the underlying hardware does 090 * not support the given type. 091 * @throws MemoryTypeConflictException The specified base does not point to memory 092 * that matches the request type, or if 093 * <code>type</code> specifies attributes with a 094 * conflict. 095 * @throws MemoryInUseException The specified memory is already in use. 096 */ 097 public VTPhysicalMemory(Object type, long base, long size, 098 Runnable logic) 099 throws SecurityException, SizeOutOfBoundsException, 100 OffsetOutOfBoundsException, 101 UnsupportedPhysicalMemoryException, 102 MemoryTypeConflictException, MemoryInUseException { 103 this(type, base, size); 104 this.logic = logic; 105 } 106 107 /** Create an instance of <code>VTPhysicalMemory</code> with the given parameters. 108 * 109 * @param type An instance of <code>Object</code> representing the type of memory 110 * required (e.g. <i>dma, shared</i>) - used to define the base 111 * address and control the mapping. 112 * @param size The size of the area in bytes. 113 * @param logic <code>enter</code> this memory area with this <code>Runnable</code> 114 * after the memory area is created. 115 * @throws java.lang.SecurityException The application doesn't have permission to 116 * access physical memory or the given type 117 * of memory. 118 * @throws SizeOutOfBoundsException The size is negative or extends into an invalid 119 * range of memory. 120 * @throws UnsupportedPhysicalMemoryException Thrown if the underlying hardware does 121 * not support the given type. 122 * @throws MemoryTypeConflictException The specified base does not point to memory 123 * that matches the request type, or if 124 * <code>type</code> specifies attributes with a 125 * conflict. 126 * @throws MemoryInUseException The specified memory is already in use. 127 */ 128 public VTPhysicalMemory(Object type, long size, Runnable logic) 129 throws SecurityException, SizeOutOfBoundsException, 130 UnsupportedPhysicalMemoryException, 131 MemoryTypeConflictException { 132 this(type, size); 133 this.logic = logic; 134 } 135 136 /** Create an instance of <code>VTPhysicalMemory</code> with the given parameters. 137 * 138 * @param type An instance of <code>Object</code> representing the type of memory 139 * required (e.g. <i>dma, shared</i>) - used to define the base 140 * address and control the mapping. 141 * @param base The physical memory address of the area. 142 * @param size A size estimator for shit memory area. 143 * @throws java.lang.SecurityException The application doesn't have permission to 144 * access physical memory or the given type 145 * of memory. 146 * @throws SizeOutOfBoundsException The size is negative or extends into an invalid 147 * range of memory. 148 * @throws UnsupportedPhysicalMemoryException Thrown if the underlying hardware does 149 * not support the given type. 150 * @throws MemoryTypeConflictException The specified base does not point to memory 151 * that matches the request type, or if 152 * <code>type</code> specifies attributes with a 153 * conflict. 154 * @throws MemoryInUseException The specified memory is already in use. 155 */ 156 public VTPhysicalMemory(Object type, long base, SizeEstimator size) 157 throws SecurityException, SizeOutOfBoundsException, 158 OffsetOutOfBoundsException, 159 UnsupportedPhysicalMemoryException, 160 MemoryTypeConflictException, MemoryInUseException { 161 this(type, size); 162 this.base = base; 163 } 164 165 /** Create an instance of <code>VTPhysicalMemory</code> with the given parameters. 166 * 167 * @param type An instance of <code>Object</code> representing the type of memory 168 * required (e.g. <i>dma, shared</i>) - used to define the base 169 * address and control the mapping. 170 * @param base The physical memory address of the area. 171 * @param size A size estimator for shit memory area. 172 * @param logic <code>enter</code> this memory area with this <code>Runnable</code> 173 * after the memory area is created. 174 * @throws java.lang.SecurityException The application doesn't have permission to 175 * access physical memory or the given type 176 * of memory. 177 * @throws SizeOutOfBoundsException The size is negative or extends into an invalid 178 * range of memory. 179 * @throws UnsupportedPhysicalMemoryException Thrown if the underlying hardware does 180 * not support the given type. 181 * @throws MemoryTypeConflictException The specified base does not point to memory 182 * that matches the request type, or if 183 * <code>type</code> specifies attributes with a 184 * conflict. 185 * @throws MemoryInUseException The specified memory is already in use. 186 */ 187 public VTPhysicalMemory(Object type, long base, SizeEstimator size, 188 Runnable logic) 189 throws SecurityException, SizeOutOfBoundsException, 190 OffsetOutOfBoundsException, 191 UnsupportedPhysicalMemoryException, 192 MemoryTypeConflictException, MemoryInUseException { 193 this(type, base, size); 194 this.logic = logic; 195 } 196 197 /** Create an instance of <code>VTPhysicalMemory</code> with the given parameters. 198 * 199 * @param type An instance of <code>Object</code> representing the type of memory 200 * required (e.g. <i>dma, shared</i>) - used to define the base 201 * address and control the mapping. 202 * @param size A size estimator for shit memory area. 203 * @throws java.lang.SecurityException The application doesn't have permission to 204 * access physical memory or the given type 205 * of memory. 206 * @throws SizeOutOfBoundsException The size is negative or extends into an invalid 207 * range of memory. 208 * @throws UnsupportedPhysicalMemoryException Thrown if the underlying hardware does 209 * not support the given type. 210 * @throws MemoryTypeConflictException The specified base does not point to memory 211 * that matches the request type, or if 212 * <code>type</code> specifies attributes with a 213 * conflict. 214 * @throws MemoryInUseException The specified memory is already in use. 215 */ 216 public VTPhysicalMemory(Object type, SizeEstimator size) 217 throws SecurityException, SizeOutOfBoundsException, 218 UnsupportedPhysicalMemoryException, 219 MemoryTypeConflictException { 220 this(type, size.getEstimate()); 221 } 222 223 /** Create an instance of <code>VTPhysicalMemory</code> with the given parameters. 224 * 225 * @param type An instance of <code>Object</code> representing the type of memory 226 * required (e.g. <i>dma, shared</i>) - used to define the base 227 * address and control the mapping. 228 * @param size A size estimator for shit memory area. 229 * @param logic <code>enter</code> this memory area with this <code>Runnable</code> 230 * after the memory area is created. 231 * @throws java.lang.SecurityException The application doesn't have permission to 232 * access physical memory or the given type 233 * of memory. 234 * @throws SizeOutOfBoundsException The size is negative or extends into an invalid 235 * range of memory. 236 * @throws UnsupportedPhysicalMemoryException Thrown if the underlying hardware does 237 * not support the given type. 238 * @throws MemoryTypeConflictException The specified base does not point to memory 239 * that matches the request type, or if 240 * <code>type</code> specifies attributes with a 241 * conflict. 242 * @throws MemoryInUseException The specified memory is already in use. 243 */ 244 public VTPhysicalMemory(Object type, SizeEstimator size, 245 Runnable logic) 246 throws SecurityException, SizeOutOfBoundsException, 247 UnsupportedPhysicalMemoryException, 248 MemoryTypeConflictException { 249 this(type, size); 250 this.logic = logic; 251 } 252 253 /** Creates a string representing the name of <code>this</code>. 254 * 255 * @return A string representing the name of <code>this</code>. 256 */ 257 public String toString() { 258 return "VTPhysicalMemory: " + super.toString(); 259 } 260 }