64 #include <inc/hw_types.h>
65 #include <inc/hw_ints.h>
66 #include <inc/hw_memmap.h>
67 #include <inc/hw_i2c.h>
68 #include <inc/hw_sysctl.h>
87 #define I2CMasterInitExpClk NOROM_I2CMasterInitExpClk
88 #define I2CMasterErr NOROM_I2CMasterErr
89 #define I2CIntRegister NOROM_I2CIntRegister
90 #define I2CIntUnregister NOROM_I2CIntUnregister
98 #define I2C_MASTER_CMD_SINGLE_SEND \
100 #define I2C_MASTER_CMD_SINGLE_RECEIVE \
102 #define I2C_MASTER_CMD_BURST_SEND_START \
104 #define I2C_MASTER_CMD_BURST_SEND_CONT \
106 #define I2C_MASTER_CMD_BURST_SEND_FINISH \
108 #define I2C_MASTER_CMD_BURST_SEND_ERROR_STOP \
110 #define I2C_MASTER_CMD_BURST_RECEIVE_START \
112 #define I2C_MASTER_CMD_BURST_RECEIVE_CONT \
114 #define I2C_MASTER_CMD_BURST_RECEIVE_FINISH \
116 #define I2C_MASTER_CMD_BURST_RECEIVE_ERROR_STOP \
124 #define I2C_MASTER_ERR_NONE 0
125 #define I2C_MASTER_ERR_ADDR_ACK 0x00000004
126 #define I2C_MASTER_ERR_DATA_ACK 0x00000008
127 #define I2C_MASTER_ERR_ARB_LOST 0x00000010
134 #define I2C_SLAVE_ACT_NONE 0
135 #define I2C_SLAVE_ACT_RREQ 0x00000001 // Master has sent data
136 #define I2C_SLAVE_ACT_TREQ 0x00000002 // Master has requested data
137 #define I2C_SLAVE_ACT_RREQ_FBR 0x00000005 // Master has sent first byte
144 #define I2C_SLAVE_INT_STOP 0x00000004 // Stop Condition Interrupt.
145 #define I2C_SLAVE_INT_START 0x00000002 // Start Condition Interrupt.
146 #define I2C_SLAVE_INT_DATA 0x00000001 // Data Interrupt.
154 #ifdef DRIVERLIB_DEBUG
170 I2CBaseValid(uint32_t ui32Base)
229 ASSERT(I2CBaseValid(ui32Base));
279 ASSERT(I2CBaseValid(ui32Base));
280 ASSERT(!(ui8SlaveAddr & 0x80));
303 ASSERT(I2CBaseValid(ui32Base));
327 ASSERT(I2CBaseValid(ui32Base));
356 ASSERT(I2CBaseValid(ui32Base));
392 ASSERT(I2CBaseValid(ui32Base));
419 __STATIC_INLINE uint32_t
425 ASSERT(I2CBaseValid(ui32Base));
451 ASSERT(I2CBaseValid(ui32Base));
494 ASSERT(I2CBaseValid(ui32Base));
519 ASSERT(I2CBaseValid(ui32Base));
561 ASSERT(I2CBaseValid(ui32Base));
593 ASSERT(I2CBaseValid(ui32Base));
624 ASSERT(I2CBaseValid(ui32Base));
656 ASSERT(I2CBaseValid(ui32Base));
657 ASSERT(!(ui8SlaveAddr & 0x80));
688 ASSERT(I2CBaseValid(ui32Base));
689 ASSERT(!(ui8SlaveAddr & 0x80));
712 ASSERT(I2CBaseValid(ui32Base));
737 __STATIC_INLINE uint32_t
743 ASSERT(I2CBaseValid(ui32Base));
763 __STATIC_INLINE uint32_t
769 ASSERT(I2CBaseValid(ui32Base));
795 ASSERT(I2CBaseValid(ui32Base));
829 ASSERT(I2CBaseValid(ui32Base));
837 ui32Val |= ui32IntFlags;
867 ASSERT(I2CBaseValid(ui32Base));
875 ui32Val &= ~ui32IntFlags;
918 ASSERT(I2CBaseValid(ui32Base));
946 __STATIC_INLINE uint32_t
952 ASSERT(I2CBaseValid(ui32Base));
989 extern void I2CIntRegister(uint32_t ui32Base,
void (*pfnHandler)(
void));
1015 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
1017 #ifdef ROM_I2CMasterInitExpClk
1018 #undef I2CMasterInitExpClk
1019 #define I2CMasterInitExpClk ROM_I2CMasterInitExpClk
1021 #ifdef ROM_I2CMasterErr
1023 #define I2CMasterErr ROM_I2CMasterErr
1025 #ifdef ROM_I2CIntRegister
1026 #undef I2CIntRegister
1027 #define I2CIntRegister ROM_I2CIntRegister
1029 #ifdef ROM_I2CIntUnregister
1030 #undef I2CIntUnregister
1031 #define I2CIntUnregister ROM_I2CIntUnregister
static void I2CSlaveInit(uint32_t ui32Base, uint8_t ui8SlaveAddr)
Initializes the I2C Slave block.
static void I2CMasterEnable(uint32_t ui32Base)
Enables the I2C Master block.
#define I2C_SLAVE_INT_STOP
static void I2CMasterDataPut(uint32_t ui32Base, uint8_t ui8Data)
Transmits a byte from the I2C Master.
#define I2C_MASTER_CMD_BURST_SEND_START
static uint32_t I2CSlaveIntStatus(uint32_t ui32Base, bool bMasked)
Gets the current I2C Slave interrupt status.
static void I2CSlaveDisable(uint32_t ui32Base)
Disables the I2C slave block.
static void I2CSlaveAddressSet(uint32_t ui32Base, uint8_t ui8SlaveAddr)
Sets the I2C slave address.
#define I2C_MASTER_CMD_BURST_SEND_ERROR_STOP
static uint32_t I2CSlaveDataGet(uint32_t ui32Base)
Receives a byte that has been sent to the I2C Slave.
static void I2CSlaveEnable(uint32_t ui32Base)
Enables the I2C Slave block.
static void I2CSlaveDataPut(uint32_t ui32Base, uint8_t ui8Data)
Transmits a byte from the I2C Slave.
#define I2C_SLAVE_INT_START
void I2CMasterInitExpClk(uint32_t ui32Base, uint32_t ui32I2CClk, bool bFast)
Initializes the I2C Master block.
#define I2C_SLAVE_INT_DATA
static uint32_t I2CSlaveStatus(uint32_t ui32Base)
Gets the I2C Slave module status.
#define I2C_MASTER_CMD_SINGLE_SEND
#define I2C_MASTER_CMD_BURST_RECEIVE_CONT
static bool I2CMasterIntStatus(uint32_t ui32Base, bool bMasked)
Gets the current I2C Master interrupt status.
static void I2CMasterSlaveAddrSet(uint32_t ui32Base, uint8_t ui8SlaveAddr, bool bReceive)
Sets the address that the I2C Master will place on the bus.
#define I2C_MASTER_CMD_BURST_SEND_FINISH
#define I2C_MASTER_CMD_BURST_SEND_CONT
#define I2C_MASTER_CMD_BURST_RECEIVE_FINISH
static bool I2CMasterBusBusy(uint32_t ui32Base)
Indicates whether or not the I2C bus is busy.
uint32_t I2CMasterErr(uint32_t ui32Base)
Gets the error status of the I2C Master module.
static void I2CSlaveIntClear(uint32_t ui32Base, uint32_t ui32IntFlags)
Clears I2C Slave interrupt sources.
static void I2CMasterControl(uint32_t ui32Base, uint32_t ui32Cmd)
Controls the state of the I2C Master module.
static void I2CMasterIntDisable(uint32_t ui32Base)
Disables the I2C Master interrupt.
static void I2CSlaveIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags)
Enables individual I2C Slave interrupt sources.
static void I2CMasterIntEnable(uint32_t ui32Base)
Enables the I2C Master interrupt.
#define I2C_MASTER_CMD_BURST_RECEIVE_START
static uint32_t I2CMasterDataGet(uint32_t ui32Base)
Receives a byte that has been sent to the I2C Master.
static void I2CMasterDisable(uint32_t ui32Base)
Disables the I2C master block.
void I2CIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
Registers an interrupt handler for the I2C module.
#define I2C_MASTER_CMD_BURST_RECEIVE_ERROR_STOP
static bool I2CMasterBusy(uint32_t ui32Base)
Indicates whether or not the I2C Master is busy.
void CPUdelay(uint32_t ui32Count)
Provide a small delay.
static void I2CSlaveIntDisable(uint32_t ui32Base, uint32_t ui32IntFlags)
Disables individual I2C Slave interrupt sources.
static void I2CMasterIntClear(uint32_t ui32Base)
Clears I2C Master interrupt sources.
void I2CIntUnregister(uint32_t ui32Base)
Unregisters an interrupt handler for the I2C module.