]> granicus.if.org Git - esp-idf/commitdiff
uart driver: Remove UART ISR handler from IRAM
authorAngus Gratton <angus@espressif.com>
Tue, 7 Feb 2017 04:05:18 +0000 (15:05 +1100)
committerAngus Gratton <angus@espressif.com>
Fri, 3 Mar 2017 05:17:55 +0000 (16:17 +1100)
Doesn't change example behaviour, as ISR wasn't being registered as
ESP_INTR_FLAG_IRAM.

components/driver/include/driver/uart.h
components/driver/uart.c

index 23635df27d65f40b19df0402eedb92f3228146d7..748735c5da7240bb42f36d30410d3a710a383506 100644 (file)
@@ -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
index a40d58b305c005fa2925348d891a216973490a0b..e254bce0336499dcfd61ccbc1a2791ca33d5f5be 100644 (file)
@@ -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