|
SmartSnippets DA1459x SDK
|
I2C Controller. More...
Files | |
| file | hw_i2c.h |
| Definition of API for the I2C Low Level Driver. | |
Data Structures | |
| struct | i2c_config |
| I2C configuration. More... | |
Macros | |
| #define | HW_I2C_DMA_SUPPORT dg_configI2C_DMA_SUPPORT |
| DMA support for I2C. | |
| #define | HW_I2C_SLAVE_SUPPORT ( 1 ) |
| I2C slave mode support. | |
| #define | I2C_FIFO_DEPTH (4) |
| TX/RX FIFO depth. More... | |
| #define | I2C_SETUP(id, seq) |
| Wrapper to perform controller setup. More... | |
| #define | HW_I2C1 ((void *)I2C_BASE) |
| I2C controller instance. More... | |
| #define | HW_I2C_F_NONE 0x00000000 |
| #define | HW_I2C_F_WAIT_FOR_STOP 0x00000001 |
| #define | HW_I2C_F_ADD_STOP 0x00000002 |
| #define | HW_I2C_F_ADD_RESTART 0x00000004 |
| #define | HW_I2C_I2C1_MADDR 0x01 |
| I2C high speed master code. This bit field holds the value of the I2C HS mode master code. HS-mode master codes are reserved 8-bit codes (00001xxx) that are not used for slave addressing or other purposes. Each master has its unique master code. Up to eight high-speed mode masters can be present on the same I2C bus system. Valid values are from 0 to 7. This can be written only when the I2C interface is disabled, which corresponds to the IC_ENABLE[0] register being set to 0. Writes at other times have no effect. More... | |
| #define | HW_I2C_REG_SETF(id, reg, field, val) |
| Write a value to an I2C register field. More... | |
| #define | HW_I2C_REG_GETF(id, reg, field) ((IBA(id)->reg##_REG & (I2C_##reg##_REG_##field##_Msk)) >> (I2C_##reg##_REG_##field##_Pos)) |
| Get the value of an I2C register field. More... | |
| #define | HW_I2C_REG_SET_FIELD(reg, field, var, val) REG_SET_FIELD(I2C, reg##_REG, field, var, val) |
| Sets a field value of an I2C register. Aimed to be used with local variables. More... | |
Typedefs | |
| typedef hw_dma_periph_prio_t | hw_i2c_dma_prio_t |
| I2C DMA priority configuration. More... | |
| typedef void(* | hw_i2c_interrupt_cb) (HW_I2C_ID id, uint16_t mask) |
| Callback called on interrupt from I2C controller. More... | |
| typedef void(* | hw_i2c_complete_cb) (HW_I2C_ID id, void *cb_data, uint16_t len, bool success) |
| Callback called upon completion of read or write in non-blocking mode (FIFO or DMA) More... | |
| typedef void(* | hw_i2c_event_cb) (HW_I2C_ID id, HW_I2C_EVENT event) |
| Callback called on event when in slave mode. More... | |
Enumerations | |
| enum | HW_I2C_ABORT_SOURCE { HW_I2C_ABORT_NONE = 0, HW_I2C_ABORT_7B_ADDR_NO_ACK = I2C_I2C_TX_ABRT_SOURCE_REG_ABRT_7B_ADDR_NOACK_Msk, HW_I2C_ABORT_10B_ADDR1_NO_ACK = I2C_I2C_TX_ABRT_SOURCE_REG_ABRT_10ADDR1_NOACK_Msk, HW_I2C_ABORT_10B_ADDR2_NO_ACK = I2C_I2C_TX_ABRT_SOURCE_REG_ABRT_10ADDR2_NOACK_Msk, HW_I2C_ABORT_TX_DATA_NO_ACK = I2C_I2C_TX_ABRT_SOURCE_REG_ABRT_TXDATA_NOACK_Msk, HW_I2C_ABORT_GENERAL_CALL_NO_ACK = I2C_I2C_TX_ABRT_SOURCE_REG_ABRT_GCALL_NOACK_Msk, HW_I2C_ABORT_GENERAL_CALL_READ = I2C_I2C_TX_ABRT_SOURCE_REG_ABRT_GCALL_READ_Msk, HW_I2C_ABORT_START_BYTE_ACK = I2C_I2C_TX_ABRT_SOURCE_REG_ABRT_SBYTE_ACKDET_Msk, HW_I2C_ABORT_10B_READ_NO_RESTART = I2C_I2C_TX_ABRT_SOURCE_REG_ABRT_10B_RD_NORSTRT_Msk, HW_I2C_ABORT_MASTER_DISABLED = I2C_I2C_TX_ABRT_SOURCE_REG_ABRT_MASTER_DIS_Msk, HW_I2C_ABORT_ARBITRATION_LOST = I2C_I2C_TX_ABRT_SOURCE_REG_ARB_LOST_Msk, HW_I2C_ABORT_SLAVE_FLUSH_TX_FIFO = I2C_I2C_TX_ABRT_SOURCE_REG_ABRT_SLVFLUSH_TXFIFO_Msk, HW_I2C_ABORT_SLAVE_ARBITRATION_LOST = I2C_I2C_TX_ABRT_SOURCE_REG_ABRT_SLV_ARBLOST_Msk, HW_I2C_ABORT_SLAVE_IN_TX = I2C_I2C_TX_ABRT_SOURCE_REG_ABRT_SLVRD_INTX_Msk, HW_I2C_ABORT_USER_ABORT = I2C_I2C_TX_ABRT_SOURCE_REG_ABRT_USER_ABRT_Msk, HW_I2C_ABORT_SW_ERROR } |
| I2C abort source. More... | |
| enum | HW_I2C_SPEED { HW_I2C_SPEED_STANDARD = 0, HW_I2C_SPEED_FAST, HW_I2C_SPEED_HIGH } |
| I2C interface speed. More... | |
| enum | HW_I2C_MODE { HW_I2C_MODE_MASTER = 0, HW_I2C_MODE_SLAVE } |
| I2C mode. More... | |
| enum | HW_I2C_ADDRESSING { HW_I2C_ADDRESSING_7B = 0, HW_I2C_ADDRESSING_10B } |
| I2C addressing mode. More... | |
| enum | HW_I2C_EVENT { HW_I2C_EVENT_READ_REQUEST = 0, HW_I2C_EVENT_DATA_READY, HW_I2C_EVENT_TX_ABORT, HW_I2C_EVENT_RX_OVERFLOW, HW_I2C_EVENT_INVALID } |
| Callback events when working as slave. More... | |
| enum | HW_I2C_INT { HW_I2C_INT_RX_UNDERFLOW = I2C_I2C_INTR_STAT_REG_R_RX_UNDER_Msk, HW_I2C_INT_RX_OVERFLOW = I2C_I2C_INTR_STAT_REG_R_RX_OVER_Msk, HW_I2C_INT_RX_FULL = I2C_I2C_INTR_STAT_REG_R_RX_FULL_Msk, HW_I2C_INT_TX_OVERFLOW = I2C_I2C_INTR_STAT_REG_R_TX_OVER_Msk, HW_I2C_INT_TX_EMPTY = I2C_I2C_INTR_STAT_REG_R_TX_EMPTY_Msk, HW_I2C_INT_READ_REQUEST = I2C_I2C_INTR_STAT_REG_R_RD_REQ_Msk, HW_I2C_INT_TX_ABORT = I2C_I2C_INTR_STAT_REG_R_TX_ABRT_Msk, HW_I2C_INT_RX_DONE = I2C_I2C_INTR_STAT_REG_R_RX_DONE_Msk, HW_I2C_INT_ACTIVITY = I2C_I2C_INTR_STAT_REG_R_ACTIVITY_Msk, HW_I2C_INT_STOP_DETECTED = I2C_I2C_INTR_STAT_REG_R_STOP_DET_Msk, HW_I2C_INT_START_DETECTED = I2C_I2C_INTR_STAT_REG_R_START_DET_Msk, HW_I2C_INT_GENERAL_CALL = I2C_I2C_INTR_STAT_REG_R_GEN_CALL_Msk } |
| I2C interrupt source. More... | |
| enum | HW_I2C_DMA_TRANSFER |
| DMA transfer type. More... | |
Functions | |
| void | hw_i2c_enable_clk (const HW_I2C_ID id) |
| Enable I2C clock. More... | |
| void | hw_i2c_disable_clk (const HW_I2C_ID id) |
| Disable I2C clock. More... | |
| bool | hw_i2c_is_clk_enabled (const HW_I2C_ID id) |
| Get the status of the I2C interface clock source. More... | |
| void | hw_i2c_init (HW_I2C_ID id, const i2c_config *cfg) |
| Initialize I2C controller. More... | |
| void | hw_i2c_deinit (HW_I2C_ID id) |
| DeInitialize I2C controller. More... | |
| void | hw_i2c_configure (HW_I2C_ID id, const i2c_config *cfg) |
| Configure I2C controller. More... | |
| __STATIC_INLINE void | hw_i2c_enable (HW_I2C_ID id) |
| Enable I2C controller. More... | |
| void | hw_i2c_disable (HW_I2C_ID id) |
| Disable I2C controller. More... | |
| __STATIC_INLINE bool | hw_i2c_is_enabled (HW_I2C_ID id) |
| Get I2C controller enable status. More... | |
| __STATIC_INLINE uint16_t | hw_i2c_get_enable_status (HW_I2C_ID id) |
| Get I2C Controller Enable status. More... | |
| void | hw_i2c_reset_dma_cb (HW_I2C_ID id) |
| Reset DMA callback. More... | |
| bool | hw_i2c_is_occupied (HW_I2C_ID id) |
| Get I2C controller occupied status. More... | |
| void | hw_i2c_register_int (HW_I2C_ID id, hw_i2c_interrupt_cb cb, uint16_t mask) |
| Register interrupt handler. More... | |
| void | hw_i2c_unregister_int (HW_I2C_ID id) |
| Unregister interrupt handler. More... | |
| void | hw_i2c_set_int_mask (HW_I2C_ID id, uint16_t mask) |
| Set bitmask of requested interrupt events. More... | |
| uint16_t | hw_i2c_get_int_mask (HW_I2C_ID id) |
| Get current bitmask of requested interrupt events. More... | |
| __STATIC_INLINE void | hw_i2c_set_mode (HW_I2C_ID id, HW_I2C_MODE mode) |
| Set I2C controller mode. More... | |
| __STATIC_INLINE uint8_t | hw_i2c_is_master (HW_I2C_ID id) |
| Get I2C controller master mode status. More... | |
| __STATIC_INLINE void | hw_i2c_set_speed (HW_I2C_ID id, HW_I2C_SPEED speed) |
| Set I2C interface bus speed. More... | |
| __STATIC_INLINE void | hw_i2c_set_restart_enabled (HW_I2C_ID id, bool enabled) |
| Set whether RESTART conditions may be sent when acting as master. More... | |
| __STATIC_INLINE void | hw_i2c_set_general_call_enabled (HW_I2C_ID id, bool enabled) |
| Set whether General Call should be used to address slaves. More... | |
| __STATIC_INLINE void | hw_i2c_set_target_addressing_mode (HW_I2C_ID id, HW_I2C_ADDRESSING addr_mode) |
| Set target slave addressing mode in master mode. More... | |
| __STATIC_INLINE void | hw_i2c_set_slave_addressing_mode (HW_I2C_ID id, HW_I2C_ADDRESSING addr_mode) |
| Set slave addressing mode in slave mode. More... | |
| __STATIC_INLINE void | hw_i2c_set_slave_address (HW_I2C_ID id, uint16_t address) |
| Set slave address in slave mode. More... | |
| __STATIC_INLINE void | hw_i2c_set_general_call_ack_enabled (HW_I2C_ID id, bool ack) |
| Set support for general call acknowledgment. More... | |
| void | hw_i2c_setup_master (HW_I2C_ID id, HW_I2C_ADDRESSING addr_mode, uint16_t address) |
| Setup controller for operation in master mode. More... | |
| void | hw_i2c_set_slave_callback (HW_I2C_ID id, hw_i2c_event_cb cb) |
| Setup callback function for operation in slave mode. More... | |
| void | hw_i2c_register_slave_dma_read_callback (HW_I2C_ID id) |
| Register proper handling for DMA read in slave mode. More... | |
| void | hw_i2c_setup_slave (HW_I2C_ID id, HW_I2C_ADDRESSING addr_mode, uint16_t address, hw_i2c_event_cb cb) |
| Setup controller for operation in slave mode. More... | |
| __STATIC_INLINE bool | hw_i2c_is_master_busy (HW_I2C_ID id) |
| Check if controller is busy when operating in master mode. More... | |
| __STATIC_INLINE bool | hw_i2c_is_slave_busy (HW_I2C_ID id) |
| Check if controller is busy when operating in slave mode. More... | |
| __STATIC_INLINE bool | hw_i2c_controler_is_busy (HW_I2C_ID id) |
| Check controller activity. More... | |
| __STATIC_INLINE bool | hw_i2c_is_tx_fifo_empty (HW_I2C_ID id) |
| Check if TX FIFO queue is empty. More... | |
| __STATIC_INLINE bool | hw_i2c_is_tx_fifo_not_full (HW_I2C_ID id) |
| Check if TX FIFO is not full. More... | |
| __STATIC_INLINE bool | hw_i2c_is_rx_fifo_full (HW_I2C_ID id) |
| Check if RX FIFO queue is full. More... | |
| __STATIC_INLINE bool | hw_i2c_is_rx_fifo_not_empty (HW_I2C_ID id) |
| Check if RX FIFO is not empty. More... | |
| __STATIC_INLINE void | hw_i2c_set_target_address (HW_I2C_ID id, uint16_t address) |
| Set target slave address in master mode. More... | |
| __STATIC_INLINE void | hw_i2c_write_byte (HW_I2C_ID id, uint8_t byte) |
| Write single byte into TX FIFO. More... | |
| size_t | hw_i2c_write_buffer_sync (HW_I2C_ID id, const uint8_t *data, uint16_t len, HW_I2C_ABORT_SOURCE *abrt_code, uint32_t flags) |
| Write multiple bytes to I2C slave synchronously. More... | |
| int | hw_i2c_write_buffer_async (HW_I2C_ID id, const uint8_t *data, uint16_t len, hw_i2c_complete_cb cb, void *cb_data, uint32_t flags) |
| Write multiple bytes to I2C slave asynchronously. More... | |
| __STATIC_INLINE void | hw_i2c_read_byte_trigger (HW_I2C_ID id) |
| Initiate reading from I2C bus. More... | |
| size_t | hw_i2c_read_buffer_sync (HW_I2C_ID id, uint8_t *data, uint16_t len, HW_I2C_ABORT_SOURCE *abrt_code, uint32_t flags) |
| Read multiple bytes from I2C slave synchronously. More... | |
| int | hw_i2c_read_buffer_async (HW_I2C_ID id, uint8_t *data, uint16_t len, hw_i2c_complete_cb cb, void *cb_data, uint32_t flags) |
| Read multiple bytes from I2C slave asynchronously. More... | |
| int | hw_i2c_write_then_read_async (HW_I2C_ID id, const uint8_t *w_data, uint16_t w_len, uint8_t *r_data, uint16_t r_len, hw_i2c_complete_cb cb, void *cb_data, uint32_t flags) |
| Write then read multiple bytes from I2C slave. More... | |
| __STATIC_INLINE uint8_t | hw_i2c_read_byte (HW_I2C_ID id) |
| Read single byte from RX FIFO. More... | |
| __STATIC_INLINE void | hw_i2c_set_tx_fifo_threshold (HW_I2C_ID id, uint8_t level) |
| Set threshold level on TX FIFO. More... | |
| __STATIC_INLINE void | hw_i2c_set_rx_fifo_threshold (HW_I2C_ID id, uint8_t level) |
| Set threshold level on RX FIFO. More... | |
| __STATIC_INLINE uint8_t | hw_i2c_get_tx_fifo_threshold (HW_I2C_ID id) |
| Get threshold level on TX FIFO. More... | |
| __STATIC_INLINE uint8_t | hw_i2c_get_rx_fifo_threshold (HW_I2C_ID id) |
| Get threshold level on RX FIFO. More... | |
| __STATIC_INLINE uint8_t | hw_i2c_get_tx_fifo_level (HW_I2C_ID id) |
| Get number of bytes in TX FIFO. More... | |
| __STATIC_INLINE uint8_t | hw_i2c_get_rx_fifo_level (HW_I2C_ID id) |
| Get number of bytes in RX FIFO. More... | |
| __STATIC_INLINE void | hw_i2c_flush_rx_fifo (HW_I2C_ID id) |
| Flushing RX FIFO. More... | |
| __STATIC_INLINE uint16_t | hw_i2c_get_int_state (HW_I2C_ID id) |
| Get interrupt state. More... | |
| __STATIC_INLINE uint16_t | hw_i2c_get_raw_int_state (HW_I2C_ID id) |
| Get raw interrupt state. More... | |
| __STATIC_INLINE void | hw_i2c_reset_int_all (HW_I2C_ID id) |
| Reset all interrupt state. More... | |
| __STATIC_INLINE void | hw_i2c_reset_int_rx_underflow (HW_I2C_ID id) |
| Reset RX_UNDERFLOW interrupt state. More... | |
| __STATIC_INLINE void | hw_i2c_reset_int_rx_overflow (HW_I2C_ID id) |
| Reset RX_OVERFLOW interrupt state. More... | |
| __STATIC_INLINE void | hw_i2c_reset_int_tx_overflow (HW_I2C_ID id) |
| Reset TX_OVERFLOW interrupt state. More... | |
| __STATIC_INLINE void | hw_i2c_reset_int_read_request (HW_I2C_ID id) |
| Reset READ_REQUEST interrupt state. More... | |
| __STATIC_INLINE void | hw_i2c_reset_int_tx_abort (HW_I2C_ID id) |
| Reset TX_ABORT interrupt state. More... | |
| __STATIC_INLINE void | hw_i2c_reset_int_rx_done (HW_I2C_ID id) |
| Reset RX_DONE interrupt state. More... | |
| __STATIC_INLINE void | hw_i2c_reset_int_activity (HW_I2C_ID id) |
| Reset ACTIVITY interrupt state. More... | |
| __STATIC_INLINE void | hw_i2c_reset_int_start_detected (HW_I2C_ID id) |
| Reset START_DETECTED interrupt state. More... | |
| __STATIC_INLINE void | hw_i2c_reset_int_stop_detected (HW_I2C_ID id) |
| Reset STOP_DETECTED interrupt state. More... | |
| __STATIC_INLINE void | hw_i2c_reset_int_gen_call (HW_I2C_ID id) |
| Reset GENERAL_CALL interrupt state. More... | |
| __STATIC_INLINE uint32_t | hw_i2c_get_abort_source (HW_I2C_ID id) |
| Get abort source. More... | |
| __STATIC_INLINE void | hw_i2c_reset_abort_source (HW_I2C_ID id) |
| Reset abort source. More... | |
| __STATIC_INLINE void | hw_i2c_master_abort_transfer (HW_I2C_ID id) |
| Aborts I2C transfer. More... | |
| void | hw_i2c_prepare_dma (HW_I2C_ID id, uint8_t channel, void *data, uint16_t len, HW_I2C_DMA_TRANSFER type, hw_i2c_complete_cb cb, void *cb_data, uint32_t flags) |
| Prepares I2C DMA for transfer. More... | |
| void | hw_i2c_dma_start (HW_I2C_ID id) |
| Starts DMA transfer. More... | |
| void | hw_i2c_write_buffer_dma (HW_I2C_ID id, uint8_t channel, const uint16_t *data, uint16_t len, hw_i2c_complete_cb cb, void *cb_data, uint32_t flags) |
| Write multiple bytes on I2C bus using DMA. More... | |
| void | hw_i2c_read_buffer_dma (HW_I2C_ID id, uint8_t channel, uint8_t *data, uint16_t len, hw_i2c_complete_cb cb, void *cb_data, uint32_t flags) |
| Read multiple bytes from I2C bus using DMA. More... | |
I2C Controller.
| #define HW_I2C1 ((void *)I2C_BASE) |
I2C controller instance.
| #define HW_I2C_F_ADD_RESTART 0x00000004 |
Add Restart condition at the start of read or write
| #define HW_I2C_F_ADD_STOP 0x00000002 |
Add stop condition after read or write
| #define HW_I2C_F_NONE 0x00000000 |
No special command for the operation
| #define HW_I2C_F_WAIT_FOR_STOP 0x00000001 |
Operation will wait until stop condition occurs
| #define HW_I2C_I2C1_MADDR 0x01 |
I2C high speed master code. This bit field holds the value of the I2C HS mode master code. HS-mode master codes are reserved 8-bit codes (00001xxx) that are not used for slave addressing or other purposes. Each master has its unique master code. Up to eight high-speed mode masters can be present on the same I2C bus system. Valid values are from 0 to 7. This can be written only when the I2C interface is disabled, which corresponds to the IC_ENABLE[0] register being set to 0. Writes at other times have no effect.
| #define HW_I2C_REG_GETF | ( | id, | |
| reg, | |||
| field | |||
| ) | ((IBA(id)->reg##_REG & (I2C_##reg##_REG_##field##_Msk)) >> (I2C_##reg##_REG_##field##_Pos)) |
Get the value of an I2C register field.
| [in] | id | I2C controller instance |
| [in] | reg | the I2C register |
| [in] | field | the I2C register field |
| #define HW_I2C_REG_SET_FIELD | ( | reg, | |
| field, | |||
| var, | |||
| val | |||
| ) | REG_SET_FIELD(I2C, reg##_REG, field, var, val) |
Sets a field value of an I2C register. Aimed to be used with local variables.
| [in] | reg | the I2C register |
| [in] | field | the I2C register field |
| [out] | var | the local variable |
| [in] | val | the field value |
| #define HW_I2C_REG_SETF | ( | id, | |
| reg, | |||
| field, | |||
| val | |||
| ) |
Write a value to an I2C register field.
| [in] | id | I2C controller instance |
| [in] | reg | the I2C register |
| [in] | field | the I2C register field |
| [in] | val | value to be written |
| #define I2C_FIFO_DEPTH (4) |
TX/RX FIFO depth.
| #define I2C_SETUP | ( | id, | |
| seq | |||
| ) |
Wrapper to perform controller setup.
Controller will be disabled, then any code given as seq is executed and controller is enabled again.
| typedef void(* hw_i2c_complete_cb) (HW_I2C_ID id, void *cb_data, uint16_t len, bool success) |
Callback called upon completion of read or write in non-blocking mode (FIFO or DMA)
| [in] | id | I2C controller instance |
| [in] | cb_data | data passed by user along with callback |
| [in] | len | number of bytes transferred. In case of write failure this number is equal to the number of bytes written to I2C TX FIFO until the failure occurred. |
| [in] | success | operation status |
I2C DMA priority configuration.
| typedef void(* hw_i2c_event_cb) (HW_I2C_ID id, HW_I2C_EVENT event) |
Callback called on event when in slave mode.
| [in] | id | I2C controller instance |
| [in] | event | event identifier |
| typedef void(* hw_i2c_interrupt_cb) (HW_I2C_ID id, uint16_t mask) |
Callback called on interrupt from I2C controller.
| [in] | id | I2C controller instance |
| [in] | mask | interrupt events mask |
| enum HW_I2C_ABORT_SOURCE |
I2C abort source.
| enum HW_I2C_ADDRESSING |
| enum HW_I2C_DMA_TRANSFER |
DMA transfer type.
| enum HW_I2C_EVENT |
| enum HW_I2C_INT |
I2C interrupt source.
Can be used as bitmask.
| Enumerator | |
|---|---|
| HW_I2C_INT_RX_UNDERFLOW | attempt to read from empty RX FIFO has been made |
| HW_I2C_INT_RX_OVERFLOW | RX FIFO is full but new data are incoming and being discarded |
| HW_I2C_INT_RX_FULL | RX FIFO level is equal or above threshold set by hw_i2c_set_rx_fifo_threshold() |
| HW_I2C_INT_TX_OVERFLOW | attempt to write to TX FIFO which is already full |
| HW_I2C_INT_TX_EMPTY | TX FIFO level is equal or below threshold set by hw_i2c_set_tx_fifo_threshold() |
| HW_I2C_INT_READ_REQUEST | (slave only) I2C master attempts to read data |
| HW_I2C_INT_TX_ABORT | TX cannot be completed
|
| HW_I2C_INT_RX_DONE | (slave only) I2C master did not acknowledge transmitted byte |
| HW_I2C_INT_ACTIVITY | any I2C activity occurred |
| HW_I2C_INT_STOP_DETECTED | STOP condition occurred |
| HW_I2C_INT_START_DETECTED | START/RESTART condition occurred |
| HW_I2C_INT_GENERAL_CALL | (slave only) General Call address received |
| enum HW_I2C_MODE |
| enum HW_I2C_SPEED |
| void hw_i2c_configure | ( | HW_I2C_ID | id, |
| const i2c_config * | cfg | ||
| ) |
Configure I2C controller.
Shortcut to configure most common I2C controller parameters.
cfg set to NULL, I2C clock (SCL) will be configured using default values.| [in] | id | I2C controller instance |
| [in] | cfg | configuration |
| __STATIC_INLINE bool hw_i2c_controler_is_busy | ( | HW_I2C_ID | id | ) |
Check controller activity.
| [in] | id | I2C controller instance |
| void hw_i2c_deinit | ( | HW_I2C_ID | id | ) |
DeInitialize I2C controller.
| [in] | id | I2C controller instance |
| void hw_i2c_disable | ( | HW_I2C_ID | id | ) |
Disable I2C controller.
| [in] | id | I2C controller instance |
| void hw_i2c_disable_clk | ( | const HW_I2C_ID | id | ) |
Disable I2C clock.
| [in] | id | I2C controller instance. |
| void hw_i2c_dma_start | ( | HW_I2C_ID | id | ) |
Starts DMA transfer.
Should be called once I2C DMA is setup using hw_i2c_prepare_dma(). Once started, DMA transfer will only finish once previously specified number of bytes is read or written.
| [in] | id | I2C controller instance |
| __STATIC_INLINE void hw_i2c_enable | ( | HW_I2C_ID | id | ) |
Enable I2C controller.
hw_i2c_init() shall be called before enabling I2C controller.
| [in] | id | I2C controller instance |
| void hw_i2c_enable_clk | ( | const HW_I2C_ID | id | ) |
Enable I2C clock.
| [in] | id | I2C controller instance. |
| __STATIC_INLINE void hw_i2c_flush_rx_fifo | ( | HW_I2C_ID | id | ) |
Flushing RX FIFO.
| [in] | id | I2C controller instance |
| __STATIC_INLINE uint32_t hw_i2c_get_abort_source | ( | HW_I2C_ID | id | ) |
Get abort source.
This can be used to retrieve source of TX_ABORT interrupt. TX FIFO is flushed and remains in this state until cleared using hw_i2c_reset_abort_source().
| [in] | id | I2C controller instance |
| __STATIC_INLINE uint16_t hw_i2c_get_enable_status | ( | HW_I2C_ID | id | ) |
Get I2C Controller Enable status.
| uint16_t hw_i2c_get_int_mask | ( | HW_I2C_ID | id | ) |
Get current bitmask of requested interrupt events.
| [in] | id | I2C controller instance |
| __STATIC_INLINE uint16_t hw_i2c_get_int_state | ( | HW_I2C_ID | id | ) |
Get interrupt state.
Interrupt state returned includes only interrupts which are not masked. For raw interrupt status use hw_i2c_get_raw_int_state().
| [in] | id | I2C controller instance |
| __STATIC_INLINE uint16_t hw_i2c_get_raw_int_state | ( | HW_I2C_ID | id | ) |
Get raw interrupt state.
| [in] | id | I2C controller instance |
| __STATIC_INLINE uint8_t hw_i2c_get_rx_fifo_level | ( | HW_I2C_ID | id | ) |
Get number of bytes in RX FIFO.
| [in] | id | I2C controller instance |
| __STATIC_INLINE uint8_t hw_i2c_get_rx_fifo_threshold | ( | HW_I2C_ID | id | ) |
Get threshold level on RX FIFO.
| [in] | id | I2C controller instance |
| __STATIC_INLINE uint8_t hw_i2c_get_tx_fifo_level | ( | HW_I2C_ID | id | ) |
Get number of bytes in TX FIFO.
| [in] | id | I2C controller instance |
| __STATIC_INLINE uint8_t hw_i2c_get_tx_fifo_threshold | ( | HW_I2C_ID | id | ) |
Get threshold level on TX FIFO.
| [in] | id | I2C controller instance |
| void hw_i2c_init | ( | HW_I2C_ID | id, |
| const i2c_config * | cfg | ||
| ) |
Initialize I2C controller.
I2C controller is disabled, clock and interrupt for I2C component are enabled, all interrupts are masked though. cfg can be NULL if no configuration should be performed.
cfg set to NULL, I2C clock (SCL) will be configured using default values.| [in] | id | I2C controller instance |
| [in] | cfg | configuration |
| bool hw_i2c_is_clk_enabled | ( | const HW_I2C_ID | id | ) |
Get the status of the I2C interface clock source.
| [in] | id | I2C controller instance. |
| false | if I2C interface clock source is disabled, |
| true | otherwise |
| __STATIC_INLINE bool hw_i2c_is_enabled | ( | HW_I2C_ID | id | ) |
Get I2C controller enable status.
| [in] | id | I2C controller instance |
| true | if I2C controller is enabled, |
| false | otherwise |
| __STATIC_INLINE uint8_t hw_i2c_is_master | ( | HW_I2C_ID | id | ) |
Get I2C controller master mode status.
| [in] | id | I2C controller instance |
| __STATIC_INLINE bool hw_i2c_is_master_busy | ( | HW_I2C_ID | id | ) |
Check if controller is busy when operating in master mode.
| [in] | id | I2C controller instance |
| bool hw_i2c_is_occupied | ( | HW_I2C_ID | id | ) |
Get I2C controller occupied status.
This function checks if the I2C controller is occupied by an ongoing operation waiting for an interrupt to hit in order to complete the operation.
| [in] | id | I2C controller instance |
| __STATIC_INLINE bool hw_i2c_is_rx_fifo_full | ( | HW_I2C_ID | id | ) |
Check if RX FIFO queue is full.
This function should be used to check if RX FIFO is filled, i.e. subsequent data read will be discarded.
| [in] | id | I2C controller instance |
| __STATIC_INLINE bool hw_i2c_is_rx_fifo_not_empty | ( | HW_I2C_ID | id | ) |
Check if RX FIFO is not empty.
This function should be used to check if there are any data received in RX FIFO
| [in] | id | I2C controller instance |
| __STATIC_INLINE bool hw_i2c_is_slave_busy | ( | HW_I2C_ID | id | ) |
Check if controller is busy when operating in slave mode.
| [in] | id | I2C controller instance |
| __STATIC_INLINE bool hw_i2c_is_tx_fifo_empty | ( | HW_I2C_ID | id | ) |
Check if TX FIFO queue is empty.
This function should be used to check if all data written to TX FIFO were transmitted.
| [in] | id | I2C controller instance |
| __STATIC_INLINE bool hw_i2c_is_tx_fifo_not_full | ( | HW_I2C_ID | id | ) |
Check if TX FIFO is not full.
This function should be used to check if data can be written to TX FIFO.
| [in] | id | I2C controller instance |
| __STATIC_INLINE void hw_i2c_master_abort_transfer | ( | HW_I2C_ID | id | ) |
Aborts I2C transfer.
This forces master to issue a STOP command and flush the TX fifo.
| [in] | id | I2C controller instance |
| void hw_i2c_prepare_dma | ( | HW_I2C_ID | id, |
| uint8_t | channel, | ||
| void * | data, | ||
| uint16_t | len, | ||
| HW_I2C_DMA_TRANSFER | type, | ||
| hw_i2c_complete_cb | cb, | ||
| void * | cb_data, | ||
| uint32_t | flags | ||
| ) |
Prepares I2C DMA for transfer.
This "extended functionality" variant of hw_i2c_prepare_dma() adds the notify_on_stop parameter.
Use hw_i2c_dma_start() to start actual data transfer.
channel specifies either of channels in RX/TX pair used for transfer, i.e. channel=0|1 means channels 0 and 1 will be used, channel=2|3 means channels 2 and 3 will be used and so on. Once DMA is prepared, no other application should make changes to either of channels.
data buffer elements are 16-bit wide, this high byte should be 0 for writing and discarded when reading.
Callback is called once DMA transfer between buffer and RX/TX FIFOs is completed which means that there could still be activity on I2C bus. Application can check when transfer is completed using other means, i.e. STOP_DETECTED interrupt.
| [in] | id | I2C controller instance |
| [in] | channel | DMA channel |
| [in] | data | buffer to read from or write to, depends on type |
| [in] | len | length of buffer |
| [in] | type | type of transfer |
| [in] | cb | callback for transfer completed |
| [in] | cb_data | data to pass to cb |
| [in] | flags | Possible values for flags are: HW_I2C_F_NONE HW_I2C_F_WAIT_FOR_STOP HW_I2C_F_ADD_STOP HW_I2C_F_ADD_RESTART |
| int hw_i2c_read_buffer_async | ( | HW_I2C_ID | id, |
| uint8_t * | data, | ||
| uint16_t | len, | ||
| hw_i2c_complete_cb | cb, | ||
| void * | cb_data, | ||
| uint32_t | flags | ||
| ) |
Read multiple bytes from I2C slave asynchronously.
This function will read multiple bytes from bus taking care of RX FIFO control. This call is non-blocking and specified callback is called upon completion, with the operation status. The operation completes when the complete buffer is filled, or in case of a failure. In case of failure the failure cause must be read from the cb by calling hw_i2c_get_abort_source().
| [in] | id | I2C controller |
| [in,out] | data | Address of the buffer where data are stored |
| [in] | len | Length of the data buffer |
| [in] | cb | Callback to be called upon completion |
| [in] | cb_data | Data to pass to cb |
| [in] | flags | Possible values for flags are: HW_I2C_F_NONE HW_I2C_F_ADD_STOP HW_I2C_F_ADD_RESTART |
| void hw_i2c_read_buffer_dma | ( | HW_I2C_ID | id, |
| uint8_t | channel, | ||
| uint8_t * | data, | ||
| uint16_t | len, | ||
| hw_i2c_complete_cb | cb, | ||
| void * | cb_data, | ||
| uint32_t | flags | ||
| ) |
Read multiple bytes from I2C bus using DMA.
This function uses the common callback type, which provides a way to signal whether the read finished successfully.
Shortcut for calling hw_i2c_prepare_dma() and hw_i2c_dma_start().
| [in] | id | I2C controller instance |
| [in] | channel | DMA channel |
| [out] | data | buffer to put data read from I2C bus |
| [in] | len | length of buffer |
| [in] | cb | callback for transfer completed |
| [in] | cb_data | data to pass to cb |
| [in] | flags | Possible values for flags are: HW_I2C_F_NONE HW_I2C_F_ADD_STOP HW_I2C_F_ADD_RESTART |
| size_t hw_i2c_read_buffer_sync | ( | HW_I2C_ID | id, |
| uint8_t * | data, | ||
| uint16_t | len, | ||
| HW_I2C_ABORT_SOURCE * | abrt_code, | ||
| uint32_t | flags | ||
| ) |
Read multiple bytes from I2C slave synchronously.
This function will read multiple bytes from bus taking care of RX FIFO control. This call blocks until the operation completes. The operation completes when the complete buffer is filled, or in case of a failure. Failures are cleared by the function before returning.
| [in] | id | I2C controller |
| [in,out] | data | Address of the buffer where data are stored |
| [in] | len | Length of the data buffer |
| [in,out] | abrt_code | If not NULL, the status of the operation based on HW_I2C_ABORT_SOURCE enumeration will be stored here |
| [in] | flags | Possible values for flags are: HW_I2C_F_NONE HW_I2C_F_ADD_STOP HW_I2C_F_ADD_RESTART |
| __STATIC_INLINE uint8_t hw_i2c_read_byte | ( | HW_I2C_ID | id | ) |
Read single byte from RX FIFO.
It is caller's responsibility to ensure there is data to read in RX FIFO before calling this function by checking either hw_i2c_get_rx_fifo_level() or hw_i2c_rx_fifo_not_empty().
This function can be used in both master and slave modes.
| [in] | id | I2C controller instance |
| __STATIC_INLINE void hw_i2c_read_byte_trigger | ( | HW_I2C_ID | id | ) |
Initiate reading from I2C bus.
No data is read via this call, only START/RESTART condition is generated on bus if required. Actual data is read by controller and put in RX FIFO which can be read using hw_i2c_read_byte().
This function should be only used when operating in master mode.
| [in] | id | I2C controller instance |
| void hw_i2c_register_int | ( | HW_I2C_ID | id, |
| hw_i2c_interrupt_cb | cb, | ||
| uint16_t | mask | ||
| ) |
Register interrupt handler.
| [in] | id | I2C controller instance |
| [in] | cb | callback function |
| [in] | mask | initial bitmask of requested interrupt events |
| void hw_i2c_register_slave_dma_read_callback | ( | HW_I2C_ID | id | ) |
Register proper handling for DMA read in slave mode.
This function must be called after DMA has been setup for reading in slave mode.
| [in] | id | I2C controller instance |
| __STATIC_INLINE void hw_i2c_reset_abort_source | ( | HW_I2C_ID | id | ) |
Reset abort source.
This clears TX_ABORT interrupt status and unlocks TX FIFO.
| [in] | id | I2C controller instance |
| void hw_i2c_reset_dma_cb | ( | HW_I2C_ID | id | ) |
Reset DMA callback.
This function sets DMA callback to NULL.
| [in] | id | I2C controller instance |
| __STATIC_INLINE void hw_i2c_reset_int_activity | ( | HW_I2C_ID | id | ) |
Reset ACTIVITY interrupt state.
Should be used to reset ACTIVITY interrupt.
| [in] | id | I2C controller instance |
| __STATIC_INLINE void hw_i2c_reset_int_all | ( | HW_I2C_ID | id | ) |
Reset all interrupt state.
This does reset all interrupts which can be reset by software and TX_ABORT status.
| [in] | id | I2C controller instance |
| __STATIC_INLINE void hw_i2c_reset_int_gen_call | ( | HW_I2C_ID | id | ) |
Reset GENERAL_CALL interrupt state.
Should be used to reset GENERAL_CALL interrupt.
| [in] | id | I2C controller instance |
| __STATIC_INLINE void hw_i2c_reset_int_read_request | ( | HW_I2C_ID | id | ) |
Reset READ_REQUEST interrupt state.
Should be used to reset READ_REQUEST interrupt.
| [in] | id | I2C controller instance |
| __STATIC_INLINE void hw_i2c_reset_int_rx_done | ( | HW_I2C_ID | id | ) |
Reset RX_DONE interrupt state.
Should be used to reset RX_DONE interrupt.
| [in] | id | I2C controller instance |
| __STATIC_INLINE void hw_i2c_reset_int_rx_overflow | ( | HW_I2C_ID | id | ) |
Reset RX_OVERFLOW interrupt state.
Should be used to reset RX_OVERFLOW interrupt.
| [in] | id | I2C controller instance |
| __STATIC_INLINE void hw_i2c_reset_int_rx_underflow | ( | HW_I2C_ID | id | ) |
Reset RX_UNDERFLOW interrupt state.
Should be used to reset RX_UNDERFLOW interrupt.
| [in] | id | I2C controller instance |
| __STATIC_INLINE void hw_i2c_reset_int_start_detected | ( | HW_I2C_ID | id | ) |
Reset START_DETECTED interrupt state.
Should be used to reset START_DETECTED interrupt.
| [in] | id | I2C controller instance |
| __STATIC_INLINE void hw_i2c_reset_int_stop_detected | ( | HW_I2C_ID | id | ) |
Reset STOP_DETECTED interrupt state.
Should be used to reset STOP_DETECTED interrupt.
| [in] | id | I2C controller instance |
| __STATIC_INLINE void hw_i2c_reset_int_tx_abort | ( | HW_I2C_ID | id | ) |
Reset TX_ABORT interrupt state.
Should be used to reset TX_ABORT interrupt.
| [in] | id | I2C controller instance |
| __STATIC_INLINE void hw_i2c_reset_int_tx_overflow | ( | HW_I2C_ID | id | ) |
Reset TX_OVERFLOW interrupt state.
Should be used to reset TX_OVERFLOW interrupt.
| [in] | id | I2C controller instance |
| __STATIC_INLINE void hw_i2c_set_general_call_ack_enabled | ( | HW_I2C_ID | id, |
| bool | ack | ||
| ) |
Set support for general call acknowledgment.
When enabled, controller will send ACK for general call address. This applies only to controller working in slave mode.
| [in] | id | I2C controller instance |
| [in] | ack | acknowledgment status |
| __STATIC_INLINE void hw_i2c_set_general_call_enabled | ( | HW_I2C_ID | id, |
| bool | enabled | ||
| ) |
Set whether General Call should be used to address slaves.
Can only be changed when controller is disabled.
| [in] | id | I2C controller instance |
| [in] | enabled | General Call status to be set |
| void hw_i2c_set_int_mask | ( | HW_I2C_ID | id, |
| uint16_t | mask | ||
| ) |
Set bitmask of requested interrupt events.
| [in] | id | I2C controller instance |
| [in] | mask | bitmask of requested interrupt events |
| __STATIC_INLINE void hw_i2c_set_mode | ( | HW_I2C_ID | id, |
| HW_I2C_MODE | mode | ||
| ) |
Set I2C controller mode.
Can be only set when controller is disabled.
| [in] | id | I2C controller instance |
| [in] | mode | mode to be set |
| __STATIC_INLINE void hw_i2c_set_restart_enabled | ( | HW_I2C_ID | id, |
| bool | enabled | ||
| ) |
Set whether RESTART conditions may be sent when acting as master.
| [in] | id | I2C controller instance |
| [in] | enabled | RESTART status to be set |
| __STATIC_INLINE void hw_i2c_set_rx_fifo_threshold | ( | HW_I2C_ID | id, |
| uint8_t | level | ||
| ) |
Set threshold level on RX FIFO.
An interrupt will be generated once number of entries in RX FIFO is greater than level. This cannot be set to value greater than HW_I2C_FIFO_DEPTH.
| [in] | id | I2C controller instance |
| [in] | level | threshold |
| __STATIC_INLINE void hw_i2c_set_slave_address | ( | HW_I2C_ID | id, |
| uint16_t | address | ||
| ) |
Set slave address in slave mode.
Can be only set when controller is disabled.
| [in] | id | I2C controller instance |
| [in] | address | slave address |
| __STATIC_INLINE void hw_i2c_set_slave_addressing_mode | ( | HW_I2C_ID | id, |
| HW_I2C_ADDRESSING | addr_mode | ||
| ) |
Set slave addressing mode in slave mode.
Can be only set when controller is disabled.
| [in] | id | I2C controller instance |
| [in] | addr_mode | mode of addressing |
| void hw_i2c_set_slave_callback | ( | HW_I2C_ID | id, |
| hw_i2c_event_cb | cb | ||
| ) |
Setup callback function for operation in slave mode.
| [in] | id | I2C controller instance |
| [in] | cb | callback for events |
| __STATIC_INLINE void hw_i2c_set_speed | ( | HW_I2C_ID | id, |
| HW_I2C_SPEED | speed | ||
| ) |
Set I2C interface bus speed.
Can be only set when controller is disabled.
| [in] | id | I2C controller instance |
| [in] | speed | speed to be set |
| __STATIC_INLINE void hw_i2c_set_target_address | ( | HW_I2C_ID | id, |
| uint16_t | address | ||
| ) |
Set target slave address in master mode.
| [in] | id | I2C controller instance |
| [in] | address | slave address |
| __STATIC_INLINE void hw_i2c_set_target_addressing_mode | ( | HW_I2C_ID | id, |
| HW_I2C_ADDRESSING | addr_mode | ||
| ) |
Set target slave addressing mode in master mode.
Can only be changed when controller is disabled.
| [in] | id | I2C controller instance |
| [in] | addr_mode | mode of addressing |
| __STATIC_INLINE void hw_i2c_set_tx_fifo_threshold | ( | HW_I2C_ID | id, |
| uint8_t | level | ||
| ) |
Set threshold level on TX FIFO.
An interrupt will be generated once number of entries in TX FIFO is less or equal to level. This cannot be set to value greater than HW_I2C_FIFO_DEPTH.
| [in] | id | I2C controller instance |
| [in] | level | threshold |
| void hw_i2c_setup_master | ( | HW_I2C_ID | id, |
| HW_I2C_ADDRESSING | addr_mode, | ||
| uint16_t | address | ||
| ) |
Setup controller for operation in master mode.
Shortcut for calling hw_i2c_set_mode(), hw_i2c_set_target_addressing_mode() and hw_i2c_set_target_address().
| [in] | id | I2C controller instance |
| [in] | addr_mode | mode of addressing |
| [in] | address | target slave address |
| void hw_i2c_setup_slave | ( | HW_I2C_ID | id, |
| HW_I2C_ADDRESSING | addr_mode, | ||
| uint16_t | address, | ||
| hw_i2c_event_cb | cb | ||
| ) |
Setup controller for operation in slave mode.
Shortcut for calling hw_i2c_set_mode(), hw_i2c_set_slave_addressing_mode() and hw_i2c_set_slave_address().
| [in] | id | I2C controller instance |
| [in] | addr_mode | mode of addressing |
| [in] | address | slave address |
| [in] | cb | callback for events |
| void hw_i2c_unregister_int | ( | HW_I2C_ID | id | ) |
Unregister interrupt handler.
This function disables all I2C interrupts by masking them. In addition it clears any pending ones on the ARM core. The status of RAW_INTR_STAT_REG remains unchanged.
| [in] | id | I2C controller instance |
| int hw_i2c_write_buffer_async | ( | HW_I2C_ID | id, |
| const uint8_t * | data, | ||
| uint16_t | len, | ||
| hw_i2c_complete_cb | cb, | ||
| void * | cb_data, | ||
| uint32_t | flags | ||
| ) |
Write multiple bytes to I2C slave asynchronously.
Writes array of data to a slave device on the I2C bus via the TX FIFO. This call is non-blocking and specified callback is called upon completion, with the operation status. In case of failure the failure cause must be read from the cb by calling hw_i2c_get_abort_source().
| [in] | id | I2C controller instance |
| [in] | data | Address of the buffer containing the data to write |
| [in] | len | Length of the data buffer |
| [in] | cb | Callback to be called upon completion |
| [in] | cb_data | Data to pass to cb |
| [in] | flags | Possible values for flags are: HW_I2C_F_NONE HW_I2C_F_WAIT_FOR_STOP HW_I2C_F_ADD_STOP HW_I2C_F_ADD_RESTART |
| void hw_i2c_write_buffer_dma | ( | HW_I2C_ID | id, |
| uint8_t | channel, | ||
| const uint16_t * | data, | ||
| uint16_t | len, | ||
| hw_i2c_complete_cb | cb, | ||
| void * | cb_data, | ||
| uint32_t | flags | ||
| ) |
Write multiple bytes on I2C bus using DMA.
Shortcut for calling hw_i2c_prepare_dma() and hw_i2c_dma_start().
| [in] | id | I2C controller instance |
| [in] | channel | DMA channel |
| [in] | data | buffer to write data to |
| [in] | len | length of buffer |
| [in] | cb | callback for transfer completed |
| [in] | cb_data | data to pass to cb |
| [in] | flags | Possible values for flags are: HW_I2C_F_NONE HW_I2C_F_WAIT_FOR_STOP HW_I2C_F_ADD_STOP HW_I2C_F_ADD_RESTART |
| size_t hw_i2c_write_buffer_sync | ( | HW_I2C_ID | id, |
| const uint8_t * | data, | ||
| uint16_t | len, | ||
| HW_I2C_ABORT_SOURCE * | abrt_code, | ||
| uint32_t | flags | ||
| ) |
Write multiple bytes to I2C slave synchronously.
Writes array of data to a slave device on the I2C bus via the TX FIFO. This call blocks until the operation completes. In case of failure the function stores the Tx error code to the abrt_code parameter -if provided- and clears the Tx Abort register.
| [in] | id | I2C controller instance |
| [in] | data | Address of the buffer containing the data to write |
| [in] | len | Length of the data buffer |
| [in,out] | abrt_code | If not NULL, the status of the operation based on HW_I2C_ABORT_SOURCE enumeration will be stored here |
| [in] | flags | Possible values for flags are: HW_I2C_F_NONE HW_I2C_F_WAIT_FOR_STOP HW_I2C_F_ADD_STOP HW_I2C_F_ADD_RESTART |
| __STATIC_INLINE void hw_i2c_write_byte | ( | HW_I2C_ID | id, |
| uint8_t | byte | ||
| ) |
Write single byte into TX FIFO.
It is caller's responsibility to ensure there is free space in TX FIFO before calling this function - either hw_i2c_is_tx_fifo_not_full() or hw_i2c_get_tx_fifo_level() can be used for this purpose.
This function can be used in both master and slave modes.
| [in] | id | I2C controller instance |
| [in] | byte | data to write |
| int hw_i2c_write_then_read_async | ( | HW_I2C_ID | id, |
| const uint8_t * | w_data, | ||
| uint16_t | w_len, | ||
| uint8_t * | r_data, | ||
| uint16_t | r_len, | ||
| hw_i2c_complete_cb | cb, | ||
| void * | cb_data, | ||
| uint32_t | flags | ||
| ) |
Write then read multiple bytes from I2C slave.
This function allows to perform typical I2C transaction. This call is non-blocking and specified callback is called upon completion, with the operation status. In case of failure the failure cause must be read from the cb by calling hw_i2c_get_abort_source().
| [in] | id | I2C controller |
| [in] | w_data | Address of the buffer containing the data to write |
| [in] | w_len | Length of the buffer containing the data to write |
| [in,out] | r_data | Address of the buffer where data will be stored |
| [in] | r_len | Length of the buffer where data will be stored |
| [in] | cb | Callback to be called upon completion |
| [in] | cb_data | Data to pass to cb |
| [in] | flags | Possible values for flags are: HW_I2C_F_NONE HW_I2C_F_ADD_STOP HW_I2C_F_ADD_RESTART |
1.8.16