mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-29 05:38:42 +00:00
feat(uart): add RCC atomic block to uart/lp-uart peripheral
This commit is contained in:
@@ -229,6 +229,51 @@ FORCE_INLINE_ATTR void uart_ll_sclk_disable(uart_dev_t *hw)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable the bus clock for uart
|
||||
* @param uart_num UART port number, the max port number is (UART_NUM_MAX -1).
|
||||
* @param enable true to enable, false to disable
|
||||
*/
|
||||
static inline void uart_ll_enable_bus_clock(uart_port_t uart_num, bool enable)
|
||||
{
|
||||
switch (uart_num)
|
||||
{
|
||||
case 0:
|
||||
PCR.uart0_conf.uart0_clk_en = enable;
|
||||
break;
|
||||
case 1:
|
||||
PCR.uart1_conf.uart1_clk_en = enable;
|
||||
break;
|
||||
default:
|
||||
// LP_UART
|
||||
abort();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reset UART module
|
||||
* @param uart_num UART port number, the max port number is (UART_NUM_MAX -1).
|
||||
*/
|
||||
static inline void uart_ll_reset_register(uart_port_t uart_num)
|
||||
{
|
||||
switch (uart_num)
|
||||
{
|
||||
case 0:
|
||||
PCR.uart0_conf.uart0_rst_en = 1;
|
||||
PCR.uart0_conf.uart0_rst_en = 0;
|
||||
break;
|
||||
case 1:
|
||||
PCR.uart1_conf.uart1_rst_en = 1;
|
||||
PCR.uart1_conf.uart1_rst_en = 0;
|
||||
break;
|
||||
default:
|
||||
// LP_UART
|
||||
abort();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the UART source clock.
|
||||
*
|
||||
|
Reference in New Issue
Block a user