I2C#

Modules#

sl_i2c_init_params_t

sl_i2c_version_t

Enumerations#

enum
SL_I2C_STANDARD_BUS_SPEED = 1
SL_I2C_FAST_BUS_SPEED
SL_I2C_HIGH_BUS_SPEED
SL_I2C_FAST_PLUS_BUS_SPEED
}

Enumeration for I2C bus speed.

enum
SL_I2C_WRITE = 0
SL_I2C_READ = 1
}

Enumeration for I2C direction i.e., read/write.

enum
SL_I2C_LEADER_MODE
SL_I2C_FOLLOWER_MODE
}

Enumeration for I2C mode i.e., leader/follower.

Typedefs#

typedef I2C0_Type

Renaming the I2C register set.

Functions#

void
sl_si91x_i2c_init(I2C_TypeDef *i2c, const sl_i2c_init_params_t *p_config)

Initialize the I2C i.e., set the parameters to the respective registers.

void
sl_si91x_i2c_reset(I2C_TypeDef *i2c)

Reset the I2C peripheral.

void
sl_si91x_i2c_tx(I2C_TypeDef *i2c, uint8_t data)

Transmit one byte on SDA line.

uint8_t
sl_si91x_i2c_rx(I2C_TypeDef *i2c)

Receive one byte on SDA line.

void
sl_si91x_i2c_set_frequency(I2C_TypeDef *i2c, uint32_t ref_freq, uint32_t freq_scl, sl_i2c_clock_hlr_t clhr)

Configure the frequency of the I2C transmission.

uint32_t
sl_si91x_i2c_get_frequency(I2C_TypeDef *i2c)

Fetch the frequency of I2C peripheral clock.

Get the release, sqa and dev version of I2C.

__STATIC_INLINE void
sl_si91x_i2c_enable(I2C_TypeDef *i2c)

Enable the I2C interface.

__STATIC_INLINE void
sl_si91x_i2c_disable(I2C_TypeDef *i2c)

Disable the I2C interface.

__STATIC_INLINE void
sl_si91x_i2c_start_cmd(I2C_TypeDef *i2c)

Hold the SCL line low and stalls the leader until new command is available in TX FIFO.

__STATIC_INLINE void
sl_si91x_i2c_stop_cmd(I2C_TypeDef *i2c)

Issue the STOP after completion of transfer irrespective of TX FIFO status.

__STATIC_INLINE uint32_t
sl_si91x_i2c_get_status(I2C_TypeDef *i2c)

Get the I2C IC status.

__STATIC_INLINE void
sl_si91x_i2c_disable_interrupts(I2C_TypeDef *i2c, uint32_t flags)

Disable the I2C interrupts.

__STATIC_INLINE void
sl_si91x_i2c_enable_interrupts(I2C_TypeDef *i2c, uint32_t flags)

Enable the I2C interrupts.

__STATIC_INLINE void
sl_si91x_i2c_set_interrupts(I2C_TypeDef *i2c, uint32_t flags)

Set the interrupts i.e., unmask according to the flags passed in the parameter.

__STATIC_INLINE void
sl_si91x_i2c_clear_interrupts(I2C_TypeDef *i2c, uint32_t flags)

Clear the interrupts i.e., mask according to the flags passed in the parameter.

__STATIC_INLINE uint32_t

Get the pending interrupts.

__STATIC_INLINE uint32_t

Get the enabled interrupts.

__STATIC_INLINE uint32_t

Get the enabled and pending interrupts.

__STATIC_INLINE void
sl_si91x_i2c_wait_ready(I2C_TypeDef *i2c, uint32_t mask)

Wait till the process is completed.

__STATIC_INLINE void
sl_si91x_i2c_wait_sync(I2C_TypeDef *i2c)

Wait till the synchronization is completed.

__STATIC_INLINE void
sl_si91x_i2c_set_follower_address(I2C_TypeDef *i2c, uint16_t addr, bool is_10bit_addr)

Set the follower address when I2C is in leader mode.

__STATIC_INLINE uint16_t

Fetch the current follower address.

__STATIC_INLINE void
sl_si91x_i2c_set_follower_mask_address(I2C_TypeDef *i2c, uint16_t mask)

Update the address of leader when it is in follower mode.

__STATIC_INLINE uint16_t

Fetch the masked follower address i.e.

__STATIC_INLINE void
sl_si91x_i2c_send_nack(I2C_TypeDef *i2c)

Generate NACK only when it is in follower-receiver mode.

__STATIC_INLINE void
sl_si91x_i2c_abort_transfer(I2C_TypeDef *i2c)

Abort the transfer.

__STATIC_INLINE void
sl_si91x_i2c_clear_bus(I2C_TypeDef *i2c)

Clear the I2C bus.

__STATIC_INLINE void
sl_si91x_i2c_set_rx_threshold(I2C_TypeDef *i2c, uint8_t threshold)

Update the RX threshold values.

__STATIC_INLINE void
sl_si91x_i2c_set_tx_threshold(I2C_TypeDef *i2c, uint8_t threshold)

Update the TX threshold values.

__STATIC_INLINE void
sl_si91x_i2c_control_direction(I2C_TypeDef *i2c, sl_i2c_direction_t direction)

Control the direction of the I2C interface.

__STATIC_INLINE void
sl_si91x_i2c_set_sda_hold_time(I2C_TypeDef *i2c, sl_i2c_direction_t direction, uint32_t time)

Configure the SDA hold time.

__STATIC_INLINE void
sl_si91x_i2c_send_ack(I2C_TypeDef *i2c)

Macros#

#define

Macro function to assert the I2C instance.

#define
I2C_NUM (ref)

Macro to validate I2C instance number.

#define

Macro function to validate the user input and I2C instance.

#define
#define

I2C enable mask.

#define

I2C write mask.

#define

I2C read mask.

#define

I2C clear mask.

#define

SCL stuck timeout, used to clear the I2C bus.

#define

SDA stick timeout, used to clear the I2C bus.

#define

16 bit mask value

#define

8 bit mask value

#define

4 bit mask value

#define

DMA enable.

#define

DMA disable.

#define

If processor attempts to read receive buffer when buffer is empty.

#define

If receive buffer is full and another byte is received (extra bytes are lost)

#define

When receive buffer is full up to the RX_TL threshold level.

#define

If transmit buffer is full and user attempts to transmit another byte.

#define

When transmit buffer is filled over the TX_TL threshold level.

#define

SCL is on hold in follower mode when another leader attempts to read data.

#define

Transmit is aborted, to validate the reason, read IC_TX_ABRT_SOURCE register.

#define

In follower mode if leader does not acknowledge, happens on last byte.

#define

Ongoing or previous activity was there on bus, to clear read IC_CLR_INTR / IC_CLR_ACTIVITY register.

#define

Stop condition is detected on the bus (leader and follower both mode)

#define

Start or Restart condition is detected on the bus (leader and follower both mode)

#define

General call address is received, to clear read IC_CLR_GEN_CALL register.

#define

Restart condition is detected on bus (follower mode)

#define

Leader is holding the bus and FIFO is empty.

#define

SCL line is stuck at low.

#define

Address sent was not acknowledged by follower in 7-bit mode.

#define

First 10-bit address byte sent was not acknowledged by follower.

#define

Second 10-bit address byte sent was not acknowledged by follower.

#define

Received acknowledgement for address bu did not receive acknowledgement for data.

#define

No follower acknowledged General call.

#define

Leader send general call but program was to read it from bus.

#define

High speed leader call was acknowledged by follower.

#define

Start byte was acknowledged by follower.

#define

Restart is disabled and data transfer is in high speed mode.

#define

Restart is disabled and user tries to send start byte.

#define

Restart is disabled and 10-bit address read command is received.

#define

Leader mode is disabled and leader mode operation is preformed.

#define

Leader has lost arbitration.

#define

Follower flushes old TX FIFO to respond new read command.

#define

Follower lost the bus.

#define

Follower requests for data and user writes 1 in CMD register.

#define

Leader has detected transfer abort.

#define

SDA is stuck at low.

#define

No acknowledgement for Device ID transfer by leader.

#define

No acknowledgement for follower address to leader.

#define
SL_I2C_ABORT_WRITE (1UL << 20)

Leader sends device ID transfer and TX FIFO has write command.

#define

'OR' of Leader and Follower activity

#define

Transmit FIFO is not full.

#define

Transmit FIFO is completely empty.

#define

Receive FIFO is not empty.

#define

Receive FIFO is completely full.

#define

Leader is not in idle state.

#define

Follower is not in idle state.

#define

Leader holds SCL as previous command did not have a STOP bit.

#define

Leader holds SCL as RX FIFO is full and additional byte is received.

#define

Follower holds SCL to request read data when TX FIFO is empty.

#define

Follower holds SCL as RX FIFO is full and additional byte is received.

#define

SDA is stuck at low and has not recovered.

Enumeration Documentation#

sl_i2c_clock_hlr_t#

sl_i2c_clock_hlr_t

Enumeration for I2C bus speed.

Enumerator
SL_I2C_STANDARD_BUS_SPEED

Standard bus speed, 100 Kbps.

SL_I2C_FAST_BUS_SPEED

Fast bus speed, 400 Kbps.

SL_I2C_HIGH_BUS_SPEED

High bus speed, 3.4 Mbps.

SL_I2C_FAST_PLUS_BUS_SPEED

Fast plus bus speed, 1 Mbps.


Definition at line 138 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_i2c_direction_t#

sl_i2c_direction_t

Enumeration for I2C direction i.e., read/write.

Enumerator
SL_I2C_WRITE

I2C write operation mask.

SL_I2C_READ

I2C read operation mask.


Definition at line 146 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_i2c_mode_t#

sl_i2c_mode_t

Enumeration for I2C mode i.e., leader/follower.

Enumerator
SL_I2C_LEADER_MODE

I2C Leader mode.

SL_I2C_FOLLOWER_MODE

I2C Follower mode.


Definition at line 152 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

Typedef Documentation#

I2C_TypeDef#

typedef I2C0_Type I2C_TypeDef

Renaming the I2C register set.


Definition at line 135 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

Function Documentation#

sl_si91x_i2c_init#

void sl_si91x_i2c_init (I2C_TypeDef * i2c, const sl_i2c_init_params_t * p_config)

Initialize the I2C i.e., set the parameters to the respective registers.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

[in]p_config

(sl_i2c_init_params_t) Pointer to the initialization parameters structure.

It needs to be called at the beginning of the code. It sets the frequency as per the input given in freq_scl and chlr. It accepts the following members for initialization parameters:

  • mode (Leader/Follower) sl_i2c_mode_t.

  • freq_scl (I2C SCL frequency).

  • chlr (Bus Speed) sl_i2c_clock_hlr_t.

  • address (Follower address).

  • is_10bit_addr (pass true if address is of 10 bit).

Returns

  • none


Definition at line 191 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_reset#

void sl_si91x_i2c_reset (I2C_TypeDef * i2c)

Reset the I2C peripheral.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

It resets the initialization parameters to zero and clears all the interrupts. It resets the target and slave addresses.

Returns

  • none


Definition at line 203 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_tx#

void sl_si91x_i2c_tx (I2C_TypeDef * i2c, uint8_t data)

Transmit one byte on SDA line.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

[in]data

(uint8_t) Data that needs to be transmitted via I2C bus.

Threshold needs to be set before calling this API sl_si91x_i2c_set_tx_threshold. Direction needs to be selected before calling this API sl_si91x_i2c_control_direction.

Returns

  • none


Definition at line 219 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_rx#

uint8_t sl_si91x_i2c_rx (I2C_TypeDef * i2c)

Receive one byte on SDA line.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

Threshold needs to be set before calling this API sl_si91x_i2c_set_rx_threshold. Direction needs to be selected before calling this API sl_si91x_i2c_control_direction.

Returns

  • data (uint8_t) Data that is received on the I2C bus.


Definition at line 234 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_set_frequency#

void sl_si91x_i2c_set_frequency (I2C_TypeDef * i2c, uint32_t ref_freq, uint32_t freq_scl, sl_i2c_clock_hlr_t clhr)

Configure the frequency of the I2C transmission.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

[in]ref_freq

(uint32_t) SCL frequency.

[in]freq_scl

(sl_i2c_clock_hlr_t) Bus speed for I2C.

N/Aclhr

This API is called inside sl_si91x_i2c_init, but can be called separately to change the frequency. According the input of freq_scl frequency is calculated and filled in the register appropriately as the speed selected in chlr. The accepted parameters for chlr are: sl_i2c_clock_hlr_t.

  • SL_I2C_STANDARD_BUS_SPEED = 1, ///< Standard bus speed, 100 Kbps

  • SL_I2C_FAST_BUS_SPEED, ///< Fast bus speed, 400 Kbps

  • SL_I2C_FAST_PLUS_BUS_SPEED, ///< Fast plus bus speed, 1 Mbps

  • SL_I2C_HIGH_BUS_SPEED, ///< High bus speed, 3.4 Mbps

Returns

  • none


Definition at line 254 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_get_frequency#

uint32_t sl_si91x_i2c_get_frequency (I2C_TypeDef * i2c)

Fetch the frequency of I2C peripheral clock.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

It returns uint32_t value of the SystemCoreClock frequency.

Returns

  • frequency (uint32_t) The frequency of the System.


Definition at line 264 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_get_version#

sl_i2c_version_t sl_si91x_i2c_get_version (void )

Get the release, sqa and dev version of I2C.

Parameters
[in]

Returns


Definition at line 273 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_enable#

__STATIC_INLINE void sl_si91x_i2c_enable (I2C_TypeDef * i2c)

Enable the I2C interface.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address

It sets the register bit which enabled the I2C interface.

Returns

  • none


Definition at line 284 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_disable#

__STATIC_INLINE void sl_si91x_i2c_disable (I2C_TypeDef * i2c)

Disable the I2C interface.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

It clears the register bit which enabled the I2C interface.

Returns

  • none


Definition at line 301 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_start_cmd#

__STATIC_INLINE void sl_si91x_i2c_start_cmd (I2C_TypeDef * i2c)

Hold the SCL line low and stalls the leader until new command is available in TX FIFO.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

STOP condition is not issued after completion of transfer irrespective of TX FIFO status.

Returns

  • none


Definition at line 320 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_stop_cmd#

__STATIC_INLINE void sl_si91x_i2c_stop_cmd (I2C_TypeDef * i2c)

Issue the STOP after completion of transfer irrespective of TX FIFO status.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

If TX FIFO has data, leader sends start byte and starts the transmission.

Returns

  • none


Definition at line 338 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_get_status#

__STATIC_INLINE uint32_t sl_si91x_i2c_get_status (I2C_TypeDef * i2c)

Get the I2C IC status.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

The bits of status are set according to the events. The macros are written in this file that can be directly used to mask the value of this register.

Returns

  • none


Definition at line 357 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_disable_interrupts#

__STATIC_INLINE void sl_si91x_i2c_disable_interrupts (I2C_TypeDef * i2c, uint32_t flags)

Disable the I2C interrupts.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

N/Aflags

It is mandatory to disable interrupts before configuring the I2C parameters.

Returns

  • none


Definition at line 374 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_enable_interrupts#

__STATIC_INLINE void sl_si91x_i2c_enable_interrupts (I2C_TypeDef * i2c, uint32_t flags)

Enable the I2C interrupts.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

N/Aflags

Returns

  • none


Definition at line 399 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_set_interrupts#

__STATIC_INLINE void sl_si91x_i2c_set_interrupts (I2C_TypeDef * i2c, uint32_t flags)

Set the interrupts i.e., unmask according to the flags passed in the parameter.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

[in]flags

(uint32_t) Interrupt flags which needs to be unmasked.

Returns

  • none


Definition at line 426 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_clear_interrupts#

__STATIC_INLINE void sl_si91x_i2c_clear_interrupts (I2C_TypeDef * i2c, uint32_t flags)

Clear the interrupts i.e., mask according to the flags passed in the parameter.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

[in]flags

(uint32_t) Interrupt flags which needs to be masked.

Returns

  • none


Definition at line 444 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_get_pending_interrupts#

__STATIC_INLINE uint32_t sl_si91x_i2c_get_pending_interrupts (I2C_TypeDef * i2c)

Get the pending interrupts.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

It returns the uint32_t type interrupt status register. The macros are written in this file that can be directly used to mask the value of this register.

Returns

  • status (uint32_t) Interrupts which are pending.


Definition at line 463 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_get_enabled_interrupts#

__STATIC_INLINE uint32_t sl_si91x_i2c_get_enabled_interrupts (I2C_TypeDef * i2c)

Get the enabled interrupts.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

It returns the uint32_t type interrupt mask register. The macros are written in this file that can be directly used to mask the value of this register.

Returns

  • status (uint32_t) Interrupts which are unmasked.


Definition at line 482 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_get_enabled_pending_interrupts#

__STATIC_INLINE uint32_t sl_si91x_i2c_get_enabled_pending_interrupts (I2C_TypeDef * i2c)

Get the enabled and pending interrupts.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

It returns the uint32_t type value which is bitwise end of enabled interrupts and pending interrupts. The macros are written in this file that can be directly used to mask the value of this register.

Returns

  • status (uint32_t) Interrupts which are unmasked and pending.


Definition at line 503 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_wait_ready#

__STATIC_INLINE void sl_si91x_i2c_wait_ready (I2C_TypeDef * i2c, uint32_t mask)

Wait till the process is completed.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

[in]mask

(uint32_t) Interrupt mask for that it waits.

Mask takes the interrupt flags and waits until it is triggered. Interrupt is cleared once it is triggered.

Returns

  • none


Definition at line 525 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_wait_sync#

__STATIC_INLINE void sl_si91x_i2c_wait_sync (I2C_TypeDef * i2c)

Wait till the synchronization is completed.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

It checks whether the I2C interface is enabled and the bus is free i.e., no activity is pending on the bus.

Returns

  • none


Definition at line 545 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_set_follower_address#

__STATIC_INLINE void sl_si91x_i2c_set_follower_address (I2C_TypeDef * i2c, uint16_t addr, bool is_10bit_addr)

Set the follower address when I2C is in leader mode.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

[in]addr

(uint16_t) Follower address.

[in]is_10bit_addr

(bool) boolean value for the 10 bit address.

It validates the is_10bit_addr parameter and sets the 10 bit address register. It updates the register of follower address with the value passed in the parameter. This API is called in sl_si91x_i2c_init function sl_si91x_i2c_init It can also be called separately from to update the follower address.

Returns

  • none


Definition at line 567 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_get_follower_address#

__STATIC_INLINE uint16_t sl_si91x_i2c_get_follower_address (I2C_TypeDef * i2c)

Fetch the current follower address.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

It returns uint8_t value as the current follower address.

Returns

  • address(uint8_t) address of the follower.


Definition at line 592 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_set_follower_mask_address#

__STATIC_INLINE void sl_si91x_i2c_set_follower_mask_address (I2C_TypeDef * i2c, uint16_t mask)

Update the address of leader when it is in follower mode.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

N/Amask

It updates the register of follower address with the value passed in the parameter. This API is called in sl_si91x_i2c_init function sl_si91x_i2c_init It can also be called separately from to update the address.

Returns

  • none


Definition at line 610 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_get_follower_mask_address#

__STATIC_INLINE uint16_t sl_si91x_i2c_get_follower_mask_address (I2C_TypeDef * i2c)

Fetch the masked follower address i.e.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

leader address when it is in follower mode. It returns uint8_t value as the current masked follower address.

Returns

  • address(uint8_t) leader's address when it is in follower mode


Definition at line 628 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_send_nack#

__STATIC_INLINE void sl_si91x_i2c_send_nack (I2C_TypeDef * i2c)

Generate NACK only when it is in follower-receiver mode.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address

It generates NACK after a byte is received and the transfer will be aborted.

Returns

  • none


Definition at line 645 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_abort_transfer#

__STATIC_INLINE void sl_si91x_i2c_abort_transfer (I2C_TypeDef * i2c)

Abort the transfer.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

It disables the interrupts, I2C interface and waits till the abort is completed. Abort issues the stop condition and flushes the TX FIFO and sets the SL_I2C_EVENT_TRANSMIT_ABORT interrupt after the operation is completed. For abort it is necessary to keep to I2C instance in enable mode.

Returns

  • none


Definition at line 666 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_clear_bus#

__STATIC_INLINE void sl_si91x_i2c_clear_bus (I2C_TypeDef * i2c)

Clear the I2C bus.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

It disables the I2C interface, loads the SCL and SDA timeout values and again enabled the I2C interface.

Returns

  • none


Definition at line 690 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_set_rx_threshold#

__STATIC_INLINE void sl_si91x_i2c_set_rx_threshold (I2C_TypeDef * i2c, uint8_t threshold)

Update the RX threshold values.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

[in]threshold

(uint8_t) Threshold value which need to be filled in FIFO.

Returns

  • none


Definition at line 713 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_set_tx_threshold#

__STATIC_INLINE void sl_si91x_i2c_set_tx_threshold (I2C_TypeDef * i2c, uint8_t threshold)

Update the TX threshold values.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

[in]threshold

(uint8_t) Threshold value which need to be filled in FIFO.

Returns

  • none


Definition at line 730 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_control_direction#

__STATIC_INLINE void sl_si91x_i2c_control_direction (I2C_TypeDef * i2c, sl_i2c_direction_t direction)

Control the direction of the I2C interface.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

[in]direction

(sl_i2c_direction_t) I2C direction for operation.

  • Read/write

It updates the register with the read mask / write mask value sl_i2c_direction_t

Note

  • I2C instance should be enabled before calling this API.

Returns

  • none


Definition at line 751 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_set_sda_hold_time#

__STATIC_INLINE void sl_si91x_i2c_set_sda_hold_time (I2C_TypeDef * i2c, sl_i2c_direction_t direction, uint32_t time)

Configure the SDA hold time.

Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address.

[in]direction

(sl_i2c_direction_t) C direction for operation.

  • Read/write.

[in]time

Time which needs to be filled in the SDA hold register.

According to the direction sl_i2c_direction_t, it updates the registers with the time value which is passed as the function parameter. It holds the SDA in the units of clock period.

Returns

  • none


Definition at line 772 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

sl_si91x_i2c_send_ack#

__STATIC_INLINE void sl_si91x_i2c_send_ack (I2C_TypeDef * i2c, p_config)
Parameters
[in]i2c

(I2C_TypeDef) Pointer to the I2C instance base address

[in]p_config

(sl_i2c_init_params_t) Pointer to the initialization parameters structure

Returns

  • none


Definition at line 793 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

Macro Definition Documentation#

SL_I2C_ASSERT#

#define SL_I2C_ASSERT
Value:
(expr)

Macro function to assert the I2C instance.


Definition at line 49 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

I2C_NUM#

#define I2C_NUM
Value:
(ref)

Macro to validate I2C instance number.


Definition at line 50 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

I2C_REF_VALID#

#define I2C_REF_VALID
Value:
(ref)

Macro function to validate the user input and I2C instance.


Definition at line 52 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

UNUSED_VARIABLE#

#define UNUSED_VARIABLE
Value:
(var)

Definition at line 53 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ENABLE_MASK#

#define SL_I2C_ENABLE_MASK
Value:
0x01

I2C enable mask.


Definition at line 55 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_WRITE_MASK#

#define SL_I2C_WRITE_MASK
Value:
0x00

I2C write mask.


Definition at line 56 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_READ_MASK#

#define SL_I2C_READ_MASK
Value:
0x01

I2C read mask.


Definition at line 57 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_CLEAR_MASK#

#define SL_I2C_CLEAR_MASK
Value:
0x00

I2C clear mask.


Definition at line 58 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_SCL_STUCK_TIMEOUT#

#define SL_I2C_SCL_STUCK_TIMEOUT
Value:
20

SCL stuck timeout, used to clear the I2C bus.


Definition at line 59 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_SDA_STUCK_TIMEOUT#

#define SL_I2C_SDA_STUCK_TIMEOUT
Value:
20

SDA stick timeout, used to clear the I2C bus.


Definition at line 60 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_16_BIT_MASK#

#define SL_16_BIT_MASK
Value:
0xFFFF

16 bit mask value


Definition at line 61 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_8_BIT_MASK#

#define SL_8_BIT_MASK
Value:
0xFF

8 bit mask value


Definition at line 62 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_4_BIT_MASK#

#define SL_4_BIT_MASK
Value:
0xF

4 bit mask value


Definition at line 63 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_DMA_ENABLE#

#define SL_I2C_DMA_ENABLE
Value:
0x1

DMA enable.


Definition at line 64 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_DMA_DISABLE#

#define SL_I2C_DMA_DISABLE
Value:
0x0

DMA disable.


Definition at line 65 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_EVENT_RECEIVE_UNDER#

#define SL_I2C_EVENT_RECEIVE_UNDER
Value:
(1UL << 0)

If processor attempts to read receive buffer when buffer is empty.


Definition at line 68 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_EVENT_RECEIVE_OVER#

#define SL_I2C_EVENT_RECEIVE_OVER
Value:
  (1UL << 1)

If receive buffer is full and another byte is received (extra bytes are lost)


Definition at line 69 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_EVENT_RECEIVE_FULL#

#define SL_I2C_EVENT_RECEIVE_FULL
Value:
(1UL << 2)

When receive buffer is full up to the RX_TL threshold level.


Definition at line 71 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_EVENT_TRANSMIT_OVER#

#define SL_I2C_EVENT_TRANSMIT_OVER
Value:
(1UL << 3)

If transmit buffer is full and user attempts to transmit another byte.


Definition at line 72 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_EVENT_TRANSMIT_EMPTY#

#define SL_I2C_EVENT_TRANSMIT_EMPTY
Value:
(1UL << 4)

When transmit buffer is filled over the TX_TL threshold level.


Definition at line 73 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_EVENT_READ_REQ#

#define SL_I2C_EVENT_READ_REQ
Value:
(1UL << 5)

SCL is on hold in follower mode when another leader attempts to read data.


Definition at line 74 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_EVENT_TRANSMIT_ABORT#

#define SL_I2C_EVENT_TRANSMIT_ABORT
Value:
  (1UL << 6)

Transmit is aborted, to validate the reason, read IC_TX_ABRT_SOURCE register.


Definition at line 75 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_EVENT_RECEIVE_DONE#

#define SL_I2C_EVENT_RECEIVE_DONE
Value:
(1UL << 7)

In follower mode if leader does not acknowledge, happens on last byte.


Definition at line 77 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_EVENT_ACTIVITY_ON_BUS#

#define SL_I2C_EVENT_ACTIVITY_ON_BUS
Value:
  (1UL << 8)

Ongoing or previous activity was there on bus, to clear read IC_CLR_INTR / IC_CLR_ACTIVITY register.


Definition at line 78 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_EVENT_STOP_DETECT#

#define SL_I2C_EVENT_STOP_DETECT
Value:
(1UL << 9)

Stop condition is detected on the bus (leader and follower both mode)


Definition at line 80 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_EVENT_START_DETECT#

#define SL_I2C_EVENT_START_DETECT
Value:
  (1UL << 10)

Start or Restart condition is detected on the bus (leader and follower both mode)


Definition at line 81 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_EVENT_GENERAL_CALL#

#define SL_I2C_EVENT_GENERAL_CALL
Value:
  (1UL << 11)

General call address is received, to clear read IC_CLR_GEN_CALL register.


Definition at line 83 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_EVENT_RESTART_DET#

#define SL_I2C_EVENT_RESTART_DET
Value:
(1UL << 12)

Restart condition is detected on bus (follower mode)


Definition at line 85 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_EVENT_MST_ON_HOLD#

#define SL_I2C_EVENT_MST_ON_HOLD
Value:
(1UL << 13)

Leader is holding the bus and FIFO is empty.


Definition at line 86 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_EVENT_SCL_STUCK_AT_LOW#

#define SL_I2C_EVENT_SCL_STUCK_AT_LOW
Value:
(1UL << 14)

SCL line is stuck at low.


Definition at line 87 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ABORT_7B_ADDRESS_NOACK#

#define SL_I2C_ABORT_7B_ADDRESS_NOACK
Value:
(1UL << 0)

Address sent was not acknowledged by follower in 7-bit mode.


Definition at line 90 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ABORT_10B_ADDRESS1_NOACK#

#define SL_I2C_ABORT_10B_ADDRESS1_NOACK
Value:
(1UL << 1)

First 10-bit address byte sent was not acknowledged by follower.


Definition at line 91 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ABORT_10B_ADDRESS2_NOACK#

#define SL_I2C_ABORT_10B_ADDRESS2_NOACK
Value:
(1UL << 2)

Second 10-bit address byte sent was not acknowledged by follower.


Definition at line 92 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ABORT_TX_DATA_NOACK#

#define SL_I2C_ABORT_TX_DATA_NOACK
Value:
  (1UL << 3)

Received acknowledgement for address bu did not receive acknowledgement for data.


Definition at line 93 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ABORT_GENERAL_CALL_NOACK#

#define SL_I2C_ABORT_GENERAL_CALL_NOACK
Value:
(1UL << 4)

No follower acknowledged General call.


Definition at line 95 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ABORT_GENERAL_CALL_READ#

#define SL_I2C_ABORT_GENERAL_CALL_READ
Value:
(1UL << 5)

Leader send general call but program was to read it from bus.


Definition at line 96 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ABORT_HIGH_SPEED_ACK#

#define SL_I2C_ABORT_HIGH_SPEED_ACK
Value:
(1UL << 6)

High speed leader call was acknowledged by follower.


Definition at line 97 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ABORT_START_BYTE_ACK#

#define SL_I2C_ABORT_START_BYTE_ACK
Value:
(1UL << 7)

Start byte was acknowledged by follower.


Definition at line 98 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ABORT_HIGH_SPEED_NO_RESTART#

#define SL_I2C_ABORT_HIGH_SPEED_NO_RESTART
Value:
(1UL << 8)

Restart is disabled and data transfer is in high speed mode.


Definition at line 99 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ABORT_START_BYTE_NO_RESTART#

#define SL_I2C_ABORT_START_BYTE_NO_RESTART
Value:
(1UL << 9)

Restart is disabled and user tries to send start byte.


Definition at line 100 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ABORT_10B_READ_NO_RESTART#

#define SL_I2C_ABORT_10B_READ_NO_RESTART
Value:
  (1UL << 10)

Restart is disabled and 10-bit address read command is received.


Definition at line 101 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ABORT_MASTER_DISABLED#

#define SL_I2C_ABORT_MASTER_DISABLED
Value:
(1UL << 11)

Leader mode is disabled and leader mode operation is preformed.


Definition at line 103 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ABORT_MASTER_ARBITRATION_LOST#

#define SL_I2C_ABORT_MASTER_ARBITRATION_LOST
Value:
(1UL << 12)

Leader has lost arbitration.


Definition at line 104 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ABORT_SLAVE_FLUSH_TX_FIFO#

#define SL_I2C_ABORT_SLAVE_FLUSH_TX_FIFO
Value:
(1UL << 13)

Follower flushes old TX FIFO to respond new read command.


Definition at line 105 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ABORT_SLAVE_ARBITRATION_LOST#

#define SL_I2C_ABORT_SLAVE_ARBITRATION_LOST
Value:
(1UL << 14)

Follower lost the bus.


Definition at line 106 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ABORT_SLAVE_READ_INTX#

#define SL_I2C_ABORT_SLAVE_READ_INTX
Value:
(1UL << 15)

Follower requests for data and user writes 1 in CMD register.


Definition at line 107 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ABORT_USER_ABORT#

#define SL_I2C_ABORT_USER_ABORT
Value:
(1UL << 16)

Leader has detected transfer abort.


Definition at line 108 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ABORT_SDA_STUCK_AT_LOW#

#define SL_I2C_ABORT_SDA_STUCK_AT_LOW
Value:
(1UL << 17)

SDA is stuck at low.


Definition at line 109 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ABORT_DEVICE_NOACK#

#define SL_I2C_ABORT_DEVICE_NOACK
Value:
(1UL << 18)

No acknowledgement for Device ID transfer by leader.


Definition at line 110 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ABORT_DEVICE_SLAVE_ADDRESS_NOACK#

#define SL_I2C_ABORT_DEVICE_SLAVE_ADDRESS_NOACK
Value:
(1UL << 19)

No acknowledgement for follower address to leader.


Definition at line 111 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ABORT_WRITE#

#define SL_I2C_ABORT_WRITE
Value:
(1UL << 20)

Leader sends device ID transfer and TX FIFO has write command.


Definition at line 112 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_ACTIVITY_STATUS#

#define SL_I2C_ACTIVITY_STATUS
Value:
(1U << 0)

'OR' of Leader and Follower activity


Definition at line 115 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_TRANSFER_FIFO_NOT_FULL_STATUS#

#define SL_I2C_TRANSFER_FIFO_NOT_FULL_STATUS
Value:
(1U << 1)

Transmit FIFO is not full.


Definition at line 116 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_TRANSFER_FIFO_EMPTY_STATUS#

#define SL_I2C_TRANSFER_FIFO_EMPTY_STATUS
Value:
(1U << 2)

Transmit FIFO is completely empty.


Definition at line 117 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_RECEIVE_FIFO_NOT_EMPTY_STATUS#

#define SL_I2C_RECEIVE_FIFO_NOT_EMPTY_STATUS
Value:
(1U << 3)

Receive FIFO is not empty.


Definition at line 118 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_RECEIVE_FIFO_FULL_STATUS#

#define SL_I2C_RECEIVE_FIFO_FULL_STATUS
Value:
(1U << 4)

Receive FIFO is completely full.


Definition at line 119 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_MASTER_ACTIVITY_STATUS#

#define SL_I2C_MASTER_ACTIVITY_STATUS
Value:
(1U << 5)

Leader is not in idle state.


Definition at line 120 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_SLAVE_ACTIVITY_STATUS#

#define SL_I2C_SLAVE_ACTIVITY_STATUS
Value:
(1U << 6)

Follower is not in idle state.


Definition at line 121 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_MASTER_HOLD_TX_FIFO_EMPTY_STATUS#

#define SL_I2C_MASTER_HOLD_TX_FIFO_EMPTY_STATUS
Value:
  (1U << 7)

Leader holds SCL as previous command did not have a STOP bit.


Definition at line 122 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_MASTER_HOLD_RX_FIFO_FULL_STATUS#

#define SL_I2C_MASTER_HOLD_RX_FIFO_FULL_STATUS
Value:
  (1U << 8)

Leader holds SCL as RX FIFO is full and additional byte is received.


Definition at line 124 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_SLAVE_HOLD_TX_FIFO_EMPTY_STATUS#

#define SL_I2C_SLAVE_HOLD_TX_FIFO_EMPTY_STATUS
Value:
  (1U << 9)

Follower holds SCL to request read data when TX FIFO is empty.


Definition at line 126 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_SLAVE_HOLD_RX_FIFO_FULL_STATUS#

#define SL_I2C_SLAVE_HOLD_RX_FIFO_FULL_STATUS
Value:
  (1U << 10)

Follower holds SCL as RX FIFO is full and additional byte is received.


Definition at line 128 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h

SL_I2C_SDA_STUCK_NOT_RECOVERED_STATUS#

#define SL_I2C_SDA_STUCK_NOT_RECOVERED_STATUS
Value:
(1U << 11)

SDA is stuck at low and has not recovered.


Definition at line 130 of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_peripheral_i2c.h