MemoryBankScratchSHAEE Class Reference

Inherits com::dalsemi::onewire::container::MemoryBankScratchEx.

List of all members.


Detailed Description

Memory bank class for the Scratchpad section of SHA EEPROM iButtons and 1-Wire devices with SHA write-protected memory pages.

Version:
1.00, 11 Aug 2002
Author:
SH

Public Member Functions

 MemoryBankScratchSHAEE (OneWireContainer33 ibutton)
 Memory bank contstuctor.
void readPageCRC (int page, boolean readContinue, byte[] readBuf, int offset) throws OneWireIOException, OneWireException
 Read a complete memory page with CRC verification provided by the device.
void readPageCRC (int page, boolean readContinue, byte[] readBuf, int offset, byte[] extraInfo) throws OneWireIOException, OneWireException
 Read a complete memory page with CRC verification provided by the device with extra information.
void readScratchpad (byte[] readBuf, int offset, int len, byte[] extraInfo) throws OneWireIOException, OneWireException
 Read the scratchpad page of memory from a NVRAM device This method reads and returns the entire scratchpad after the byte offset regardless of the actual ending offset.
void copyScratchpad (int addr, int len) throws OneWireIOException, OneWireException
 Copy the scratchpad page to memory.
void copyScratchpad (int addr, byte[] scratchpad, int offset) throws OneWireIOException, OneWireException
 Copy the scratchpad page to memory.
void copyScratchpad (int addr, byte[] scratchpad, int scratchpadOffset, byte[] pageData, int pageDataOffset) throws OneWireIOException, OneWireException
 Copy the scratchpad page to memory.
void copyScratchpadWithMAC (int addr, byte[] authMAC, int authOffset) throws OneWireIOException, OneWireException
 Copy all 8 bytes of the Sratch Pad to a certain address in memory using the provided authorization MAC.
void writeScratchpad (int addr, byte[] writeBuf, int offset, int len) throws OneWireIOException, OneWireException
 Write to the scratchpad page of memory a NVRAM device.
void write (int addr, byte[] writeBuf, int offset, int len) throws OneWireIOException, OneWireException
 Write memory in the current bank.
void loadFirstSecret (int addr, byte[] data, int offset) throws OneWireIOException, OneWireException
 Load First Secret for the DS2432.
void loadFirstSecret (int addr) throws OneWireIOException, OneWireException
 Load First Secret for the DS2432.
void computeNextSecret (int addr) throws OneWireIOException, OneWireException
 Computes the next secret.
void computeNextSecret (int addr, byte[] partialsecret, int offset) throws OneWireIOException, OneWireException
 Computes the next secret.
void refreshScratchpad (int addr) throws OneWireIOException, OneWireException
 Refreshes the scratchpad for DS1961S.

Static Public Attributes

static final byte LOAD_FIRST_SECRET = ( byte ) 0x5A
 Load First Secret.
static final byte COMPUTE_NEXT_SECRET = ( byte ) 0x33
 Compute next Secret command.
static final byte REFRESH_SCRATCHPAD = ( byte ) 0xA3
 Refresh Scratchpad command.

Protected Attributes

OneWireContainer33 owc33 = null
 The Password container to acces the 8 byte passwords.

Static Protected Attributes

static final byte[] ffBlock = OneWireContainer33.ffBlock
 block of 0xFF's used for faster read pre-fill of 1-Wire blocks Comes from OneWireContainer33 that this MemoryBank references.
static final byte[] zeroBlock = OneWireContainer33.zeroBlock
 block of 0x00's used for faster read pre-fill of 1-Wire blocks Comes from OneWireContainer33 that this MemoryBank references.

Constructor & Destructor Documentation

Memory bank contstuctor.

Requires reference to the OneWireContainer this memory bank resides on.


Member Function Documentation

void readPageCRC ( int  page,
boolean  readContinue,
byte[]  readBuf,
int  offset 
) throws OneWireIOException, OneWireException

Read a complete memory page with CRC verification provided by the device.

Not supported by all devices. See the method 'hasPageAutoCRC()'.

Parameters:
page page number to read
readContinue if 'true' then device read is continued without re-selecting. This can only be used if the new readPagePacket() continious where the last one stopped and it is inside a 'beginExclusive/endExclusive' block.
readBuf byte array to put data read. Must have at least 'getMaxPacketDataLength()' elements.
offset offset into readBuf to place data
Exceptions:
OneWireIOException 
OneWireException 

Reimplemented from MemoryBankScratch.

void readPageCRC ( int  page,
boolean  readContinue,
byte[]  readBuf,
int  offset,
byte[]  extraInfo 
) throws OneWireIOException, OneWireException

Read a complete memory page with CRC verification provided by the device with extra information.

Not supported by all devices. See the method 'hasPageAutoCRC()'. See the method 'hasExtraInfo()' for a description of the optional extra information.

Parameters:
page page number to read
readContinue if 'true' then device read is continued without re-selecting. This can only be used if the new readPagePacket() continious where the last one stopped and it is inside a 'beginExclusive/endExclusive' block.
readBuf byte array to put data read. Must have at least 'getMaxPacketDataLength()' elements.
offset offset into readBuf to place data
extraInfo byte array to put extra info read into
Exceptions:
OneWireIOException 
OneWireException 

Reimplemented from MemoryBankScratch.

void readScratchpad ( byte[]  readBuf,
int  offset,
int  len,
byte[]  extraInfo 
) throws OneWireIOException, OneWireException

Read the scratchpad page of memory from a NVRAM device This method reads and returns the entire scratchpad after the byte offset regardless of the actual ending offset.

Parameters:
readBuf byte array to place read data into length of array is always pageLength.
offset offset into readBuf to pug data
len length in bytes to read
extraInfo byte array to put extra info read into (TA1, TA2, e/s byte) length of array is always extraInfoLength. Can be 'null' if extra info is not needed.
Exceptions:
OneWireIOException 
OneWireException 

Reimplemented from MemoryBankScratch.

void copyScratchpad ( int  addr,
int  len 
) throws OneWireIOException, OneWireException

Copy the scratchpad page to memory.

Parameters:
addr the address to copy the data to
len length byte is ignored, must always be 8.
Exceptions:
OneWireIOException 
OneWireException 

Reimplemented from MemoryBankScratchEx.

void copyScratchpad ( int  addr,
byte[]  scratchpad,
int  offset 
) throws OneWireIOException, OneWireException

Copy the scratchpad page to memory.

Parameters:
addr the address to copy to
scratchpad the scratchpad contents that will be copied
offset the offset into scratchpad byte[] where scratchpad data begins
Exceptions:
OneWireIOException 
OneWireException 

void copyScratchpad ( int  addr,
byte[]  scratchpad,
int  scratchpadOffset,
byte[]  pageData,
int  pageDataOffset 
) throws OneWireIOException, OneWireException

Copy the scratchpad page to memory.

Parameters:
addr the address to copy to
scratchpad the scratchpad contents that will be copied
scratchpadOffset the offset into scratchpad byte[] where scratchpad data begins
pageData the data on the page of memory to be written to
pageDataOffset the offset into pageData byte[] where pageData begins
Exceptions:
OneWireIOException 
OneWireException 

void copyScratchpadWithMAC ( int  addr,
byte[]  authMAC,
int  authOffset 
) throws OneWireIOException, OneWireException

Copy all 8 bytes of the Sratch Pad to a certain address in memory using the provided authorization MAC.

Parameters:
addr the address to copy the data to
authMAC byte[] containing write authorization MAC
authOffset offset into authMAC where authorization MAC begins
Exceptions:
OneWireIOException 
OneWireException 

void writeScratchpad ( int  addr,
byte[]  writeBuf,
int  offset,
int  len 
) throws OneWireIOException, OneWireException

Write to the scratchpad page of memory a NVRAM device.

Parameters:
addr physical address to copy data to
writeBuf byte array containing data to write
offset offset into readBuf to place data
len length in bytes to write
Exceptions:
OneWireIOException 
OneWireException 

Reimplemented from MemoryBankScratchEx.

void write ( int  addr,
byte[]  writeBuf,
int  offset,
int  len 
) throws OneWireIOException, OneWireException

Write memory in the current bank.

It is recommended that when writing data that some structure in the data is created to provide error free reading back with read(). Or the method 'writePagePacket()' could be used which automatically wraps the data in a length and CRC.

When using on Write-Once devices care must be taken to write into into empty space. If write() is used to write over an unlocked page on a Write-Once device it will fail. If write verification is turned off with the method 'setWriteVerification(false)' then the result will be an 'AND' of the existing data and the new data.

Parameters:
addr the address to write to
writeBuf byte array containing data to write
offset offset into writeBuf to get data
len length in bytes to write
Exceptions:
OneWireIOException 
OneWireException 

Reimplemented from MemoryBankScratch.

void loadFirstSecret ( int  addr,
byte[]  data,
int  offset 
) throws OneWireIOException, OneWireException

Load First Secret for the DS2432.

Loads the specified data to the specified location. If the address is data memory (instead of secret memory), this command must have been preceded by a Refresh Scratchpad command for it to be successful.

Parameters:
addr the address to write the data to
data the data to 'load' with the Load First Secret command
offset the offset to use for reading the data byte[]
Exceptions:
OneWireIOException 
OneWireException 

void loadFirstSecret ( int  addr  )  throws OneWireIOException, OneWireException

Load First Secret for the DS2432.

Loads current contents of the scratchpad to the specified location. If the address is data memory (instead of secret memory), this command must have been preceded by a Refresh Scratchpad command for it to be successful.

Parameters:
addr the address to write the data to
Exceptions:
OneWireIOException 
OneWireException 

void computeNextSecret ( int  addr  )  throws OneWireIOException, OneWireException

Computes the next secret.

Parameters:
addr the physical address of the page to use for secret computation
partialsecret byte array containing next partial secret for writing to the scratchpad
Exceptions:
OneWireIOException 
OneWireException 

void computeNextSecret ( int  addr,
byte[]  partialsecret,
int  offset 
) throws OneWireIOException, OneWireException

Computes the next secret.

Parameters:
addr the physical address of the page to use for secret computation
partialsecret byte array containing next partial secret for writing to the scratchpad
offset into partialsecret byte array to start reading
Exceptions:
OneWireIOException 
OneWireException 

void refreshScratchpad ( int  addr  )  throws OneWireIOException, OneWireException

Refreshes the scratchpad for DS1961S.

Command has no effect on DS2432 devices. After this command is executed, the data at the address specified will be loaded into the scratchpad. The Load First Secret command can then be used to re-write the data back to the page, correcting any weakly-programmed EEPROM bits.

Parameters:
addr the address to load the data from into the scratchpad
Exceptions:
OneWireIOException 
OneWireException 


The documentation for this class was generated from the following file:

Generated on Thu Aug 28 15:42:33 2008 for 1-Wire API for .NET by  doxygen 1.5.6