SMBusLibrary  1.0
Functions
NWK layer

Functions

uint16_t SMBus_NWK_getRxPayloadSize (SMBus *smbus)
 Returns the number of received bytes from last transaction. More...
 
void SMBus_NWK_startTxTransfer (SMBus *smbus)
 Start the TX transfer process. More...
 
void SMBus_NWK_startRxTransfer (SMBus *smbus)
 Start the RX transfer process. More...
 
SMBus_State SMBus_NWK_targetProcessStart (SMBus *smbus, uint8_t addrRw)
 Start callback for SMBus. More...
 
SMBus_State SMBus_NWK_targetProcessRx (SMBus *smbus, uint8_t data)
 RX callback for SMBus target. More...
 
SMBus_State SMBus_NWK_targetProcessTx (SMBus *smbus, uint8_t *data)
 TX callback for SMBus target. More...
 
SMBus_State SMBus_NWK_targetProcessStop (SMBus *smbus)
 Stop callback for SMBus-based protocol. More...
 
SMBus_State SMBus_NWK_targetProcessTimeout (SMBus *smbus)
 Handles the SMBus protocol when a Timeout error is detected by PHY. More...
 
SMBus_State SMBus_NWK_controllerProcessRx (SMBus *smbus, uint8_t data)
 RX callback for SMBus controller. More...
 
SMBus_State SMBus_NWK_controllerProcessTx (SMBus *smbus, uint8_t *data)
 TX callback for SMBus controller. More...
 
SMBus_State SMBus_NWK_controllerTxDone (SMBus *smbus)
 Process a Done condition, between restarts. More...
 
SMBus_State SMBus_NWK_controllerProcessStop (SMBus *smbus)
 Process a Stop condition. More...
 
SMBus_State SMBus_NWK_controllerProcessTimeout (SMBus *smbus)
 Handles the SMBus protocol when a Timeout error is detected by PHY. More...
 
SMBus_State SMBus_NWK_controllerProcessNACK (SMBus *smbus)
 Handles the SMBus protocol when a NACK. More...
 
void SMBus_NWK_controllerReset (SMBus *smbus)
 Resets the SMBus network layer. More...
 
void SMBus_NWK_controllerEnableHostNotify (SMBus *smbus, uint8_t *buff)
 Enable network functions for Host Notify. More...
 
void SMBus_NWK_controllerDisableHostNotify (SMBus *smbus)
 Disable network functions for Host Notify. More...
 

Detailed Description

Function Documentation

§ SMBus_NWK_getRxPayloadSize()

uint16_t SMBus_NWK_getRxPayloadSize ( SMBus smbus)

Returns the number of received bytes from last transaction.

Parameters
smbusPointer to SMBus structure
Returns
Number of bytes in the RX buffer. PEC byte is not included.

References SMBus_Ctrl::bits, SMBus::ctrl, SMBus::nwk, SMBus_Ctrl::pecEn, and SMBus_Nwk::rxIndex.

Referenced by SMBus_getRxPayloadAvailable().

§ SMBus_NWK_startTxTransfer()

void SMBus_NWK_startTxTransfer ( SMBus smbus)

§ SMBus_NWK_startRxTransfer()

void SMBus_NWK_startRxTransfer ( SMBus smbus)

Start the RX transfer process.

Parameters
smbusPointer to SMBus structure
Returns
None

References SMBus_Ctrl::bits, SMBus::ctrl, SMBus_Nwk::eState, SMBus::nwk, SMBus_Ctrl::pecEn, SMBus_Nwk::rxIndex, SMBus_Nwk::rxLen, SMBus_NwkState_RX, SMBus_State_OK, and SMBus::state.

Referenced by SMBus_controllerSendByte(), and SMBus_NWK_controllerTxDone().

§ SMBus_NWK_targetProcessStart()

SMBus_State SMBus_NWK_targetProcessStart ( SMBus smbus,
uint8_t  addrRw 
)

Start callback for SMBus.

Handles the protocol when a Start is received. Depending on the current state, the start could also mean re-start.

Parameters
smbusPointer to SMBus structure
addrRwCurrent Address+RW as received by PHY_DL
Returns
SMBus_State value as follows:
  • SMBus_State_Target_NotReady : Packet in progress
  • SMBus_State_PECError : Packet was invalid
  • SMBus_State_Target_CmdComplete : restart received after command, process previous packet

References SMBus_Ctrl::bits, SMBus_Status::bits, SMBus_Ctrl::controller, SMBus::ctrl, SMBus_Nwk::currentAddr, SMBus_Nwk::eState, SMBus_Ctrl::hostNotifyEn, SMBus::nwk, SMBus_Status::packOvrErr, SMBus::phy, SMBus_Nwk::rxIndex, SMBus_Nwk::rxLen, SMB_HOST_DEFAULT_ADDRESS, SMBus_NwkState_Idle, SMBus_NwkState_RX, SMBus_NwkState_TX_Resp, SMBus_Phy::SMBus_Phy_i2cBase, SMBus_State_OK, SMBus_State_Target_CmdComplete, SMBus_State_Target_QCMD, SMBus::state, SMBus::status, SMBus_Nwk::txIndex, and SMBus_Nwk::txLen.

Referenced by SMBus_PHY_controllerProcessInt(), and SMBus_PHY_targetProcessInt().

§ SMBus_NWK_targetProcessRx()

SMBus_State SMBus_NWK_targetProcessRx ( SMBus smbus,
uint8_t  data 
)

RX callback for SMBus target.

Handles the protocol when a reception is requested.

Parameters
smbusPointer to SMBus structure
dataData byte as received by the PHY layer
Returns
SMBus_State value as follows:
  • SMBus_State_OK
  • SMBus_State_Target_NotReady : Packet in progress
  • SMBus_State_Target_FirstByte : First byte (Command) was received
  • SMBus_State_Target_ByteReceived : Data byte (2-n) was received
  • SMBus_State_Target_Error : not expecting RX
  • SMBus_State_Target_NotReady : not ready for RX
  • SMBus_State_DataSizeError : Max packet size exceeded

References SMBus_Ctrl::bits, SMBus_Status::bits, SMBus_Status::byteOvrErr, SMBus_Ctrl::controller, SMBus::ctrl, SMBus_Nwk::currentAddr, SMBus_Nwk::currentCmd, SMBus_Nwk::eState, SMBus_Ctrl::hostNotifyEn, SMBus_Nwk::hostNotifyRxBuffPtr, SMBus::nwk, SMBus_Status::packErr, SMBus_Nwk::rxBuffPtr, SMBus_Nwk::rxIndex, SMBus_Nwk::rxLen, SMBus_Nwk::rxSize, SMB_HOST_DEFAULT_ADDRESS, SMB_MAX_PACKET_SIZE, SMBus_NwkState_Error, SMBus_NwkState_Idle, SMBus_NwkState_RX, SMBus_State_DataSizeError, SMBus_State_OK, SMBus_State_Target_ByteReceived, SMBus_State_Target_Error, SMBus_State_Target_FirstByte, SMBus_State_Target_NotReady, SMBus::state, and SMBus::status.

Referenced by SMBus_PHY_controllerProcessInt(), and SMBus_PHY_targetProcessInt().

§ SMBus_NWK_targetProcessTx()

SMBus_State SMBus_NWK_targetProcessTx ( SMBus smbus,
uint8_t *  data 
)

TX callback for SMBus target.

Handles the protocol when a transmission is requested.

Parameters
smbusPointer to SMBus structure
*dataPointer to tranmission byte, must be written with value being sent
Returns
SMBus_State value as follows:
  • SMBus_State_OK
  • SMBus_State_Target_NotReady : Buffer not initialized
  • SMBus_State_Target_Error : not expecting TX
  • SMBus_State_Target_NotReady : not ready for TX
  • SMBus_State_DataSizeError : Max packet size exceeded

References SMBus_Ctrl::bits, SMBus_Status::bits, SMBus_Ctrl::controller, SMBus::ctrl, SMBus_Nwk::eState, SMBus::nwk, SMBus_Status::packErr, SMBus_Ctrl::pecEn, SMBus::phy, SMBus_Nwk::recByteTxPtr, RESPONSE_NTR, SMB_MAX_PACKET_SIZE, SMBus_NwkState_Error, SMBus_NwkState_Idle, SMBus_NwkState_TX, SMBus_NwkState_TX_Resp, SMBus_Phy::SMBus_Phy_i2cBase, SMBus_State_DataSizeError, SMBus_State_OK, SMBus_State_Target_Error, SMBus_State_Target_NotReady, SMBus::status, SMBus_Nwk::txBuffPtr, SMBus_Nwk::txIndex, SMBus_Nwk::txLen, and SMBus_Nwk::txSize.

Referenced by SMBus_PHY_targetProcessInt().

§ SMBus_NWK_targetProcessStop()

SMBus_State SMBus_NWK_targetProcessStop ( SMBus smbus)

Stop callback for SMBus-based protocol.

Handles SMus protocol when a stop is detected

Parameters
smbusPointer to SMBus structure
Returns
SMBus_State value as follows:
  • SMBus_State_OK
  • SMBus_State_Target_NotReady : Packet in progress
  • SMBus_State_PECError : Packet was invalid
  • SMBus_State_Target_QCMD : Quick Command was detected
  • SMBus_State_Target_CmdComplete : Stop was detected and packet is ready to process

References SMBus_Ctrl::bits, SMBus_Ctrl::controller, SMBus::ctrl, SMBus_Nwk::currentAddr, SMBus_Nwk::eState, SMBus_Ctrl::hostNotifyEn, SMBus::nwk, SMBus_Nwk::rxIndex, SMB_HOST_DEFAULT_ADDRESS, SMBus_NwkState_Idle, SMBus_NwkState_RX, SMBus_State_Controller_HostNotify, SMBus_State_OK, SMBus_State_Target_CmdComplete, and SMBus_State_Target_QCMD.

Referenced by SMBus_PHY_controllerProcessInt(), and SMBus_PHY_targetProcessInt().

§ SMBus_NWK_targetProcessTimeout()

SMBus_State SMBus_NWK_targetProcessTimeout ( SMBus smbus)

Handles the SMBus protocol when a Timeout error is detected by PHY.

Parameters
smbusPointer to SMBus structure
Returns
SMBus_State_TimeOutError

References SMBus_Status::bits, SMBus_Nwk::eState, SMBus::nwk, SMBus_NwkState_Idle, SMBus_PHY_disable(), SMBus_PHY_targetEnable(), SMBus_State_TimeOutError, SMBus::status, and SMBus_Status::toErr.

§ SMBus_NWK_controllerProcessRx()

SMBus_State SMBus_NWK_controllerProcessRx ( SMBus smbus,
uint8_t  data 
)

RX callback for SMBus controller.

Handles the protocol when a reception is requested.

Parameters
smbusPointer to SMBus structure
dataData byte as received by the PHY layer
Returns
SMBus_State value as follows:
  • SMBus_State_OK
  • SMBus_State_Controller_Error : not expecting RX
  • SMBus_State_DataSizeError : Max packet size exceeded, or greater than expected

References SMBus_Ctrl::bits, SMBus_Status::bits, SMBus::ctrl, SMBus_Nwk::eState, SMBus::nwk, SMBus_Status::packErr, SMBus_Ctrl::pecEn, SMBus_Nwk::rxBuffPtr, SMBus_Nwk::rxIndex, SMBus_Nwk::rxLen, SMB_MAX_PACKET_SIZE, SMB_MAX_PAYLOAD_SIZE, SMBus_NwkState_Error, SMBus_NwkState_RX, SMBus_NwkState_RX_Block_Byte_Count, SMBus_NwkState_RX_Block_Payload, SMBus_PHY_controllerSendStop(), SMBus_State_Controller_Error, SMBus_State_DataSizeError, SMBus::state, and SMBus::status.

Referenced by SMBus_PHY_controllerProcessInt().

§ SMBus_NWK_controllerProcessTx()

SMBus_State SMBus_NWK_controllerProcessTx ( SMBus smbus,
uint8_t *  data 
)

TX callback for SMBus controller.

Handles the protocol when a transmission is requested.

Parameters
smbusPointer to SMBus structure
*dataPointer to tranmission byte, must be written with value being sent
Returns
SMBus_State value as follows:
  • SMBus_State_OK
  • SMBus_State_Controller_Error : not expecting TX

References SMBus_Ctrl::bits, SMBus::ctrl, SMBus_Nwk::currentCmd, SMBus_Nwk::eState, SMBus::nwk, SMBus_Ctrl::pecEn, SMBus_NwkState_Error, SMBus_NwkState_TX, SMBus_NwkState_TX_Block, SMBus_NwkState_TXHostAlert, SMBus_NwkState_TXQuickCMD, SMBus_State_Controller_Error, SMBus::state, SMBus_Nwk::txBuffPtr, SMBus_Nwk::txIndex, and SMBus_Nwk::txLen.

Referenced by SMBus_PHY_controllerProcessInt(), and SMBus_PHY_targetProcessInt().

§ SMBus_NWK_controllerTxDone()

SMBus_State SMBus_NWK_controllerTxDone ( SMBus smbus)

Process a Done condition, between restarts.

Parameters
smbusPointer to SMBus structure
Returns
Current SMBus_State.

References SMBus::nwk, SMBus_Nwk::rxLen, SMBus_NWK_startRxTransfer(), and SMBus::state.

Referenced by SMBus_PHY_controllerProcessInt(), and SMBus_PHY_targetProcessInt().

§ SMBus_NWK_controllerProcessStop()

SMBus_State SMBus_NWK_controllerProcessStop ( SMBus smbus)

§ SMBus_NWK_controllerProcessTimeout()

SMBus_State SMBus_NWK_controllerProcessTimeout ( SMBus smbus)

Handles the SMBus protocol when a Timeout error is detected by PHY.

Parameters
smbusPointer to SMBus structure
Returns
SMBus_State_TimeOutError

References SMBus_Status::bits, SMBus_NWK_controllerReset(), SMBus_State_TimeOutError, SMBus::state, SMBus::status, and SMBus_Status::toErr.

Referenced by SMBus_PHY_controllerProcessInt().

§ SMBus_NWK_controllerProcessNACK()

SMBus_State SMBus_NWK_controllerProcessNACK ( SMBus smbus)

Handles the SMBus protocol when a NACK.

Parameters
smbusPointer to SMBus structure
Returns
SMBus_State value as follows:
  • SMBus_State_OK
  • SMBus_State_Controller_NACK

References SMBus_Nwk::eState, SMBus::nwk, SMBus_NwkState_Ending, SMBus_NwkState_Error, SMBus_PHY_controllerSendStop(), SMBus_State_Controller_NACK, SMBus_State_OK, and SMBus::state.

Referenced by SMBus_PHY_controllerProcessInt(), and SMBus_PHY_targetProcessInt().

§ SMBus_NWK_controllerReset()

void SMBus_NWK_controllerReset ( SMBus smbus)

Resets the SMBus network layer.

Parameters
smbusPointer to SMBus structure
Returns
none

References SMBus_Nwk::eState, SMBus::nwk, SMBus_NwkState_Idle, SMBus_PHY_controllerEnable(), and SMBus_PHY_disable().

Referenced by SMBus_controllerReset(), and SMBus_NWK_controllerProcessTimeout().

§ SMBus_NWK_controllerEnableHostNotify()

void SMBus_NWK_controllerEnableHostNotify ( SMBus smbus,
uint8_t *  buff 
)

Enable network functions for Host Notify.

Parameters
smbusPointer to SMBus structure
buffPointer to Host Notify buffer
Returns
The new state of controller (see SMBus_controllerProcessInt())

References SMBus_Nwk::hostNotifyRxBuffPtr, and SMBus::nwk.

Referenced by SMBus_controllerEnableHostNotify().

§ SMBus_NWK_controllerDisableHostNotify()

void SMBus_NWK_controllerDisableHostNotify ( SMBus smbus)

Disable network functions for Host Notify.

Parameters
smbusPointer to SMBus structure
Returns
The new state of controller (see SMBus_controllerProcessInt())

Referenced by SMBus_controllerDisableHostNotify().

© Copyright 1995-2023, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale