|
Sun SPOT API |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.spot.peripheral.external.M25P05
public class M25P05
Driver for the M25P05 flash memory chip as fitted to Sun SPOT external boards
| Constructor Summary | |
|---|---|
M25P05(ISPI spi)
|
|
| Method Summary | |
|---|---|
void |
eraseChip()
Erase all data in the chip |
void |
eraseSectorAtAddress(int address)
Erase a sector |
int |
getFirstAvailableSector()
Get the sector number of the first sector that can be used with the input and output streams. |
InputStream |
getInputStream(int startSectorNum,
int numOfSectors)
Create an input stream over a logical device formed of selected sectors of the physical device. |
int |
getNumberOfSectors()
Get the number of sectors in the device. |
int |
getNumberOfSectorsInRegion(int startAddress,
int length)
Find the number of sectors in a region of the flash memory. |
OutputStream |
getOutputStream(int startSectorNum,
int numOfSectors)
Create an output stream over a logical device formed of selected sectors of the physical device. |
int |
getPageSize()
Get the page size for writing. |
int |
getSectorContainingAddress(int addr)
Find the sector associated with a given address in the flash. |
int[] |
getSectorMap()
Get a map of sector numbers to sector addresses |
int |
getSectorSize(int sectorNum)
Get the size of a device sector |
int |
getSize()
Get the capacity of the device |
boolean |
isWriteProtected()
Check whether the device is write protected |
void |
read(int address,
int numOfBytes,
byte[] buffer)
Read data from the M25P05 flash memory. |
boolean |
sectorErased(int address)
Check whether a sector is erased. |
void |
setWriteProtection(boolean b)
Set or clear the write protection |
boolean |
verify(int address,
int numOfBytes,
byte[] buffer)
Verify data in the M25P05 flash memory. |
void |
write(int address,
byte[] data,
int index)
Write a 16-bit value into flash. |
void |
write(int address,
int numOfBytes,
byte[] buffer)
Write data into the M25P05 flash memory. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public M25P05(ISPI spi)
| Method Detail |
|---|
public void read(int address,
int numOfBytes,
byte[] buffer)
read in interface IFlashMemoryDeviceaddress - address in memory to start reading, in range 0 to 0xFFFFnumOfBytes - number of bytes to read, in range 0 to (0x10000-address)buffer - the hold the data
public void write(int address,
int numOfBytes,
byte[] buffer)
write in interface IFlashMemoryDeviceaddress - address in memory to start writing, in range 0 to 0xFF00 but must be page-alignednumOfBytes - number of bytes to write, in range 0 to PAGE_SIZEbuffer - the data to write
public void write(int address,
byte[] data,
int index)
IFlashMemoryDevice
write in interface IFlashMemoryDeviceaddress - The address to write at - must be even and in rangedata - The byte at data[index] is written to the address, the byte at data[index+1] to address+1index - The offset into data at which to get the data to write
public boolean verify(int address,
int numOfBytes,
byte[] buffer)
verify in interface IFlashMemoryDeviceaddress - address in memory to start verifying, in range 0 to 0xFF00 but must be page-alignednumOfBytes - number of bytes to write, in range 0 to PAGE_SIZEbuffer - the data to verify against
public void eraseSectorAtAddress(int address)
eraseSectorAtAddress in interface IFlashMemoryDeviceaddress - an address within sector to erasepublic boolean sectorErased(int address)
sectorErased in interface IFlashMemoryDeviceaddress - an address within sector to check
public void eraseChip()
eraseChip in interface IFlashMemoryDevicepublic int getPageSize()
getPageSize in interface IFlashMemoryDevicepublic int[] getSectorMap()
getSectorMap in interface IFlashMemoryDevicepublic void setWriteProtection(boolean b)
b - If b is true the device becomes write protected; if b is false the device becomes writable.public boolean isWriteProtected()
public InputStream getInputStream(int startSectorNum,
int numOfSectors)
getInputStream in interface IFlashMemoryDevicestartSectorNum - The number of the sector at the base of the logical devicenumOfSectors - The number of sectors that form the logical device
public OutputStream getOutputStream(int startSectorNum,
int numOfSectors)
throws IOException
getOutputStream in interface IFlashMemoryDevicestartSectorNum - The number of the sector at the base of the logical devicenumOfSectors - The number of sectors that form the logical device
IOException - If the sectors in the logical device cannot be erased.public int getSize()
getSize in interface IFlashMemoryDevicepublic int getSectorSize(int sectorNum)
getSectorSize in interface IFlashMemoryDevicesectorNum - The sector whose size is to be returned
public int getFirstAvailableSector()
IFlashMemoryDevice
getFirstAvailableSector in interface IFlashMemoryDevicepublic int getNumberOfSectors()
IFlashMemoryDevice
getNumberOfSectors in interface IFlashMemoryDevicepublic int getSectorContainingAddress(int addr)
IFlashMemoryDevice
getSectorContainingAddress in interface IFlashMemoryDeviceaddr - The address.
public int getNumberOfSectorsInRegion(int startAddress,
int length)
IFlashMemoryDevice
getNumberOfSectorsInRegion in interface IFlashMemoryDevicestartAddress - The start of the region.length - The size of the region.
|
Sun SPOT API |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||