![]() |
![]() |
SMBusLibrary
1.0
|
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. 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) |
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) |
Start a RX transfer. More... | |
SMBus_State | SMBus_PHY_controllerProcessInt (SMBus *smbus) |
I2C Interrupt Service routine. More... | |
void SMBus_PHY_disable | ( | SMBus * | smbus | ) |
Disables the PHY and Data Link layer.
*smbus | Pointer to SMBus structure |
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().
void SMBus_PHY_enable | ( | SMBus * | smbus | ) |
Enables the PHY and Data Link layer.
*smbus | Pointer to SMBus structure |
References SMBus_Ctrl::bits, SMBus_Ctrl::controller, SMBus::ctrl, SMBus_PHY_controllerEnable(), and SMBus_PHY_targetEnable().
void SMBus_PHY_targetEnable | ( | SMBus * | smbus | ) |
Enables the PHY and Data Link layer for target operation.
*smbus | Pointer to SMBus structure |
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().
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.
*smbus | Pointer to SMBus structure |
References SMBus_Ctrl::bits, SMBus::ctrl, SMBus_Ctrl::intEn, SMBus::phy, and SMBus_Phy::SMBus_Phy_i2cBase.
Referenced by SMBus_targetEnableInt().
void SMBus_PHY_targetInit | ( | SMBus * | smbus, |
I2C_Regs * | i2cAddr | ||
) |
Initializes the I2C Target module supporting SMBus functionality.
*smbus | Pointer to SMBus structure |
i2cAddr | Base address of I2C module |
References SMBus::phy, and SMBus_Phy::SMBus_Phy_i2cBase.
Referenced by SMBus_targetInit().
SMBus_State SMBus_PHY_targetProcessInt | ( | SMBus * | smbus | ) |
I2C Interrupt Service routine.
Handles the interrupts from I2C module and passes the information to the network layer. Should be called by application when an I2C interrupt is detected.
smbus | Pointer to SMBus structure |
References SMBus::phy, SMBus_NWK_targetProcessRx(), SMBus_NWK_targetProcessStart(), SMBus_NWK_targetProcessStop(), SMBus_NWK_targetProcessTx(), SMBus_Phy::SMBus_Phy_i2cBase, and SMBus_State_Target_NTR.
Referenced by SMBus_targetProcessInt().
void SMBus_PHY_controllerEnable | ( | SMBus * | smbus | ) |
Enables the PHY and Data Link layer.
*smbus | Pointer to SMBus structure |
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().
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.
*smbus | Pointer to SMBus structure |
References SMBus_Ctrl::bits, SMBus::ctrl, SMBus_Ctrl::intEn, SMBus::phy, and SMBus_Phy::SMBus_Phy_i2cBase.
Referenced by SMBus_controllerEnableInt().
void SMBus_PHY_controllerInit | ( | SMBus * | smbus, |
I2C_Regs * | i2cAddr, | ||
uint32_t | busClk | ||
) |
Initializes the I2C Controller module supporting SMBus functionality.
smbus | Pointer to SMBus structure |
i2cAddr | Base address of I2C module |
busClk | SMCLK Frequency (used for I2C) |
References SMBus::ownTargetAddr, SMBus::phy, and SMBus_Phy::SMBus_Phy_i2cBase.
Referenced by SMBus_controllerInit().
void SMBus_PHY_controllerSendStop | ( | SMBus * | smbus | ) |
Generate Stop condition if it hasn't been sent.
smbus | Pointer to SMBus structure |
References SMBus::phy, and SMBus_Phy::SMBus_Phy_i2cBase.
Referenced by SMBus_NWK_controllerProcessNACK(), and SMBus_NWK_controllerProcessRx().
void SMBus_PHY_controllerStartTx | ( | SMBus * | smbus, |
uint8_t | targetaddr, | ||
uint16_t | length, | ||
SMBus_Stop | stopFlag | ||
) |
Start a TX transfer.
smbus | Pointer to SMBus structure |
targetaddr | Target target address |
length | Number of bytes to send, not including the address byte |
stopFlag | Indicates whether the HW will generate stop condition |
void SMBus_PHY_controllerStartRx | ( | SMBus * | smbus, |
uint8_t | targetaddr, | ||
uint16_t | length, | ||
SMBus_Start | startFlag, | ||
SMBus_Stop | stopFlag, | ||
SMBus_Auto_Ack | ackFlag | ||
) |
Start a RX transfer.
smbus | Pointer to SMBus structure |
targetaddr | Target target address |
length | Number of bytes to send, not including the address byte |
stopFlag | Indicates whether the HW will generate stop condition |
startFlag | Indicates whether the HW will generate start condition |
ackFlag | Indicates whether the HW will auto ack the last byte |
SMBus_State SMBus_PHY_controllerProcessInt | ( | SMBus * | smbus | ) |
I2C Interrupt Service routine.
Handles the interrupts from I2C module and passes the information to the network layer. Should be called by application when an I2C interrupt is detected.
smbus | Pointer to SMBus structure |
References SMBus::phy, SMBus_NWK_controllerProcessNACK(), SMBus_NWK_controllerProcessRx(), SMBus_NWK_controllerProcessStop(), SMBus_NWK_controllerProcessTimeout(), SMBus_NWK_controllerProcessTx(), SMBus_NWK_controllerTxDone(), and SMBus_Phy::SMBus_Phy_i2cBase.
Referenced by SMBus_controllerProcessInt().