mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-03 20:54:32 +02:00
Merge branch 'refactor/gpio_valid_2_soc' into 'master'
refactor(gpio): Move valid gpio_caps macro from driver layer to soc layer Closes IDF-13564 See merge request espressif/esp-idf!40521
This commit is contained in:
@@ -20,17 +20,6 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GPIO_PIN_COUNT (SOC_GPIO_PIN_COUNT)
|
|
||||||
/// Check whether it is a valid GPIO number
|
|
||||||
#define GPIO_IS_VALID_GPIO(gpio_num) ((gpio_num >= 0) && \
|
|
||||||
(((1ULL << (gpio_num)) & SOC_GPIO_VALID_GPIO_MASK) != 0))
|
|
||||||
/// Check whether it can be a valid GPIO number of output mode
|
|
||||||
#define GPIO_IS_VALID_OUTPUT_GPIO(gpio_num) ((gpio_num >= 0) && \
|
|
||||||
(((1ULL << (gpio_num)) & SOC_GPIO_VALID_OUTPUT_GPIO_MASK) != 0))
|
|
||||||
/// Check whether it can be a valid digital I/O pad
|
|
||||||
#define GPIO_IS_VALID_DIGITAL_IO_PAD(gpio_num) ((gpio_num >= 0) && \
|
|
||||||
(((1ULL << (gpio_num)) & SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK) != 0))
|
|
||||||
|
|
||||||
typedef intr_handle_t gpio_isr_handle_t;
|
typedef intr_handle_t gpio_isr_handle_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -20,13 +20,6 @@
|
|||||||
#include "hal/gpio_ll.h"
|
#include "hal/gpio_ll.h"
|
||||||
#include "soc/soc_caps.h"
|
#include "soc/soc_caps.h"
|
||||||
|
|
||||||
/// Check whether it is a valid GPIO number
|
|
||||||
#define GPIO_IS_VALID_GPIO(gpio_num) ((gpio_num >= 0) && \
|
|
||||||
(((1ULL << (gpio_num)) & SOC_GPIO_VALID_GPIO_MASK) != 0))
|
|
||||||
/// Check whether it can be a valid GPIO number of output mode
|
|
||||||
#define GPIO_IS_VALID_OUTPUT_GPIO(gpio_num) ((gpio_num >= 0) && \
|
|
||||||
(((1ULL << (gpio_num)) & SOC_GPIO_VALID_OUTPUT_GPIO_MASK) != 0))
|
|
||||||
|
|
||||||
#if SOC_USB_UTMI_PHY_NO_POWER_OFF_ISO
|
#if SOC_USB_UTMI_PHY_NO_POWER_OFF_ISO
|
||||||
#include "esp_private/sleep_usb.h"
|
#include "esp_private/sleep_usb.h"
|
||||||
#include "esp_sleep.h"
|
#include "esp_sleep.h"
|
||||||
|
@@ -16,6 +16,17 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define GPIO_PIN_COUNT (SOC_GPIO_PIN_COUNT)
|
||||||
|
/// Check whether it is a valid GPIO number
|
||||||
|
#define GPIO_IS_VALID_GPIO(gpio_num) ((gpio_num >= 0) && \
|
||||||
|
(((1ULL << (gpio_num)) & SOC_GPIO_VALID_GPIO_MASK) != 0))
|
||||||
|
/// Check whether it can be a valid GPIO number of output mode
|
||||||
|
#define GPIO_IS_VALID_OUTPUT_GPIO(gpio_num) ((gpio_num >= 0) && \
|
||||||
|
(((1ULL << (gpio_num)) & SOC_GPIO_VALID_OUTPUT_GPIO_MASK) != 0))
|
||||||
|
/// Check whether it can be a valid digital I/O pad
|
||||||
|
#define GPIO_IS_VALID_DIGITAL_IO_PAD(gpio_num) ((gpio_num >= 0) && \
|
||||||
|
(((1ULL << (gpio_num)) & SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK) != 0))
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GPIO_PORT_0 = 0,
|
GPIO_PORT_0 = 0,
|
||||||
GPIO_PORT_MAX,
|
GPIO_PORT_MAX,
|
||||||
|
@@ -52,9 +52,7 @@ else()
|
|||||||
"spi_flash_os_func_noos.c")
|
"spi_flash_os_func_noos.c")
|
||||||
|
|
||||||
list(APPEND srcs ${cache_srcs})
|
list(APPEND srcs ${cache_srcs})
|
||||||
set(priv_requires bootloader_support app_update soc esp_mm
|
set(priv_requires bootloader_support soc esp_mm)
|
||||||
esp_driver_gpio
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
idf_component_register(SRCS "${srcs}"
|
idf_component_register(SRCS "${srcs}"
|
||||||
|
@@ -8,7 +8,6 @@
|
|||||||
#include "esp_flash.h"
|
#include "esp_flash.h"
|
||||||
#include "memspi_host_driver.h"
|
#include "memspi_host_driver.h"
|
||||||
#include "esp_flash_spi_init.h"
|
#include "esp_flash_spi_init.h"
|
||||||
#include "driver/gpio.h"
|
|
||||||
#include "esp_rom_gpio.h"
|
#include "esp_rom_gpio.h"
|
||||||
#include "esp_rom_efuse.h"
|
#include "esp_rom_efuse.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
# SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
@@ -6,13 +6,30 @@ from typing import Dict
|
|||||||
from typing import List
|
from typing import List
|
||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
|
|
||||||
g1_g0_components = ['hal', 'cxx', 'newlib', 'freertos', 'esp_hw_support', 'heap', 'log', 'soc', 'esp_rom',
|
g1_g0_components = [
|
||||||
'esp_common', 'esp_system', 'xtensa', 'riscv', 'spi_flash', 'esp_mm']
|
'hal',
|
||||||
|
'cxx',
|
||||||
|
'newlib',
|
||||||
|
'freertos',
|
||||||
|
'esp_hw_support',
|
||||||
|
'heap',
|
||||||
|
'log',
|
||||||
|
'soc',
|
||||||
|
'esp_rom',
|
||||||
|
'esp_common',
|
||||||
|
'esp_system',
|
||||||
|
'xtensa',
|
||||||
|
'riscv',
|
||||||
|
'spi_flash',
|
||||||
|
'esp_mm',
|
||||||
|
]
|
||||||
|
|
||||||
expected_dep_violations = {'esp_system': ['esp_timer', 'bootloader_support', 'esp_pm'],
|
expected_dep_violations = {
|
||||||
'spi_flash': ['bootloader_support', 'app_update', 'esp_driver_gpio'],
|
'esp_system': ['esp_timer', 'bootloader_support', 'esp_pm'],
|
||||||
'esp_hw_support': ['efuse', 'bootloader_support', 'esp_driver_gpio', 'esp_timer', 'esp_pm', 'esp_security'],
|
'spi_flash': ['bootloader_support'],
|
||||||
'cxx': ['pthread']}
|
'esp_hw_support': ['efuse', 'bootloader_support', 'esp_driver_gpio', 'esp_timer', 'esp_pm', 'esp_security'],
|
||||||
|
'cxx': ['pthread'],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def parse_dependencies(file_path: str) -> Tuple[Dict[str, List[str]], List[str]]:
|
def parse_dependencies(file_path: str) -> Tuple[Dict[str, List[str]], List[str]]:
|
||||||
@@ -25,7 +42,7 @@ def parse_dependencies(file_path: str) -> Tuple[Dict[str, List[str]], List[str]]
|
|||||||
if line:
|
if line:
|
||||||
parts = line.split(' -> ')
|
parts = line.split(' -> ')
|
||||||
|
|
||||||
if (len(parts) >= 2):
|
if len(parts) >= 2:
|
||||||
source = parts[0]
|
source = parts[0]
|
||||||
target = parts[1].split()[0] # Extracting the target component
|
target = parts[1].split()[0] # Extracting the target component
|
||||||
logging.debug(f'Parsed dependency: {source} -> {target}')
|
logging.debug(f'Parsed dependency: {source} -> {target}')
|
||||||
@@ -48,7 +65,9 @@ def parse_dependencies(file_path: str) -> Tuple[Dict[str, List[str]], List[str]]
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser(description='Check G1 dependencies')
|
parser = argparse.ArgumentParser(description='Check G1 dependencies')
|
||||||
parser.add_argument('--component_deps_file', required=True, type=str, help='The path to the component_deps.dot file')
|
parser.add_argument(
|
||||||
|
'--component_deps_file', required=True, type=str, help='The path to the component_deps.dot file'
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user