Chapter 2. API Reference
Return ESP_ERR_INVALID_ARG if the combination of arguments is invalid. ESP_ERR_NOT_FOUND
No free interrupt found with the specified flags ESP_OK otherwise
Parameters
• source: The interrupt source. One of the ETS_*_INTR_SOURCE interrupt mux sources, as
defined in soc/soc.h, or one of the internal ETS_INTERNAL_*_INTR_SOURCE sources as defined
in this header.
• flags: An ORred mask of the ESP_INTR_FLAG_* defines. These restrict the choice of inter-
rupts that this routine can choose from. If this value is 0, it will default to allocating a non-shared
interrupt of level 1, 2 or 3. If this is ESP_INTR_FLAG_SHARED, it will allocate a shared inter-
rupt of level 1. Setting ESP_INTR_FLAG_INTRDISABLED will return from this function with
the interrupt disabled.
• intrstatusreg: The address of an interrupt status register
• intrstatusmask: A mask. If a read of address intrstatusreg has any of the bits that are 1 in the
mask set, the ISR will be called. If not, it will be skipped.
• handler: The interrupt handler. Must be NULL when an interrupt of level >3 is requested,
because these types of interrupts aren't C-callable.
• arg: Optional argument for passed to the interrupt handler
• ret_handle: Pointer to an intr_handle_t to store a handle that can later be used to request details
or free the interrupt. Can be NULL if no handle is required.
esp_err_t esp_intr_free(intr_handle_t
Disable and free an interrupt.
Use an interrupt handle to disable the interrupt and release the resources associated with it. If the current core
is not the core that registered this interrupt, this routine will be assigned to the core that allocated this interrupt,
blocking and waiting until the resource is successfully released.
Note When the handler shares its source with other handlers, the interrupt status bits it's responsible for
should be managed properly before freeing it. see esp_intr_disable for more details. Please do
not call this function in esp_ipc_call_blocking.
Return ESP_ERR_INVALID_ARG the handle is NULL ESP_FAIL failed to release this handle ESP_OK
otherwise
Parameters
• handle: The handle, as obtained by esp_intr_alloc or esp_intr_alloc_intrstatus
int
esp_intr_get_cpu(intr_handle_t
Get CPU number an interrupt is tied to.
Return The core number where the interrupt is allocated
Parameters
• handle: The handle, as obtained by esp_intr_alloc or esp_intr_alloc_intrstatus
int
esp_intr_get_intno(intr_handle_t
Get the allocated interrupt for a certain handle.
Return The interrupt number
Parameters
• handle: The handle, as obtained by esp_intr_alloc or esp_intr_alloc_intrstatus
esp_err_t esp_intr_disable(intr_handle_t
Disable the interrupt associated with the handle.
Note
1. For local interrupts (ESP_INTERNAL_* sources), this function has to be called on the CPU the
interrupt is allocated on. Other interrupts have no such restriction.
2. When several handlers sharing a same interrupt source, interrupt status bits, which are handled in the
handler to be disabled, should be masked before the disabling, or handled in other enabled interrupts
properly. Miss of interrupt status handling will cause infinite interrupt calls and finally system crash.
Return ESP_ERR_INVALID_ARG if the combination of arguments is invalid. ESP_OK otherwise
Parameters
• handle: The handle, as obtained by esp_intr_alloc or esp_intr_alloc_intrstatus
Espressif Systems
handle)
handle)
handle)
handle)
1003
Submit Document Feedback
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?
Questions and answers