Lines Matching full:i2c

9  * @brief I2C driver for Infineon XMC MCU family.
17 #include <zephyr/drivers/i2c.h>
20 #include "i2c-priv.h"
52 /* I2C speed */
71 XMC_USIC_CH_t *i2c; member
104 /* Acquire semaphore (block I2C operation for another thread) */ in ifx_xmc4_i2c_configure()
109 XMC_I2C_CH_Stop(config->i2c); in ifx_xmc4_i2c_configure()
111 /* Configure the I2C resource */ in ifx_xmc4_i2c_configure()
113 XMC_I2C_CH_Init(config->i2c, &data->cfg); in ifx_xmc4_i2c_configure()
114 XMC_I2C_CH_SetInputSource(config->i2c, XMC_I2C_CH_INPUT_SCL, config->scl_src); in ifx_xmc4_i2c_configure()
115 XMC_I2C_CH_SetInputSource(config->i2c, XMC_I2C_CH_INPUT_SDA, config->sda_src); in ifx_xmc4_i2c_configure()
117 XMC_USIC_CH_SetFractionalDivider(config->i2c, in ifx_xmc4_i2c_configure()
123 XMC_I2C_CH_Start(config->i2c); in ifx_xmc4_i2c_configure()
182 /* Acquire semaphore (block I2C transfer for another thread) */ in ifx_xmc4_i2c_transfer()
194 XMC_I2C_CH_ClearStatusFlag(config->i2c, 0xFFFFFFFF); in ifx_xmc4_i2c_transfer()
202 XMC_I2C_CH_MasterRepeatedStart(config->i2c, addr << 1, cmd_type); in ifx_xmc4_i2c_transfer()
204 XMC_I2C_CH_MasterStart(config->i2c, addr << 1, cmd_type); in ifx_xmc4_i2c_transfer()
208 while ((XMC_I2C_CH_GetStatusFlag(config->i2c) & in ifx_xmc4_i2c_transfer()
211 if (XMC_I2C_CH_GetStatusFlag(config->i2c) & in ifx_xmc4_i2c_transfer()
217 XMC_I2C_CH_ClearStatusFlag(config->i2c, in ifx_xmc4_i2c_transfer()
223 /* Transmit next command from I2C master to I2C slave */ in ifx_xmc4_i2c_transfer()
224 XMC_I2C_CH_MasterTransmit(config->i2c, in ifx_xmc4_i2c_transfer()
228 while ((XMC_I2C_CH_GetStatusFlag(config->i2c) & in ifx_xmc4_i2c_transfer()
231 if (XMC_I2C_CH_GetStatusFlag(config->i2c) & in ifx_xmc4_i2c_transfer()
237 XMC_I2C_CH_ClearStatusFlag(config->i2c, in ifx_xmc4_i2c_transfer()
241 while (!XMC_USIC_CH_TXFIFO_IsEmpty(config->i2c)) { in ifx_xmc4_i2c_transfer()
243 if (XMC_I2C_CH_GetStatusFlag(config->i2c) & in ifx_xmc4_i2c_transfer()
251 XMC_I2C_CH_MasterReceiveNack(config->i2c); in ifx_xmc4_i2c_transfer()
253 XMC_I2C_CH_MasterReceiveAck(config->i2c); in ifx_xmc4_i2c_transfer()
256 while ((XMC_I2C_CH_GetStatusFlag(config->i2c) & in ifx_xmc4_i2c_transfer()
260 if (XMC_I2C_CH_GetStatusFlag(config->i2c) & in ifx_xmc4_i2c_transfer()
266 XMC_I2C_CH_ClearStatusFlag(config->i2c, in ifx_xmc4_i2c_transfer()
271 XMC_I2C_CH_GetReceivedData(config->i2c); in ifx_xmc4_i2c_transfer()
277 XMC_I2C_CH_MasterStop(config->i2c); in ifx_xmc4_i2c_transfer()
281 /* Release semaphore (After I2C transfer is complete) */ in ifx_xmc4_i2c_transfer()
326 /* Acquire semaphore (block I2C operation for another thread) */ in ifx_xmc4_i2c_target_register()
358 /* Acquire semaphore (block I2C operation for another thread) */ in ifx_xmc4_i2c_target_unregister()
364 XMC_I2C_CH_DisableEvent(config->i2c, I2C_XMC_EVENTS_MASK); in ifx_xmc4_i2c_target_unregister()
377 uint32_t status = XMC_I2C_CH_GetStatusFlag(config->i2c); in i2c_xmc4_isr()
380 XMC_I2C_CH_ClearStatusFlag(config->i2c, status); in i2c_xmc4_isr()
384 XMC_USIC_CH_SetTransmitBufferStatus(config->i2c, in i2c_xmc4_isr()
398 XMC_I2C_CH_SlaveTransmit(config->i2c, data->target_wr_byte); in i2c_xmc4_isr()
407 XMC_I2C_CH_SlaveTransmit(config->i2c, data->target_wr_byte); in i2c_xmc4_isr()
414 XMC_I2C_CH_GetReceivedData(config->i2c)); in i2c_xmc4_isr()
422 status = XMC_I2C_CH_GetStatusFlag(config->i2c); in i2c_xmc4_isr()
427 /* I2C API structure */
428 static DEVICE_API(i2c, i2c_xmc4_driver_api) = {
439 /* Macros for I2C instance declaration */
447 XMC_I2C_CH_SelectInterruptNodePointer(config->i2c, \
449 XMC_I2C_CH_SelectInterruptNodePointer(config->i2c, \
452 XMC_I2C_CH_EnableEvent(config->i2c, I2C_XMC_EVENTS_MASK); \
469 .i2c = (XMC_USIC_CH_t *)DT_INST_REG_ADDR(n), \