public class MemoryBankScratchSHAEE
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static byte |
COMPUTE_NEXT_SECRET
Compute next Secret command
|
static byte |
LOAD_FIRST_SECRET
Load First Secret
|
static byte |
READ_SCRATCHPAD_COMMAND
Read Scratchpad Command
|
static byte |
REFRESH_SCRATCHPAD
Refresh Scratchpad command
|
static byte |
WRITE_SCRATCHPAD_COMMAND
Write Scratchpad Command
|
Constructor and Description |
---|
MemoryBankScratchSHAEE(OneWireContainer33 ibutton)
Memory bank contstuctor.
|
Modifier and Type | Method and Description |
---|---|
void |
checkSpeed()
Check the device speed if has not been done before or if
an error was detected.
|
void |
computeNextSecret(int addr)
Computes the next secret.
|
void |
computeNextSecret(int addr,
byte[] partialsecret,
int offset)
Computes the next secret.
|
void |
copyScratchpad(int addr,
byte[] scratchpad,
int offset)
Copy the scratchpad page to memory.
|
void |
copyScratchpad(int addr,
byte[] scratchpad,
int scratchpadOffset,
byte[] pageData,
int pageDataOffset)
Copy the scratchpad page to memory.
|
void |
copyScratchpad(int addr,
int len)
Copy the scratchpad page to memory.
|
void |
copyScratchpad(int startAddr,
int len,
boolean WriteProtect)
Copy the scratchpad page to memory.
|
void |
copyScratchpadWithMAC(int addr,
byte[] authMAC,
int authOffset)
Copy all 8 bytes of the Sratch Pad to a certain address in memory
using the provided authorization MAC
|
void |
forceVerify()
Set the flag to indicate the next 'checkSpeed()' will force
a speed set and verify 'doSpeed()'.
|
java.lang.String |
getBankDescription()
Query to see get a string description of the current memory bank.
|
java.lang.String |
getExtraInfoDescription()
Query to get a string description of what is contained in
the Extra Informationed return when reading pages in the current
memory bank.
|
int |
getExtraInfoLength()
Query to get the length in bytes of extra information that
is read when read a page in the current memory bank.
|
int |
getMaxPacketDataLength()
Query to get Maximum data page length in bytes for a packet
read or written in the current memory bank.
|
int |
getNumberPages()
Query to get the number of pages in current memory bank.
|
int |
getPageLength()
Query to get page length in bytes in current memory bank.
|
int |
getSize()
Query to get the memory bank size in bytes.
|
int |
getStartPhysicalAddress()
Query to get the starting physical address of this bank.
|
boolean |
hasExtraInfo()
Checks to see if this memory bank's pages deliver extra
information outside of the normal data space, when read.
|
boolean |
hasPageAutoCRC()
Query to see if current memory bank pages can be read with
the contents being verified by a device generated CRC.
|
boolean |
haveExtraInfo()
Deprecated.
As of 1-Wire API 0.01, replaced by
hasExtraInfo() |
boolean |
isGeneralPurposeMemory()
Query to see if the current memory bank is general purpose
user memory.
|
boolean |
isNonVolatile()
Query to see if current memory bank non-volatile.
|
boolean |
isReadOnly()
Query to see if current memory bank is read only.
|
boolean |
isReadWrite()
Query to see if current memory bank is read/write.
|
boolean |
isWriteOnce()
Query to see if current memory bank is write write once such
as with EPROM technology.
|
void |
loadFirstSecret(int addr)
Load First Secret for the DS2432.
|
void |
loadFirstSecret(int addr,
byte[] data,
int offset)
Load First Secret for the DS2432.
|
boolean |
needsPowerDelivery()
Query to see if current memory bank pages need the adapter to
have a 'PowerDelivery' feature in order to write to the memory.
|
boolean |
needsProgramPulse()
Query to see if current memory bank pages need the adapter to
have a 'ProgramPulse' in order to write to the memory.
|
void |
read(int startAddr,
boolean readContinue,
byte[] readBuf,
int offset,
int len)
Read memory in the current bank with no CRC checking (device or
data).
|
void |
readPage(int page,
boolean readContinue,
byte[] readBuf,
int offset)
Read page in the current bank with no
CRC checking (device or data).
|
void |
readPage(int page,
boolean readContinue,
byte[] readBuf,
int offset,
byte[] extraInfo)
Read page with extra information in the current bank with no
CRC checking (device or data).
|
void |
readPageCRC(int page,
boolean readContinue,
byte[] readBuf,
int offset)
Read a complete memory page with CRC verification provided by the
device.
|
void |
readPageCRC(int page,
boolean readContinue,
byte[] readBuf,
int offset,
byte[] extraInfo)
Read a complete memory page with CRC verification provided by the
device with extra information.
|
int |
readPagePacket(int page,
boolean readContinue,
byte[] readBuf,
int offset)
Read a Universal Data Packet.
|
int |
readPagePacket(int page,
boolean readContinue,
byte[] readBuf,
int offset,
byte[] extraInfo)
Read a Universal Data Packet and extra information.
|
void |
readScratchpad(byte[] readBuf,
int offset,
int len,
byte[] extraInfo)
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 |
refreshScratchpad(int addr)
Refreshes the scratchpad for DS1961S.
|
void |
setWriteVerification(boolean doReadVerf)
Set the write verification for the 'write()' method.
|
void |
write(int addr,
byte[] writeBuf,
int offset,
int len)
Write memory in the current bank.
|
void |
writePagePacket(int page,
byte[] writeBuf,
int offset,
int len)
Write a Universal Data Packet.
|
void |
writeScratchpad(int addr,
byte[] writeBuf,
int offset,
int len)
Write to the scratchpad page of memory a NVRAM device.
|
public static final byte LOAD_FIRST_SECRET
public static final byte COMPUTE_NEXT_SECRET
public static final byte REFRESH_SCRATCHPAD
public static final byte WRITE_SCRATCHPAD_COMMAND
public static final byte READ_SCRATCHPAD_COMMAND
public MemoryBankScratchSHAEE(OneWireContainer33 ibutton)
public void readPageCRC(int page, boolean readContinue, byte[] readBuf, int offset) throws OneWireIOException, OneWireException
readPageCRC
in interface PagedMemoryBank
page
- page number to readreadContinue
- 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 dataOneWireIOException
OneWireException
hasPageAutoCRC
,
getPageLength
public void readPageCRC(int page, boolean readContinue, byte[] readBuf, int offset, byte[] extraInfo) throws OneWireIOException, OneWireException
readPageCRC
in interface PagedMemoryBank
page
- page number to readreadContinue
- 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 dataextraInfo
- byte array to put extra info read intoOneWireIOException
OneWireException
hasExtraInfo
,
getExtraInfoLength
,
hasPageAutoCRC
,
getPageLength
public void readScratchpad(byte[] readBuf, int offset, int len, byte[] extraInfo) throws OneWireIOException, OneWireException
readBuf
- byte array to place read data into
length of array is always pageLength.offset
- offset into readBuf to pug datalen
- length in bytes to readextraInfo
- 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.OneWireIOException
OneWireException
public void copyScratchpad(int addr, int len) throws OneWireIOException, OneWireException
addr
- the address to copy the data tolen
- length byte is ignored, must always be 8.OneWireIOException
OneWireException
public void copyScratchpad(int addr, byte[] scratchpad, int offset) throws OneWireIOException, OneWireException
addr
- the address to copy toscratchpad
- the scratchpad contents that will be copiedoffset
- the offset into scratchpad byte[] where scratchpad data beginsOneWireIOException
OneWireException
public void copyScratchpad(int addr, byte[] scratchpad, int scratchpadOffset, byte[] pageData, int pageDataOffset) throws OneWireIOException, OneWireException
addr
- the address to copy toscratchpad
- the scratchpad contents that will be copiedscratchpadOffset
- the offset into scratchpad byte[] where scratchpad data beginspageData
- the data on the page of memory to be written topageDataOffset
- the offset into pageData byte[] where pageData beginsOneWireIOException
OneWireException
public void copyScratchpadWithMAC(int addr, byte[] authMAC, int authOffset) throws OneWireIOException, OneWireException
addr
- the address to copy the data toauthMAC
- byte[] containing write authorization MACauthOffset
- offset into authMAC where authorization MAC beginsOneWireIOException
OneWireException
public void writeScratchpad(int addr, byte[] writeBuf, int offset, int len) throws OneWireIOException, OneWireException
addr
- physical address to copy data towriteBuf
- byte array containing data to writeoffset
- offset into readBuf to place datalen
- length in bytes to writeOneWireIOException
OneWireException
public void write(int addr, byte[] writeBuf, int offset, int len) throws OneWireIOException, OneWireException
write
in interface MemoryBank
addr
- the address to write towriteBuf
- byte array containing data to writeoffset
- offset into writeBuf to get datalen
- length in bytes to writeOneWireIOException
OneWireException
public void loadFirstSecret(int addr, byte[] data, int offset) throws OneWireIOException, OneWireException
addr
- the address to write the data todata
- the data to 'load' with the Load First Secret commandoffset
- the offset to use for reading the data byte[]OneWireIOException
OneWireException
public void loadFirstSecret(int addr) throws OneWireIOException, OneWireException
addr
- the address to write the data toOneWireIOException
OneWireException
public void computeNextSecret(int addr) throws OneWireIOException, OneWireException
addr
- the physical address of the page to use for secret computationpartialsecret
- byte array containing next partial secret for writing to the scratchpadOneWireIOException
OneWireException
public void computeNextSecret(int addr, byte[] partialsecret, int offset) throws OneWireIOException, OneWireException
addr
- the physical address of the page to use for secret computationpartialsecret
- byte array containing next partial secret for writing to the scratchpadoffset
- into partialsecret byte array to start readingOneWireIOException
OneWireException
public void refreshScratchpad(int addr) throws OneWireIOException, OneWireException
addr
- the address to load the data from into the scratchpadOneWireIOException
OneWireException
public java.lang.String getBankDescription()
getBankDescription
in interface MemoryBank
public boolean isGeneralPurposeMemory()
isGeneralPurposeMemory
in interface MemoryBank
public boolean isReadWrite()
isReadWrite
in interface MemoryBank
public boolean isWriteOnce()
isWriteOnce
in interface MemoryBank
public boolean isReadOnly()
isReadOnly
in interface MemoryBank
public boolean isNonVolatile()
isNonVolatile
in interface MemoryBank
public boolean needsProgramPulse()
needsProgramPulse
in interface MemoryBank
DSPortAdapter
public boolean needsPowerDelivery()
needsPowerDelivery
in interface MemoryBank
DSPortAdapter
public int getStartPhysicalAddress()
getStartPhysicalAddress
in interface MemoryBank
public int getSize()
getSize
in interface MemoryBank
public int getNumberPages()
getNumberPages
in interface PagedMemoryBank
public int getPageLength()
getPageLength
in interface PagedMemoryBank
public int getMaxPacketDataLength()
getMaxPacketDataLength
in interface PagedMemoryBank
readPagePacket
,
readPagePacket(extra)
,
writePagePacket
public boolean hasPageAutoCRC()
hasPageAutoCRC
in interface PagedMemoryBank
readPageCRC
,
readPageCRC(extra)
public boolean haveExtraInfo()
hasExtraInfo()
haveExtraInfo
in interface PagedMemoryBank
readPage(extra)
,
readPageCRC(extra)
,
readPagePacket(extra)
public boolean hasExtraInfo()
readPage
,
readPageCRC
, and
readPagePacket
.hasExtraInfo
in interface PagedMemoryBank
true
if reading the this memory bank's
pages provides extra informationreadPage(extra)
,
readPageCRC(extra)
,
readPagePacket(extra)
public int getExtraInfoLength()
getExtraInfoLength
in interface PagedMemoryBank
hasExtraInfo
public java.lang.String getExtraInfoDescription()
getExtraInfoDescription
in interface PagedMemoryBank
hasExtraInfo
public void setWriteVerification(boolean doReadVerf)
setWriteVerification
in interface MemoryBank
doReadVerf
- true (default) verify write in 'write'
false, don't verify write (used on
Write-Once bit manipulation)OTPMemoryBank
public void read(int startAddr, boolean readContinue, byte[] readBuf, int offset, int len) throws OneWireIOException, OneWireException
read
in interface MemoryBank
startAddr
- starting addressreadContinue
- if 'true' then device read is continued without
re-selecting. This can only be used if the new
read() continious where the last one led off
and it is inside a 'beginExclusive/endExclusive'
block.readBuf
- byte array to place read data intooffset
- offset into readBuf to place datalen
- length in bytes to readOneWireIOException
OneWireException
public void readPage(int page, boolean readContinue, byte[] readBuf, int offset) throws OneWireIOException, OneWireException
readPage
in interface PagedMemoryBank
page
- page number to read packet fromreadContinue
- if 'true' then device read is continued without
re-selecting. This can only be used if the new
readPage() continious where the last one
led off and it is inside a
'beginExclusive/endExclusive' block.readBuf
- byte array to place read data intooffset
- offset into readBuf to place dataOneWireIOException
OneWireException
public void readPage(int page, boolean readContinue, byte[] readBuf, int offset, byte[] extraInfo) throws OneWireIOException, OneWireException
readPage
in interface PagedMemoryBank
page
- page number to read packet fromreadContinue
- if 'true' then device read is continued without
re-selecting. This can only be used if the new
readPage() continious where the last one
led off and it is inside a
'beginExclusive/endExclusive' block.readBuf
- byte array to place read data intooffset
- offset into readBuf to place dataextraInfo
- byte array to put extra info read intoOneWireIOException
OneWireException
hasExtraInfo
,
getExtraInfoLength
public int readPagePacket(int page, boolean readContinue, byte[] readBuf, int offset) throws OneWireIOException, OneWireException
readPagePacket
in interface PagedMemoryBank
page
- page number to read packet fromreadContinue
- 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 dataOneWireIOException
OneWireException
getMaxPacketDataLength
public int readPagePacket(int page, boolean readContinue, byte[] readBuf, int offset, byte[] extraInfo) throws OneWireIOException, OneWireException
readPagePacket
in interface PagedMemoryBank
page
- page number to read packet fromreadContinue
- 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 dataextraInfo
- byte array to put extra info read intoOneWireIOException
OneWireException
hasExtraInfo
,
getExtraInfoLength
,
getMaxPacketDataLength
public void writePagePacket(int page, byte[] writeBuf, int offset, int len) throws OneWireIOException, OneWireException
writePagePacket
in interface PagedMemoryBank
page
- page number to write packet towriteBuf
- data byte array to writeoffset
- offset into writeBuf where data to write islen
- number of bytes to writeOneWireIOException
OneWireException
getMaxPacketDataLength
public void copyScratchpad(int startAddr, int len, boolean WriteProtect) throws OneWireIOException, OneWireException
startAddr
- starting addresslen
- length in bytes that was written alreadyOneWireIOException
OneWireException
public void checkSpeed() throws OneWireIOException, OneWireException
OneWireIOException
OneWireException
public void forceVerify()
Copyright © 1999-2012 Maxim Integrated Products. All Rights Reserved.