Macros | |
#define | I2C_WRITE 0 |
R/W state when write is received. | |
#define | I2C_READ 1 |
R/W state when read is received. | |
#define | TAxCTL TA0CTL |
Timer control register. | |
#define | TAxCCR0 TA0CCR0 |
Timer Capture/Compare 0 reg. | |
#define | TAxCCTL0 TA0CCTL0 |
Timer cap/comp control 0 reg. | |
#define | TAxSCLTIMEOUT (12000 / 33) |
Timeout Count for Clock low detection based on ACLK counts (VLO/(VLO/33) = ~30ms) | |
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_slaveEnable (SMBus *smbus) |
Enables the PHY and Data Link layer for slave operation. More... | |
void | SMBus_PHY_slaveEnableInt (SMBus *smbus) |
Enables the I2C interrupts. More... | |
void | SMBus_PHY_slaveInit (SMBus *smbus, uint16_t unused) |
Initializes the I2C Slave module supporting SMBus functionality. More... | |
SMBus_State | SMBus_PHY_slaveProcessInt (SMBus *smbus) |
I2C Interrupt Service routine. More... | |
SMBus_State | SMBus_PHY_slaveProcessTimeoutInt (SMBus *smbus) |
Timer interrupt service routine. More... | |
void | SMBus_PHY_masterEnable (SMBus *smbus) |
Enables the PHY and Data Link layer. More... | |
void | SMBus_PHY_masterEnableInt (SMBus *smbus) |
Enables the I2C interrupts. More... | |
void | SMBus_PHY_masterInit (SMBus *smbus, uint16_t unused, uint32_t busClk) |
Initializes the I2C Master module supporting SMBus functionality. More... | |
void | SMBus_PHY_masterSendStop (SMBus *smbus) |
Generate Stop condition if it hasn't been sent. More... | |
void | SMBus_PHY_masterSendPreStop (SMBus *smbus) |
Prepare to send stop at next byte. More... | |
void | SMBus_PHY_masterStartTx (SMBus *smbus, uint8_t targetaddr, SMBus_Stop stopFlag) |
Start a TX transfer. More... | |
void | SMBus_PHY_masterStartRx (SMBus *smbus, uint8_t targetaddr, SMBus_Stop stopFlag) |
Start a RX transfer. More... | |
SMBus_State | SMBus_PHY_masterProcessInt (SMBus *smbus) |
I2C Interrupt Service routine. More... | |
SMBus_State | SMBus_PHY_masterProcessTimeoutInt (SMBus *smbus) |
Timer 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, and SMBus_Ctrl::phyEn.
Referenced by SMBus_NWK_masterReset(), SMBus_NWK_slaveProcessTimeout(), SMBus_PHY_masterEnable(), and SMBus_PHY_slaveEnable().
void SMBus_PHY_enable | ( | SMBus * | smbus | ) |
Enables the PHY and Data Link layer.
smbus | Pointer to SMBus structure |
References SMBus_Ctrl::bits, SMBus::ctrl, SMBus_Ctrl::master, SMBus_PHY_masterEnable(), and SMBus_PHY_slaveEnable().
Referenced by SMBus_slaveSetAddress().
void SMBus_PHY_masterEnable | ( | SMBus * | smbus | ) |
Enables the PHY and Data Link layer.
smbus | Pointer to SMBus structure |
References SMBus_Ctrl::bits, SMBus::ctrl, SMBus_Ctrl::intEn, SMBus::ownSlaveAddr, SMBus_Ctrl::phyEn, SMBus_masterEnableInt(), and SMBus_PHY_disable().
Referenced by SMBus_NWK_masterReset(), SMBus_PHY_enable(), and SMBus_PHY_masterInit().
void SMBus_PHY_masterEnableInt | ( | SMBus * | smbus | ) |
Enables the I2C interrupts.
This function enables the USCI Start,Stop, RX,TX interrupts. SMBus_PHY_slaveInit() must be called before this function.
smbus | Pointer to SMBus structure |
References SMBus_Ctrl::bits, SMBus::ctrl, SMBus_Ctrl::intEn, and TAxCCTL0.
Referenced by SMBus_masterEnableInt().
void SMBus_PHY_masterInit | ( | SMBus * | smbus, |
uint16_t | unused, | ||
uint32_t | busClk | ||
) |
Initializes the I2C Master module supporting SMBus functionality.
smbus | Pointer to SMBus structure |
unused | This parameter is unused |
busClk | SMCLK Frequency (used for USCI baud rate) |
References SMBus::ownSlaveAddr, SMBus_PHY_masterEnable(), SMBus_Phy::SMBus_Phy_stop, TAxCCR0, TAxCTL, and TAxSCLTIMEOUT.
Referenced by SMBus_masterInit().
SMBus_State SMBus_PHY_masterProcessInt | ( | SMBus * | smbus | ) |
I2C Interrupt Service routine.
Handles the interrupts from USCI module and passes the information to the network layer. Should be called by application when an USCI interrupt is detected.
smbus | Pointer to SMBus structure |
References SMBus_NWK_masterProcessNACK(), SMBus_NWK_masterProcessRx(), SMBus_NWK_masterProcessTx(), SMBus_Phy::SMBus_Phy_stop, SMBus_Stop_PreRead, SMBus_Stop_Sent, and SMBus::state.
Referenced by SMBus_masterProcessInt().
SMBus_State SMBus_PHY_masterProcessTimeoutInt | ( | SMBus * | smbus | ) |
Timer interrupt service routine.
Handles the timeout interrupts from the Timer module and passes the information to the network layer. Should be callsed by the application when a timer interrupt is detected
smbus | Pointer to SMBus structure |
References SMBus_NWK_masterProcessTimeout().
Referenced by SMBus_masterProcessTimeoutInt().
void SMBus_PHY_masterSendPreStop | ( | SMBus * | smbus | ) |
Prepare to send stop at next byte.
smbus | Pointer to SMBus structure |
References SMBus_Phy::SMBus_Phy_stop, and SMBus_Stop_PreRead.
Referenced by SMBus_NWK_masterProcessRx().
void SMBus_PHY_masterSendStop | ( | SMBus * | smbus | ) |
Generate Stop condition if it hasn't been sent.
smbus | Pointer to SMBus structure |
References SMBus_NWK_masterProcessStop(), SMBus_Phy::SMBus_Phy_stop, and SMBus_Stop_Sent.
Referenced by SMBus_NWK_masterProcessNACK(), SMBus_NWK_masterProcessRx(), SMBus_NWK_masterProcessTx(), SMBus_PHY_masterStartRx(), and SMBus_PHY_masterStartTx().
void SMBus_PHY_masterStartRx | ( | SMBus * | smbus, |
uint8_t | targetaddr, | ||
SMBus_Stop | stopFlag | ||
) |
Start a RX transfer.
smbus | Pointer to SMBus structure |
targetaddr | Slave target address |
stopFlag | Indicates the stop condition |
References SMBus_NWK_masterProcessStop(), SMBus_PHY_masterSendStop(), SMBus_Phy::SMBus_Phy_stop, SMBus_Stop_Addr, SMBus_Stop_Immediate, SMBus_Stop_PreRead, and SMBus_Stop_Sent.
Referenced by SMBus_NWK_startRxTransfer().
void SMBus_PHY_masterStartTx | ( | SMBus * | smbus, |
uint8_t | targetaddr, | ||
SMBus_Stop | stopFlag | ||
) |
Start a TX transfer.
smbus | Pointer to SMBus structure |
targetaddr | Slave target address |
stopFlag | Indicates the stop condition |
References SMBus_PHY_masterSendStop(), SMBus_Phy::SMBus_Phy_stop, SMBus_Stop_Immediate, and SMBus_Stop_Sent.
Referenced by SMBus_NWK_startTxTransfer().
void SMBus_PHY_slaveEnable | ( | SMBus * | smbus | ) |
Enables the PHY and Data Link layer for slave operation.
smbus | Pointer to SMBus structure |
References SMBus_Ctrl::bits, SMBus::ctrl, SMBus_Ctrl::intEn, SMBus::ownSlaveAddr, SMBus_Ctrl::phyEn, SMBus_PHY_disable(), and SMBus_slaveEnableInt().
Referenced by SMBus_NWK_slaveProcessTimeout(), SMBus_PHY_enable(), and SMBus_PHY_slaveInit().
void SMBus_PHY_slaveEnableInt | ( | SMBus * | smbus | ) |
Enables the I2C interrupts.
This function enables the USCI Start,Stop, RX,TX, Timeout interrupts.
smbus | Pointer to SMBus structure |
References SMBus_Ctrl::bits, SMBus::ctrl, SMBus_Ctrl::intEn, and TAxCCTL0.
Referenced by SMBus_slaveEnableInt().
void SMBus_PHY_slaveInit | ( | SMBus * | smbus, |
uint16_t | unused | ||
) |
Initializes the I2C Slave module supporting SMBus functionality.
smbus | Pointer to SMBus structure |
unused | This parameter is unused |
References SMBus::ownSlaveAddr, SMBus_PHY_slaveEnable(), TAxCCR0, TAxCTL, and TAxSCLTIMEOUT.
Referenced by SMBus_slaveInit().
SMBus_State SMBus_PHY_slaveProcessInt | ( | SMBus * | smbus | ) |
I2C Interrupt Service routine.
Handles the interrupts from USCI module and passes the information to the network layer. Should be called by application when an USCI interrupt is detected.
smbus | Pointer to SMBus structure |
References I2C_READ, SMBus::ownSlaveAddr, SMBus_NWK_slaveProcessRx(), SMBus_NWK_slaveProcessStart(), SMBus_NWK_slaveProcessStop(), SMBus_NWK_slaveProcessTx(), and SMBus_State_Slave_NTR.
Referenced by SMBus_slaveProcessInt().
SMBus_State SMBus_PHY_slaveProcessTimeoutInt | ( | SMBus * | smbus | ) |
Timer interrupt service routine.
Handles the timeout interrupts from the Timer module and passes the information to the network layer. Should be callsed by the application when a timer interrupt is detected
References SMBus_NWK_slaveProcessTimeout().
Referenced by SMBus_slaveProcessTimeoutInt().