1 /* 2 * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <zephyr/kernel.h> 8 9 #include "esp_types.h" 10 #include "esp_bit_defs.h" 11 #include "soc/soc_caps.h" 12 13 static uint64_t s_reserve_status = 0; 14 esp_gpio_reserve_pins(uint64_t mask)15void esp_gpio_reserve_pins(uint64_t mask) 16 { 17 #if SOC_GPIO_PIN_COUNT < 64 18 mask &= BIT64(SOC_GPIO_PIN_COUNT) - 1; 19 #endif 20 s_reserve_status |= mask; 21 } 22 esp_gpio_is_pin_reserved(uint32_t gpio_num)23bool esp_gpio_is_pin_reserved(uint32_t gpio_num) 24 { 25 if (gpio_num >= SOC_GPIO_PIN_COUNT) { 26 return false; 27 } 28 return !!(s_reserve_status & BIT64(gpio_num)); 29 } 30 31 // TODO: IDF-6968 reserve the pins that not fanned out regarding the SiP version 32