From 345c4577112acea074e3d04b54330397a389d0e0 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Tue, 3 Sep 2024 15:37:55 +0200 Subject: [PATCH] feat(wifi_remote): Add slave selection and peview targets --- components/esp_wifi_remote/Kconfig | 1 + .../Kconfig => Kconfig.slave_select.in} | 8 +-- .../esp_wifi_remote/Kconfig.soc_wifi_caps.in | 42 ++++++++++++-- .../scripts/generate_and_check.py | 58 +++++++++---------- .../test/smoke_test/main/smoke_test.c | 5 +- 5 files changed, 71 insertions(+), 43 deletions(-) rename components/esp_wifi_remote/{test/smoke_test/components/esp_hosted/Kconfig => Kconfig.slave_select.in} (76%) diff --git a/components/esp_wifi_remote/Kconfig b/components/esp_wifi_remote/Kconfig index 80fde92a9..5853fd121 100644 --- a/components/esp_wifi_remote/Kconfig +++ b/components/esp_wifi_remote/Kconfig @@ -4,6 +4,7 @@ menu "Wi-Fi Remote" bool default y + orsource "./Kconfig.slave_select.in" orsource "./Kconfig.soc_wifi_caps.in" orsource "./Kconfig.rpc.in" diff --git a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/Kconfig b/components/esp_wifi_remote/Kconfig.slave_select.in similarity index 76% rename from components/esp_wifi_remote/test/smoke_test/components/esp_hosted/Kconfig rename to components/esp_wifi_remote/Kconfig.slave_select.in index e3e075afd..90fed9c6b 100644 --- a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/Kconfig +++ b/components/esp_wifi_remote/Kconfig.slave_select.in @@ -1,5 +1,4 @@ # This file is auto-generated -menu "ESP Hosted Mock" choice SLAVE_IDF_TARGET prompt "choose slave target" default SLAVE_IDF_TARGET_ESP32 @@ -15,9 +14,6 @@ menu "ESP Hosted Mock" bool "esp32c2" config SLAVE_IDF_TARGET_ESP32C6 bool "esp32c6" - config SLAVE_IDF_TARGET_ESP32H2 - bool "esp32h2" - config SLAVE_IDF_TARGET_ESP32P4 - bool "esp32p4" + config SLAVE_IDF_TARGET_ESP32C5 + bool "esp32c5" endchoice -endmenu diff --git a/components/esp_wifi_remote/Kconfig.soc_wifi_caps.in b/components/esp_wifi_remote/Kconfig.soc_wifi_caps.in index 1ec5de2b2..8569da4e7 100644 --- a/components/esp_wifi_remote/Kconfig.soc_wifi_caps.in +++ b/components/esp_wifi_remote/Kconfig.soc_wifi_caps.in @@ -224,14 +224,46 @@ if SLAVE_IDF_TARGET_ESP32C6 endif # ESP32C6 -if SLAVE_IDF_TARGET_ESP32H2 +if SLAVE_IDF_TARGET_ESP32C5 -endif # ESP32H2 - -if SLAVE_IDF_TARGET_ESP32P4 + config SLAVE_SOC_WIFI_SUPPORTED + bool + default y config SLAVE_SOC_WIFI_LIGHT_SLEEP_CLK_WIDTH int default 12 -endif # ESP32P4 + config SLAVE_SOC_WIFI_HW_TSF + bool + default y + + config SLAVE_SOC_WIFI_FTM_SUPPORT + bool + default n + + config SLAVE_SOC_WIFI_GCMP_SUPPORT + bool + default y + + config SLAVE_SOC_WIFI_WAPI_SUPPORT + bool + default y + + config SLAVE_SOC_WIFI_CSI_SUPPORT + bool + default y + + config SLAVE_SOC_WIFI_MESH_SUPPORT + bool + default y + + config SLAVE_SOC_WIFI_HE_SUPPORT + bool + default y + + config SLAVE_SOC_WIFI_HE_SUPPORT_5G + bool + default y + +endif # ESP32C5 diff --git a/components/esp_wifi_remote/scripts/generate_and_check.py b/components/esp_wifi_remote/scripts/generate_and_check.py index 9368004d0..0f25ac6ee 100644 --- a/components/esp_wifi_remote/scripts/generate_and_check.py +++ b/components/esp_wifi_remote/scripts/generate_and_check.py @@ -7,7 +7,7 @@ import re import subprocess from collections import namedtuple -from idf_build_apps.constants import SUPPORTED_TARGETS +from idf_build_apps.constants import PREVIEW_TARGETS, SUPPORTED_TARGETS from pycparser import c_ast, c_parser, preprocess_file Param = namedtuple('Param', ['ptr', 'array', 'qual', 'type', 'name']) @@ -161,45 +161,42 @@ def get_vars(parameters): def generate_kconfig_wifi_caps(idf_path, component_path): kconfig = os.path.join(component_path, 'Kconfig.soc_wifi_caps.in') + slave_select = os.path.join(component_path, 'Kconfig.slave_select.in') sdkconfig_files = [] - with open(kconfig, 'w') as out: - out.write(f'# {AUTO_GENERATED}\n') - for slave_target in SUPPORTED_TARGETS: - out.write(f'\nif SLAVE_IDF_TARGET_{slave_target.upper()}\n\n') + with open(kconfig, 'w') as slave_caps, open(slave_select, 'w') as slave: + slave_caps.write(f'# {AUTO_GENERATED}\n') + slave.write(f'# {AUTO_GENERATED}\n') + slave.write(' choice SLAVE_IDF_TARGET\n') + slave.write(' prompt "choose slave target"\n') + slave.write(' default SLAVE_IDF_TARGET_ESP32\n') + for slave_target in SUPPORTED_TARGETS + PREVIEW_TARGETS: + add_slave = False + kconfig_content = [] soc_caps = os.path.join(idf_path, 'components', 'soc', slave_target, 'include', 'soc', 'Kconfig.soc_caps.in') with open(soc_caps, 'r') as f: for line in f: if line.strip().startswith('config SOC_WIFI_'): if 'config SOC_WIFI_SUPPORTED' in line: - # if WiFi supported for this target, test it as a slave + # if WiFi supported for this target, add it to Kconfig slave options and test this slave + add_slave = True sdkconfig = os.path.join(component_path, 'test', 'smoke_test', f'sdkconfig.ci.slave_{slave_target}') open(sdkconfig, 'w').write(f'CONFIG_SLAVE_IDF_TARGET_{slave_target.upper()}=y\n') sdkconfig_files.append(sdkconfig) - replaced = re.compile(r'SOC_WIFI_').sub('SLAVE_SOC_WIFI_', line) - out.write(f' {replaced}') - line = f.readline() # type - out.write(f' {line}') - line = f.readline() # default - out.write(f' {line}\n') - out.write(f'endif # {slave_target.upper()}\n') - return [kconfig] + sdkconfig_files + replaced = re.sub(r'SOC_WIFI_', 'SLAVE_SOC_WIFI_', line) + kconfig_content.append(f' {replaced}') + kconfig_content.append(f' {f.readline()}') # type + kconfig_content.append(f' {f.readline()}\n') # default + if add_slave: + slave_caps.write(f'\nif SLAVE_IDF_TARGET_{slave_target.upper()}\n\n') + slave_caps.writelines(kconfig_content) + slave_caps.write(f'endif # {slave_target.upper()}\n') + slave_config_name = 'SLAVE_IDF_TARGET_' + slave_target.upper() + slave.write(f' config {slave_config_name}\n') + slave.write(f' bool "{slave_target}"\n') -def generate_test_kconfig(component_path): - path = os.path.join(component_path, 'test','smoke_test','components','esp_hosted','Kconfig') - with open(path, 'w') as f: - f.write(f'# {AUTO_GENERATED}\n') - f.write('menu "ESP Hosted Mock"\n') - f.write(' choice SLAVE_IDF_TARGET\n') - f.write(' prompt "choose slave target"\n') - f.write(' default SLAVE_IDF_TARGET_ESP32\n') - for slave_target in SUPPORTED_TARGETS: - config = 'SLAVE_IDF_TARGET_' + slave_target.upper() - f.write(f' config {config}\n') - f.write(f' bool "{slave_target}"\n') - f.write(' endchoice\n') - f.write('endmenu\n') - return [path] + slave.write(' endchoice\n') + return [kconfig, slave_select] + sdkconfig_files def generate_remote_wifi_api(function_prototypes, component_path): @@ -311,6 +308,7 @@ def generate_kconfig(idf_path, component_path): f.write(' config ESP_WIFI_REMOTE_ENABLED\n') f.write(' bool\n') f.write(' default y\n\n') + f.write(' orsource "./Kconfig.slave_select.in"\n') f.write(' orsource "./Kconfig.soc_wifi_caps.in"\n') f.write(' orsource "./Kconfig.rpc.in"\n') for line1 in lines: @@ -377,8 +375,6 @@ making changes you might need to modify 'copyright_header.h' in the script direc files_to_check = [] - files_to_check += generate_test_kconfig(component_path) - files_to_check += generate_kconfig_wifi_caps(idf_path, component_path) files_to_check += generate_remote_wifi_api(function_prototypes, component_path) diff --git a/components/esp_wifi_remote/test/smoke_test/main/smoke_test.c b/components/esp_wifi_remote/test/smoke_test/main/smoke_test.c index 190348d4f..c2104972e 100644 --- a/components/esp_wifi_remote/test/smoke_test/main/smoke_test.c +++ b/components/esp_wifi_remote/test/smoke_test/main/smoke_test.c @@ -16,6 +16,9 @@ void app_main(void) esp_wifi_init(&cfg); esp_wifi_deinit(); - run_all_wifi_apis(); +#if CONFIG_SOC_WIFI_SUPPORTED run_all_wifi_remote_apis(); +#else + run_all_wifi_apis(); +#endif }