1 /*
2  * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 /**
7  * File Introduction:
8  * This file is used to reserve the GPIOs runtime, which has been occupied by FLASH/PSRAM or
9  * the GPIOs that not fan out.
10  *
11  * The FLASH pins can be tuned according to eFuse, pins will be reserved in the `esp_mspi_pin_init`
12  * while starting the CPU.
13  *
14  * As for the PSRAM pins, they are initialized after CPU started. They will be reserved in
15  * the `psram_gpio_config` when enabling the PSRAM.
16  */
17 
18 #pragma once
19 
20 #include "esp_types.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /**
27  * @brief Set the reserved pin
28  * @note  A same gpio can be reserve repetitively, but can't be clear once it is reserved
29  *
30  * @param[in]  mask Mask of GPIO reserved pins
31  */
32 void esp_gpio_reserve_pins(uint64_t mask);
33 
34 /**
35  * @brief Check whether the pin has been reserved
36  *
37  * @param[in]  gpio_num  GPIO pin number, please input a gpio number within `SOC_GPIO_PIN_COUNT`
38  * @return
39  *      - true  This gpio is reserved for FLASH or PSRAM
40  *      - false This gpio is available for other purposes
41  */
42 bool esp_gpio_is_pin_reserved(uint32_t gpio_num);
43 
44 #ifdef __cplusplus
45 }
46 #endif
47