Functions | |
uint8_t | SMBus_NWK_getRxPayloadSize (SMBus *smbus) |
Returns the number of received bytes from last transaction. More... | |
void | SMBus_NWK_addCrc8 (uint8_t *crc, uint8_t newData) |
Adds a new value to CRC-8 Calculation. 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_slaveProcessStart (SMBus *smbus, uint8_t addrRw) |
Start callback for SMBus. More... | |
SMBus_State | SMBus_NWK_slaveProcessRx (SMBus *smbus, uint8_t data) |
RX callback for SMBus slave. More... | |
SMBus_State | SMBus_NWK_slaveProcessTx (SMBus *smbus, uint8_t *data) |
TX callback for SMBus slave. More... | |
SMBus_State | SMBus_NWK_slaveProcessStop (SMBus *smbus) |
Stop callback for SMBus-based protocol. More... | |
SMBus_State | SMBus_NWK_slaveProcessTimeout (SMBus *smbus) |
Handles the SMBus protocol when a Timeout error is detected by PHY. More... | |
SMBus_State | SMBus_NWK_masterProcessRx (SMBus *smbus, uint8_t data) |
RX callback for SMBus master. More... | |
SMBus_State | SMBus_NWK_masterProcessTx (SMBus *smbus, uint8_t *data) |
TX callback for SMBus master. More... | |
SMBus_State | SMBus_NWK_masterProcessStop (SMBus *smbus) |
Process a Stop condition. More... | |
SMBus_State | SMBus_NWK_masterProcessTimeout (SMBus *smbus) |
Handles the SMBus protocol when a Timeout error is detected by PHY. More... | |
SMBus_State | SMBus_NWK_masterProcessNACK (SMBus *smbus) |
Handles the SMBus protocol when a NACK. More... | |
void | SMBus_NWK_masterReset (SMBus *smbus) |
Resets the SMBus network layer. More... | |
void SMBus_NWK_addCrc8 | ( | uint8_t * | crc, |
uint8_t | newData | ||
) |
Adds a new value to CRC-8 Calculation.
Follows format: C(x) = x8 + x2 + x + 1
Two methods are available:
*crc | Pointer to current CRC-8 value, will get updated |
newData | New byte added to CRC-8 calulation |
Referenced by SMBus_NWK_masterProcessRx(), SMBus_NWK_masterProcessTx(), SMBus_NWK_slaveProcessRx(), SMBus_NWK_slaveProcessStart(), SMBus_NWK_slaveProcessTx(), SMBus_NWK_startRxTransfer(), and SMBus_NWK_startTxTransfer().
uint8_t SMBus_NWK_getRxPayloadSize | ( | SMBus * | smbus | ) |
Returns the number of received bytes from last transaction.
smbus | Pointer to SMBus structure |
References SMBus_Ctrl::bits, SMBus::ctrl, SMBus::nwk, and SMBus_Nwk::rxIndex.
Referenced by SMBus_getRxPayloadAvailable().
SMBus_State SMBus_NWK_masterProcessNACK | ( | SMBus * | smbus | ) |
Handles the SMBus protocol when a NACK.
smbus | Pointer to SMBus structure |
References SMBus::nwk, SMBus_NwkState_Ending, SMBus_NwkState_Error, SMBus_PHY_masterSendStop(), SMBus_State_Master_NACK, and SMBus::state.
Referenced by SMBus_PHY_masterProcessInt().
SMBus_State SMBus_NWK_masterProcessRx | ( | SMBus * | smbus, |
uint8_t | data | ||
) |
RX callback for SMBus master.
Handles the protocol when a reception is requested.
smbus | Pointer to SMBus structure |
data | Data byte as received by the PHY layer |
References SMBus_Ctrl::bits, SMBus_Status::bits, SMBus::ctrl, SMBus::nwk, SMBus_Status::packErr, SMBus_Nwk::pec, SMBus_Nwk::rxBuffPtr, SMBus_Nwk::rxIndex, SMBus_Nwk::rxLen, SMB_MAX_PACKET_SIZE, SMBus_NWK_addCrc8(), SMBus_NwkState_Error, SMBus_NwkState_RX, SMBus_NwkState_RX_Block, SMBus_PHY_masterSendPreStop(), SMBus_PHY_masterSendStop(), SMBus_State_DataSizeError, SMBus_State_Master_Error, SMBus::state, and SMBus::status.
Referenced by SMBus_PHY_masterProcessInt().
SMBus_State SMBus_NWK_masterProcessStop | ( | SMBus * | smbus | ) |
Process a Stop condition.
smbus | Pointer to SMBus structure |
References SMBus_Ctrl::bits, SMBus_Status::bits, SMBus::ctrl, SMBus::nwk, SMBus_Nwk::pec, SMBus_NwkState_RX, SMBus_NwkState_RX_Block, SMBus_State_PECError, SMBus::state, and SMBus::status.
Referenced by SMBus_PHY_masterSendStop(), and SMBus_PHY_masterStartRx().
SMBus_State SMBus_NWK_masterProcessTimeout | ( | SMBus * | smbus | ) |
Handles the SMBus protocol when a Timeout error is detected by PHY.
Used for USCI devices that do not support timeouts inherently (as in eUSCI).
smbus | Pointer to SMBus structure |
References SMBus_Status::bits, SMBus_NWK_masterReset(), SMBus_State_TimeOutError, SMBus::state, SMBus::status, and SMBus_Status::toErr.
Referenced by SMBus_PHY_masterProcessTimeoutInt().
SMBus_State SMBus_NWK_masterProcessTx | ( | SMBus * | smbus, |
uint8_t * | data | ||
) |
TX callback for SMBus master.
Handles the protocol when a transmission is requested.
smbus | Pointer to SMBus structure |
*data | Pointer to tranmission byte, must be written with value being sent |
References SMBus_Ctrl::bits, SMBus::ctrl, SMBus_Nwk::currentCmd, SMBus::nwk, SMBus_Nwk::pec, SMBus_Nwk::rxLen, SMBus_NWK_addCrc8(), SMBus_NWK_startRxTransfer(), SMBus_NwkState_Ending, SMBus_NwkState_Error, SMBus_NwkState_TX, SMBus_NwkState_TX_Block, SMBus_NwkState_TXQuickCMD, SMBus_PHY_masterSendStop(), SMBus_State_Master_Error, SMBus::state, SMBus_Nwk::txBuffPtr, SMBus_Nwk::txIndex, and SMBus_Nwk::txLen.
Referenced by SMBus_PHY_masterProcessInt().
void SMBus_NWK_masterReset | ( | SMBus * | smbus | ) |
Resets the SMBus network layer.
smbus | Pointer to SMBus structure |
References SMBus::nwk, SMBus_PHY_disable(), and SMBus_PHY_masterEnable().
Referenced by SMBus_masterReset(), and SMBus_NWK_masterProcessTimeout().
SMBus_State SMBus_NWK_slaveProcessRx | ( | SMBus * | smbus, |
uint8_t | data | ||
) |
RX callback for SMBus slave.
Handles the protocol when a reception is requested.
smbus | Pointer to SMBus structure |
data | Data byte as received by the PHY layer |
References SMBus_Ctrl::bits, SMBus_Status::bits, SMBus_Status::byteOvrErr, SMBus::ctrl, SMBus_Nwk::currentCmd, SMBus::nwk, SMBus_Status::packErr, SMBus_Nwk::pec, SMBus_Nwk::rxBuffPtr, SMBus_Nwk::rxIndex, SMBus_Nwk::rxSize, SMB_MAX_PACKET_SIZE, SMBus_NWK_addCrc8(), SMBus_NwkState_Error, SMBus_NwkState_RX, SMBus_State_DataSizeError, SMBus_State_Slave_ByteReceived, SMBus_State_Slave_Error, SMBus_State_Slave_FirstByte, SMBus_State_Slave_NotReady, SMBus::state, and SMBus::status.
Referenced by SMBus_PHY_slaveProcessInt().
SMBus_State SMBus_NWK_slaveProcessStart | ( | 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.
smbus | Pointer to SMBus structure |
addrRw | Current Address+RW as received by PHY_DL |
References SMBus_Ctrl::bits, SMBus_Status::bits, SMBus::ctrl, SMBus_Nwk::currentAddr, I2C_READ, SMBus::nwk, SMBus_Status::packOvrErr, SMBus_Nwk::pec, SMBus_Nwk::rxIndex, SMBus_NWK_addCrc8(), SMBus_NwkState_Error, SMBus_NwkState_RX, SMBus_NwkState_TX, SMBus_NwkState_TX_Resp, SMBUS_RET_OK, SMBus_State_PECError, SMBus_State_Slave_CmdComplete, SMBus_State_Slave_QCMD, SMBus::state, SMBus::status, SMBus_Nwk::txIndex, and SMBus_Nwk::txLen.
Referenced by SMBus_PHY_slaveProcessInt().
SMBus_State SMBus_NWK_slaveProcessStop | ( | SMBus * | smbus | ) |
Stop callback for SMBus-based protocol.
Handles SMus protocol when a stop is detected
smbus | Pointer to SMBus structure |
References SMBus::nwk, SMBus_Nwk::rxIndex, SMBus_NwkState_RX, SMBUS_RET_OK, SMBus_State_PECError, SMBus_State_Slave_CmdComplete, and SMBus_State_Slave_QCMD.
Referenced by SMBus_PHY_slaveProcessInt().
SMBus_State SMBus_NWK_slaveProcessTimeout | ( | SMBus * | smbus | ) |
Handles the SMBus protocol when a Timeout error is detected by PHY.
Used for USCI devices that do not support timeouts inherently (as in eUSCI).
smbus | Pointer to SMBus structure |
References SMBus_Status::bits, SMBus::nwk, SMBus_PHY_disable(), SMBus_PHY_slaveEnable(), SMBus_State_TimeOutError, SMBus::status, and SMBus_Status::toErr.
Referenced by SMBus_PHY_slaveProcessTimeoutInt().
SMBus_State SMBus_NWK_slaveProcessTx | ( | SMBus * | smbus, |
uint8_t * | data | ||
) |
TX callback for SMBus slave.
Handles the protocol when a transmission is requested.
smbus | Pointer to SMBus structure |
*data | Pointer to tranmission byte, must be written with value being sent |
References SMBus_Ctrl::bits, SMBus_Status::bits, SMBus::ctrl, SMBus::nwk, SMBus_Status::packErr, SMBus_Nwk::pec, SMBus_Nwk::recByteTxPtr, RESPONSE_NTR, SMB_MAX_PACKET_SIZE, SMBus_NWK_addCrc8(), SMBus_NwkState_Error, SMBus_NwkState_TX, SMBus_NwkState_TX_Resp, SMBus_State_DataSizeError, SMBus_State_Slave_Error, SMBus_State_Slave_NotReady, SMBus::status, SMBus_Nwk::txBuffPtr, SMBus_Nwk::txIndex, SMBus_Nwk::txLen, and SMBus_Nwk::txSize.
Referenced by SMBus_PHY_slaveProcessInt().
void SMBus_NWK_startRxTransfer | ( | SMBus * | smbus | ) |
Start the RX transfer process.
smbus | Pointer to SMBus structure |
References SMBus_Ctrl::bits, SMBus::ctrl, SMBus_Nwk::currentAddr, I2C_READ, SMBus::nwk, SMBus_Nwk::pec, SMBus_Nwk::rxIndex, SMBus_Nwk::rxLen, SMBus_NWK_addCrc8(), SMBus_NwkState_RX, SMBus_NwkState_RX_Block, SMBus_NwkState_TX_Block, SMBus_PHY_masterStartRx(), SMBus_Stop_Addr, SMBus_Stop_Immediate, SMBus_Stop_PreRead, and SMBus::state.
Referenced by SMBus_masterReceiveByte(), and SMBus_NWK_masterProcessTx().
void SMBus_NWK_startTxTransfer | ( | SMBus * | smbus | ) |
Start the TX transfer process.
smbus | Pointer to SMBus structure |
References SMBus_Ctrl::bits, SMBus::ctrl, SMBus_Nwk::currentAddr, SMBus::nwk, SMBus_Nwk::pec, SMBus_Nwk::rxIndex, SMBus_NWK_addCrc8(), SMBus_NwkState_TXQuickCMD, SMBus_PHY_masterStartTx(), SMBus_Stop_Immediate, SMBus::state, and SMBus_Nwk::txIndex.
Referenced by SMBus_masterProcessCall(), SMBus_masterProcessCallBlock(), SMBus_masterQuickCommand(), SMBus_masterReadBlock(), SMBus_masterReadByteWord(), SMBus_masterSendByte(), SMBus_masterWriteBlock(), and SMBus_masterWriteByteWord().