From a7935539b55eac34cd026fde2705b0f463204efe Mon Sep 17 00:00:00 2001 From: songruojing Date: Fri, 25 Feb 2022 15:44:28 +0800 Subject: [PATCH] i2c: Correct hal functions iram placement and remove IRAM_ATTR for i2c_hw_fsm_reset Closes https://github.com/espressif/esp-idf/issues/8422 Closes https://github.com/espressif/esp-idf/issues/7249 (cherry picked from commit 1ceb7c8cd6f2b5a2c6513eaf51658d51ae5e9088) --- components/driver/i2c.c | 2 +- components/hal/i2c_hal.c | 20 -------------------- components/hal/i2c_hal_iram.c | 20 ++++++++++++++++++++ 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/components/driver/i2c.c b/components/driver/i2c.c index 9dfc16ac5e7a..06a74acb1ff3 100644 --- a/components/driver/i2c.c +++ b/components/driver/i2c.c @@ -200,7 +200,7 @@ static i2c_clk_alloc_t i2c_clk_alloc[I2C_SCLK_MAX] = { static i2c_obj_t *p_i2c_obj[I2C_NUM_MAX] = {0}; static void i2c_isr_handler_default(void *arg); static void IRAM_ATTR i2c_master_cmd_begin_static(i2c_port_t i2c_num); -static esp_err_t IRAM_ATTR i2c_hw_fsm_reset(i2c_port_t i2c_num); +static esp_err_t i2c_hw_fsm_reset(i2c_port_t i2c_num); static void i2c_hw_disable(i2c_port_t i2c_num) { diff --git a/components/hal/i2c_hal.c b/components/hal/i2c_hal.c index 2d975d8c996f..db2dd1a7e112 100644 --- a/components/hal/i2c_hal.c +++ b/components/hal/i2c_hal.c @@ -144,26 +144,11 @@ bool i2c_hal_is_master_mode(i2c_hal_context_t *hal) return i2c_ll_is_master_mode(hal->dev); } -void i2c_hal_get_rxfifo_cnt(i2c_hal_context_t *hal, uint32_t *len) -{ - *len = i2c_ll_get_rxfifo_cnt(hal->dev); -} - -void i2c_hal_get_txfifo_cnt(i2c_hal_context_t *hal, uint32_t *len) -{ - *len = i2c_ll_get_txfifo_len(hal->dev); -} - void i2c_hal_enable_slave_tx_it(i2c_hal_context_t *hal) { i2c_ll_slave_enable_tx_it(hal->dev); } -void i2c_hal_disable_slave_tx_it(i2c_hal_context_t *hal) -{ - i2c_ll_slave_disable_tx_it(hal->dev); -} - void i2c_hal_enable_slave_rx_it(i2c_hal_context_t *hal) { i2c_ll_slave_enable_rx_it(hal->dev); @@ -218,8 +203,3 @@ void i2c_hal_master_init(i2c_hal_context_t *hal, int i2c_num) i2c_ll_txfifo_rst(hal->dev); i2c_ll_rxfifo_rst(hal->dev); } - -void i2c_hal_update_config(i2c_hal_context_t *hal) -{ - i2c_ll_update(hal->dev); -} diff --git a/components/hal/i2c_hal_iram.c b/components/hal/i2c_hal_iram.c index 80c490009bf4..197143ae14e1 100644 --- a/components/hal/i2c_hal_iram.c +++ b/components/hal/i2c_hal_iram.c @@ -42,3 +42,23 @@ void i2c_hal_slave_handle_event(i2c_hal_context_t *hal, i2c_intr_event_t *event) { i2c_ll_slave_get_event(hal->dev, event); } + +void i2c_hal_disable_slave_tx_it(i2c_hal_context_t *hal) +{ + i2c_ll_slave_disable_tx_it(hal->dev); +} + +void i2c_hal_update_config(i2c_hal_context_t *hal) +{ + i2c_ll_update(hal->dev); +} + +void i2c_hal_get_rxfifo_cnt(i2c_hal_context_t *hal, uint32_t *len) +{ + *len = i2c_ll_get_rxfifo_cnt(hal->dev); +} + +void i2c_hal_get_txfifo_cnt(i2c_hal_context_t *hal, uint32_t *len) +{ + *len = i2c_ll_get_txfifo_len(hal->dev); +}