DCT Lightfoot v3 API specification

com.dctl.hardware.flash
Class FlashMemory

java.lang.Object
  |
  +--com.dctl.hardware.flash.FlashMemory

public class FlashMemory
extends Object

Provide access to raw flash memory. Use of this class can be dangerous if running from flash or using a flash file system. This does not provide an input or output stream interface to discourage use in this way. The flash file system classes are much more suitable to use


Constructor Summary
FlashMemory(int instance)
          Create a new flash memory
 
Method Summary
 void erase(int position)
          Erase a block
 EraseRegion[] getEraseRegions()
          Get the erase regions - a copy only
 int getPageSize()
          Get the page size
 int getSize()
          Get the memory size
 void lock(int position)
          Lock a block
 int read(int position, byte[] buf, int offset, int length)
          Read a number of bytes from flash into a buffer
 void unlock(int position)
          Unlock all the flash
 int write(int position, byte[] buf, int offset, int length)
          Write a number of bytes from a buffer into flash
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlashMemory

public FlashMemory(int instance)
            throws SystemException
Create a new flash memory

Parameters:
instance - The instance to use
Throws:
SystemException - if the flash cannot be opened
Method Detail

read

public int read(int position,
                byte[] buf,
                int offset,
                int length)
         throws SystemException
Read a number of bytes from flash into a buffer

Parameters:
position - The position to read from
buf - The buffer
offset - The offset into the buffer
length - The length to read
Returns:
the number of bytes read
Throws:
IOException - if there is an error reading
SystemException

write

public int write(int position,
                 byte[] buf,
                 int offset,
                 int length)
          throws SystemException
Write a number of bytes from a buffer into flash

Parameters:
position - The position to write to
buf - The buffer
offset - The offset into the buffer
length - The length to write
Returns:
the number of bytes written
Throws:
IOException - if there is an error reading
SystemException

erase

public void erase(int position)
           throws SystemException
Erase a block

Parameters:
position - The position of the block
Throws:
SystemException - if there is an error erasing

lock

public void lock(int position)
          throws SystemException
Lock a block

Parameters:
position - The position of the block
Throws:
SystemException - if there is an error locking

unlock

public void unlock(int position)
            throws SystemException
Unlock all the flash

Throws:
SystemException - if there is an error unlocking

getSize

public int getSize()
Get the memory size

Returns:
the memory size

getPageSize

public int getPageSize()
Get the page size

Returns:
the page size

getEraseRegions

public EraseRegion[] getEraseRegions()
Get the erase regions - a copy only


DCT Lightfoot v3 API specification

DCT Lightfoot v3 API specification