Merge branch 'bugfix/fix_iram_handler_call_inline_func' into 'release/v4.1'

Bugfix/fix iram handler call inline function uart_ll_is_tx_idle in flash (v4.1)

See merge request espressif/esp-idf!9951
This commit is contained in:
Michael (XIAO Xufeng)
2020-11-23 12:16:57 +08:00

View File

@@ -19,6 +19,7 @@
#pragma once #pragma once
#include "hal/uart_types.h" #include "hal/uart_types.h"
#include "soc/uart_periph.h" #include "soc/uart_periph.h"
#include "esp_attr.h"
// The default fifo depth // The default fifo depth
#define UART_LL_FIFO_DEF_LEN (UART_FIFO_LEN) #define UART_LL_FIFO_DEF_LEN (UART_FIFO_LEN)
@@ -96,7 +97,7 @@ static inline uint32_t uart_ll_get_baudrate(uart_dev_t *hw)
* *
* @return None * @return None
*/ */
static inline void uart_ll_ena_intr_mask(uart_dev_t *hw, uint32_t mask) FORCE_INLINE_ATTR void uart_ll_ena_intr_mask(uart_dev_t *hw, uint32_t mask)
{ {
hw->int_ena.val |= mask; hw->int_ena.val |= mask;
} }
@@ -109,7 +110,7 @@ static inline void uart_ll_ena_intr_mask(uart_dev_t *hw, uint32_t mask)
* *
* @return None * @return None
*/ */
static inline void uart_ll_disable_intr_mask(uart_dev_t *hw, uint32_t mask) FORCE_INLINE_ATTR void uart_ll_disable_intr_mask(uart_dev_t *hw, uint32_t mask)
{ {
hw->int_ena.val &= (~mask); hw->int_ena.val &= (~mask);
} }
@@ -121,7 +122,7 @@ static inline void uart_ll_disable_intr_mask(uart_dev_t *hw, uint32_t mask)
* *
* @return The UART interrupt status. * @return The UART interrupt status.
*/ */
static inline uint32_t uart_ll_get_intsts_mask(uart_dev_t *hw) FORCE_INLINE_ATTR uint32_t uart_ll_get_intsts_mask(uart_dev_t *hw)
{ {
return hw->int_st.val; return hw->int_st.val;
} }
@@ -134,7 +135,7 @@ static inline uint32_t uart_ll_get_intsts_mask(uart_dev_t *hw)
* *
* @return None * @return None
*/ */
static inline void uart_ll_clr_intsts_mask(uart_dev_t *hw, uint32_t mask) FORCE_INLINE_ATTR void uart_ll_clr_intsts_mask(uart_dev_t *hw, uint32_t mask)
{ {
hw->int_clr.val = mask; hw->int_clr.val = mask;
} }
@@ -160,7 +161,7 @@ static inline uint32_t uart_ll_get_intr_ena_status(uart_dev_t *hw)
* *
* @return None. * @return None.
*/ */
static inline void uart_ll_read_rxfifo(uart_dev_t *hw, uint8_t *buf, uint32_t rd_len) FORCE_INLINE_ATTR void uart_ll_read_rxfifo(uart_dev_t *hw, uint8_t *buf, uint32_t rd_len)
{ {
//Get the UART APB fifo addr. Read fifo, we use APB address //Get the UART APB fifo addr. Read fifo, we use APB address
uint32_t fifo_addr = (hw == &UART0) ? UART_FIFO_REG(0) : (hw == &UART1) ? UART_FIFO_REG(1) : UART_FIFO_REG(2); uint32_t fifo_addr = (hw == &UART0) ? UART_FIFO_REG(0) : (hw == &UART1) ? UART_FIFO_REG(1) : UART_FIFO_REG(2);
@@ -178,7 +179,7 @@ static inline void uart_ll_read_rxfifo(uart_dev_t *hw, uint8_t *buf, uint32_t rd
* *
* @return None * @return None
*/ */
static inline void uart_ll_write_txfifo(uart_dev_t *hw, const uint8_t *buf, uint32_t wr_len) FORCE_INLINE_ATTR void uart_ll_write_txfifo(uart_dev_t *hw, const uint8_t *buf, uint32_t wr_len)
{ {
//Get the UART AHB fifo addr, Write fifo, we use AHB address //Get the UART AHB fifo addr, Write fifo, we use AHB address
uint32_t fifo_addr = (hw == &UART0) ? UART_FIFO_AHB_REG(0) : (hw == &UART1) ? UART_FIFO_AHB_REG(1) : UART_FIFO_AHB_REG(2); uint32_t fifo_addr = (hw == &UART0) ? UART_FIFO_AHB_REG(0) : (hw == &UART1) ? UART_FIFO_AHB_REG(1) : UART_FIFO_AHB_REG(2);
@@ -194,7 +195,7 @@ static inline void uart_ll_write_txfifo(uart_dev_t *hw, const uint8_t *buf, uint
* *
* @return None * @return None
*/ */
static inline void uart_ll_rxfifo_rst(uart_dev_t *hw) FORCE_INLINE_ATTR void uart_ll_rxfifo_rst(uart_dev_t *hw)
{ {
//Hardware issue: we can not use `rxfifo_rst` to reset the hw rxfifo. //Hardware issue: we can not use `rxfifo_rst` to reset the hw rxfifo.
uint16_t fifo_cnt; uint16_t fifo_cnt;
@@ -260,7 +261,7 @@ static inline uint32_t uart_ll_get_rxfifo_len(uart_dev_t *hw)
* *
* @return The data length of txfifo can be written. * @return The data length of txfifo can be written.
*/ */
static inline uint32_t uart_ll_get_txfifo_len(uart_dev_t *hw) FORCE_INLINE_ATTR uint32_t uart_ll_get_txfifo_len(uart_dev_t *hw)
{ {
return UART_LL_FIFO_DEF_LEN - hw->status.txfifo_cnt; return UART_LL_FIFO_DEF_LEN - hw->status.txfifo_cnt;
} }
@@ -424,7 +425,7 @@ static inline void uart_ll_set_rx_tout(uart_dev_t *hw, uint8_t tout_thr)
* *
* @return None. * @return None.
*/ */
static inline void uart_ll_tx_break(uart_dev_t *hw, uint32_t break_num) FORCE_INLINE_ATTR void uart_ll_tx_break(uart_dev_t *hw, uint32_t break_num)
{ {
if(break_num > 0) { if(break_num > 0) {
hw->idle_conf.tx_brk_num = break_num; hw->idle_conf.tx_brk_num = break_num;
@@ -515,7 +516,7 @@ static inline void uart_ll_set_sw_flow_ctrl(uart_dev_t *hw, uart_sw_flowctrl_t *
* *
* @return None. * @return None.
*/ */
static inline void uart_ll_set_at_cmd_char(uart_dev_t *hw, uart_at_cmd_t *cmd_char) FORCE_INLINE_ATTR void uart_ll_set_at_cmd_char(uart_dev_t *hw, uart_at_cmd_t *cmd_char)
{ {
hw->at_cmd_char.data = cmd_char->cmd_char; hw->at_cmd_char.data = cmd_char->cmd_char;
hw->at_cmd_char.char_num = cmd_char->char_num; hw->at_cmd_char.char_num = cmd_char->char_num;
@@ -558,7 +559,7 @@ static inline void uart_ll_get_sclk(uart_dev_t *hw, uart_sclk_t* source_clk)
* *
* @return None. * @return None.
*/ */
static inline void uart_ll_set_rts_active_level(uart_dev_t *hw, int level) FORCE_INLINE_ATTR void uart_ll_set_rts_active_level(uart_dev_t *hw, int level)
{ {
hw->conf0.sw_rts = level & 0x1; hw->conf0.sw_rts = level & 0x1;
} }
@@ -740,7 +741,7 @@ static inline uint32_t uart_ll_get_wakeup_thrd(uart_dev_t *hw)
* *
* @return The bit mode. * @return The bit mode.
*/ */
static inline void uart_ll_get_data_bit_num(uart_dev_t *hw, uart_word_length_t *data_bit) FORCE_INLINE_ATTR void uart_ll_get_data_bit_num(uart_dev_t *hw, uart_word_length_t *data_bit)
{ {
*data_bit = hw->conf0.bit_num; *data_bit = hw->conf0.bit_num;
} }
@@ -752,7 +753,7 @@ static inline void uart_ll_get_data_bit_num(uart_dev_t *hw, uart_word_length_t *
* *
* @return True if the state machine is in the IDLE state, otherwise false is returned. * @return True if the state machine is in the IDLE state, otherwise false is returned.
*/ */
static inline bool uart_ll_is_tx_idle(uart_dev_t *hw) FORCE_INLINE_ATTR bool uart_ll_is_tx_idle(uart_dev_t *hw)
{ {
typeof(hw->status) status = hw->status; typeof(hw->status) status = hw->status;
return ((status.txfifo_cnt == 0) && (status.st_utx_out == 0)); return ((status.txfifo_cnt == 0) && (status.st_utx_out == 0));