Skip to main content

esp_intr_alloc_intrstatus_bind

Function esp_intr_alloc_intrstatus_bind 

Source
pub unsafe extern "C" fn esp_intr_alloc_intrstatus_bind(
    source: c_int,
    flags: c_int,
    intrstatusreg: u32,
    intrstatusmask: u32,
    handler: intr_handler_t,
    arg: *mut c_void,
    shared_handle: intr_handle_t,
    ret_handle: *mut intr_handle_t,
) -> esp_err_t
Expand description

@brief Allocate an interrupt with the given parameters, including an interrupt status register, that can be bound to an existing interrupt handler

This function does the same as esp_intr_alloc_intrstatus, but allows specifying a previously allocated handler as the interrupt to share with the given source. This can be very handy to treat two pre-determined interrupt sources in the same interrupt handler. The interrupt will be allocated on the same core as the given shared_handle. Moreover, make sure to specify the same interrupt level as the one being used by shared_handle to prevent any failure from this function.

@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 ESP_INTR_FLAG_SHARED mask is provided, a shared interrupt of the given level will be allocated (or level 1 if not specified). 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 shared_handle Previously allocated interrupt to share the CPU interrupt line with. If NULL, calling this function equivalent to esp_intr_alloc, else, ESP_INTR_FLAG_SHARED must be provided in the flags parameter. @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 flasg or the given level is different from the one assigned to the share_handle parameter. ESP_OK on success