Device interface library for multiple platforms including Mbed.

Dependents:   DeepCover Embedded Security in IoT MaximInterface MAXREFDES155#

Embed: (wiki syntax)

« Back to documentation index

DS2465 Class Reference

Interface to the DS2465 1-Wire master and SHA-256 coprocessor. More...

#include <DS2465.hpp>

Inherits MaximInterfaceCore::OneWireMaster.

Data Structures

class  Config
 Represents a DS2465 configuration. More...

Public Types

enum  ErrorValue
 

Result of all 1-Wire commands.

More...
enum  PortParameter
 

1-Wire port adjustment parameters.

More...
enum  PageRegion
 

Page region to use for swapping.

More...
typedef Core::array_span
< uint_least8_t, 4 > 
Segment
 Holds the contents of a device memory segment.
typedef Core::array_span
< uint_least8_t, 32 > 
Page
 Holds the contents of a device memory page.
typedef Core::array_span
< uint_least8_t, 20 > 
WriteMacData
 Data for Compute Write MAC operation.
typedef Core::array_span
< uint_least8_t, 76 > 
AuthenticationData
 Data for the Compute Auth. MAC and Compute Slave Secret operations.
enum  Speed
 

Speed of the 1-Wire bus.

More...
enum  Level
 

Level of the 1-Wire bus.

More...

Public Member Functions

MaximInterfaceDevices_EXPORT
Core::Result< void > 
initialize (Config config=Config())
 Initialize hardware for use.
MaximInterfaceDevices_EXPORT
Core::Result< void > 
writeConfig (Config config)
 Write a new configuration to the DS2465.
MaximInterfaceDevices_EXPORT
Core::Result< void > 
writePortParameter (PortParameter param, int val)
 Write a new port configuration parameter to the DS2465.
virtual
MaximInterfaceDevices_EXPORT
Core::Result< void > 
reset ()
 Reset all of the devices on the 1-Wire bus and check for a presence pulse.
virtual
MaximInterfaceDevices_EXPORT
Core::Result< bool > 
touchBitSetLevel (bool sendBit, Level afterLevel)
 Send and receive one bit of communication and set a new level on the 1-Wire bus.
virtual
MaximInterfaceDevices_EXPORT
Core::Result< uint_least8_t > 
readByteSetLevel (Level afterLevel)
 Receive one byte of communication and set a new level on the 1-Wire bus.
virtual
MaximInterfaceDevices_EXPORT
Core::Result< void > 
writeByteSetLevel (uint_least8_t sendByte, Level afterLevel)
 Send one byte of communication and set a new level on the 1-Wire bus.
virtual
MaximInterfaceDevices_EXPORT
Core::Result< void > 
readBlock (Core::span< uint_least8_t > recvBuf)
 Receive a block of communication on the 1-Wire bus.
virtual
MaximInterfaceDevices_EXPORT
Core::Result< void > 
writeBlock (Core::span< const uint_least8_t > sendBuf)
 Send a block of communication on the 1-Wire bus.
virtual
MaximInterfaceDevices_EXPORT
Core::Result< void > 
setSpeed (Speed newSpeed)
 Set the 1-Wire bus communication speed.
virtual
MaximInterfaceDevices_EXPORT
Core::Result< void > 
setLevel (Level newLevel)
virtual
MaximInterfaceDevices_EXPORT
Core::Result< TripletData
triplet (bool sendBit)
 1-Wire Triplet operation.
MaximInterfaceDevices_EXPORT
Core::Result< Page::array
readPage (int pageNum) const
 Read data from an EEPROM memory page.
MaximInterfaceDevices_EXPORT
Core::Result< void > 
writePage (int pageNum, Page::const_span data)
 Write data to an EEPROM memory page.
MaximInterfaceDevices_EXPORT
Core::Result< void > 
writeSegment (int pageNum, int segmentNum, Segment::const_span data)
 Write data to an EEPROM memory segment.
MaximInterfaceDevices_EXPORT
Core::Result< void > 
writeMasterSecret (Page::const_span masterSecret)
 Write data to the secret EEPROM memory page.
MaximInterfaceDevices_EXPORT
Core::Result< void > 
computeNextMasterSecret (AuthenticationData::const_span data)
 Compute Next Master Secret.
MaximInterfaceDevices_EXPORT
Core::Result< void > 
computeNextMasterSecretWithSwap (AuthenticationData::const_span data, int pageNum, PageRegion region)
 Compute Next Master Secret with page swapping.
MaximInterfaceDevices_EXPORT
Core::Result< Page::array
computeWriteMac (WriteMacData::const_span data) const
 Compute Write MAC.
MaximInterfaceDevices_EXPORT
Core::Result< void > 
computeAndTransmitWriteMac (WriteMacData::const_span data)
 Compute Write MAC.
MaximInterfaceDevices_EXPORT
Core::Result< Page::array
computeWriteMacWithSwap (WriteMacData::const_span data, int pageNum, int segmentNum) const
 Compute Write MAC with page swapping.
MaximInterfaceDevices_EXPORT
Core::Result< void > 
computeAndTransmitWriteMacWithSwap (WriteMacData::const_span data, int pageNum, int segmentNum)
 Compute Write MAC with page swapping.
MaximInterfaceDevices_EXPORT
Core::Result< void > 
computeSlaveSecret (AuthenticationData::const_span data)
 Compute Slave Secret (S-Secret).
MaximInterfaceDevices_EXPORT
Core::Result< void > 
computeSlaveSecretWithSwap (AuthenticationData::const_span data, int pageNum, PageRegion region)
 Compute Slave Secret (S-Secret) with page swapping.
MaximInterfaceDevices_EXPORT
Core::Result< Page::array
computeAuthMac (AuthenticationData::const_span data) const
 Compute Authentication MAC.
MaximInterfaceDevices_EXPORT
Core::Result< void > 
computeAndTransmitAuthMac (AuthenticationData::const_span data)
 Compute Authentication MAC.
MaximInterfaceDevices_EXPORT
Core::Result< Page::array
computeAuthMacWithSwap (AuthenticationData::const_span data, int pageNum, PageRegion region) const
 Compute Authentication MAC with page swapping.
MaximInterfaceDevices_EXPORT
Core::Result< void > 
computeAndTransmitAuthMacWithSwap (AuthenticationData::const_span data, int pageNum, PageRegion region)
 Compute Authentication MAC with page swapping.
Result< void > writeBitSetLevel (bool sendBit, Level afterLevel)
 Send one bit of communication and set a new level on the 1-Wire bus.
Result< bool > readBitSetLevel (Level afterLevel)
 Receive one bit of communication and set a new level on the 1-Wire bus.

Detailed Description

Interface to the DS2465 1-Wire master and SHA-256 coprocessor.

Const member functions should not change the settings of the DS2465 or affect the state of the 1-Wire bus. Read pointer, scratchpad, MAC output register, and command register on the DS2465 are considered mutable.

Definition at line 49 of file DS2465.hpp.


Member Typedef Documentation

typedef Core::array_span<uint_least8_t, 76> AuthenticationData

Data for the Compute Auth. MAC and Compute Slave Secret operations.

Definition at line 80 of file DS2465.hpp.

typedef Core::array_span<uint_least8_t, 32> Page

Holds the contents of a device memory page.

Definition at line 74 of file DS2465.hpp.

typedef Core::array_span<uint_least8_t, 4> Segment

Holds the contents of a device memory segment.

Definition at line 71 of file DS2465.hpp.

typedef Core::array_span<uint_least8_t, 20> WriteMacData

Data for Compute Write MAC operation.

Definition at line 77 of file DS2465.hpp.


Member Enumeration Documentation

enum ErrorValue

Result of all 1-Wire commands.

Reimplemented from OneWireMaster.

Definition at line 51 of file DS2465.hpp.

enum Level [inherited]

Level of the 1-Wire bus.

Definition at line 51 of file OneWireMaster.hpp.

enum PageRegion

Page region to use for swapping.

Definition at line 68 of file DS2465.hpp.

1-Wire port adjustment parameters.

Note:
See datasheet page 13.

Definition at line 55 of file DS2465.hpp.

enum Speed [inherited]

Speed of the 1-Wire bus.

Definition at line 48 of file OneWireMaster.hpp.


Member Function Documentation

Result< void > computeAndTransmitAuthMac ( AuthenticationData::const_span  data )

Compute Authentication MAC.

Parameters:
dataCombined data fields for computation.

Definition at line 695 of file DS2465.cpp.

Result< void > computeAndTransmitAuthMacWithSwap ( AuthenticationData::const_span  data,
int  pageNum,
PageRegion  region 
)

Compute Authentication MAC with page swapping.

Parameters:
dataCombined data fields for computation.
pageNumPage number to swap in.
regionRegion of the page to swap in.

Definition at line 729 of file DS2465.cpp.

Result< void > computeAndTransmitWriteMac ( WriteMacData::const_span  data )

Compute Write MAC.

Parameters:
dataCombined data fields for computation.

Definition at line 610 of file DS2465.cpp.

Result< void > computeAndTransmitWriteMacWithSwap ( WriteMacData::const_span  data,
int  pageNum,
int  segmentNum 
)

Compute Write MAC with page swapping.

Parameters:
dataCombined data fields for computation.
pageNumPage number to swap in.
segmentNumSegment number to swap in.

Definition at line 644 of file DS2465.cpp.

Result< DS2465::Page::array > computeAuthMac ( AuthenticationData::const_span  data ) const

Compute Authentication MAC.

Parameters:
dataCombined data fields for computation.
Returns:
Computed Auth MAC.

Definition at line 681 of file DS2465.cpp.

Result< DS2465::Page::array > computeAuthMacWithSwap ( AuthenticationData::const_span  data,
int  pageNum,
PageRegion  region 
) const

Compute Authentication MAC with page swapping.

Parameters:
dataCombined data fields for computation.
pageNumPage number to swap in.
regionRegion of the page to swap in.
Returns:
Computed Auth MAC.

Definition at line 714 of file DS2465.cpp.

Result< void > computeNextMasterSecret ( AuthenticationData::const_span  data )

Compute Next Master Secret.

Parameters:
dataCombined data fields for computation.

Definition at line 570 of file DS2465.cpp.

Result< void > computeNextMasterSecretWithSwap ( AuthenticationData::const_span  data,
int  pageNum,
PageRegion  region 
)

Compute Next Master Secret with page swapping.

Parameters:
dataCombined data fields for computation.
pageNumPage number to swap in.
regionRegion of the page to swap in.

Definition at line 579 of file DS2465.cpp.

Result< void > computeSlaveSecret ( AuthenticationData::const_span  data )

Compute Slave Secret (S-Secret).

Parameters:
dataCombined data fields for computation.

Definition at line 653 of file DS2465.cpp.

Result< void > computeSlaveSecretWithSwap ( AuthenticationData::const_span  data,
int  pageNum,
PageRegion  region 
)

Compute Slave Secret (S-Secret) with page swapping.

Parameters:
dataCombined data fields for computation.
pageNumPage number to swap in.
regionRegion of the page to swap in.

Definition at line 662 of file DS2465.cpp.

Result< DS2465::Page::array > computeWriteMac ( WriteMacData::const_span  data ) const

Compute Write MAC.

Parameters:
dataCombined data fields for computation.
Returns:
Computed Write MAC.

Definition at line 597 of file DS2465.cpp.

Result< DS2465::Page::array > computeWriteMacWithSwap ( WriteMacData::const_span  data,
int  pageNum,
int  segmentNum 
) const

Compute Write MAC with page swapping.

Parameters:
dataCombined data fields for computation.
pageNumPage number to swap in.
segmentNumSegment number to swap in.
Returns:
Computed Write MAC.

Definition at line 629 of file DS2465.cpp.

Result< void > initialize ( Config  config = Config() )

Initialize hardware for use.

Definition at line 70 of file DS2465.cpp.

Result<bool> readBitSetLevel ( Level  afterLevel ) [inherited]

Receive one bit of communication and set a new level on the 1-Wire bus.

Parameters:
afterLevelLevel to set the 1-Wire bus to after communication.
Returns:
Received data from the 1-Wire bus.

Definition at line 135 of file OneWireMaster.hpp.

Result< void > readBlock ( Core::span< uint_least8_t >  recvBuf ) [virtual]

Receive a block of communication on the 1-Wire bus.

Parameters:
[out]recvBufBuffer to receive the data from the 1-Wire bus.

Reimplemented from OneWireMaster.

Definition at line 258 of file DS2465.cpp.

Result< uint_least8_t > readByteSetLevel ( Level  afterLevel ) [virtual]

Receive one byte of communication and set a new level on the 1-Wire bus.

Parameters:
afterLevelLevel to set the 1-Wire bus to after communication.
Returns:
Data received from the 1-Wire bus.

Reimplemented from OneWireMaster.

Definition at line 312 of file DS2465.cpp.

Result< DS2465::Page::array > readPage ( int  pageNum ) const

Read data from an EEPROM memory page.

Parameters:
pageNumPage number to read from.
Returns:
Data that was read.

Definition at line 137 of file DS2465.cpp.

Result< void > reset (  ) [virtual]

Reset all of the devices on the 1-Wire bus and check for a presence pulse.

Returns:
NoSlaveError if reset was performed but no presence pulse was detected.

Implements OneWireMaster.

Definition at line 521 of file DS2465.cpp.

Result< void > setLevel ( Level  newLevel ) [virtual]

Set the 1-Wire bus level.

Note:
The DS2465 only supports enabling strong pullup following a 1-Wire read or write operation.

Implements OneWireMaster.

Definition at line 215 of file DS2465.cpp.

Result< void > setSpeed ( Speed  newSpeed ) [virtual]

Set the 1-Wire bus communication speed.

Implements OneWireMaster.

Definition at line 223 of file DS2465.cpp.

Result< bool > touchBitSetLevel ( bool  sendBit,
Level  afterLevel 
) [virtual]

Send and receive one bit of communication and set a new level on the 1-Wire bus.

Parameters:
sendBitBit to send on the 1-Wire bus.
afterLevelLevel to set the 1-Wire bus to after communication.
Returns:
Bit received from the 1-Wire bus.

Implements OneWireMaster.

Definition at line 349 of file DS2465.cpp.

Result< OneWireMaster::TripletData > triplet ( bool  sendBit ) [virtual]

1-Wire Triplet operation.

Perform one bit of a 1-Wire search. This command does two read bits and one write bit. The write bit is either the default direction (all devices have same bit) or in case of a discrepancy, the data.writeBit parameter is used.

Parameters:
sendBitBit to send in case both read bits are zero.

Reimplemented from OneWireMaster.

Definition at line 236 of file DS2465.cpp.

Result<void> writeBitSetLevel ( bool  sendBit,
Level  afterLevel 
) [inherited]

Send one bit of communication and set a new level on the 1-Wire bus.

Parameters:
sendBitBit to send on the 1-Wire bus.
afterLevelLevel to set the 1-Wire bus to after communication.

Definition at line 126 of file OneWireMaster.hpp.

Result< void > writeBlock ( Core::span< const uint_least8_t >  sendBuf ) [virtual]

Send a block of communication on the 1-Wire bus.

Parameters:
[in]sendBufBuffer to send on the 1-Wire bus.

Reimplemented from OneWireMaster.

Definition at line 278 of file DS2465.cpp.

Result< void > writeByteSetLevel ( uint_least8_t  sendByte,
Level  afterLevel 
) [virtual]

Send one byte of communication and set a new level on the 1-Wire bus.

Parameters:
sendByteByte to send on the 1-Wire bus.
afterLevelLevel to set the 1-Wire bus to after communication.

Reimplemented from OneWireMaster.

Definition at line 331 of file DS2465.cpp.

Result< void > writeConfig ( Config  config )

Write a new configuration to the DS2465.

Parameters:
[in]configNew configuration to write.

Definition at line 438 of file DS2465.cpp.

Result< void > writeMasterSecret ( Page::const_span  masterSecret )

Write data to the secret EEPROM memory page.

Definition at line 177 of file DS2465.cpp.

Result< void > writePage ( int  pageNum,
Page::const_span  data 
)

Write data to an EEPROM memory page.

Parameters:
pageNumPage number to copy to.
dataData to write.

Definition at line 154 of file DS2465.cpp.

Result< void > writePortParameter ( PortParameter  param,
int  val 
)

Write a new port configuration parameter to the DS2465.

Parameters:
[in]paramParameter to adjust.
[in]valNew parameter value to set. Consult datasheet for value mappings.

Definition at line 455 of file DS2465.cpp.

Result< void > writeSegment ( int  pageNum,
int  segmentNum,
Segment::const_span  data 
)

Write data to an EEPROM memory segment.

Parameters:
pageNumPage number to copy to.
segmentNumSegment number to copy to.
dataData to write.

Definition at line 165 of file DS2465.cpp.