Function esp_idf_svc::sys::esp_intr_alloc_intrstatus

source ·
pub unsafe extern "C" fn esp_intr_alloc_intrstatus(
    source: i32,
    flags: i32,
    intrstatusreg: u32,
    intrstatusmask: u32,
    handler: Option<unsafe extern "C" fn(_: *mut c_void)>,
    arg: *mut c_void,
    ret_handle: *mut *mut intr_handle_data_t,
) -> i32
Expand description

@brief Allocate an interrupt with the given parameters.

This essentially does the same as esp_intr_alloc, but allows specifying a register and mask combo. For shared interrupts, the handler is only called if a read from the specified register, ANDed with the mask, returns non-zero. By passing an interrupt status register address and a fitting mask, this can be used to accelerate interrupt handling in the case a shared interrupt is triggered; by checking the interrupt statuses first, the code can decide which ISRs can be skipped

@param 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_INTERNALINTR_SOURCE sources as defined in this header. @param flags An ORred mask of the ESP_INTR_FLAG* defines. These restrict the choice of interrupts 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 interrupt of level 1. Setting ESP_INTR_FLAG_INTRDISABLED will return from this function with the interrupt disabled. @param intrstatusreg The address of an interrupt status register @param 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. @param handler The interrupt handler. Must be NULL when an interrupt of level >3 is requested, because these types of interrupts aren’t C-callable. @param arg Optional argument for passed to the interrupt handler @param 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.

@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