SunSPOT API V5.0


com.sun.squawk.flash
Class NorFlashMemoryHeap

java.lang.Object
  extended by com.sun.squawk.flash.NorFlashMemoryHeap
All Implemented Interfaces:
INorFlashMemoryHeap

public class NorFlashMemoryHeap
extends Object
implements INorFlashMemoryHeap


Field Summary
static byte[] BLOCK_FOOTER
           
static int BLOCK_HEADER_SIZE
           
protected  INorFlashSectorState currentSectorState
           
static byte ERASED_VALUE
           
static byte ERASED_VALUE_XOR
           
protected  int erasedSequenceCurrentValue
           
protected  boolean hasScannedBlocks
           
protected  INorFlashSectorStateList inUseSectorStateList
           
protected  INorFlashSectorState[] sectorStates
           
protected  INorFlashSectorStateList toBeErasedSectorStateList
           
 
Constructor Summary
protected NorFlashMemoryHeap()
           
  NorFlashMemoryHeap(INorFlashSectorState[] sectorStates)
           
  NorFlashMemoryHeap(int purpose)
           
 
Method Summary
 Address allocateAndWriteBlock(byte[] bytes, int offset, int length, INorFlashMemoryHeapScanner scanner)
           
 void forceEraseAll()
           
 void freeBlockAt(Address address)
           
 IMemoryHeapBlock getBlockAt(Address address)
           
protected  boolean getBlockAt(IMemoryHeapBlock block, INorFlashSectorState sectorState, int offset)
           
 long getErasedSequenceCurrentValue()
           
static Vector getNorFlashSectors(int purpose)
           
 INorFlashSectorState getSectorContaining(Address address)
           
 int getSizeAvailable()
           
 int incrementErasedSequence()
           
protected  void init(INorFlashSectorState[] sectorStates)
           
protected  void makeRoomToWrite(int entrySize, INorFlashMemoryHeapScanner scanner)
           
 void scanBlocks(INorFlashMemoryHeapScanner scanner)
          It is guaranteed that the order that blocks were allocated in, is the order in which they will be iterated.
protected  Address writeBlock(IMemoryHeapBlock block, INorFlashMemoryHeapScanner scanner, Address oldAddress)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLOCK_FOOTER

public static final byte[] BLOCK_FOOTER

BLOCK_HEADER_SIZE

public static final int BLOCK_HEADER_SIZE
See Also:
Constant Field Values

ERASED_VALUE

public static final byte ERASED_VALUE
See Also:
Constant Field Values

ERASED_VALUE_XOR

public static final byte ERASED_VALUE_XOR
See Also:
Constant Field Values

currentSectorState

protected INorFlashSectorState currentSectorState

erasedSequenceCurrentValue

protected int erasedSequenceCurrentValue

hasScannedBlocks

protected boolean hasScannedBlocks

inUseSectorStateList

protected INorFlashSectorStateList inUseSectorStateList

sectorStates

protected INorFlashSectorState[] sectorStates

toBeErasedSectorStateList

protected INorFlashSectorStateList toBeErasedSectorStateList
Constructor Detail

NorFlashMemoryHeap

protected NorFlashMemoryHeap()

NorFlashMemoryHeap

public NorFlashMemoryHeap(int purpose)
Parameters:
purpose - One of INorFlashMemorySector.USER_PURPOSED
Throws:
IOException

NorFlashMemoryHeap

public NorFlashMemoryHeap(INorFlashSectorState[] sectorStates)
Method Detail

allocateAndWriteBlock

public Address allocateAndWriteBlock(byte[] bytes,
                                     int offset,
                                     int length,
                                     INorFlashMemoryHeapScanner scanner)
                              throws RecordStoreException
Specified by:
allocateAndWriteBlock in interface INorFlashMemoryHeap
Throws:
RecordStoreException

forceEraseAll

public void forceEraseAll()
Specified by:
forceEraseAll in interface INorFlashMemoryHeap

freeBlockAt

public void freeBlockAt(Address address)
                 throws RecordStoreException
Specified by:
freeBlockAt in interface INorFlashMemoryHeap
Throws:
RecordStoreException

getBlockAt

public IMemoryHeapBlock getBlockAt(Address address)
                            throws RecordStoreException
Specified by:
getBlockAt in interface INorFlashMemoryHeap
Throws:
RecordStoreException

getBlockAt

protected boolean getBlockAt(IMemoryHeapBlock block,
                             INorFlashSectorState sectorState,
                             int offset)
                      throws RecordStoreException
Parameters:
block -
sectorState -
offset -
Returns:
boolean true if there was a block at that address, false if not
Throws:
RecordStoreException

getErasedSequenceCurrentValue

public long getErasedSequenceCurrentValue()
Specified by:
getErasedSequenceCurrentValue in interface INorFlashMemoryHeap

getNorFlashSectors

public static Vector getNorFlashSectors(int purpose)
Returns:
SquawkVector

getSectorContaining

public INorFlashSectorState getSectorContaining(Address address)

getSizeAvailable

public int getSizeAvailable()
                     throws RecordStoreException
Specified by:
getSizeAvailable in interface INorFlashMemoryHeap
Throws:
RecordStoreException

incrementErasedSequence

public int incrementErasedSequence()

init

protected void init(INorFlashSectorState[] sectorStates)

makeRoomToWrite

protected void makeRoomToWrite(int entrySize,
                               INorFlashMemoryHeapScanner scanner)
                        throws RecordStoreException
Throws:
RecordStoreException

scanBlocks

public void scanBlocks(INorFlashMemoryHeapScanner scanner)
                throws RecordStoreException
It is guaranteed that the order that blocks were allocated in, is the order in which they will be iterated.

Specified by:
scanBlocks in interface INorFlashMemoryHeap
Parameters:
scanner -
Throws:
RecordStoreException

writeBlock

protected Address writeBlock(IMemoryHeapBlock block,
                             INorFlashMemoryHeapScanner scanner,
                             Address oldAddress)
                      throws RecordStoreException
Throws:
RecordStoreException

SunSPOT API V5.0


Copyright � 2006-2008 Sun Microsystems, Inc. All Rights Reserved.