1 /* 2 * Copyright (c) 2022 Espressif Systems (Shanghai) Co., Ltd. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef ZEPHYR_INCLUDE_DRIVERS_PINCTRL_PINCTRL_ESP32_COMMON_H_ 8 #define ZEPHYR_INCLUDE_DRIVERS_PINCTRL_PINCTRL_ESP32_COMMON_H_ 9 10 #define ESP32_PORT_IDX(_pin) \ 11 (((_pin) < 32) ? 0 : 1) 12 13 #define ESP32_PIN_NUM(_mux) \ 14 (((_mux) >> ESP32_PIN_NUM_SHIFT) & ESP32_PIN_NUM_MASK) 15 16 #define ESP32_PIN_SIGI(_mux) \ 17 (((_mux) >> ESP32_PIN_SIGI_SHIFT) & ESP32_PIN_SIGI_MASK) 18 19 #define ESP32_PIN_SIGO(_mux) \ 20 (((_mux) >> ESP32_PIN_SIGO_SHIFT) & ESP32_PIN_SIGO_MASK) 21 22 #define ESP32_PIN_BIAS(_cfg) \ 23 (((_cfg) >> ESP32_PIN_BIAS_SHIFT) & ESP32_PIN_BIAS_MASK) 24 25 #define ESP32_PIN_DRV(_cfg) \ 26 (((_cfg) >> ESP32_PIN_DRV_SHIFT) & ESP32_PIN_DRV_MASK) 27 28 #define ESP32_PIN_MODE_OUT(_cfg) \ 29 (((_cfg) >> ESP32_PIN_OUT_SHIFT) & ESP32_PIN_OUT_MASK) 30 31 #define ESP32_PIN_EN_DIR(_cfg) \ 32 (((_cfg) >> ESP32_PIN_EN_DIR_SHIFT) & ESP32_PIN_EN_DIR_MASK) 33 34 #endif /* ZEPHYR_INCLUDE_DRIVERS_PINCTRL_PINCTRL_ESP32_COMMON_H_ */ 35