1 /* 2 * SPDX-FileCopyrightText: 2016-2021 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #pragma once 8 9 #include <stdint.h> 10 #include "esp_err.h" 11 #include "esp_intr_alloc.h" 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif 16 17 /** 18 * @brief Register a handler for specific RTC_CNTL interrupts 19 * 20 * Multiple handlers can be registered using this function. Whenever an 21 * RTC interrupt happens, all handlers with matching rtc_intr_mask values 22 * will be called. 23 * 24 * @param handler handler function to call 25 * @param handler_arg argument to be passed to the handler 26 * @param rtc_intr_mask combination of RTC_CNTL_*_INT_ENA bits indicating the 27 * sources to call the handler for 28 * @return 29 * - ESP_OK on success 30 * - ESP_ERR_NO_MEM not enough memory to allocate handler structure 31 * - other errors returned by esp_intr_alloc 32 */ 33 esp_err_t rtc_isr_register(intr_handler_t handler, void* handler_arg, 34 uint32_t rtc_intr_mask); 35 /** 36 * @brief Deregister the handler previously registered using rtc_isr_register 37 * @param handler handler function to call (as passed to rtc_isr_register) 38 * @param handler_arg argument of the handler (as passed to rtc_isr_register) 39 * @return 40 * - ESP_OK on success 41 * - ESP_ERR_INVALID_STATE if a handler matching both handler and 42 * handler_arg isn't registered 43 */ 44 esp_err_t rtc_isr_deregister(intr_handler_t handler, void* handler_arg); 45 46 #ifdef __cplusplus 47 } 48 #endif 49