SMBusLibrary  1.0
Data Structures | Macros | Enumerations | Functions
Application API layer

Data Structures

union  SMBus_Ctrl
 SMBus control register. More...
 
struct  SMBus_Phy
 Physical and Data Link Layer object. More...
 
struct  tSMBusUDID
 
struct  SMBus_Nwk
 Definition of SMBus Network structure. More...
 
union  SMBus_Status
 SMBus Status Register. More...
 
struct  SMBus_ARP_Status
 SMBus ARP Status Register. More...
 
struct  SMBus
 Main SMBus object. More...
 

Macros

#define SMB_TARGET_SUPPORTS_HOST_NOTIFY   (true)
 Enables Host Notify support as target.
 
#define SMB_CONTROLLER_SUPPORTS_HOST_NOTIFY   (true)
 Enables Host Notify support as Controller.
 
#define SMB_MAX_PAYLOAD_SIZE   (255)
 Maximum payload as specified by SMBus Spec.
 
#define SMB_MAX_PACKET_SIZE   (SMB_MAX_PAYLOAD_SIZE + 3)
 Max packet size = Payload+PEC+CMD+Len.
 
#define SMB_HOST_ALERT_PACKET_SIZE   (3)
 Host Alert packet size = Address + Data Byte Low + Data Byte High.
 
#define SMB_HOST_DEFAULT_ADDRESS   (0x08)
 Default Host Address used for Host Alert.
 
#define RESPONSE_NTR   0xFF
 Default response when there's nothing to send.
 
#define SMBUS_RET_OK   (1)
 SMBus Return value when successful.
 
#define SMBUS_RET_OK_FIXED   (2)
 SMBUS_RET_OK_FIXED Return value when successful.
 
#define SMBUS_RET_OK_BLOCK   (3)
 SMBUS_RET_OK_BLOCK Return value when successful.
 
#define SMBUS_RET_ERROR   (-1)
 Return value when an error ocurred.
 
#define SMBUS_BLOCK_LENGTH   (0xFFFF)
 Definition when using variable lenght for block transactions.
 
#define SMBUS_CMD_PREPARE_TO_ARP   0x01
 ARP Command PREPARE_TO_ARP.
 
#define SMBUS_CMD_ARP_RESET_DEVICE   0x02
 ARP Command RESET_DEVICE.
 
#define SMBUS_CMD_ARP_GET_UDID   0x03
 ARP Command GET_UDID.
 
#define SMBUS_CMD_ARP_ASSIGN_ADDRESS   0x04
 ARP Commands ASSIGN_ADDRESS.
 
#define SMBUS_ADR_HOST   0x08
 SMBus Specification Host Address.
 
#define SMBUS_ADR_SMART_BATTERY_CHARGER   0x09
 SMBus Specification SMART_BATTERY_CHARGER Address.
 
#define SMBUS_ADR_SMART_BATTERY_SELECTOR   0x0A
 SMBus Specification SMART_BATTERY_CHARGER Address.
 
#define SMBUS_ADR_SMART_BATTERY   0x0B
 SMBus Specification SMART_BATTERY Address.
 
#define SMBUS_ADR_DEFAULT_DEVICE   0x61
 SMBus Specification DEFAULT Device Address.
 
#define SMBUS_TARGET_OWN_ADDRESS   SMBUS_ADR_SMART_BATTERY_CHARGER
 SMBus Specification TARGET_OWN_ADDRESS Address.
 
#define SMBUS_ARP_UDID_LEN   0x11
 Length of UDID Packet including Target Address.
 
#define ARP_ADD_RESOLVED   0x00
 Default ARP Address Resolved Flags Status.
 
#define ARP_ADD_VALID   0x00
 Default ARP Address Valid Flags Status.
 
#define ARP_ADD_TYPE   0x00
 Default ARP Address Type.
 

Enumerations

enum  SMBus_Stop {
  SMBus_Stop_After_Transfer = 0,
  SMBus_No_Stop_After_Transfer
}
 List of stop codes used within the NWK and PHY layers.
 
enum  SMBus_Start {
  SMBus_Start_Before_Transfer = 0,
  SMBus_No_Start_Before_Transfer
}
 List of start codes used within the NWK and PHY layers. More...
 
enum  SMBus_Auto_Ack {
  SMBus_Auto_Ack_Last_Byte = 0,
  SMBus_No_Auto_Ack_Last_Byte
}
 List of auto ack codes used within the NWK and PHY layers. More...
 
enum  SMBus_NwkState {
  SMBus_NwkState_Idle = 0,
  SMBus_NwkState_RX,
  SMBus_NwkState_TX,
  SMBus_NwkState_TXHostAlert,
  SMBus_NwkState_TXQuickCMD,
  SMBus_NwkState_TX_Resp,
  SMBus_NwkState_TX_Block,
  SMBus_NwkState_RX_Block_Byte_Count,
  SMBus_NwkState_RX_Block_Payload,
  SMBus_NwkState_Ending,
  SMBus_NwkState_Error
}
 SMBus network layer states. More...
 
enum  SMBus_ErrorCode {
  SMBus_ErrorCode_NoError = 0,
  SMBus_ErrorCode_Packet,
  SMBus_ErrorCode_Cmd
}
 List of error codes used by the application to indicate an error to the library. More...
 
enum  SMBus_State {
  SMBus_State_OK = 0,
  SMBus_State_DataSizeError,
  SMBus_State_PECError,
  SMBus_State_TimeOutError,
  SMBus_State_Target_FirstByte,
  SMBus_State_Target_ByteReceived,
  SMBus_State_Target_QCMD,
  SMBus_State_Target_CmdComplete,
  SMBus_State_Target_Error,
  SMBus_State_Target_NotReady,
  SMBus_State_Target_NTR,
  SMBus_State_Controller_ArbLost,
  SMBus_State_Controller_NACK,
  SMBus_State_Controller_Error,
  SMBus_State_Controller_HostNotify,
  SMBus_State_Invalid_ARP_Cmd,
  SMBus_State_Unknown
}
 SMBus state sent to application layer. More...
 

Functions

void SMBus_processDone (SMBus *smbus)
 Clears the current state of SMBus. More...
 
uint16_t SMBus_getRxPayloadAvailable (SMBus *smbus)
 Returns the number of received bytes from last transaction. More...
 
SMBus_State SMBus_getState (SMBus *smbus)
 Returns the state of the SMBus module. More...
 
void SMBus_enablePEC (SMBus *smbus)
 Enables PEC support. More...
 
void SMBus_disablePEC (SMBus *smbus)
 Disables PEC support. More...
 
void SMBus_targetInit (SMBus *smbus, I2C_Regs *i2cAddr)
 Initialize the SMBus interface as a target. More...
 
void SMBus_targetEnableInt (SMBus *smbus)
 Enables the I2C interrupts for a target. More...
 
void SMBus_targetDisableInt (SMBus *smbus)
 Disables the I2C interrupts for a target. More...
 
SMBus_State SMBus_targetProcessInt (SMBus *smbus)
 I2C Interrupt Service routine for a target. More...
 
void SMBus_controllerReset (SMBus *smbus)
 Force reset to SMBus controller interface. More...
 
void SMBus_targetSetAddress (SMBus *smbus, uint8_t targetAddr)
 Set the target's own I2C address. More...
 
void SMBus_targetSetRxBuffer (SMBus *smbus, uint8_t *data, uint16_t size)
 Initialize the reception buffer for target. More...
 
void SMBus_targetSetTxBuffer (SMBus *smbus, uint8_t *data, uint16_t size)
 Initialize the transmission buffer for target. More...
 
void SMBus_targetReportError (SMBus *smbus, SMBus_ErrorCode errorCode)
 Reports an error to SMBus driver from the target. More...
 
uint8_t SMBus_targetGetCommand (SMBus *smbus)
 Return the current command (Rxbuffer[0]) received by the target. More...
 
void SMBus_targetReportBlock (SMBus *smbus)
 Report to hardware that the command type is a block command. More...
 
void SMBus_targetReportLength (SMBus *smbus, uint16_t length)
 Report to hardware the fixed length of a given command. More...
 
uint8_t SMBus_targetClearStatusReg (SMBus *smbus, uint8_t val)
 Clear the target's status register. More...
 
uint8_t SMBus_targetWriteCtrlReg (SMBus *smbus, uint8_t val)
 Write a value to the target's control register. More...
 
int8_t SMBus_targetHostAlert (SMBus *smbus, uint8_t deviceAddress, uint8_t *txData)
 Send a Host Alert from the target. More...
 
void SMBus_controllerInit (SMBus *smbus, I2C_Regs *i2cAddr, uint32_t busClk)
 Initialize the SMBus Interface for a controller. More...
 
void SMBus_controllerEnableInt (SMBus *smbus)
 Enables the I2C interrupts for a controller. More...
 
void SMBus_controllerDisableInt (SMBus *smbus)
 Disables the I2C interrupts for a controller. More...
 
SMBus_State SMBus_controllerProcessInt (SMBus *smbus)
 I2C Interrupt Service routine for a controller. More...
 
int8_t SMBus_controllerProcessCall (SMBus *smbus, uint8_t targetAddr, uint8_t command, uint8_t *txData, uint8_t *rxData)
 Sends a process call to a target. More...
 
int8_t SMBus_controllerProcessCallBlock (SMBus *smbus, uint8_t targetAddr, uint8_t command, uint8_t *txData, uint8_t txSize, uint8_t *rxData)
 Sends a block write-block read process call. More...
 
int8_t SMBus_controllerSendByte (SMBus *smbus, uint8_t targetAddr, uint8_t txData)
 Sends byte to the target. More...
 
int8_t SMBus_controllerReadByteWord (SMBus *smbus, uint8_t targetAddr, uint8_t command, uint8_t *rxData, uint8_t rxSize)
 Receive a byte from the target. More...
 
int8_t SMBus_controllerWriteByteWord (SMBus *smbus, uint8_t targetAddr, uint8_t command, uint8_t *txData, uint8_t txSize)
 Send a command transmitting a byte or word of data from the target. More...
 
int8_t SMBus_controllerQuickCommand (SMBus *smbus, uint8_t targetAddr, bool write)
 Send a SMBus "quick command". More...
 
int8_t SMBus_controllerWaitUntilDone (SMBus *smbus, int32_t timeout)
 Wait until the previous SMBus command is executed. More...
 
void SMBus_controllerEnableHostNotify (SMBus *smbus, uint8_t *hostAlertBuffer)
 Enable support for Host Notify Protocol. More...
 
void SMBus_controllerDisableHostNotify (SMBus *smbus)
 Disable support for Host Notify Protocol. More...
 
uint8_t SMBus_targetGetAddress (SMBus *smbus)
 Get the target's own I2C address. More...
 
void SMBusARPAssignAddress (SMBus *smbus)
 Validates the Received Address into SMBus-transferable byte order. More...
 
int8_t SMBusARPUDIDByteValidate (SMBus *smbus)
 Validates the Received UDID Byte and address into SMBus-transferable byte order. More...
 
void SMBusARPGetUDIDPacket (SMBus *smbus)
 Encodes a UDID structure and address into SMBus-transferable byte order. More...
 
void SMBusARPGetUDIDPacketDirect (SMBus *smbus)
 Encodes a UDID structure and address into SMBus-transferable byte order. More...
 
void SMBusARP_RESET (SMBus *smbus)
 Resets the States of the AR Flag and AV flag based on POR status. More...
 
void SMBusARPUDIDPacketDecode (tSMBusUDID *pUDID, uint8_t *pui8Data)
 Decodes an SMBus packet into a UDID structure and address. More...
 
uint8_t SMBus_targetGetARPInProgress (SMBus *smbus)
 Get ARP Address Progress Status. More...
 
uint8_t SMBus_targetGetARStatus (SMBus *smbus)
 Get ARP Address Valid Status. More...
 
void SMBus_targetSetARStatus (SMBus *smbus, uint8_t val)
 Set ARP Address Resolved Status. More...
 
void SMBus_targetSetAVStatus (SMBus *smbus, uint8_t val)
 Set ARP Address Valid Status. More...
 
uint8_t SMBus_targetGetAVStatus (SMBus *smbus)
 Get ARP Address Valid Status. More...
 
uint8_t SMBus_targetGetAddressDirect (SMBus *smbus)
 Get Target Direct Address in ARP Direct Address Call. More...
 
uint8_t SMBus_targetGetDirectCmd (SMBus *smbus)
 Get Target Direct Command with Direct Address Call. More...
 
int8_t ARP_UDIDValidate (SMBus *smbus)
 ARP_UDIDValidate. More...
 
void ARP_invalidCMD (SMBus *smbus)
 ARP Invalid Command Routine. More...
 
int8_t ARP_isCmdValid (SMBus *smbus)
 Validates a command for ARP. More...
 
int8_t ARP_CmdComplete (SMBus *smbus)
 ARP Command complete callback. More...
 

Detailed Description

Enumeration Type Documentation

§ SMBus_Start

List of start codes used within the NWK and PHY layers.

Enumerator
SMBus_Start_Before_Transfer 

SMBus start before the Transfer

SMBus_No_Start_Before_Transfer 

SMBus do not start before the Transfer

§ SMBus_Auto_Ack

List of auto ack codes used within the NWK and PHY layers.

Enumerator
SMBus_Auto_Ack_Last_Byte 

SMBus Auto acknowledge last byte

SMBus_No_Auto_Ack_Last_Byte 

SMBus do not Auto acknowledge last byte

§ SMBus_NwkState

SMBus network layer states.

Enumerator
SMBus_NwkState_Idle 

Network is idle and waiting for new packet

SMBus_NwkState_RX 

Network is receiving a packet

SMBus_NwkState_TX 

Network is transmitting after receive byte

SMBus_NwkState_TXHostAlert 

Network is transmitting Host Alert

SMBus_NwkState_TXQuickCMD 

Network is sending Quick Command

SMBus_NwkState_TX_Resp 

Network is transmitting a response after restart

SMBus_NwkState_TX_Block 

Network is transmitting a block

SMBus_NwkState_RX_Block_Byte_Count 

Network is receiving a block

SMBus_NwkState_RX_Block_Payload 

Network is receiving a block

SMBus_NwkState_Ending 

Network is finishing transfer

SMBus_NwkState_Error 

Network error detected

§ SMBus_ErrorCode

List of error codes used by the application to indicate an error to the library.

Enumerator
SMBus_ErrorCode_NoError 

No error detected

SMBus_ErrorCode_Packet 

Incorrect packet was received

SMBus_ErrorCode_Cmd 

Command is not supported

§ SMBus_State

SMBus state sent to application layer.

Enumerator
SMBus_State_OK 

Nothing special to report

SMBus_State_DataSizeError 

Incorrect packet size

SMBus_State_PECError 

PEC Error detected

SMBus_State_TimeOutError 

Timeout Error

SMBus_State_Target_FirstByte 

1st byte (cmd) received

SMBus_State_Target_ByteReceived 

Case where second byte is length in a block command

SMBus_State_Target_QCMD 

Quick Command detected

SMBus_State_Target_CmdComplete 

Complete packet received by target

SMBus_State_Target_Error 

SMBus Target Error

SMBus_State_Target_NotReady 

SMBus Buffers haven't been initialized

SMBus_State_Target_NTR 

No Interrupt flags detected

SMBus_State_Controller_ArbLost 

Arbitration Lost

SMBus_State_Controller_NACK 

Unexpected NACKed

SMBus_State_Controller_Error 

SMBus Controller error

SMBus_State_Controller_HostNotify 

SMBus Controller Host Notify Received

SMBus_State_Invalid_ARP_Cmd 

SMBus State Invalid ARP Command

SMBus_State_Unknown 

SMBus State Unknown

Function Documentation

§ SMBus_processDone()

void SMBus_processDone ( SMBus smbus)

Clears the current state of SMBus.

Must be called by application in order to clear the state machine when a byte/packet was processed

Parameters
smbusPointer to SMBus structure

References SMBus_ARP_Status::arpInProgress, SMBus::arpStatus, SMBus_Ctrl::bits, SMBus::ctrl, SMBus::phy, SMBus_Phy::SMBus_Phy_AckPending, SMBus_PHY_targetManualACK(), SMBus_State_OK, SMBus_State_Target_ByteReceived, SMBus_State_Target_FirstByte, SMBus::state, and SMBus_Ctrl::swackEn.

§ SMBus_getRxPayloadAvailable()

uint16_t SMBus_getRxPayloadAvailable ( 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_NWK_getRxPayloadSize().

§ SMBus_getState()

SMBus_State SMBus_getState ( SMBus smbus)

Returns the state of the SMBus module.

Parameters
smbusPointer to SMBus structure
Returns
State of the SMBus module

References SMBus::state.

§ SMBus_enablePEC()

void SMBus_enablePEC ( SMBus smbus)

Enables PEC support.

Parameters
smbusPointer to SMBus structure

References SMBus_Ctrl::bits, SMBus::ctrl, and SMBus_Ctrl::pecEn.

§ SMBus_disablePEC()

void SMBus_disablePEC ( SMBus smbus)

Disables PEC support.

Parameters
smbusPointer to SMBus structure

References SMBus_Ctrl::bits, SMBus::ctrl, and SMBus_Ctrl::pecEn.

§ SMBus_targetInit()

void SMBus_targetInit ( SMBus smbus,
I2C_Regs *  i2cAddr 
)

§ SMBus_targetEnableInt()

void SMBus_targetEnableInt ( SMBus smbus)

Enables the I2C interrupts for a target.

This function enables the I2C Start, Stop, RX, TX, Timeout interrupts

Parameters
smbusPointer to SMBus structure

References SMBus_PHY_targetEnableInt().

§ SMBus_targetDisableInt()

void SMBus_targetDisableInt ( SMBus smbus)

Disables the I2C interrupts for a target.

This function disables the I2C Start, Stop, RX, TX, Timeout interrupts

Parameters
smbusPointer to SMBus structure

References SMBus_PHY_targetDisableInt().

§ SMBus_targetProcessInt()

SMBus_State SMBus_targetProcessInt ( SMBus smbus)

I2C Interrupt Service routine for a target.

Handles the interrupts for SMBus passing information to NWK layer Should be called by application when I2C interrupt is detected

Parameters
smbusPointer to SMBus structure
Returns
Processing State (SMBus_State)
  • SMBus_State_Target_NotReady - Packet is not ready
  • SMBus_State_Target_FirstByte - First byte received (application can use it to validate the command)
  • SMBus_State_Target_ByteReceived - Byte 2+ received (application can use it to validate each byte)
  • SMBus_State_Target_QCMD - Quick command received
  • SMBus_State_Target_CmdComplete - Packet complete and if PEC enabled, validated.

References SMBus_PHY_targetProcessInt(), SMBus_State_Target_NTR, and SMBus::state.

§ SMBus_controllerReset()

void SMBus_controllerReset ( SMBus smbus)

Force reset to SMBus controller interface.

Resets the network and PHY layers

Parameters
smbusPointer to SMBus structure

References SMBus_NWK_controllerReset().

§ SMBus_targetSetAddress()

void SMBus_targetSetAddress ( SMBus smbus,
uint8_t  targetAddr 
)

Set the target's own I2C address.

Parameters
smbusPointer to SMBus structure
targetAddrTarget I2C address

References SMBus::ownTargetAddr.

§ SMBus_targetSetRxBuffer()

void SMBus_targetSetRxBuffer ( SMBus smbus,
uint8_t *  data,
uint16_t  size 
)

Initialize the reception buffer for target.

Parameters
smbusPointer to SMBus structure
dataPointer to Application RX buffer
sizeMaximum size of buffer

References SMBus::nwk, SMBus_Nwk::rxBuffPtr, and SMBus_Nwk::rxSize.

§ SMBus_targetSetTxBuffer()

void SMBus_targetSetTxBuffer ( SMBus smbus,
uint8_t *  data,
uint16_t  size 
)

Initialize the transmission buffer for target.

Parameters
smbusPointer to SMBus structure
dataPointer to Application TX buffer
sizeMaximum size of buffer

References SMBus::nwk, SMBus_Nwk::txBuffPtr, and SMBus_Nwk::txSize.

§ SMBus_targetReportError()

void SMBus_targetReportError ( SMBus smbus,
SMBus_ErrorCode  errorCode 
)

Reports an error to SMBus driver from the target.

Used to signal an error when incorrect command/data is detected by the target

Parameters
smbusPointer to SMBus structure
errorCodeSMBus_ErrorCode

References SMBus_Status::bits, SMBus_Status::cmdErr, SMBus_Nwk::eState, SMBus::nwk, SMBus_Status::packErr, SMBus_ErrorCode_Cmd, SMBus_ErrorCode_Packet, SMBus_NwkState_Error, SMBus_State_Target_Error, SMBus::state, and SMBus::status.

§ SMBus_targetGetCommand()

uint8_t SMBus_targetGetCommand ( SMBus smbus)

Return the current command (Rxbuffer[0]) received by the target.

Parameters
smbusPointer to SMBus structure
Returns
Current command byte

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

Referenced by ARP_isCmdValid().

§ SMBus_targetReportBlock()

void SMBus_targetReportBlock ( SMBus smbus)

Report to hardware that the command type is a block command.

Parameters
smbusPointer to SMBus structure

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

§ SMBus_targetReportLength()

void SMBus_targetReportLength ( SMBus smbus,
uint16_t  length 
)

Report to hardware the fixed length of a given command.

Parameters
smbusPointer to SMBus structure
lengthLength of payload (without PEC byte), max supported is 0xFF

References SMBus_Ctrl::bits, SMBus::ctrl, SMBus_Ctrl::pecEn, and SMBus_PHY_targetSetPECCount().

Referenced by ARP_invalidCMD().

§ SMBus_targetClearStatusReg()

uint8_t SMBus_targetClearStatusReg ( SMBus smbus,
uint8_t  val 
)

Clear the target's status register.

Parameters
smbusPointer to SMBus structure
valBits cleared from status register (1=X, 0=clear)
Returns
Value of Status register after clearing flags

References SMBus::status, and SMBus_Status::u8byte.

§ SMBus_targetWriteCtrlReg()

uint8_t SMBus_targetWriteCtrlReg ( SMBus smbus,
uint8_t  val 
)

Write a value to the target's control register.

Parameters
smbusPointer to SMBus structure
valValue being written to the Control register
Returns
Value of Control register after write

References SMBus::ctrl, SMBus_Ctrl::u8byte, SMBus_Ctrl::writeableBits, and SMBus_Ctrl::writeBits.

§ SMBus_targetHostAlert()

int8_t SMBus_targetHostAlert ( SMBus smbus,
uint8_t  deviceAddress,
uint8_t *  txData 
)

Send a Host Alert from the target.

SMBus Host Alert protocol
Modified Write Word:
1 7 1 1 8 1 8 1 8 1 1
----------------------------------------------------------------------------------------------
| S | Default Host Address | Wr | A | Device Address | A | Data Byte Low | A | Data Byte High | A | P |
----------------------------------------------------------------------------------------------
where:
S = Start bit
Wr = Write bit (0)
Default Host Address = 0x08
Device Address = Own address to transmit
Data Byte = data sent to target
A = Acknowledge from target
P = Stop bit
Parameters
smbusPointer to SMBus structure
deviceAddressOwn Address
txDataPointer to TX data (2 bytes)
Returns
SMBUS_RET_ERROR, or SMBUS_RET_OK

References SMBus_Nwk::currentAddr, SMBus_Nwk::currentCmd, SMBus_Nwk::eState, SMBus::nwk, SMBus_Nwk::rxLen, SMB_HOST_DEFAULT_ADDRESS, SMBus_NWK_startTxTransfer(), SMBus_NwkState_Idle, SMBus_NwkState_TXHostAlert, SMBUS_RET_ERROR, SMBUS_RET_OK, SMBus_Nwk::txBuffPtr, and SMBus_Nwk::txLen.

§ SMBus_controllerInit()

void SMBus_controllerInit ( SMBus smbus,
I2C_Regs *  i2cAddr,
uint32_t  busClk 
)

§ SMBus_controllerEnableInt()

void SMBus_controllerEnableInt ( SMBus smbus)

Enables the I2C interrupts for a controller.

This function enables the I2C Start, Stop, RX, TX, Timeout interrupts. SMBus_controllerInit() must be called before this function.

Parameters
smbusPointer to SMBus structure

References SMBus_PHY_controllerEnableInt().

§ SMBus_controllerDisableInt()

void SMBus_controllerDisableInt ( SMBus smbus)

Disables the I2C interrupts for a controller.

This function disables the I2C Start, Stop, RX, TX, Timeout interrupts.

Parameters
smbusPointer to SMBus structure

References SMBus_PHY_controllerEnableInt().

§ SMBus_controllerProcessInt()

SMBus_State SMBus_controllerProcessInt ( SMBus smbus)

I2C Interrupt Service routine for a controller.

Handles the interrupts for SMBus passing information to NWK layer Should be called by application when I2C interrupt is detected

Parameters
smbusPointer to SMBus structure
Returns
Processing State (SMBus_State)

References SMBus_PHY_controllerProcessInt().

§ SMBus_controllerProcessCall()

int8_t SMBus_controllerProcessCall ( SMBus smbus,
uint8_t  targetAddr,
uint8_t  command,
uint8_t *  txData,
uint8_t *  rxData 
)

Sends a process call to a target.

Send process call to the target. A command byte and 2 bytes of TX data are required. Two bytes of data will be returned by the target in rxData.

SMBus Process Call command protocol
Process Call:
1 7 1 1 8 1 8 1 8 1
------------------------------------------------------------------------------------------
| S | Target Address | Wr | A | Command Code | A | Data Byte Low | A | Data Byte High | A | ...
------------------------------------------------------------------------------------------
1 7 1 1 8 1 8 1 1
----------------------------------------------------------------------------
| Sr | Target Address | Rd | A | Data Byte Low | A | Data Byte High | A | P |
----------------------------------------------------------------------------
Process Call with PEC:
1 7 1 1 8 1 8 1 8 1
------------------------------------------------------------------------------------------
| S | Target Address | Wr | A | Command Code | A | Data Byte Low | A | Data Byte High | A | ...
------------------------------------------------------------------------------------------
1 7 1 1 8 1 8 1 8 1 1
--------------------------------------------------------------------------------------
| Sr | Target Address | Rd | A | Data Byte Low | A | Data Byte High | A | PEC | A | P |
--------------------------------------------------------------------------------------
where:
S = Start bit
Sr = Reapeated Start bit
Wr = Write bit (0)
Target Adddress = SMBus address for target
Command Code = Command byte sent to target
Data Byte = data sent to target
A = Acknowledge from target
PEC = Optional Packet Error Code
P = Stop bit
Parameters
smbusPointer to SMBus structure
targetAddrTarget address
commandCommand byte for target
txDataTX data buffer
rxDataRX data buffer
Returns
SMBUS_RET_ERROR, or SMBUS_RET_OK

References SMBus_Nwk::currentAddr, SMBus_Nwk::currentCmd, SMBus_Nwk::eState, SMBus::nwk, SMBus_Nwk::rxBuffPtr, SMBus_Nwk::rxLen, SMBus_NWK_startTxTransfer(), SMBus_NwkState_Idle, SMBus_NwkState_TX, SMBUS_RET_ERROR, SMBUS_RET_OK, SMBus_Nwk::txBuffPtr, and SMBus_Nwk::txLen.

§ SMBus_controllerProcessCallBlock()

int8_t SMBus_controllerProcessCallBlock ( SMBus smbus,
uint8_t  targetAddr,
uint8_t  command,
uint8_t *  txData,
uint8_t  txSize,
uint8_t *  rxData 
)

Sends a block write-block read process call.

Send block write-block read process call to the target. A command byte, length and tx data byte array are required. Ensure that rxData is large enough to hold the data received from the target.

SMBus Block write-block read process call protocol
Block write-block read process call:
1 7 1 1 8 1 8 1 8 1
----------------------------------------------------------------------------------------
| S | Target Address | Wr | A | Command Code | A | Byte Count = M | A | Data Byte 1 | A | ...
----------------------------------------------------------------------------------------
8 1 8 1
------------------- -------------------
| Data Byte 2 | A | ... | Data Byte M | A | ...
------------------- -------------------
1 7 1 1 8 1 8 1
----------------------------------------------------------------------
| Sr | Target Address | Rd | A | Byte Count = N | A | Data Byte 1 | A | ...
----------------------------------------------------------------------
8 1 8 1 1
------------------- -----------------------
| Data Byte 2 | A | ... | Data Byte N | A | P |
------------------- -----------------------
Block write-block read process call with PEC:
1 7 1 1 8 1 8 1 8 1
----------------------------------------------------------------------------------------
| S | Target Address | Wr | A | Command Code | A | Byte Count = M | A | Data Byte 1 | A | ...
----------------------------------------------------------------------------------------
8 1 8 1
------------------- -------------------
| Data Byte 2 | A | ... | Data Byte M | A | ...
------------------- -------------------
1 7 1 1 8 1 8 1
----------------------------------------------------------------------
| Sr | Target Address | Rd | A | Byte Count = N | A | Data Byte 1 | A | ...
----------------------------------------------------------------------
8 1 8 1 8 1 1
------------------- ---------------------------------
| Data Byte 2 | A | ... | Data Byte N | A | PEC | A | P |
------------------- ---------------------------------
where:
S = Start bit
Sr = Reapeated Start bit
Wr = Write bit (0)
Rd = Read bit (1)
Target Adddress = SMBus address for target
Command Code = Command byte sent to target
Data Byte = data sent to target
A = Acknowledge from target
PEC = Optional Packet Error Code
P = Stop bit
Parameters
smbusPointer to SMBus structure
targetAddrTarget address
commandCommand byte for target
txDataTX data buffer
txSizeSize of the txData buffer
rxDataRX data buffer
Returns
SMBUS_RET_ERROR, or SMBUS_RET_OK

References SMBus_Nwk::currentAddr, SMBus_Nwk::currentCmd, SMBus_Nwk::eState, SMBus::nwk, SMBus_Nwk::rxBuffPtr, SMBus_Nwk::rxLen, SMB_MAX_PAYLOAD_SIZE, SMBus_NWK_startTxTransfer(), SMBus_NwkState_Idle, SMBus_NwkState_TX_Block, SMBUS_RET_ERROR, SMBUS_RET_OK, SMBus_Nwk::txBuffPtr, and SMBus_Nwk::txLen.

§ SMBus_controllerSendByte()

int8_t SMBus_controllerSendByte ( SMBus smbus,
uint8_t  targetAddr,
uint8_t  txData 
)

Sends byte to the target.

SMBus Send Byte command protocol
1 7 1 1 8 1 1
---------------------------------------------------
| S | Target Address | Wr | A | Data Byte | A | P |
---------------------------------------------------
Send Byte with PEC:
1 7 1 1 8 1 8 1 1
------------------------------------------------------------
| S | Target Address | Wr | A | Data Byte | A | PEC | A | P |
------------------------------------------------------------
where:
S = Start bit
Wr = Write bit (0)
Target Adddress = SMBus address for target
Data Byte = data sent to target
A = Acknowledge from target
PEC = Optional Packet Error Code
P = Stop bit
Parameters
smbusPointer to SMBus structure
targetAddrTarget address
txDataTX data buffer
Returns
SMBUS_RET_ERROR, or SMBUS_RET_OK

References SMBus_Nwk::currentAddr, SMBus_Nwk::currentCmd, SMBus_Nwk::eState, SMBus::nwk, SMBus_Nwk::rxBuffPtr, SMBus_Nwk::rxLen, SMB_MAX_PAYLOAD_SIZE, SMBus_NWK_startRxTransfer(), SMBus_NWK_startTxTransfer(), SMBus_NwkState_Idle, SMBus_NwkState_RX, SMBus_NwkState_TX, SMBus_NwkState_TX_Block, SMBUS_RET_ERROR, SMBUS_RET_OK, SMBus_Nwk::txBuffPtr, and SMBus_Nwk::txLen.

§ SMBus_controllerReadByteWord()

int8_t SMBus_controllerReadByteWord ( SMBus smbus,
uint8_t  targetAddr,
uint8_t  command,
uint8_t *  rxData,
uint8_t  rxSize 
)

Receive a byte from the target.

SMBus Receive Byte command protocol
1 7 1 1 8 1 1
--------------------------------------------------
| S | Target Address | Rd | A | Data Byte | A | P |
--------------------------------------------------
With PEC:
1 7 1 1 8 1 8 1 1
------------------------------------------------------------
| S | Target Address | Rd | A | Data Byte | A | PEC | A | P |
------------------------------------------------------------
where:
S = Start bit
Rd = Read bit (1)
Target Adddress = SMBus address for target
Data Byte = data received from target
A = Acknowledge from target
PEC = Optional Packet Error Code
P = Stop bit
~~~~~~~~ */
//
//
//
//*****************************************************************************
extern int8_t SMBus_controllerReceiveByte(SMBus *smbus,
uint8_t targetAddr,
uint8_t *rxData);
//*****************************************************************************
//
//
//
/**

SMBus Block Read command protocol

Block Read:

1 7 1 1 8 1 1 8 1 1

| S | Target Address | Wr | A | Command Code | A | Sr | Target Address | Rd | A | ...

8 1 8 1 8 1 8 1 1

| Byte Count = N | A | Data Byte 1 | A | Data Byte 2 | A | ... | Data Byte N | A | P |

Block Read with PEC:

1 7 1 1 8 1 1 8 1 1

| S | Target Address | Wr | A | Command Code | A | Sr | Target Address | Rd | A | ...

8 1 8 1 8 1 8 1

| Byte Count = N | A | Data Byte 1 | A | Data Byte 2 | A | ... | Data Byte N | A |...

8 1 1

| PEC | A | P |

where: 
    S = Start bit
    Sr = Reapeated Start bit
    Wr = Write bit (0)
    Rd = Read bit (1)
    Target Adddress = SMBus address for target
    Command Code = Command byte sent to target
    Data Byte = data sent to target
    A = Acknowledge from target
    PEC = Optional Packet Error Code
    P = Stop bit
//
//
//
//*****************************************************************************
extern int8_t SMBus_controllerReadBlock(SMBus *smbus,
uint8_t targetAddr,
uint8_t command,
uint8_t *rxData);
//*****************************************************************************
//
//
//
/**

SMBus Block Write command protocol

Block Write:

1 7 1 1 8 1 8 1 8 1

| S | Target Address | Wr | A | Command Code | A | Byte Count = N | A | Data Byte 1 | A | ...

8 1 8 1 1


| Data Byte 2 | A | ... | Data Byte N | A | P |


Block Write with PEC:

1 7 1 1 8 1 8 1 8 1

| S | Target Address | Wr | A | Command Code | A | Byte Count = N | A | Data Byte 1 | A | ...

8 1 8 1 8 1 1


| Data Byte 2 | A | ... | Data Byte N | A | PEC | A | P |


where: 
    S = Start bit
    Wr = Write bit (0)
    Target Adddress = SMBus address for target
    Command Code = Command byte sent to target
    Data Byte = data sent to target
    A = Acknowledge from target
    PEC = Optional Packet Error Code
    P = Stop bit
//
//
//
//*****************************************************************************
extern int8_t SMBus_controllerWriteBlock(SMBus *smbus,
uint8_t targetAddr,
uint8_t command,
uint8_t *txData,
uint16_t txSize);
//*****************************************************************************
//
//
//
/*

SMBus Read ByteWord command protocol

Read Byte:

1 7 1 1 8 1 8 1 1 8 1 1

| S | Target Address | Wr | A | Command Code | S | Target Address | Rd | A | Data Byte | A | P |

Read Byte with PEC:

1 7 1 1 8 1 8 1 1 8 1 1

| S | Target Address | Wr | A | Command Code | S | Target Address | Rd | A | Data Byte | A | P | ...

8 1 1

| PEC | A | P |

Read Word:

1 7 1 1 8 1 8 1 1 8 1 1

| S | Target Address | Wr | A | Command Code | S | Target Address | Rd | A | Data Byte Low | A | P | ...

8 1 1

| Data Byte High | A | P |

Read Word with PEC:

1 7 1 1 8 1 8 1 1 8 1 1

| S | Target Address | Wr | A | Command Code | S | Target Address | Rd | A | Data Byte Low | A | P | ...

8 1 1 8 1 1

| Data Byte High | A | P | PEC | A | P |

where: 
    S = Start bit
    Wr = Read bit (0)
    Rd = Read bit (1)
    Target Adddress = SMBus address for target
    Command Code = Command byte sent to target
    Data Byte = data sent to target
    A = Acknowledge from target
    PEC = Optional Packet Error Code
    P = Stop bit

~~~~~~~~

Parameters
smbusPointer to SMBus structure
targetAddrTarget address
commandCommand byte for target
rxDataRX data buffer
rxSizeMust be 1 or 2 bytes
Returns
SMBUS_RET_ERROR, or SMBUS_RET_OK

References SMBus_Nwk::currentAddr, SMBus_Nwk::currentCmd, SMBus_Nwk::eState, SMBus::nwk, SMBus_Nwk::rxBuffPtr, SMBus_Nwk::rxLen, SMBus_NWK_startTxTransfer(), SMBus_NwkState_Idle, SMBus_NwkState_TX, SMBUS_RET_ERROR, SMBUS_RET_OK, and SMBus_Nwk::txLen.

§ SMBus_controllerWriteByteWord()

int8_t SMBus_controllerWriteByteWord ( SMBus smbus,
uint8_t  targetAddr,
uint8_t  command,
uint8_t *  txData,
uint8_t  txSize 
)

Send a command transmitting a byte or word of data from the target.

SMBus Write ByteWord command protocol
Write Byte:
1 7 1 1 8 1 8 1 1
---------------------------------------------------------------------
| S | Target Address | Wr | A | Command Code | A | Data Byte | A | P |
---------------------------------------------------------------------
Write Byte with PEC:
1 7 1 1 8 1 8 1 8 1 1
-------------------------------------------------------------------------------
| S | Target Address | Wr | A | Command Code | A | Data Byte | A | PEC | A | P |
-------------------------------------------------------------------------------
Write Word:
1 7 1 1 8 1 8 1 8 1 1
----------------------------------------------------------------------------------------------
| S | Target Address | Wr | A | Command Code | A | Data Byte Low | A | Data Byte High | A | P |
----------------------------------------------------------------------------------------------
Write Word with PEC:
1 7 1 1 8 1 8 1 8 1 8 1 1
--------------------------------------------------------------------------------------------------------
| S | Target Address | Wr | A | Command Code | A | Data Byte Low | A | Data Byte High | A | PEC | A | P |
--------------------------------------------------------------------------------------------------------
where:
S = Start bit
Wr = Write bit (0)
Target Adddress = SMBus address for target
Command Code = Command byte sent to target
Data Byte = data sent to target
A = Acknowledge from target
PEC = Optional Packet Error Code
P = Stop bit
Parameters
smbusPointer to SMBus structure
targetAddrTarget address
commandCommand byte for target
txDataTX data buffer
txSizeMust be 1 or 2 bytes
Returns
SMBUS_RET_ERROR, or SMBUS_RET_OK

References SMBus_Nwk::currentAddr, SMBus_Nwk::currentCmd, SMBus_Nwk::eState, SMBus::nwk, SMBus_Nwk::rxLen, SMBus_NWK_startTxTransfer(), SMBus_NwkState_Idle, SMBus_NwkState_TX, SMBUS_RET_ERROR, SMBUS_RET_OK, SMBus_Nwk::txBuffPtr, and SMBus_Nwk::txLen.

§ SMBus_controllerQuickCommand()

int8_t SMBus_controllerQuickCommand ( SMBus smbus,
uint8_t  targetAddr,
bool  write 
)

Send a SMBus "quick command".

A "quick command" is only a trigger. There is no data sent or received.

SMBus Quick Commmand Protocol:
1 7 1 1 1
-------------------------------------
| S | Target Address | Rd/Wr | A | P |
-------------------------------------
where:
S = Start bit
Rd/Wr = Read or Write bit
Target Adddress = SMBus address for target
A = Acknowledge from target
P = Stop bit
Parameters
smbusPointer to SMBus structure
targetAddrTarget address
writetrue if this is a write command, false if this is a read command
Returns
SMBUS_RET_ERROR, or SMBUS_RET_OK

References SMBus_Nwk::currentAddr, SMBus_Nwk::eState, SMBus::nwk, SMBus_Nwk::rxLen, SMBus_NWK_startTxTransfer(), SMBus_NwkState_Idle, SMBus_NwkState_TXQuickCMD, SMBUS_RET_ERROR, SMBUS_RET_OK, and SMBus_Nwk::txLen.

§ SMBus_controllerWaitUntilDone()

int8_t SMBus_controllerWaitUntilDone ( SMBus smbus,
int32_t  timeout 
)

Wait until the previous SMBus command is executed.

Parameters
smbusPointer to SMBus structure
timeoutSoftware timeout
Returns
SMBUS_RET_ERROR, or SMBUS_RET_OK

References SMBus_Nwk::eState, SMBus::nwk, SMBus_NwkState_Idle, SMBUS_RET_ERROR, and SMBUS_RET_OK.

§ SMBus_controllerEnableHostNotify()

void SMBus_controllerEnableHostNotify ( SMBus smbus,
uint8_t *  hostAlertBuffer 
)

Enable support for Host Notify Protocol.

Controller will respond to Default host address and recognize a host notify protocol.

Parameters
smbusPointer to SMBus structure
hostAlertBufferPointer to buffer to store host Alert response

References SMBus_Ctrl::bits, SMBus::ctrl, SMBus_Ctrl::hostNotifyEn, SMBus_NWK_controllerEnableHostNotify(), and SMBus_PHY_controllerEnableHostNotify().

§ SMBus_controllerDisableHostNotify()

void SMBus_controllerDisableHostNotify ( SMBus smbus)

Disable support for Host Notify Protocol.

Controller will not respond to Default host address and won't recognize the host notify protocol.

Parameters
smbusPointer to SMBus structure

References SMBus_Ctrl::bits, SMBus::ctrl, SMBus_Ctrl::hostNotifyEn, SMBus_NWK_controllerDisableHostNotify(), and SMBus_PHY_controllerDisableHostNotify().

§ SMBus_targetGetAddress()

uint8_t SMBus_targetGetAddress ( SMBus smbus)

Get the target's own I2C address.

Parameters
smbusPointer to SMBus structure
Returns
Target I2C address

References SMBus::ownTargetAddr.

Referenced by ARP_CmdComplete(), and ARP_isCmdValid().

§ SMBusARPAssignAddress()

void SMBusARPAssignAddress ( SMBus smbus)

Validates the Received Address into SMBus-transferable byte order.

This function takes a tSMBusUDID and Acknowledges the Target Address Upon Successful Identification of UDID

Parameters
smbusspecifies the SMBUS structure UDIA Data to encode.

References SMBus_ARP_Status::arpAddResolved, SMBus_ARP_Status::arpAddressValid, SMBus::arpStatus, SMBus::nwk, SMBus::ownTargetAddr, SMBus_Nwk::rxBuffPtr, SMBus_Nwk::rxIndex, and SMBus_Phy_ARP_TARGET_ADDR_Reset().

Referenced by ARP_CmdComplete().

§ SMBusARPUDIDByteValidate()

int8_t SMBusARPUDIDByteValidate ( SMBus smbus)

Validates the Received UDID Byte and address into SMBus-transferable byte order.

Parameters
smbusspecifies the SMBUS structure UDIA Data to encode.

This function takes a tSMBusUDID structure and re-orders the bytes so that it can be transferred on the bus. The destination data buffer must contain at least 17 bytes.

Returns
SMBUS_RET_ERROR

References SMBus_ARP_Status::arpRxData, SMBus::arpStatus, SMBus::nwk, SMBus_Nwk::pUDID, SMBus_Nwk::rxBuffPtr, SMBus_Nwk::rxIndex, SMBUS_ARP_UDID_LEN, SMBUS_RET_ERROR, SMBUS_RET_OK_FIXED, tSMBusUDID::ui16DeviceID, tSMBusUDID::ui16Interface, tSMBusUDID::ui16SubSystemDeviceID, tSMBusUDID::ui16SubSystemVendorID, tSMBusUDID::ui16VendorID, tSMBusUDID::ui32VendorSpecificID, tSMBusUDID::ui8DeviceCapabilities, and tSMBusUDID::ui8Version.

Referenced by ARP_UDIDValidate().

§ SMBusARPGetUDIDPacket()

void SMBusARPGetUDIDPacket ( SMBus smbus)

Encodes a UDID structure and address into SMBus-transferable byte order.

Parameters
smbusspecifies the SMBUS structure UDIA Data to encode.

This function takes a tSMBusUDID structure and re-orders the bytes so that it can be transferred on the bus. The destination data buffer must contain at least 17 bytes.

References SMBus_ARP_Status::arpAddResolved, SMBus::arpStatus, SMBus::nwk, RESPONSE_NTR, SMBusARPGetUDIDPacketDirect(), SMBus_Nwk::txBuffPtr, and SMBus_Nwk::txLen.

Referenced by ARP_CmdComplete().

§ SMBusARPGetUDIDPacketDirect()

void SMBusARPGetUDIDPacketDirect ( SMBus smbus)

Encodes a UDID structure and address into SMBus-transferable byte order.

Parameters
smbusspecifies the SMBUS structure UDIA Data to encode.

This function takes a tSMBusUDID structure and re-orders the bytes so that it can be transferred on the bus. The destination data buffer must contain at least 17 bytes.

References SMBus_ARP_Status::arpAddressValid, SMBus::arpStatus, SMBus::nwk, SMBus::ownTargetAddr, SMBus_Nwk::pUDID, SMBUS_ARP_UDID_LEN, SMBus_Nwk::txBuffPtr, SMBus_Nwk::txLen, tSMBusUDID::ui16DeviceID, tSMBusUDID::ui16Interface, tSMBusUDID::ui16SubSystemDeviceID, tSMBusUDID::ui16SubSystemVendorID, tSMBusUDID::ui16VendorID, tSMBusUDID::ui32VendorSpecificID, tSMBusUDID::ui8DeviceCapabilities, and tSMBusUDID::ui8Version.

Referenced by ARP_CmdComplete(), and SMBusARPGetUDIDPacket().

§ SMBusARP_RESET()

void SMBusARP_RESET ( SMBus smbus)

Resets the States of the AR Flag and AV flag based on POR status.

Parameters
smbusspecifies the SMBUS structure UDIA Data to encode.

This function takes a data buffer and decodes it into a tSMBusUDID structure and an address variable. It is assumed that there are 17 bytes in the data buffer.

References ARP_ADD_VALID, SMBus_ARP_Status::arpAddResolved, SMBus_ARP_Status::arpAddressValid, SMBus::arpStatus, SMBus::nwk, SMBus::ownTargetAddr, SMBus_Nwk::pUDID, SMBus_Phy_ARP_TARGET_ADDR_Reset(), SMBUS_TARGET_OWN_ADDRESS, and tSMBusUDID::ui8DeviceCapabilities.

Referenced by ARP_CmdComplete().

§ SMBusARPUDIDPacketDecode()

void SMBusARPUDIDPacketDecode ( tSMBusUDID pUDID,
uint8_t *  pui8Data 
)

Decodes an SMBus packet into a UDID structure and address.

Parameters
pUDIDspecifies the EDID structure.
pui8Dataspecifies the EDID that is updated with new data.

References tSMBusUDID::ui16DeviceID, tSMBusUDID::ui16Interface, tSMBusUDID::ui16SubSystemDeviceID, tSMBusUDID::ui16SubSystemVendorID, tSMBusUDID::ui16VendorID, tSMBusUDID::ui32VendorSpecificID, tSMBusUDID::ui8DeviceCapabilities, and tSMBusUDID::ui8Version.

§ SMBus_targetGetARPInProgress()

uint8_t SMBus_targetGetARPInProgress ( SMBus smbus)

Get ARP Address Progress Status.

Parameters
smbusWith Received command
Returns
ARP Progress

References SMBus_ARP_Status::arpInProgress, and SMBus::arpStatus.

§ SMBus_targetGetARStatus()

uint8_t SMBus_targetGetARStatus ( SMBus smbus)

Get ARP Address Valid Status.

Parameters
smbusWith Received command
Returns
AV Flag Status

References SMBus_ARP_Status::arpAddResolved, and SMBus::arpStatus.

Referenced by ARP_isCmdValid().

§ SMBus_targetSetARStatus()

void SMBus_targetSetARStatus ( SMBus smbus,
uint8_t  val 
)

Set ARP Address Resolved Status.

Parameters
smbusWith ARP Status
val: AR Flag Value

References SMBus_ARP_Status::arpAddResolved, and SMBus::arpStatus.

Referenced by ARP_CmdComplete().

§ SMBus_targetSetAVStatus()

void SMBus_targetSetAVStatus ( SMBus smbus,
uint8_t  val 
)

Set ARP Address Valid Status.

Parameters
smbusWith ARP Status
val: AV Flag Value

References SMBus_ARP_Status::arpAddressValid, and SMBus::arpStatus.

§ SMBus_targetGetAVStatus()

uint8_t SMBus_targetGetAVStatus ( SMBus smbus)

Get ARP Address Valid Status.

Parameters
smbusWith Received command
Returns
AV Flag Status

References SMBus_ARP_Status::arpAddressValid, and SMBus::arpStatus.

Referenced by ARP_isCmdValid().

§ SMBus_targetGetAddressDirect()

uint8_t SMBus_targetGetAddressDirect ( SMBus smbus)

Get Target Direct Address in ARP Direct Address Call.

Parameters
smbusWith Received command
Returns
MSB 7 bits of the Command

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

Referenced by ARP_CmdComplete(), and ARP_isCmdValid().

§ SMBus_targetGetDirectCmd()

uint8_t SMBus_targetGetDirectCmd ( SMBus smbus)

Get Target Direct Command with Direct Address Call.

Parameters
smbusWith Received command
Returns
1b for Direct GetUDID Command 0b for Direct Reser Command

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

Referenced by ARP_CmdComplete(), and ARP_isCmdValid().

§ ARP_UDIDValidate()

int8_t ARP_UDIDValidate ( SMBus smbus)

ARP_UDIDValidate.

Parameters
smbusSMBus structure with UDID and ARP Status

This function is called when a new RX packet is received and to be Validated

Returns
SMBUS_RET_OK if command executed successfully SMBUS_RET_ERROR if unsuccessful

References SMBus_ARP_Status::arpCommand, SMBus::arpStatus, SMBUS_CMD_ARP_ASSIGN_ADDRESS, SMBUS_RET_OK_FIXED, and SMBusARPUDIDByteValidate().

§ ARP_invalidCMD()

void ARP_invalidCMD ( SMBus smbus)

§ ARP_isCmdValid()

int8_t ARP_isCmdValid ( SMBus smbus)

Validates a command for ARP.

Parameters
smbusWith Received command and ARP Status

This function is called when a command is received with Default Device Address (0x61) and the target needs to Respond with NACK for Invalid Scenarios check if the command is valid

Returns
SMBUS_RET_OK if command was found SMBUS_RET_ERROR if command is invalid

References ARP_invalidCMD(), SMBus_ARP_Status::arpCommand, SMBus_ARP_Status::arpDataLength, SMBus::arpStatus, SMBus_ARP_Status::arpUDIDNacked, SMBus_ARP_Status::arpUDIDTransmit, SMBus::nwk, SMBus_Nwk::pecBlockLenOverride, SMBUS_ARP_UDID_LEN, SMBUS_CMD_ARP_ASSIGN_ADDRESS, SMBUS_CMD_ARP_GET_UDID, SMBUS_CMD_ARP_RESET_DEVICE, SMBUS_CMD_PREPARE_TO_ARP, SMBus_Phy_ARP_Get_Write_Status(), SMBUS_RET_OK_FIXED, SMBus_targetGetAddress(), SMBus_targetGetAddressDirect(), SMBus_targetGetARStatus(), SMBus_targetGetAVStatus(), SMBus_targetGetCommand(), and SMBus_targetGetDirectCmd().

§ ARP_CmdComplete()

int8_t ARP_CmdComplete ( SMBus smbus)

ARP Command complete callback.

Parameters
smbusSMBus structure which received the command with SMBus Default Address

This function is called when a received packet is ready to process after a STOP or RE-START.

Returns
SMBUS_RET_OK if command executed successfully SMBUS_RET_ERROR if unsuccessful

References ARP_invalidCMD(), SMBus_ARP_Status::arpCommand, SMBus_ARP_Status::arpInProgress, SMBus::arpStatus, SMBUS_CMD_ARP_ASSIGN_ADDRESS, SMBUS_CMD_ARP_GET_UDID, SMBUS_CMD_ARP_RESET_DEVICE, SMBUS_CMD_PREPARE_TO_ARP, SMBUS_RET_OK_FIXED, SMBus_targetGetAddress(), SMBus_targetGetAddressDirect(), SMBus_targetGetDirectCmd(), SMBus_targetSetARStatus(), SMBusARP_RESET(), SMBusARPAssignAddress(), SMBusARPGetUDIDPacket(), and SMBusARPGetUDIDPacketDirect().

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