@@ -342,7 +342,7 @@ static inline void i2c_ll_get_intr_mask(i2c_dev_t *hw, uint32_t *intr_status)
342342 *
343343 * @return None
344344 */
345- static inline void i2c_ll_slave_set_fifo_mode (i2c_dev_t * hw , bool fifo_mode_en )
345+ static inline void i2c_ll_enable_fifo_mode (i2c_dev_t * hw , bool fifo_mode_en )
346346{
347347 hw -> fifo_conf .nonfifo_en = fifo_mode_en ? 0 : 1 ;
348348}
@@ -361,7 +361,7 @@ static inline void i2c_ll_set_tout(i2c_dev_t *hw, int tout)
361361}
362362
363363/**
364- * @brief Configure I2C slave broadcasting mode.
364+ * @brief Enable the I2C slave to respond to broadcast address
365365 *
366366 * @param hw Beginning address of the peripheral registers
367367 * @param broadcast_en Set true to enable broadcast, else, set it false
@@ -495,6 +495,7 @@ static inline void i2c_ll_set_sda_timing(i2c_dev_t *hw, int sda_sample, int sda_
495495 */
496496static inline void i2c_ll_set_txfifo_empty_thr (i2c_dev_t * hw , uint8_t empty_thr )
497497{
498+ hw -> fifo_conf .fifo_prt_en = 1 ;
498499 hw -> fifo_conf .tx_fifo_wm_thrhd = empty_thr ;
499500}
500501
@@ -509,6 +510,7 @@ static inline void i2c_ll_set_txfifo_empty_thr(i2c_dev_t *hw, uint8_t empty_thr)
509510static inline void i2c_ll_set_rxfifo_full_thr (i2c_dev_t * hw , uint8_t full_thr )
510511{
511512 hw -> fifo_conf .fifo_prt_en = 1 ;
513+ hw -> ctr .rx_full_ack_level = 0 ;
512514 hw -> fifo_conf .rx_fifo_wm_thrhd = full_thr ;
513515}
514516
@@ -625,7 +627,7 @@ static inline void i2c_ll_get_tout(i2c_dev_t *hw, int *timeout)
625627 * @return None
626628 */
627629__attribute__((always_inline ))
628- static inline void i2c_ll_master_trans_start (i2c_dev_t * hw )
630+ static inline void i2c_ll_start_trans (i2c_dev_t * hw )
629631{
630632 hw -> ctr .trans_start = 1 ;
631633}
@@ -673,7 +675,7 @@ __attribute__((always_inline))
673675static inline void i2c_ll_write_txfifo (i2c_dev_t * hw , const uint8_t * ptr , uint8_t len )
674676{
675677 for (int i = 0 ; i < len ; i ++ ) {
676- HAL_FORCE_MODIFY_U32_REG_FIELD ( hw -> fifo_data , data , ptr [i ]) ;
678+ hw -> fifo_data . val = ptr [i ];
677679 }
678680}
679681
@@ -695,44 +697,46 @@ static inline void i2c_ll_read_rxfifo(i2c_dev_t *hw, uint8_t *ptr, uint8_t len)
695697}
696698
697699/**
698- * @brief Write the I2C hardware txFIFO
700+ * @brief Write to the TX RAM by direct address
699701 *
700702 * @param hw Beginning address of the peripheral registers
701703 * @param ram_offset Offset value of I2C RAM.
702704 * @param ptr Pointer to data buffer
703705 * @param len Amount of data needs to be written
704706 */
705- static inline void i2c_ll_write_by_nonfifo (i2c_dev_t * hw , uint8_t ram_offset , const uint8_t * ptr , uint8_t len )
707+ static inline void i2c_ll_write_tx_by_nonfifo (i2c_dev_t * hw , uint8_t ram_offset , const uint8_t * ptr , uint8_t len )
706708{
707709 for (int i = 0 ; i < len ; i ++ ) {
708710 hw -> txfifo_mem [i + ram_offset ] = ptr [i ];
709711 }
710712}
711713
712714/**
713- * @brief Read the I2C hardware ram
715+ * @brief Read from the RX RAM by direct address
714716 *
715717 * @param hw Beginning address of the peripheral registers
716718 * @param ram_offset Offset value of I2C RAM.
717719 * @param ptr Pointer to data buffer
718720 * @param len Amount of data needs read
719721 */
720- static inline void i2c_ll_read_by_nonfifo (i2c_dev_t * hw , uint8_t ram_offset , uint8_t * ptr , uint8_t len )
722+ static inline void i2c_ll_read_rx_by_nonfifo (i2c_dev_t * hw , uint8_t ram_offset , uint8_t * ptr , uint8_t len )
721723{
722724 for (int i = 0 ; i < len ; i ++ ) {
723725 ptr [i ] = hw -> rxfifo_mem [i + ram_offset ];
724726 }
725727}
726728
727729/**
728- * @brief Get access to I2C RAM address directly
730+ * @brief Enable I2C slave dual addressing mode
731+ *
732+ * @note When enable the dual addressing mode, I2C RAM must be accessed in non-FIFO mode
729733 *
730734 * @param hw Beginning address of the peripheral registers
731735 * @param addr_wr_en Enable I2C ram address read and write
732736 *
733737 * @return None
734738*/
735- static inline void i2c_ll_enable_mem_access_nonfifo (i2c_dev_t * hw , bool addr_wr_en )
739+ static inline void i2c_ll_slave_enable_dual_addressing_mode (i2c_dev_t * hw , bool addr_wr_en )
736740{
737741 hw -> fifo_conf .fifo_addr_cfg_en = addr_wr_en ;
738742}
@@ -874,16 +878,15 @@ static inline void i2c_ll_slave_init(i2c_dev_t *hw)
874878 ctrl_reg .sda_force_out = 1 ;
875879 ctrl_reg .scl_force_out = 1 ;
876880 hw -> ctr .val = ctrl_reg .val ;
877- hw -> fifo_conf .fifo_addr_cfg_en = 0 ;
878881}
879882
880883/**
881- * @brief Set whether slave should auto start, or only start with start signal from master
884+ * @brief Enable I2C slave to automatically send data when addressed by the master
882885 *
883886 * @param hw Beginning address of the peripheral registers
884887 * @param slv_ex_auto_en 1 if slave auto start data transaction, otherwise, 0.
885888 */
886- static inline void i2c_ll_slave_tx_auto_start_en (i2c_dev_t * hw , bool slv_ex_auto_en )
889+ static inline void i2c_ll_slave_enable_auto_start (i2c_dev_t * hw , bool slv_ex_auto_en )
887890{
888891 hw -> ctr .slv_tx_auto_start_en = slv_ex_auto_en ;
889892}
0 commit comments