SMBusLibrary  1.0
Macros | Functions
MSPM0 PHY layer

Macros

#define I2C_WRITE   0
 R/W state when write is received.
 
#define I2C_READ   1
 R/W state when read is received.
 

Functions

void SMBus_PHY_disable (SMBus *smbus)
 Disables the PHY and Data Link layer. More...
 
void SMBus_PHY_enable (SMBus *smbus)
 Enables the PHY and Data Link layer. More...
 
void SMBus_PHY_targetEnable (SMBus *smbus)
 Enables the PHY and Data Link layer for target operation. More...
 
void SMBus_PHY_targetEnableInt (SMBus *smbus)
 Enables the I2C interrupts. More...
 
void SMBus_PHY_targetInit (SMBus *smbus, I2C_Regs *i2cAddr)
 Initializes the I2C Target module supporting SMBus functionality. More...
 
SMBus_State SMBus_PHY_targetProcessInt (SMBus *smbus)
 I2C Interrupt Service routine for SMBus Target. More...
 
void SMBus_PHY_controllerEnable (SMBus *smbus)
 Enables the PHY and Data Link layer. More...
 
void SMBus_PHY_controllerEnableInt (SMBus *smbus)
 Enables the I2C interrupts. More...
 
void SMBus_PHY_controllerInit (SMBus *smbus, I2C_Regs *i2cAddr, uint32_t busClk)
 Initializes the I2C Controller module supporting SMBus functionality. More...
 
void SMBus_PHY_controllerSendStop (SMBus *smbus)
 Generate Stop condition if it hasn't been sent. More...
 
void SMBus_PHY_controllerStartTx (SMBus *smbus, uint8_t targetaddr, uint16_t length, SMBus_Stop stopFlag, uint8_t setPEC)
 Start a TX transfer. More...
 
void SMBus_PHY_controllerStartRx (SMBus *smbus, uint8_t targetaddr, uint16_t length, SMBus_Start startFlag, SMBus_Stop stopFlag, SMBus_Auto_Ack ackFlag, uint8_t setPEC)
 Start a RX transfer. More...
 
SMBus_State SMBus_PHY_controllerProcessInt (SMBus *smbus)
 I2C Interrupt Service routine for SMBus Controller. More...
 
void SMBus_PHY_controllerEnableHostNotify (SMBus *smbus)
 Enable the hardware functionality to respond to Host Default address (0b000_1000) More...
 
void SMBus_PHY_controllerDisableHostNotify (SMBus *smbus)
 Disable the hardware functionality to respond to Host Default address (0b000_1000) More...
 

Detailed Description

Function Documentation

§ SMBus_PHY_disable()

void SMBus_PHY_disable ( SMBus smbus)

Disables the PHY and Data Link layer.

Parameters
*smbusPointer to SMBus structure
Returns
None

References SMBus_Ctrl::bits, SMBus::ctrl, SMBus::phy, SMBus_Ctrl::phyEn, and SMBus_Phy::SMBus_Phy_i2cBase.

Referenced by SMBus_NWK_controllerReset(), SMBus_NWK_targetProcessTimeout(), SMBus_PHY_controllerEnable(), and SMBus_PHY_targetEnable().

§ SMBus_PHY_enable()

void SMBus_PHY_enable ( SMBus smbus)

Enables the PHY and Data Link layer.

Parameters
*smbusPointer to SMBus structure
Returns
None

References SMBus_Ctrl::bits, SMBus_Ctrl::controller, SMBus::ctrl, SMBus_PHY_controllerEnable(), and SMBus_PHY_targetEnable().

§ SMBus_PHY_targetEnable()

void SMBus_PHY_targetEnable ( SMBus smbus)

Enables the PHY and Data Link layer for target operation.

Parameters
*smbusPointer to SMBus structure
Returns
None

References SMBus_Ctrl::bits, SMBus::ctrl, SMBus_Ctrl::intEn, SMBus::ownTargetAddr, SMBus::phy, SMBus_Ctrl::phyEn, SMBus_PHY_disable(), SMBus_Phy::SMBus_Phy_i2cBase, and SMBus_targetEnableInt().

Referenced by SMBus_NWK_targetProcessTimeout(), and SMBus_PHY_enable().

§ SMBus_PHY_targetEnableInt()

void SMBus_PHY_targetEnableInt ( SMBus smbus)

Enables the I2C interrupts.

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

Parameters
*smbusPointer to SMBus structure
Returns
None

References SMBus_Ctrl::bits, SMBus::ctrl, SMBus_Ctrl::intEn, SMBus::phy, and SMBus_Phy::SMBus_Phy_i2cBase.

Referenced by SMBus_targetEnableInt().

§ SMBus_PHY_targetInit()

void SMBus_PHY_targetInit ( SMBus smbus,
I2C_Regs *  i2cAddr 
)

Initializes the I2C Target module supporting SMBus functionality.

  • Resets and then configures the I2C for SMBus support
  • I2C is enabled using Automatic ACK and Target address is initialized to 0x00
  • Call SMBus_targetSetAddress() in order to set the Target address
    Parameters
    *smbusPointer to SMBus structure
    i2cAddrBase address of I2C module

References SMBus::phy, and SMBus_Phy::SMBus_Phy_i2cBase.

Referenced by SMBus_targetInit().

§ SMBus_PHY_targetProcessInt()

SMBus_State SMBus_PHY_targetProcessInt ( SMBus smbus)

I2C Interrupt Service routine for SMBus Target.

Handles the interrupts from I2C module and passes the information to the network layer. Should be called by application when acting as a target and an I2C interrupt is detected. Note that a target can also act as Host in some scenarios (like Host notify), so the ISR needs to handle such cases.

Parameters
smbusPointer to SMBus structure
Returns
The new state of Target (see SMBus_targetProcessInt())

References SMBus_Status::bits, SMBus_Status::pecErr, SMBus::phy, SMBus_NWK_controllerProcessNACK(), SMBus_NWK_controllerProcessStop(), SMBus_NWK_controllerProcessTx(), SMBus_NWK_controllerTxDone(), SMBus_NWK_targetProcessRx(), SMBus_NWK_targetProcessStart(), SMBus_NWK_targetProcessStop(), SMBus_NWK_targetProcessTx(), SMBus_Phy::SMBus_Phy_i2cBase, SMBus_State_PECError, SMBus_State_Target_NTR, and SMBus::status.

Referenced by SMBus_targetProcessInt().

§ SMBus_PHY_controllerEnable()

void SMBus_PHY_controllerEnable ( SMBus smbus)

Enables the PHY and Data Link layer.

Parameters
*smbusPointer to SMBus structure
Returns
None

References SMBus_Ctrl::bits, SMBus::ctrl, SMBus_Ctrl::intEn, SMBus::phy, SMBus_Ctrl::phyEn, SMBus_controllerEnableInt(), SMBus_PHY_disable(), and SMBus_Phy::SMBus_Phy_i2cBase.

Referenced by SMBus_NWK_controllerReset(), and SMBus_PHY_enable().

§ SMBus_PHY_controllerEnableInt()

void SMBus_PHY_controllerEnableInt ( SMBus smbus)

Enables the I2C interrupts.

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

Parameters
*smbusPointer to SMBus structure
Returns
None

References SMBus_Ctrl::bits, SMBus::ctrl, SMBus_Ctrl::intEn, SMBus::phy, and SMBus_Phy::SMBus_Phy_i2cBase.

Referenced by SMBus_controllerEnableInt().

§ SMBus_PHY_controllerInit()

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

Initializes the I2C Controller module supporting SMBus functionality.

  • Resets and then configures the I2C for SMBus support
  • I2C is enabled using Automatic ACK and Target address is initialized to 0x00
    Parameters
    smbusPointer to SMBus structure
    i2cAddrBase address of I2C module
    busClkSMCLK Frequency (used for I2C)
    Returns
    None

References SMBus::ownTargetAddr, SMBus::phy, and SMBus_Phy::SMBus_Phy_i2cBase.

Referenced by SMBus_controllerInit().

§ SMBus_PHY_controllerSendStop()

void SMBus_PHY_controllerSendStop ( SMBus smbus)

Generate Stop condition if it hasn't been sent.

Parameters
smbusPointer to SMBus structure
Returns
None

References SMBus::phy, and SMBus_Phy::SMBus_Phy_i2cBase.

Referenced by SMBus_NWK_controllerProcessNACK(), and SMBus_NWK_controllerProcessRx().

§ SMBus_PHY_controllerStartTx()

void SMBus_PHY_controllerStartTx ( SMBus smbus,
uint8_t  targetaddr,
uint16_t  length,
SMBus_Stop  stopFlag,
uint8_t  setPEC 
)

Start a TX transfer.

Parameters
smbusPointer to SMBus structure
targetaddrTarget target address
lengthNumber of bytes to send, not including the address byte
stopFlagIndicates whether the HW will generate stop condition
setPECPacket Error Checking (PEC) count value
Returns
None

§ SMBus_PHY_controllerStartRx()

void SMBus_PHY_controllerStartRx ( SMBus smbus,
uint8_t  targetaddr,
uint16_t  length,
SMBus_Start  startFlag,
SMBus_Stop  stopFlag,
SMBus_Auto_Ack  ackFlag,
uint8_t  setPEC 
)

Start a RX transfer.

Parameters
smbusPointer to SMBus structure
targetaddrTarget target address
lengthNumber of bytes to send, not including the address byte
stopFlagIndicates whether the HW will generate stop condition
startFlagIndicates whether the HW will generate start condition
ackFlagIndicates whether the HW will auto ack the last byte
setPECPacket Error Checking (PEC) count value
Returns
None

§ SMBus_PHY_controllerProcessInt()

SMBus_State SMBus_PHY_controllerProcessInt ( SMBus smbus)

I2C Interrupt Service routine for SMBus Controller.

Handles the interrupts from I2C module and passes the information to the network layer. Should be called by application when acting as a controller and an I2C interrupt is detected. Note that a controller can also act as target in some scenarios (like Host notify), so the ISR needs to handle such cases.

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

References SMBus::phy, SMBus_NWK_controllerProcessNACK(), SMBus_NWK_controllerProcessRx(), SMBus_NWK_controllerProcessStop(), SMBus_NWK_controllerProcessTimeout(), SMBus_NWK_controllerProcessTx(), SMBus_NWK_controllerTxDone(), SMBus_NWK_targetProcessRx(), SMBus_NWK_targetProcessStart(), SMBus_NWK_targetProcessStop(), and SMBus_Phy::SMBus_Phy_i2cBase.

Referenced by SMBus_controllerProcessInt().

§ SMBus_PHY_controllerEnableHostNotify()

void SMBus_PHY_controllerEnableHostNotify ( SMBus smbus)

Enable the hardware functionality to respond to Host Default address (0b000_1000)

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

References SMBus::phy, and SMBus_Phy::SMBus_Phy_i2cBase.

Referenced by SMBus_controllerEnableHostNotify().

§ SMBus_PHY_controllerDisableHostNotify()

void SMBus_PHY_controllerDisableHostNotify ( SMBus smbus)

Disable the hardware functionality to respond to Host Default address (0b000_1000)

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

References SMBus::phy, and SMBus_Phy::SMBus_Phy_i2cBase.

Referenced by SMBus_controllerDisableHostNotify().

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