Add interrupt allocation scheme / interrupt sharing. Also modifies drivers and examples. Also allows interrupts

to be marked specifically as having a handler that's all in IRAM.
This commit is contained in:
Jeroen Domburg
2016-11-25 17:33:51 +08:00
parent 505282bab1
commit 655fd2986a
29 changed files with 1142 additions and 161 deletions

View File

@@ -14,6 +14,7 @@
#include <esp_types.h>
#include "esp_err.h"
#include "esp_intr.h"
#include "esp_intr_alloc.h"
#include "freertos/FreeRTOS.h"
#include "freertos/xtensa_api.h"
#include "driver/gpio.h"
@@ -320,14 +321,10 @@ esp_err_t gpio_config(gpio_config_t *pGPIOConfig)
return ESP_OK;
}
esp_err_t gpio_isr_register(uint32_t gpio_intr_num, void (*fn)(void*), void * arg)
esp_err_t gpio_isr_register(void (*fn)(void*), void * arg, int intr_alloc_flags)
{
GPIO_CHECK(fn, "GPIO ISR null", ESP_ERR_INVALID_ARG);
ESP_INTR_DISABLE(gpio_intr_num);
intr_matrix_set(xPortGetCoreID(), ETS_GPIO_INTR_SOURCE, gpio_intr_num);
xt_set_interrupt_handler(gpio_intr_num, fn, arg);
ESP_INTR_ENABLE(gpio_intr_num);
return ESP_OK;
return esp_intr_alloc(ETS_GPIO_INTR_SOURCE, intr_alloc_flags, fn, arg, NULL);
}
/*only level interrupt can be used for wake-up function*/