From 3db4402f3cc4b21ba32f37401260de03a73b24ed Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 7 Feb 2017 15:05:18 +1100 Subject: [PATCH] uart driver: Remove UART ISR handler from IRAM Doesn't change example behaviour, as ISR wasn't being registered as ESP_INTR_FLAG_IRAM. --- components/driver/include/driver/uart.h | 3 ++- components/driver/uart.c | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/components/driver/include/driver/uart.h b/components/driver/include/driver/uart.h index 23635df27..748735c5d 100644 --- a/components/driver/include/driver/uart.h +++ b/components/driver/include/driver/uart.h @@ -478,7 +478,8 @@ esp_err_t uart_intr_config(uart_port_t uart_num, const uart_intr_config_t *intr_ * @param uart_queue UART event queue handle (out param). On success, a new queue handle is written here to provide * access to UART events. If set to NULL, driver will not use an event queue. * @param intr_alloc_flags Flags used to allocate the interrupt. One or multiple (ORred) - * ESP_INTR_FLAG_* values. See esp_intr_alloc.h for more info. + * ESP_INTR_FLAG_* values. See esp_intr_alloc.h for more info. Do not set ESP_INTR_FLAG_IRAM here + * (the driver's ISR handler is not located in IRAM) * * @return * - ESP_OK Success diff --git a/components/driver/uart.c b/components/driver/uart.c index a40d58b30..e254bce03 100644 --- a/components/driver/uart.c +++ b/components/driver/uart.c @@ -470,7 +470,7 @@ esp_err_t uart_intr_config(uart_port_t uart_num, const uart_intr_config_t *intr_ } //internal isr handler for default driver code. -static void IRAM_ATTR uart_rx_intr_handler_default(void *param) +static void uart_rx_intr_handler_default(void *param) { uart_obj_t *p_uart = (uart_obj_t*) param; uint8_t uart_num = p_uart->uart_num; @@ -1002,6 +1002,9 @@ esp_err_t uart_driver_install(uart_port_t uart_num, int rx_buffer_size, int tx_b ESP_LOGE(UART_TAG, "UART driver already installed"); return ESP_FAIL; } + + assert((intr_alloc_flags & ESP_INTR_FLAG_IRAM) == 0); /* uart_rx_intr_handler_default is not in IRAM */ + uart_isr_register(uart_num, uart_rx_intr_handler_default, p_uart_obj[uart_num], intr_alloc_flags, &p_uart_obj[uart_num]->intr_handle); uart_intr_config_t uart_intr = { .intr_enable_mask = UART_RXFIFO_FULL_INT_ENA_M