From 75e2a3712df9e700bcb86bdac86fb4db9d2aab3a Mon Sep 17 00:00:00 2001 From: David Cermak Date: Fri, 22 Mar 2024 09:44:57 +0100 Subject: [PATCH] fix(wifi_remote): Per review comments --- .github/workflows/wifi_remote__build.yml | 7 +- ci/ignore_astyle.txt | 1 + components/esp_wifi_remote/CMakeLists.txt | 2 +- components/esp_wifi_remote/Kconfig | 1 + .../esp_wifi_remote/Kconfig.soc_wifi_caps.in | 3 +- components/esp_wifi_remote/README.md | 18 +- .../esp_wifi_remote/esp_wifi_remote_private.h | 16 + .../esp_wifi_remote/esp_wifi_remote_weak.c | 393 ++++++++++++++++++ .../esp_wifi_remote/esp_wifi_with_remote.c | 6 + .../esp_wifi_remote/include/esp_wifi_remote.h | 16 +- .../include/esp_wifi_remote_api.h | 5 +- .../esp_wifi_remote/scripts/check_headers.sh | 22 - .../scripts/copyright_header.h | 1 + ...{parse_header.py => generate_and_check.py} | 279 ++++++++----- .../scripts/ignore_extensions.h | 3 - .../smoke_test/components/esp_hosted/Kconfig | 1 + .../components/esp_hosted/esp_hosted_mock.c | 158 +++---- .../esp_hosted/include/esp_hosted_mock.h | 156 +++---- .../test/smoke_test/main/all_wifi_calls.c | 7 + .../smoke_test/main/all_wifi_remote_calls.c | 7 + ...dkconfig.ci.1 => sdkconfig.ci.slave_esp32} | 0 ...config.ci.5 => sdkconfig.ci.slave_esp32c2} | 0 ...config.ci.3 => sdkconfig.ci.slave_esp32c3} | 0 ...config.ci.6 => sdkconfig.ci.slave_esp32c6} | 0 ...config.ci.2 => sdkconfig.ci.slave_esp32s2} | 0 ...config.ci.4 => sdkconfig.ci.slave_esp32s3} | 0 components/esp_wifi_remote/wifi_remote_init.c | 3 +- components/esp_wifi_remote/wifi_remote_net.c | 12 +- components/esp_wifi_remote/wifi_remote_rpc.c | 203 +-------- 29 files changed, 807 insertions(+), 513 deletions(-) create mode 100644 components/esp_wifi_remote/esp_wifi_remote_private.h create mode 100644 components/esp_wifi_remote/esp_wifi_remote_weak.c delete mode 100755 components/esp_wifi_remote/scripts/check_headers.sh rename components/esp_wifi_remote/scripts/{parse_header.py => generate_and_check.py} (55%) rename components/esp_wifi_remote/test/smoke_test/{sdkconfig.ci.1 => sdkconfig.ci.slave_esp32} (100%) rename components/esp_wifi_remote/test/smoke_test/{sdkconfig.ci.5 => sdkconfig.ci.slave_esp32c2} (100%) rename components/esp_wifi_remote/test/smoke_test/{sdkconfig.ci.3 => sdkconfig.ci.slave_esp32c3} (100%) rename components/esp_wifi_remote/test/smoke_test/{sdkconfig.ci.6 => sdkconfig.ci.slave_esp32c6} (100%) rename components/esp_wifi_remote/test/smoke_test/{sdkconfig.ci.2 => sdkconfig.ci.slave_esp32s2} (100%) rename components/esp_wifi_remote/test/smoke_test/{sdkconfig.ci.4 => sdkconfig.ci.slave_esp32s3} (100%) diff --git a/.github/workflows/wifi_remote__build.yml b/.github/workflows/wifi_remote__build.yml index 29c5704b0b8..0309273db2f 100644 --- a/.github/workflows/wifi_remote__build.yml +++ b/.github/workflows/wifi_remote__build.yml @@ -25,8 +25,7 @@ jobs: ${IDF_PATH}/install.sh --enable-pytest . ${IDF_PATH}/export.sh cd ./components/esp_wifi_remote/scripts - python parse_header.py - ./check_headers.sh + python generate_and_check.py build_wifi_remote: if: contains(github.event.pull_request.labels.*.name, 'wifi_remote') || github.event_name == 'push' @@ -40,6 +39,10 @@ jobs: steps: - name: Checkout esp-protocols uses: actions/checkout@v3 + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ matrix.idf_ver }} - name: Build ${{ matrix.test.app }} with IDF-${{ matrix.idf_ver }} shell: bash run: | diff --git a/ci/ignore_astyle.txt b/ci/ignore_astyle.txt index 651f65ea489..e8c26957235 100644 --- a/ci/ignore_astyle.txt +++ b/ci/ignore_astyle.txt @@ -1 +1,2 @@ +# The below file is generated from esp_wifi_types_native.h in IDF, which doesn't follow atyle components/esp_wifi_remote/include/esp_wifi_types_native.h diff --git a/components/esp_wifi_remote/CMakeLists.txt b/components/esp_wifi_remote/CMakeLists.txt index acbef7984f1..7bd488e560d 100644 --- a/components/esp_wifi_remote/CMakeLists.txt +++ b/components/esp_wifi_remote/CMakeLists.txt @@ -3,6 +3,6 @@ if(NOT CONFIG_ESP_WIFI_ENABLED) endif() idf_component_register(INCLUDE_DIRS include - SRCS wifi_remote_rpc.c wifi_remote_net.c wifi_remote_init.c ${src_wifi_is_remote} + SRCS wifi_remote_rpc.c wifi_remote_net.c wifi_remote_init.c ${src_wifi_is_remote} esp_wifi_remote_weak.c REQUIRES esp_event esp_netif PRIV_REQUIRES esp_wifi esp_hosted) diff --git a/components/esp_wifi_remote/Kconfig b/components/esp_wifi_remote/Kconfig index e52b8e74f87..a6aa5a10ea5 100644 --- a/components/esp_wifi_remote/Kconfig +++ b/components/esp_wifi_remote/Kconfig @@ -1,3 +1,4 @@ +# This file is auto-generated menu "Wi-Fi Remote" orsource "./Kconfig.soc_wifi_caps.in" diff --git a/components/esp_wifi_remote/Kconfig.soc_wifi_caps.in b/components/esp_wifi_remote/Kconfig.soc_wifi_caps.in index 935376b89cd..a0aee080a2c 100644 --- a/components/esp_wifi_remote/Kconfig.soc_wifi_caps.in +++ b/components/esp_wifi_remote/Kconfig.soc_wifi_caps.in @@ -1,3 +1,4 @@ +# This file is auto-generated if SLAVE_IDF_TARGET_ESP32 @@ -199,7 +200,7 @@ if SLAVE_IDF_TARGET_ESP32C6 config SLAVE_SOC_WIFI_FTM_SUPPORT bool - default n + default y config SLAVE_SOC_WIFI_GCMP_SUPPORT bool diff --git a/components/esp_wifi_remote/README.md b/components/esp_wifi_remote/README.md index d04270f150c..f15c9dbeebe 100644 --- a/components/esp_wifi_remote/README.md +++ b/components/esp_wifi_remote/README.md @@ -2,19 +2,25 @@ [![Component Registry](https://components.espressif.com/components/espressif/esp_wifi_remote/badge.svg)](https://components.espressif.com/components/espressif/esp_wifi_remote) -This component wraps the public API of `esp_wifi` and provides a set of the same function calls namespaces with `esp_wifi_remote` prefix that translate to RPC calls to another target device (called `slave` device) which executes the appropriate `esp_wifi` APIs. +The `esp_wifi_remote` component is designed to extend WiFi functionality to ESP chipsets that lack native WiFi support. By simply adding a dependency to this component from your project, you gain access to WiFi capabilities via the WiFi-remote menuconfig and standard `esp_wifi` interface. -This component is heavily dependent on a specific version of the `esp_wifi` component, as that's why most of its headers, sources and configuration files are pre-generated based on the actual version of `esp_wifi`. +Moreover, `esp_wifi_remote` can be utilized on ESP chipsets that do support native WiFi, providing an additional WiFi interface through the `esp_wifi_remote` API. -This component doesn't implement the RPC calls by itself, but uses their dependencies for the functionality. Currently, only `esp_hosted` is supported to provide the RPC functionality of `esp_wifi_remote`. +To employ this component, a slave device -- capable of WiFi connectivity -- must be connected to your target device in a specified manner, as defined by the transport layer of [`esp_hosted`](https://github.com/espressif/esp-hosted). + +Functionally, `esp_wifi_remote` wraps the public API of `esp_wifi`, offering a set of function call namespaces prefixed with esp_wifi_remote. These calls are translated into Remote Procedure Calls (RPC) to another target device (referred to as the "slave" device), which then executes the appropriate `esp_wifi` APIs. + +Notably, `esp_wifi_remote` heavily relies on a specific version of the `esp_wifi` component. Consequently, the majority of its headers, sources, and configuration files are pre-generated based on the actual version of `esp_wifi`. + +It's important to highlight that `esp_wifi_remote` does not directly implement the RPC calls; rather, it relies on dependencies for this functionality. Presently, only esp_hosted is supported to provide the RPC functionality required by esp_wifi_remote. ## Dependencies on `esp_wifi` Public API needs to correspond exactly to the `esp_wifi` API. Some of the internal types depend on the actual wifi target, as well as some default configuration values. Therefore it's easier to maintain consistency between this component and the exact version of `esp_wifi` automatically in CI: -We extract function prototypes from `esp_wifi.h` and use them to generate `esp_wifi_remote` function declarations (and forwarding the definitions to the underlying RPC component -- `esp_hosted`) -We process the local `esp_wifi_types_native.h` and replace `CONFIG_IDF_TARGET` to `CONFIG_SLAVE_IDF_TARGET` and `CONFIG_SOC_WIFI_...` to `CONFIG_SLAVE_...`. -Similarly we process `esp_wifi`'s Kconfig, so the dependencies are on the slave target and slave SOC capabilities. +* We extract function prototypes from `esp_wifi.h` and use them to generate `esp_wifi_remote` function declarations. +* We process the local `esp_wifi_types_native.h` and replace `CONFIG_IDF_TARGET` to `CONFIG_SLAVE_IDF_TARGET` and `CONFIG_SOC_WIFI_...` to `CONFIG_SLAVE_....` +* Similarly we process `esp_wifi`'s Kconfig, so the dependencies are on the slave target and slave SOC capabilities. Please check the [README.md](./scripts/README.md) for more details on the generation step and testing consistency. diff --git a/components/esp_wifi_remote/esp_wifi_remote_private.h b/components/esp_wifi_remote/esp_wifi_remote_private.h new file mode 100644 index 00000000000..a9bae4326bb --- /dev/null +++ b/components/esp_wifi_remote/esp_wifi_remote_private.h @@ -0,0 +1,16 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once +#include "esp_wifi.h" +#include "esp_wifi_remote.h" + +esp_err_t remote_esp_wifi_init_slave(void); + +// handling channels +esp_err_t esp_wifi_remote_channel_rx(void *h, void *buffer, void *buff_to_free, size_t len); +esp_err_t esp_wifi_remote_channel_set(wifi_interface_t ifx, void *h, esp_remote_channel_tx_fn_t tx_cb); +esp_err_t esp_wifi_remote_rpc_channel_rx(void *h, void *buffer, size_t len); +esp_err_t esp_wifi_remote_rpc_channel_set(void *h, esp_remote_channel_tx_fn_t tx_cb); diff --git a/components/esp_wifi_remote/esp_wifi_remote_weak.c b/components/esp_wifi_remote/esp_wifi_remote_weak.c new file mode 100644 index 00000000000..3443e65c8c3 --- /dev/null +++ b/components/esp_wifi_remote/esp_wifi_remote_weak.c @@ -0,0 +1,393 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +// This file is auto-generated +#include "esp_wifi_remote.h" +#define WEAK __attribute__((weak)) + +WEAK esp_err_t esp_wifi_remote_init(const wifi_init_config_t *config) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_deinit(void) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_mode(wifi_mode_t mode) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_get_mode(wifi_mode_t *mode) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_start(void) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_stop(void) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_restore(void) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_connect(void) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_disconnect(void) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_clear_fast_connect(void) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_deauth_sta(uint16_t aid) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_scan_start(const wifi_scan_config_t *config, _Bool block) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_scan_stop(void) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_scan_get_ap_num(uint16_t *number) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_scan_get_ap_record(wifi_ap_record_t *ap_record) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_clear_ap_list(void) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_sta_get_ap_info(wifi_ap_record_t *ap_info) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_ps(wifi_ps_type_t type) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_get_ps(wifi_ps_type_t *type) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_channel(uint8_t primary, wifi_second_chan_t second) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_get_channel(uint8_t *primary, wifi_second_chan_t *second) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_country(const wifi_country_t *country) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_get_country(wifi_country_t *country) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_mac(wifi_interface_t ifx, const uint8_t mac[6]) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_get_mac(wifi_interface_t ifx, uint8_t mac[6]) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_promiscuous(_Bool en) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_get_promiscuous(_Bool *en) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_get_promiscuous_filter(wifi_promiscuous_filter_t *filter) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_promiscuous_ctrl_filter(const wifi_promiscuous_filter_t *filter) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_config(wifi_interface_t interface, wifi_config_t *conf) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_get_config(wifi_interface_t interface, wifi_config_t *conf) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_ap_get_sta_list(wifi_sta_list_t *sta) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_storage(wifi_storage_t storage) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_vendor_ie(_Bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_max_tx_power(int8_t power) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_get_max_tx_power(int8_t *power) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_event_mask(uint32_t mask) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_get_event_mask(uint32_t *mask) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_80211_tx(wifi_interface_t ifx, const void *buffer, int len, _Bool en_sys_seq) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_csi_config(const wifi_csi_config_t *config) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_csi(_Bool en) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_ant_gpio(const wifi_ant_gpio_config_t *config) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_get_ant_gpio(wifi_ant_gpio_config_t *config) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_ant(const wifi_ant_config_t *config) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_get_ant(wifi_ant_config_t *config) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK int64_t esp_wifi_remote_get_tsf_time(wifi_interface_t interface) +{ + return -1; +} + +WEAK esp_err_t esp_wifi_remote_set_inactive_time(wifi_interface_t ifx, uint16_t sec) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_get_inactive_time(wifi_interface_t ifx, uint16_t *sec) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_statis_dump(uint32_t modules) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_rssi_threshold(int32_t rssi) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_ftm_end_session(void) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_ftm_resp_set_offset(int16_t offset_cm) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_ftm_get_report(wifi_ftm_report_entry_t *report, uint8_t num_entries) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_config_11b_rate(wifi_interface_t ifx, _Bool disable) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_connectionless_module_set_wake_interval(uint16_t wake_interval) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_force_wakeup_acquire(void) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_force_wakeup_release(void) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_country_code(const char *country, _Bool ieee80211d_enabled) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_get_country_code(char *country) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_disable_pmf_config(wifi_interface_t ifx) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_sta_get_aid(uint16_t *aid) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_set_dynamic_cs(_Bool enabled) +{ + return ESP_ERR_NOT_SUPPORTED; +} + +WEAK esp_err_t esp_wifi_remote_sta_get_rssi(int *rssi) +{ + return ESP_ERR_NOT_SUPPORTED; +} diff --git a/components/esp_wifi_remote/esp_wifi_with_remote.c b/components/esp_wifi_remote/esp_wifi_with_remote.c index d687f75412d..66b202fc933 100644 --- a/components/esp_wifi_remote/esp_wifi_with_remote.c +++ b/components/esp_wifi_remote/esp_wifi_with_remote.c @@ -3,6 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ +// This file is auto-generated #include "esp_wifi.h" #include "esp_wifi_remote.h" @@ -326,6 +327,11 @@ esp_err_t esp_wifi_ftm_resp_set_offset(int16_t offset_cm) return esp_wifi_remote_ftm_resp_set_offset(offset_cm); } +esp_err_t esp_wifi_ftm_get_report(wifi_ftm_report_entry_t *report, uint8_t num_entries) +{ + return esp_wifi_remote_ftm_get_report(report, num_entries); +} + esp_err_t esp_wifi_config_11b_rate(wifi_interface_t ifx, _Bool disable) { return esp_wifi_remote_config_11b_rate(ifx, disable); diff --git a/components/esp_wifi_remote/include/esp_wifi_remote.h b/components/esp_wifi_remote/include/esp_wifi_remote.h index 2fcbdd555df..00f131e8cfe 100644 --- a/components/esp_wifi_remote/include/esp_wifi_remote.h +++ b/components/esp_wifi_remote/include/esp_wifi_remote.h @@ -5,6 +5,7 @@ */ #pragma once #include "esp_wifi.h" +#include "esp_wifi_remote_api.h" typedef esp_err_t (*esp_remote_channel_rx_fn_t)(void *h, void *buffer, void *buff_to_free, size_t len); typedef esp_err_t (*esp_remote_channel_tx_fn_t)(void *h, void *buffer, size_t len); @@ -12,20 +13,5 @@ typedef esp_err_t (*esp_remote_channel_tx_fn_t)(void *h, void *buffer, size_t le typedef struct esp_remote_channel *esp_remote_channel_t; typedef struct esp_remote_channel_config *esp_remote_channel_config_t; -// Public API -#define ESP_WIFI_REMOTE_WITH_HOSTED 1 -#if ESP_WIFI_REMOTE_WITH_HOSTED -#include "esp_wifi_remote_with_hosted.h" -#else -#include "esp_wifi_remote_api.h" -#endif - // TODO: Move this to private include // Private API -esp_err_t remote_esp_wifi_init_slave(void); - -// handling channels -esp_err_t esp_wifi_remote_channel_rx(void *h, void *buffer, void *buff_to_free, size_t len); -esp_err_t esp_wifi_remote_channel_set(wifi_interface_t ifx, void *h, esp_remote_channel_tx_fn_t tx_cb); -esp_err_t esp_wifi_remote_rpc_channel_rx(void *h, void *buffer, size_t len); -esp_err_t esp_wifi_remote_rpc_channel_set(void *h, esp_remote_channel_tx_fn_t tx_cb); diff --git a/components/esp_wifi_remote/include/esp_wifi_remote_api.h b/components/esp_wifi_remote/include/esp_wifi_remote_api.h index d39fea26115..420aa5e7e9e 100644 --- a/components/esp_wifi_remote/include/esp_wifi_remote_api.h +++ b/components/esp_wifi_remote/include/esp_wifi_remote_api.h @@ -1,8 +1,10 @@ /* - * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ +// This file is auto-generated +#pragma once esp_err_t esp_wifi_remote_init(const wifi_init_config_t *config); esp_err_t esp_wifi_remote_deinit(void); esp_err_t esp_wifi_remote_set_mode(wifi_mode_t mode); @@ -67,6 +69,7 @@ esp_err_t esp_wifi_remote_set_rssi_threshold(int32_t rssi); esp_err_t esp_wifi_remote_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg); esp_err_t esp_wifi_remote_ftm_end_session(void); esp_err_t esp_wifi_remote_ftm_resp_set_offset(int16_t offset_cm); +esp_err_t esp_wifi_remote_ftm_get_report(wifi_ftm_report_entry_t *report, uint8_t num_entries); esp_err_t esp_wifi_remote_config_11b_rate(wifi_interface_t ifx, _Bool disable); esp_err_t esp_wifi_remote_connectionless_module_set_wake_interval(uint16_t wake_interval); esp_err_t esp_wifi_remote_force_wakeup_acquire(void); diff --git a/components/esp_wifi_remote/scripts/check_headers.sh b/components/esp_wifi_remote/scripts/check_headers.sh deleted file mode 100755 index 947a935961b..00000000000 --- a/components/esp_wifi_remote/scripts/check_headers.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -set -e - -check_files=" - include/esp_wifi_remote_api.h - include/esp_wifi_remote_with_hosted.h - esp_wifi_with_remote.c - test/smoke_test/components/esp_hosted/esp_hosted_mock.c - test/smoke_test/components/esp_hosted/include/esp_hosted_mock.h - test/smoke_test/main/all_wifi_calls.c - test/smoke_test/main/all_wifi_remote_calls.c - include/esp_wifi_types_native.h - Kconfig - Kconfig.soc_wifi_caps.in - " - -for i in $check_files; do - generated_header="${i##*/}" - current_header="../$i" - echo "Checking $current_header" - diff -I 'FileCopyrightText' $generated_header $current_header -done; diff --git a/components/esp_wifi_remote/scripts/copyright_header.h b/components/esp_wifi_remote/scripts/copyright_header.h index ff0217ffe0f..f4f626a7cbb 100644 --- a/components/esp_wifi_remote/scripts/copyright_header.h +++ b/components/esp_wifi_remote/scripts/copyright_header.h @@ -3,3 +3,4 @@ * * SPDX-License-Identifier: Apache-2.0 */ +// This file is auto-generated diff --git a/components/esp_wifi_remote/scripts/parse_header.py b/components/esp_wifi_remote/scripts/generate_and_check.py similarity index 55% rename from components/esp_wifi_remote/scripts/parse_header.py rename to components/esp_wifi_remote/scripts/generate_and_check.py index 099d99aaae0..0e63c46114a 100644 --- a/components/esp_wifi_remote/scripts/parse_header.py +++ b/components/esp_wifi_remote/scripts/generate_and_check.py @@ -1,5 +1,6 @@ # SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 +import argparse import json import os import re @@ -11,6 +12,10 @@ Param = namedtuple('Param', ['ptr', 'array', 'qual', 'type', 'name']) +AUTO_GENERATED = 'This file is auto-generated' +COPYRIGHT_HEADER = open('copyright_header.h', 'r').read() +NAMESPACE = re.compile(r'^esp_wifi') + class FunctionVisitor(c_ast.NodeVisitor): def __init__(self, header): @@ -64,8 +69,8 @@ def extract_function_prototypes(header_code, header): return visitor.function_prototypes -def exec_cmd(what, out_file): - p = subprocess.Popen(what, stdin=subprocess.PIPE, stdout=out_file, stderr=subprocess.PIPE) +def exec_cmd(what, out_file=None): + p = subprocess.Popen(what, stdin=subprocess.PIPE, stdout=out_file if out_file is not None else subprocess.PIPE, stderr=subprocess.PIPE) output_b, err_b = p.communicate() rc = p.returncode output: str = output_b.decode('utf-8') if output_b is not None else '' @@ -151,25 +156,11 @@ def get_vars(parameters): return definitions, comma_separated_names -if __name__ == '__main__': - idf_path = os.getenv('IDF_PATH') - if idf_path is None: - raise RuntimeError("Environment variable 'IDF_PATH' wasn't set.") - - with open('Kconfig.hosted.mock', 'w') as f: - 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') - - test_config = 0 - with open('Kconfig.soc_wifi_caps.in', 'w') as out: +def generate_kconfig_wifi_caps(idf_path, component_path): + kconfig = os.path.join(component_path, 'Kconfig.soc_wifi_caps.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') soc_caps = os.path.join(idf_path, 'components', 'soc', slave_target, 'include', 'soc', 'Kconfig.soc_caps.in') @@ -177,8 +168,10 @@ def get_vars(parameters): for line in f: if line.strip().startswith('config SOC_WIFI_'): if 'config SOC_WIFI_SUPPORTED' in line: - test_config += 1 # if WiFi supported for this target, test it as a slave - open(f'sdkconfig.ci.{test_config}', 'w').write(f'CONFIG_SLAVE_IDF_TARGET_{slave_target.upper()}=y\n') + # if WiFi supported for this target, test it as a slave + 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 @@ -186,101 +179,129 @@ def get_vars(parameters): line = f.readline() # default out.write(f' {line}\n') out.write(f'endif # {slave_target.upper()}\n') + return [kconfig] + sdkconfig_files - header = os.path.join(idf_path, 'components', 'esp_wifi', 'include', 'esp_wifi.h') - function_prototypes = extract_function_prototypes(preprocess(idf_path, header), header) - copyright_header = open('copyright_header.h', 'r').read() - namespace = re.compile(r'^esp_wifi') - with open('esp_wifi_remote_api.h', 'w') as f: - f.write(copyright_header) +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] + + +def generate_remote_wifi_api(function_prototypes, component_path): + header = os.path.join(component_path, 'include', 'esp_wifi_remote_api.h') + wifi_source = os.path.join(component_path, 'esp_wifi_with_remote.c') + remote_source = os.path.join(component_path, 'esp_wifi_remote_weak.c') + with open(header, 'w') as f: + f.write(COPYRIGHT_HEADER) + f.write('#pragma once\n') for func_name, args in function_prototypes.items(): params, _ = get_args(args[1]) - remote_func_name = namespace.sub('esp_wifi_remote', func_name) + remote_func_name = NAMESPACE.sub('esp_wifi_remote', func_name) f.write(f'{args[0]} {remote_func_name}({params});\n') + with open(wifi_source, 'w') as wifi, open(remote_source, 'w') as remote: + wifi.write(COPYRIGHT_HEADER) + wifi.write('#include "esp_wifi.h"\n') + wifi.write('#include "esp_wifi_remote.h"\n') + remote.write(COPYRIGHT_HEADER) + remote.write('#include "esp_wifi_remote.h"\n') + remote.write('#define WEAK __attribute__((weak))\n') + for func_name, args in function_prototypes.items(): + remote_func_name = NAMESPACE.sub('esp_wifi_remote', func_name) + params, names = get_args(args[1]) + ret_type = args[0] + ret_value = '-1' # default return value indicating error + if (ret_type == 'esp_err_t'): + ret_value = 'ESP_ERR_NOT_SUPPORTED' + wifi.write(f'\n{args[0]} {func_name}({params})\n') + wifi.write('{\n') + wifi.write(f' return {remote_func_name}({names});\n') + wifi.write('}\n') + remote.write(f'\nWEAK {args[0]} {remote_func_name}({params})\n') + remote.write('{\n') + remote.write(f' return {ret_value};\n') + remote.write('}\n') + return [header, wifi_source, remote_source] + - with open('esp_wifi_with_remote.c', 'w') as f: - f.write(copyright_header) +def generate_hosted_mocks(function_prototypes, component_path): + source = os.path.join(component_path, 'test', 'smoke_test', 'components', 'esp_hosted', 'esp_hosted_mock.c') + header = os.path.join(component_path, 'test', 'smoke_test', 'components', 'esp_hosted', 'include', 'esp_hosted_mock.h') + with open(source, 'w') as f, open(header, 'w') as h: + f.write(COPYRIGHT_HEADER) + h.write(COPYRIGHT_HEADER) + h.write('#pragma once\n') f.write('#include "esp_wifi.h"\n') f.write('#include "esp_wifi_remote.h"\n') for func_name, args in function_prototypes.items(): - remote_func_name = namespace.sub('esp_wifi_remote', func_name) + hosted_func_name = NAMESPACE.sub('esp_wifi_remote', func_name) params, names = get_args(args[1]) - f.write(f'\n{args[0]} {func_name}({params})\n') + ret_type = args[0] + ret_value = '0' # default return value + if (ret_type == 'esp_err_t'): + ret_value = 'ESP_OK' + f.write(f'\n{ret_type} {hosted_func_name}({params})\n') f.write('{\n') - f.write(f' return {remote_func_name}({names});\n') + f.write(f' return {ret_value};\n') f.write('}\n') - - with open('esp_hosted_mock.c', 'w') as f: - with open('esp_hosted_mock.h', 'w') as h: - f.write(copyright_header) - h.write(copyright_header) - h.write('\n') - f.write('#include "esp_wifi.h"\n') - f.write('#include "esp_wifi_remote.h"\n') - for func_name, args in function_prototypes.items(): - hosted_func_name = namespace.sub('esp_hosted_wifi', func_name) - params, names = get_args(args[1]) - ret_type = args[0] - ret_value = '0' # default return value - if (ret_type == 'esp_err_t'): - ret_value = 'ESP_OK' - f.write(f'\n{ret_type} {hosted_func_name}({params})\n') - f.write('{\n') - f.write(f' return {ret_value};\n') - f.write('}\n') - h.write(f'{ret_type} {hosted_func_name}({params});\n') - - with open('esp_wifi_remote_with_hosted.h', 'w') as f: - f.write(copyright_header) - f.write('#include "esp_hosted_wifi_api.h"\n') + h.write(f'{ret_type} {hosted_func_name}({params});\n') + return [source, header] + + +def generate_test_cases(function_prototypes, component_path): + wifi_cases = os.path.join(component_path, 'test', 'smoke_test', 'main', 'all_wifi_calls.c') + remote_wifi_cases = os.path.join(component_path, 'test', 'smoke_test', 'main', 'all_wifi_remote_calls.c') + with open(wifi_cases, 'w') as wifi, open(remote_wifi_cases, 'w') as remote: + wifi.write(COPYRIGHT_HEADER) + remote.write(COPYRIGHT_HEADER) + wifi.write('#include "esp_wifi.h"\n\n') + remote.write('#include "esp_wifi_remote.h"\n\n') + wifi.write('void run_all_wifi_apis(void)\n{\n') + remote.write('void run_all_wifi_remote_apis(void)\n{\n') for func_name, args in function_prototypes.items(): - remote_func_name = namespace.sub('esp_wifi_remote', func_name) - hosted_func_name = namespace.sub('esp_hosted_wifi', func_name) - - params, names = get_args(args[1]) - f.write(f'\nstatic inline {args[0]} {remote_func_name}({params})\n') - f.write('{\n') - f.write(f' return {hosted_func_name}({names});\n') - f.write('}\n') - - with open('all_wifi_calls.c', 'w') as wifi: - with open('all_wifi_remote_calls.c', 'w') as remote: - wifi.write(copyright_header) - remote.write(copyright_header) - wifi.write('#include "esp_wifi.h"\n\n') - remote.write('#include "esp_wifi_remote.h"\n\n') - wifi.write('void run_all_wifi_apis(void)\n{\n') - remote.write('void run_all_wifi_remote_apis(void)\n{\n') - for func_name, args in function_prototypes.items(): - remote_func_name = namespace.sub('esp_wifi_remote', func_name) - - defs, names = get_vars(args[1]) - wifi.write(' {\n') - wifi.write(f'{defs}') - wifi.write(f' {func_name}({names});\n') - wifi.write(' }\n\n') - remote.write(' {\n') - remote.write(f'{defs}') - remote.write(f' {remote_func_name}({names});\n') - remote.write(' }\n\n') - wifi.write('}\n') - remote.write('}\n') - + remote_func_name = NAMESPACE.sub('esp_wifi_remote', func_name) + defs, names = get_vars(args[1]) + wifi.write(' {\n') + wifi.write(f'{defs}') + wifi.write(f' {func_name}({names});\n') + wifi.write(' }\n\n') + remote.write(' {\n') + remote.write(f'{defs}') + remote.write(f' {remote_func_name}({names});\n') + remote.write(' }\n\n') + wifi.write('}\n') + remote.write('}\n') + return [wifi_cases, remote_wifi_cases] + + +def generate_wifi_native(idf_path, component_path): + wifi_native = os.path.join(component_path, 'include', 'esp_wifi_types_native.h') native_header = os.path.join(idf_path, 'components', 'esp_wifi', 'include', 'local', 'esp_wifi_types_native.h') orig_content = open(native_header, 'r').read() content = orig_content.replace('CONFIG_','CONFIG_SLAVE_') - open('esp_wifi_types_native.h', 'w').write(content) + open(wifi_native, 'w').write(content) + return [wifi_native] + +def generate_kconfig(idf_path, component_path): + remote_kconfig = os.path.join(component_path, 'Kconfig') slave_configs = ['SOC_WIFI_', 'IDF_TARGET_'] - pattern = re.compile(r'ESP_WIFI_') - Kconfig = os.path.join(idf_path, 'components', 'esp_wifi', 'Kconfig') - lines = open(Kconfig, 'r').readlines() - copy = 100 + lines = open(os.path.join(idf_path, 'components', 'esp_wifi', 'Kconfig'), 'r').readlines() + copy = 100 # just a big number to be greater than nested_if in the first few iterations nested_if = 0 - wifi_configs = [] - types = ['bool', 'int'] - with open('Kconfig', 'w') as f: + with open(remote_kconfig, 'w') as f: + f.write(f'# {AUTO_GENERATED}\n') f.write('menu "Wi-Fi Remote"\n') f.write(' orsource "./Kconfig.soc_wifi_caps.in"\n') for line1 in lines: @@ -299,3 +320,63 @@ def get_vars(parameters): if line.startswith('if ESP_WIFI_ENABLED'): copy = nested_if f.write('endmenu # Wi-Fi Remote\n') + return [remote_kconfig] + + +if __name__ == '__main__': + parser = argparse.ArgumentParser( + description='Build all projects', + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + epilog='''\ +TEST FAILED +----------- +Some of the component files are different from the pregenerated output. +Please check the files that marked as "FAILED" in this step, +typically you'd just need to commit the changes and create a new version. +Please be aware that the pregenerated files use the same copyright header, so after +making changes you might need to modify 'copyright_header.h' in the script directory. + ''') + parser.add_argument('-s', '--skip-check', help='Skip checking the versioned files against the re-generated', action='store_true') + args = parser.parse_args() + + component_path = os.path.normpath(os.path.join(os.path.realpath(__file__),'..', '..')) + idf_path = os.getenv('IDF_PATH') + if idf_path is None: + raise RuntimeError("Environment variable 'IDF_PATH' wasn't set.") + header = os.path.join(idf_path, 'components', 'esp_wifi', 'include', 'esp_wifi.h') + function_prototypes = extract_function_prototypes(preprocess(idf_path, header), header) + + 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) + + files_to_check += generate_hosted_mocks(function_prototypes, component_path) + + files_to_check += generate_test_cases(function_prototypes, component_path) + + files_to_check += generate_wifi_native(idf_path, component_path) + + files_to_check += generate_kconfig(idf_path, component_path) + + fail_test = False + failures = [] + for f in files_to_check: + print(f'checking {f}') + rc, out, err, cmd = exec_cmd(['git', 'difftool', '-y', '-x', 'diff -I Copyright', '--', f]) + if out == '' or out.isspace(): + print(' - ok') + else: + print(' - FAILED!') + failures.append((f, out)) + fail_test = True + + if fail_test: + print(parser.epilog) + print('\nDIfferent files:\n') + for i in failures: + print(f'{i[0]}\nChanges:\n{i[1]}') + exit(1) diff --git a/components/esp_wifi_remote/scripts/ignore_extensions.h b/components/esp_wifi_remote/scripts/ignore_extensions.h index 1338b2564f8..f65b3caf42c 100644 --- a/components/esp_wifi_remote/scripts/ignore_extensions.h +++ b/components/esp_wifi_remote/scripts/ignore_extensions.h @@ -11,6 +11,3 @@ typedef void *__builtin_va_list; #define __inline__ inline #define __inline inline #define __extension__ -// #define asm -// #define __asm__ -// #define __volatile__ diff --git a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/Kconfig b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/Kconfig index 4fb0091b121..48b4ed62e66 100644 --- a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/Kconfig +++ b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/Kconfig @@ -1,3 +1,4 @@ +# This file is auto-generated menu "ESP Hosted Mock" choice SLAVE_IDF_TARGET prompt "choose slave target" diff --git a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/esp_hosted_mock.c b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/esp_hosted_mock.c index 361ac8a88df..6ae190a660f 100644 --- a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/esp_hosted_mock.c +++ b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/esp_hosted_mock.c @@ -3,385 +3,391 @@ * * SPDX-License-Identifier: Apache-2.0 */ +// This file is auto-generated #include "esp_wifi.h" #include "esp_wifi_remote.h" -esp_err_t esp_hosted_wifi_init(const wifi_init_config_t *config) +esp_err_t esp_wifi_remote_init(const wifi_init_config_t *config) { return ESP_OK; } -esp_err_t esp_hosted_wifi_deinit(void) +esp_err_t esp_wifi_remote_deinit(void) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_mode(wifi_mode_t mode) +esp_err_t esp_wifi_remote_set_mode(wifi_mode_t mode) { return ESP_OK; } -esp_err_t esp_hosted_wifi_get_mode(wifi_mode_t *mode) +esp_err_t esp_wifi_remote_get_mode(wifi_mode_t *mode) { return ESP_OK; } -esp_err_t esp_hosted_wifi_start(void) +esp_err_t esp_wifi_remote_start(void) { return ESP_OK; } -esp_err_t esp_hosted_wifi_stop(void) +esp_err_t esp_wifi_remote_stop(void) { return ESP_OK; } -esp_err_t esp_hosted_wifi_restore(void) +esp_err_t esp_wifi_remote_restore(void) { return ESP_OK; } -esp_err_t esp_hosted_wifi_connect(void) +esp_err_t esp_wifi_remote_connect(void) { return ESP_OK; } -esp_err_t esp_hosted_wifi_disconnect(void) +esp_err_t esp_wifi_remote_disconnect(void) { return ESP_OK; } -esp_err_t esp_hosted_wifi_clear_fast_connect(void) +esp_err_t esp_wifi_remote_clear_fast_connect(void) { return ESP_OK; } -esp_err_t esp_hosted_wifi_deauth_sta(uint16_t aid) +esp_err_t esp_wifi_remote_deauth_sta(uint16_t aid) { return ESP_OK; } -esp_err_t esp_hosted_wifi_scan_start(const wifi_scan_config_t *config, _Bool block) +esp_err_t esp_wifi_remote_scan_start(const wifi_scan_config_t *config, _Bool block) { return ESP_OK; } -esp_err_t esp_hosted_wifi_scan_stop(void) +esp_err_t esp_wifi_remote_scan_stop(void) { return ESP_OK; } -esp_err_t esp_hosted_wifi_scan_get_ap_num(uint16_t *number) +esp_err_t esp_wifi_remote_scan_get_ap_num(uint16_t *number) { return ESP_OK; } -esp_err_t esp_hosted_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records) +esp_err_t esp_wifi_remote_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records) { return ESP_OK; } -esp_err_t esp_hosted_wifi_scan_get_ap_record(wifi_ap_record_t *ap_record) +esp_err_t esp_wifi_remote_scan_get_ap_record(wifi_ap_record_t *ap_record) { return ESP_OK; } -esp_err_t esp_hosted_wifi_clear_ap_list(void) +esp_err_t esp_wifi_remote_clear_ap_list(void) { return ESP_OK; } -esp_err_t esp_hosted_wifi_sta_get_ap_info(wifi_ap_record_t *ap_info) +esp_err_t esp_wifi_remote_sta_get_ap_info(wifi_ap_record_t *ap_info) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_ps(wifi_ps_type_t type) +esp_err_t esp_wifi_remote_set_ps(wifi_ps_type_t type) { return ESP_OK; } -esp_err_t esp_hosted_wifi_get_ps(wifi_ps_type_t *type) +esp_err_t esp_wifi_remote_get_ps(wifi_ps_type_t *type) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap) +esp_err_t esp_wifi_remote_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap) { return ESP_OK; } -esp_err_t esp_hosted_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap) +esp_err_t esp_wifi_remote_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw) +esp_err_t esp_wifi_remote_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw) { return ESP_OK; } -esp_err_t esp_hosted_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw) +esp_err_t esp_wifi_remote_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_channel(uint8_t primary, wifi_second_chan_t second) +esp_err_t esp_wifi_remote_set_channel(uint8_t primary, wifi_second_chan_t second) { return ESP_OK; } -esp_err_t esp_hosted_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second) +esp_err_t esp_wifi_remote_get_channel(uint8_t *primary, wifi_second_chan_t *second) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_country(const wifi_country_t *country) +esp_err_t esp_wifi_remote_set_country(const wifi_country_t *country) { return ESP_OK; } -esp_err_t esp_hosted_wifi_get_country(wifi_country_t *country) +esp_err_t esp_wifi_remote_get_country(wifi_country_t *country) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_mac(wifi_interface_t ifx, const uint8_t mac[6]) +esp_err_t esp_wifi_remote_set_mac(wifi_interface_t ifx, const uint8_t mac[6]) { return ESP_OK; } -esp_err_t esp_hosted_wifi_get_mac(wifi_interface_t ifx, uint8_t mac[6]) +esp_err_t esp_wifi_remote_get_mac(wifi_interface_t ifx, uint8_t mac[6]) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb) +esp_err_t esp_wifi_remote_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_promiscuous(_Bool en) +esp_err_t esp_wifi_remote_set_promiscuous(_Bool en) { return ESP_OK; } -esp_err_t esp_hosted_wifi_get_promiscuous(_Bool *en) +esp_err_t esp_wifi_remote_get_promiscuous(_Bool *en) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter) +esp_err_t esp_wifi_remote_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter) { return ESP_OK; } -esp_err_t esp_hosted_wifi_get_promiscuous_filter(wifi_promiscuous_filter_t *filter) +esp_err_t esp_wifi_remote_get_promiscuous_filter(wifi_promiscuous_filter_t *filter) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_promiscuous_ctrl_filter(const wifi_promiscuous_filter_t *filter) +esp_err_t esp_wifi_remote_set_promiscuous_ctrl_filter(const wifi_promiscuous_filter_t *filter) { return ESP_OK; } -esp_err_t esp_hosted_wifi_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter) +esp_err_t esp_wifi_remote_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_config(wifi_interface_t interface, wifi_config_t *conf) +esp_err_t esp_wifi_remote_set_config(wifi_interface_t interface, wifi_config_t *conf) { return ESP_OK; } -esp_err_t esp_hosted_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf) +esp_err_t esp_wifi_remote_get_config(wifi_interface_t interface, wifi_config_t *conf) { return ESP_OK; } -esp_err_t esp_hosted_wifi_ap_get_sta_list(wifi_sta_list_t *sta) +esp_err_t esp_wifi_remote_ap_get_sta_list(wifi_sta_list_t *sta) { return ESP_OK; } -esp_err_t esp_hosted_wifi_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid) +esp_err_t esp_wifi_remote_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_storage(wifi_storage_t storage) +esp_err_t esp_wifi_remote_set_storage(wifi_storage_t storage) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_vendor_ie(_Bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie) +esp_err_t esp_wifi_remote_set_vendor_ie(_Bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx) +esp_err_t esp_wifi_remote_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_max_tx_power(int8_t power) +esp_err_t esp_wifi_remote_set_max_tx_power(int8_t power) { return ESP_OK; } -esp_err_t esp_hosted_wifi_get_max_tx_power(int8_t *power) +esp_err_t esp_wifi_remote_get_max_tx_power(int8_t *power) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_event_mask(uint32_t mask) +esp_err_t esp_wifi_remote_set_event_mask(uint32_t mask) { return ESP_OK; } -esp_err_t esp_hosted_wifi_get_event_mask(uint32_t *mask) +esp_err_t esp_wifi_remote_get_event_mask(uint32_t *mask) { return ESP_OK; } -esp_err_t esp_hosted_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, _Bool en_sys_seq) +esp_err_t esp_wifi_remote_80211_tx(wifi_interface_t ifx, const void *buffer, int len, _Bool en_sys_seq) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx) +esp_err_t esp_wifi_remote_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_csi_config(const wifi_csi_config_t *config) +esp_err_t esp_wifi_remote_set_csi_config(const wifi_csi_config_t *config) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_csi(_Bool en) +esp_err_t esp_wifi_remote_set_csi(_Bool en) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_ant_gpio(const wifi_ant_gpio_config_t *config) +esp_err_t esp_wifi_remote_set_ant_gpio(const wifi_ant_gpio_config_t *config) { return ESP_OK; } -esp_err_t esp_hosted_wifi_get_ant_gpio(wifi_ant_gpio_config_t *config) +esp_err_t esp_wifi_remote_get_ant_gpio(wifi_ant_gpio_config_t *config) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_ant(const wifi_ant_config_t *config) +esp_err_t esp_wifi_remote_set_ant(const wifi_ant_config_t *config) { return ESP_OK; } -esp_err_t esp_hosted_wifi_get_ant(wifi_ant_config_t *config) +esp_err_t esp_wifi_remote_get_ant(wifi_ant_config_t *config) { return ESP_OK; } -int64_t esp_hosted_wifi_get_tsf_time(wifi_interface_t interface) +int64_t esp_wifi_remote_get_tsf_time(wifi_interface_t interface) { return 0; } -esp_err_t esp_hosted_wifi_set_inactive_time(wifi_interface_t ifx, uint16_t sec) +esp_err_t esp_wifi_remote_set_inactive_time(wifi_interface_t ifx, uint16_t sec) { return ESP_OK; } -esp_err_t esp_hosted_wifi_get_inactive_time(wifi_interface_t ifx, uint16_t *sec) +esp_err_t esp_wifi_remote_get_inactive_time(wifi_interface_t ifx, uint16_t *sec) { return ESP_OK; } -esp_err_t esp_hosted_wifi_statis_dump(uint32_t modules) +esp_err_t esp_wifi_remote_statis_dump(uint32_t modules) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_rssi_threshold(int32_t rssi) +esp_err_t esp_wifi_remote_set_rssi_threshold(int32_t rssi) { return ESP_OK; } -esp_err_t esp_hosted_wifi_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg) +esp_err_t esp_wifi_remote_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg) { return ESP_OK; } -esp_err_t esp_hosted_wifi_ftm_end_session(void) +esp_err_t esp_wifi_remote_ftm_end_session(void) { return ESP_OK; } -esp_err_t esp_hosted_wifi_ftm_resp_set_offset(int16_t offset_cm) +esp_err_t esp_wifi_remote_ftm_resp_set_offset(int16_t offset_cm) { return ESP_OK; } -esp_err_t esp_hosted_wifi_config_11b_rate(wifi_interface_t ifx, _Bool disable) +esp_err_t esp_wifi_remote_ftm_get_report(wifi_ftm_report_entry_t *report, uint8_t num_entries) { return ESP_OK; } -esp_err_t esp_hosted_wifi_connectionless_module_set_wake_interval(uint16_t wake_interval) +esp_err_t esp_wifi_remote_config_11b_rate(wifi_interface_t ifx, _Bool disable) { return ESP_OK; } -esp_err_t esp_hosted_wifi_force_wakeup_acquire(void) +esp_err_t esp_wifi_remote_connectionless_module_set_wake_interval(uint16_t wake_interval) { return ESP_OK; } -esp_err_t esp_hosted_wifi_force_wakeup_release(void) +esp_err_t esp_wifi_remote_force_wakeup_acquire(void) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_country_code(const char *country, _Bool ieee80211d_enabled) +esp_err_t esp_wifi_remote_force_wakeup_release(void) { return ESP_OK; } -esp_err_t esp_hosted_wifi_get_country_code(char *country) +esp_err_t esp_wifi_remote_set_country_code(const char *country, _Bool ieee80211d_enabled) { return ESP_OK; } -esp_err_t esp_hosted_wifi_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate) +esp_err_t esp_wifi_remote_get_country_code(char *country) { return ESP_OK; } -esp_err_t esp_hosted_wifi_disable_pmf_config(wifi_interface_t ifx) +esp_err_t esp_wifi_remote_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate) { return ESP_OK; } -esp_err_t esp_hosted_wifi_sta_get_aid(uint16_t *aid) +esp_err_t esp_wifi_remote_disable_pmf_config(wifi_interface_t ifx) { return ESP_OK; } -esp_err_t esp_hosted_wifi_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode) +esp_err_t esp_wifi_remote_sta_get_aid(uint16_t *aid) { return ESP_OK; } -esp_err_t esp_hosted_wifi_set_dynamic_cs(_Bool enabled) +esp_err_t esp_wifi_remote_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode) { return ESP_OK; } -esp_err_t esp_hosted_wifi_sta_get_rssi(int *rssi) +esp_err_t esp_wifi_remote_set_dynamic_cs(_Bool enabled) +{ + return ESP_OK; +} + +esp_err_t esp_wifi_remote_sta_get_rssi(int *rssi) { return ESP_OK; } diff --git a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/include/esp_hosted_mock.h b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/include/esp_hosted_mock.h index ba6ece408b1..420aa5e7e9e 100644 --- a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/include/esp_hosted_mock.h +++ b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/include/esp_hosted_mock.h @@ -3,80 +3,82 @@ * * SPDX-License-Identifier: Apache-2.0 */ - -esp_err_t esp_hosted_wifi_init(const wifi_init_config_t *config); -esp_err_t esp_hosted_wifi_deinit(void); -esp_err_t esp_hosted_wifi_set_mode(wifi_mode_t mode); -esp_err_t esp_hosted_wifi_get_mode(wifi_mode_t *mode); -esp_err_t esp_hosted_wifi_start(void); -esp_err_t esp_hosted_wifi_stop(void); -esp_err_t esp_hosted_wifi_restore(void); -esp_err_t esp_hosted_wifi_connect(void); -esp_err_t esp_hosted_wifi_disconnect(void); -esp_err_t esp_hosted_wifi_clear_fast_connect(void); -esp_err_t esp_hosted_wifi_deauth_sta(uint16_t aid); -esp_err_t esp_hosted_wifi_scan_start(const wifi_scan_config_t *config, _Bool block); -esp_err_t esp_hosted_wifi_scan_stop(void); -esp_err_t esp_hosted_wifi_scan_get_ap_num(uint16_t *number); -esp_err_t esp_hosted_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records); -esp_err_t esp_hosted_wifi_scan_get_ap_record(wifi_ap_record_t *ap_record); -esp_err_t esp_hosted_wifi_clear_ap_list(void); -esp_err_t esp_hosted_wifi_sta_get_ap_info(wifi_ap_record_t *ap_info); -esp_err_t esp_hosted_wifi_set_ps(wifi_ps_type_t type); -esp_err_t esp_hosted_wifi_get_ps(wifi_ps_type_t *type); -esp_err_t esp_hosted_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap); -esp_err_t esp_hosted_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap); -esp_err_t esp_hosted_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw); -esp_err_t esp_hosted_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw); -esp_err_t esp_hosted_wifi_set_channel(uint8_t primary, wifi_second_chan_t second); -esp_err_t esp_hosted_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second); -esp_err_t esp_hosted_wifi_set_country(const wifi_country_t *country); -esp_err_t esp_hosted_wifi_get_country(wifi_country_t *country); -esp_err_t esp_hosted_wifi_set_mac(wifi_interface_t ifx, const uint8_t mac[6]); -esp_err_t esp_hosted_wifi_get_mac(wifi_interface_t ifx, uint8_t mac[6]); -esp_err_t esp_hosted_wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb); -esp_err_t esp_hosted_wifi_set_promiscuous(_Bool en); -esp_err_t esp_hosted_wifi_get_promiscuous(_Bool *en); -esp_err_t esp_hosted_wifi_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter); -esp_err_t esp_hosted_wifi_get_promiscuous_filter(wifi_promiscuous_filter_t *filter); -esp_err_t esp_hosted_wifi_set_promiscuous_ctrl_filter(const wifi_promiscuous_filter_t *filter); -esp_err_t esp_hosted_wifi_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter); -esp_err_t esp_hosted_wifi_set_config(wifi_interface_t interface, wifi_config_t *conf); -esp_err_t esp_hosted_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf); -esp_err_t esp_hosted_wifi_ap_get_sta_list(wifi_sta_list_t *sta); -esp_err_t esp_hosted_wifi_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid); -esp_err_t esp_hosted_wifi_set_storage(wifi_storage_t storage); -esp_err_t esp_hosted_wifi_set_vendor_ie(_Bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie); -esp_err_t esp_hosted_wifi_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx); -esp_err_t esp_hosted_wifi_set_max_tx_power(int8_t power); -esp_err_t esp_hosted_wifi_get_max_tx_power(int8_t *power); -esp_err_t esp_hosted_wifi_set_event_mask(uint32_t mask); -esp_err_t esp_hosted_wifi_get_event_mask(uint32_t *mask); -esp_err_t esp_hosted_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, _Bool en_sys_seq); -esp_err_t esp_hosted_wifi_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx); -esp_err_t esp_hosted_wifi_set_csi_config(const wifi_csi_config_t *config); -esp_err_t esp_hosted_wifi_set_csi(_Bool en); -esp_err_t esp_hosted_wifi_set_ant_gpio(const wifi_ant_gpio_config_t *config); -esp_err_t esp_hosted_wifi_get_ant_gpio(wifi_ant_gpio_config_t *config); -esp_err_t esp_hosted_wifi_set_ant(const wifi_ant_config_t *config); -esp_err_t esp_hosted_wifi_get_ant(wifi_ant_config_t *config); -int64_t esp_hosted_wifi_get_tsf_time(wifi_interface_t interface); -esp_err_t esp_hosted_wifi_set_inactive_time(wifi_interface_t ifx, uint16_t sec); -esp_err_t esp_hosted_wifi_get_inactive_time(wifi_interface_t ifx, uint16_t *sec); -esp_err_t esp_hosted_wifi_statis_dump(uint32_t modules); -esp_err_t esp_hosted_wifi_set_rssi_threshold(int32_t rssi); -esp_err_t esp_hosted_wifi_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg); -esp_err_t esp_hosted_wifi_ftm_end_session(void); -esp_err_t esp_hosted_wifi_ftm_resp_set_offset(int16_t offset_cm); -esp_err_t esp_hosted_wifi_config_11b_rate(wifi_interface_t ifx, _Bool disable); -esp_err_t esp_hosted_wifi_connectionless_module_set_wake_interval(uint16_t wake_interval); -esp_err_t esp_hosted_wifi_force_wakeup_acquire(void); -esp_err_t esp_hosted_wifi_force_wakeup_release(void); -esp_err_t esp_hosted_wifi_set_country_code(const char *country, _Bool ieee80211d_enabled); -esp_err_t esp_hosted_wifi_get_country_code(char *country); -esp_err_t esp_hosted_wifi_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate); -esp_err_t esp_hosted_wifi_disable_pmf_config(wifi_interface_t ifx); -esp_err_t esp_hosted_wifi_sta_get_aid(uint16_t *aid); -esp_err_t esp_hosted_wifi_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode); -esp_err_t esp_hosted_wifi_set_dynamic_cs(_Bool enabled); -esp_err_t esp_hosted_wifi_sta_get_rssi(int *rssi); +// This file is auto-generated +#pragma once +esp_err_t esp_wifi_remote_init(const wifi_init_config_t *config); +esp_err_t esp_wifi_remote_deinit(void); +esp_err_t esp_wifi_remote_set_mode(wifi_mode_t mode); +esp_err_t esp_wifi_remote_get_mode(wifi_mode_t *mode); +esp_err_t esp_wifi_remote_start(void); +esp_err_t esp_wifi_remote_stop(void); +esp_err_t esp_wifi_remote_restore(void); +esp_err_t esp_wifi_remote_connect(void); +esp_err_t esp_wifi_remote_disconnect(void); +esp_err_t esp_wifi_remote_clear_fast_connect(void); +esp_err_t esp_wifi_remote_deauth_sta(uint16_t aid); +esp_err_t esp_wifi_remote_scan_start(const wifi_scan_config_t *config, _Bool block); +esp_err_t esp_wifi_remote_scan_stop(void); +esp_err_t esp_wifi_remote_scan_get_ap_num(uint16_t *number); +esp_err_t esp_wifi_remote_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records); +esp_err_t esp_wifi_remote_scan_get_ap_record(wifi_ap_record_t *ap_record); +esp_err_t esp_wifi_remote_clear_ap_list(void); +esp_err_t esp_wifi_remote_sta_get_ap_info(wifi_ap_record_t *ap_info); +esp_err_t esp_wifi_remote_set_ps(wifi_ps_type_t type); +esp_err_t esp_wifi_remote_get_ps(wifi_ps_type_t *type); +esp_err_t esp_wifi_remote_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap); +esp_err_t esp_wifi_remote_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap); +esp_err_t esp_wifi_remote_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw); +esp_err_t esp_wifi_remote_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw); +esp_err_t esp_wifi_remote_set_channel(uint8_t primary, wifi_second_chan_t second); +esp_err_t esp_wifi_remote_get_channel(uint8_t *primary, wifi_second_chan_t *second); +esp_err_t esp_wifi_remote_set_country(const wifi_country_t *country); +esp_err_t esp_wifi_remote_get_country(wifi_country_t *country); +esp_err_t esp_wifi_remote_set_mac(wifi_interface_t ifx, const uint8_t mac[6]); +esp_err_t esp_wifi_remote_get_mac(wifi_interface_t ifx, uint8_t mac[6]); +esp_err_t esp_wifi_remote_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb); +esp_err_t esp_wifi_remote_set_promiscuous(_Bool en); +esp_err_t esp_wifi_remote_get_promiscuous(_Bool *en); +esp_err_t esp_wifi_remote_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter); +esp_err_t esp_wifi_remote_get_promiscuous_filter(wifi_promiscuous_filter_t *filter); +esp_err_t esp_wifi_remote_set_promiscuous_ctrl_filter(const wifi_promiscuous_filter_t *filter); +esp_err_t esp_wifi_remote_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter); +esp_err_t esp_wifi_remote_set_config(wifi_interface_t interface, wifi_config_t *conf); +esp_err_t esp_wifi_remote_get_config(wifi_interface_t interface, wifi_config_t *conf); +esp_err_t esp_wifi_remote_ap_get_sta_list(wifi_sta_list_t *sta); +esp_err_t esp_wifi_remote_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid); +esp_err_t esp_wifi_remote_set_storage(wifi_storage_t storage); +esp_err_t esp_wifi_remote_set_vendor_ie(_Bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie); +esp_err_t esp_wifi_remote_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx); +esp_err_t esp_wifi_remote_set_max_tx_power(int8_t power); +esp_err_t esp_wifi_remote_get_max_tx_power(int8_t *power); +esp_err_t esp_wifi_remote_set_event_mask(uint32_t mask); +esp_err_t esp_wifi_remote_get_event_mask(uint32_t *mask); +esp_err_t esp_wifi_remote_80211_tx(wifi_interface_t ifx, const void *buffer, int len, _Bool en_sys_seq); +esp_err_t esp_wifi_remote_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx); +esp_err_t esp_wifi_remote_set_csi_config(const wifi_csi_config_t *config); +esp_err_t esp_wifi_remote_set_csi(_Bool en); +esp_err_t esp_wifi_remote_set_ant_gpio(const wifi_ant_gpio_config_t *config); +esp_err_t esp_wifi_remote_get_ant_gpio(wifi_ant_gpio_config_t *config); +esp_err_t esp_wifi_remote_set_ant(const wifi_ant_config_t *config); +esp_err_t esp_wifi_remote_get_ant(wifi_ant_config_t *config); +int64_t esp_wifi_remote_get_tsf_time(wifi_interface_t interface); +esp_err_t esp_wifi_remote_set_inactive_time(wifi_interface_t ifx, uint16_t sec); +esp_err_t esp_wifi_remote_get_inactive_time(wifi_interface_t ifx, uint16_t *sec); +esp_err_t esp_wifi_remote_statis_dump(uint32_t modules); +esp_err_t esp_wifi_remote_set_rssi_threshold(int32_t rssi); +esp_err_t esp_wifi_remote_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg); +esp_err_t esp_wifi_remote_ftm_end_session(void); +esp_err_t esp_wifi_remote_ftm_resp_set_offset(int16_t offset_cm); +esp_err_t esp_wifi_remote_ftm_get_report(wifi_ftm_report_entry_t *report, uint8_t num_entries); +esp_err_t esp_wifi_remote_config_11b_rate(wifi_interface_t ifx, _Bool disable); +esp_err_t esp_wifi_remote_connectionless_module_set_wake_interval(uint16_t wake_interval); +esp_err_t esp_wifi_remote_force_wakeup_acquire(void); +esp_err_t esp_wifi_remote_force_wakeup_release(void); +esp_err_t esp_wifi_remote_set_country_code(const char *country, _Bool ieee80211d_enabled); +esp_err_t esp_wifi_remote_get_country_code(char *country); +esp_err_t esp_wifi_remote_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate); +esp_err_t esp_wifi_remote_disable_pmf_config(wifi_interface_t ifx); +esp_err_t esp_wifi_remote_sta_get_aid(uint16_t *aid); +esp_err_t esp_wifi_remote_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode); +esp_err_t esp_wifi_remote_set_dynamic_cs(_Bool enabled); +esp_err_t esp_wifi_remote_sta_get_rssi(int *rssi); diff --git a/components/esp_wifi_remote/test/smoke_test/main/all_wifi_calls.c b/components/esp_wifi_remote/test/smoke_test/main/all_wifi_calls.c index 87d5e276fed..196c4df3e05 100644 --- a/components/esp_wifi_remote/test/smoke_test/main/all_wifi_calls.c +++ b/components/esp_wifi_remote/test/smoke_test/main/all_wifi_calls.c @@ -3,6 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ +// This file is auto-generated #include "esp_wifi.h" void run_all_wifi_apis(void) @@ -340,6 +341,12 @@ void run_all_wifi_apis(void) esp_wifi_ftm_resp_set_offset(offset_cm); } + { + wifi_ftm_report_entry_t *report = NULL; + uint8_t num_entries = 0; + esp_wifi_ftm_get_report(report, num_entries); + } + { wifi_interface_t ifx = 0; _Bool disable = 0; diff --git a/components/esp_wifi_remote/test/smoke_test/main/all_wifi_remote_calls.c b/components/esp_wifi_remote/test/smoke_test/main/all_wifi_remote_calls.c index b68904fb7c9..9b49393dabe 100644 --- a/components/esp_wifi_remote/test/smoke_test/main/all_wifi_remote_calls.c +++ b/components/esp_wifi_remote/test/smoke_test/main/all_wifi_remote_calls.c @@ -3,6 +3,7 @@ * * SPDX-License-Identifier: Apache-2.0 */ +// This file is auto-generated #include "esp_wifi_remote.h" void run_all_wifi_remote_apis(void) @@ -340,6 +341,12 @@ void run_all_wifi_remote_apis(void) esp_wifi_remote_ftm_resp_set_offset(offset_cm); } + { + wifi_ftm_report_entry_t *report = NULL; + uint8_t num_entries = 0; + esp_wifi_remote_ftm_get_report(report, num_entries); + } + { wifi_interface_t ifx = 0; _Bool disable = 0; diff --git a/components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.1 b/components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.slave_esp32 similarity index 100% rename from components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.1 rename to components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.slave_esp32 diff --git a/components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.5 b/components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.slave_esp32c2 similarity index 100% rename from components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.5 rename to components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.slave_esp32c2 diff --git a/components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.3 b/components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.slave_esp32c3 similarity index 100% rename from components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.3 rename to components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.slave_esp32c3 diff --git a/components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.6 b/components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.slave_esp32c6 similarity index 100% rename from components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.6 rename to components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.slave_esp32c6 diff --git a/components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.2 b/components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.slave_esp32s2 similarity index 100% rename from components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.2 rename to components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.slave_esp32s2 diff --git a/components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.4 b/components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.slave_esp32s3 similarity index 100% rename from components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.4 rename to components/esp_wifi_remote/test/smoke_test/sdkconfig.ci.slave_esp32s3 diff --git a/components/esp_wifi_remote/wifi_remote_init.c b/components/esp_wifi_remote/wifi_remote_init.c index 77be4069a50..b05a01071ab 100644 --- a/components/esp_wifi_remote/wifi_remote_init.c +++ b/components/esp_wifi_remote/wifi_remote_init.c @@ -7,7 +7,8 @@ #include "esp_err.h" #include "esp_log.h" #include "esp_hosted_api.h" -#include "esp_wifi_remote.h" +#include "esp_wifi_remote_private.h" + const char *TAG = "esp_remote_wifi_init"; esp_err_t remote_esp_wifi_init_slave(void) diff --git a/components/esp_wifi_remote/wifi_remote_net.c b/components/esp_wifi_remote/wifi_remote_net.c index 5bc3ec0cb02..ff419d25338 100644 --- a/components/esp_wifi_remote/wifi_remote_net.c +++ b/components/esp_wifi_remote/wifi_remote_net.c @@ -17,12 +17,10 @@ static wifi_rxcb_t s_rx_fn[CHANNELS]; esp_err_t esp_wifi_remote_channel_rx(void *h, void *buffer, void *buff_to_free, size_t len) { assert(h); - if (h == s_channel[0]) { - assert(s_rx_fn[0]); + if (h == s_channel[0] && s_rx_fn[0]) { return s_rx_fn[0](buffer, len, buff_to_free); } - if (h == s_channel[1]) { - assert(s_rx_fn[1]); + if (h == s_channel[1] && s_rx_fn[1]) { return s_rx_fn[1](buffer, len, buff_to_free); } return ESP_FAIL; @@ -46,6 +44,8 @@ esp_err_t esp_wifi_remote_channel_set(wifi_interface_t ifx, void *h, esp_remote_ esp_err_t esp_wifi_internal_set_sta_ip(void) { + // TODO: Pass this information to the slave target + // Note that this function is called from the default event loop, so we shouldn't block here return ESP_OK; } @@ -56,9 +56,7 @@ esp_err_t esp_wifi_internal_reg_netstack_buf_cb(wifi_netstack_buf_ref_cb_t ref, void esp_wifi_internal_free_rx_buffer(void *buffer) { - if (buffer) { - free(buffer); - } + free(buffer); } int esp_wifi_internal_tx(wifi_interface_t ifx, void *buffer, uint16_t len) diff --git a/components/esp_wifi_remote/wifi_remote_rpc.c b/components/esp_wifi_remote/wifi_remote_rpc.c index 5f2494dce75..830f34285f7 100644 --- a/components/esp_wifi_remote/wifi_remote_rpc.c +++ b/components/esp_wifi_remote/wifi_remote_rpc.c @@ -7,7 +7,7 @@ #include "esp_log.h" #include "esp_err.h" #include "esp_wifi.h" -#include "esp_wifi_remote.h" +#include "esp_wifi_remote_private.h" #include "esp_hosted_api.h" static esp_remote_channel_t s_params_channel; @@ -29,204 +29,3 @@ esp_err_t esp_wifi_remote_rpc_channel_set(void *h, esp_err_t (*tx_cb)(void *, vo s_params_tx = tx_cb; return ESP_OK; } - -esp_err_t remote_esp_wifi_connect(void) -{ - return esp_hosted_wifi_connect(); -} - -esp_err_t remote_esp_wifi_disconnect(void) -{ - return esp_hosted_wifi_disconnect(); -} - -esp_err_t remote_esp_wifi_init(const wifi_init_config_t *config) -{ - if (remote_esp_wifi_init_slave() != ESP_OK) { - return ESP_FAIL; - } - return esp_hosted_wifi_init(config); -} - -esp_err_t remote_esp_wifi_deinit(void) -{ - return esp_hosted_wifi_deinit(); -} - -esp_err_t remote_esp_wifi_set_mode(wifi_mode_t mode) -{ - return esp_hosted_wifi_set_mode(mode); -} - -esp_err_t remote_esp_wifi_get_mode(wifi_mode_t *mode) -{ - return esp_hosted_wifi_get_mode(mode); -} - -esp_err_t remote_esp_wifi_set_config(wifi_interface_t interface, wifi_config_t *conf) -{ -#if 0 - uint8_t *param = (uint8_t *)conf; - uint32_t checksum = 0; // TODO: generate a random number and add it to both - for (int i = 0; i < sizeof(wifi_config_t); ++i) { - checksum += param[i]; - } - - // transmit the sensitive parameters over a secure channel -// s_params_tx(s_params_channel, param, sizeof(wifi_config_t)); - - // add only a checksum to the RPC - return esp_hosted_wifi_set_config(interface, checksum); -#endif - return esp_hosted_wifi_set_config(interface, conf); -} - -esp_err_t remote_esp_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf) -{ - return esp_hosted_wifi_get_config(interface, conf); -} - -esp_err_t remote_esp_wifi_start(void) -{ - return esp_hosted_wifi_start(); -} - -esp_err_t remote_esp_wifi_stop(void) -{ - return esp_hosted_wifi_stop(); -} - -esp_err_t remote_esp_wifi_get_mac(wifi_interface_t ifx, uint8_t mac[6]) -{ - return esp_hosted_wifi_get_mac(ifx, mac); -} - -esp_err_t remote_esp_wifi_set_mac(wifi_interface_t ifx, const uint8_t mac[6]) -{ - return esp_hosted_wifi_set_mac(ifx, mac); -} - -esp_err_t remote_esp_wifi_scan_start(const wifi_scan_config_t *config, bool block) -{ - return esp_hosted_wifi_scan_start(config, block); -} - -esp_err_t remote_esp_wifi_scan_stop(void) -{ - return esp_hosted_wifi_scan_stop(); -} - -esp_err_t remote_esp_wifi_scan_get_ap_num(uint16_t *number) -{ - return esp_hosted_wifi_scan_get_ap_num(number); -} - -esp_err_t remote_esp_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records) -{ - return esp_hosted_wifi_scan_get_ap_records(number, ap_records); -} - -esp_err_t remote_esp_wifi_clear_ap_list(void) -{ - return esp_hosted_wifi_clear_ap_list(); -} - -esp_err_t remote_esp_wifi_restore(void) -{ - return esp_hosted_wifi_restore(); -} - -esp_err_t remote_esp_wifi_clear_fast_connect(void) -{ - return esp_hosted_wifi_clear_fast_connect(); -} - -esp_err_t remote_esp_wifi_deauth_sta(uint16_t aid) -{ - return esp_hosted_wifi_deauth_sta(aid); -} - -esp_err_t remote_esp_wifi_sta_get_ap_info(wifi_ap_record_t *ap_info) -{ - return esp_hosted_wifi_sta_get_ap_info(ap_info); -} - -esp_err_t remote_esp_wifi_set_ps(wifi_ps_type_t type) -{ - return esp_hosted_wifi_set_ps(type); -} - -esp_err_t remote_esp_wifi_get_ps(wifi_ps_type_t *type) -{ - return esp_hosted_wifi_get_ps(type); -} - -esp_err_t remote_esp_wifi_set_storage(wifi_storage_t storage) -{ - return esp_hosted_wifi_set_storage(storage); -} - -esp_err_t remote_esp_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw) -{ - return esp_hosted_wifi_set_bandwidth(ifx, bw); -} - -esp_err_t remote_esp_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw) -{ - return esp_hosted_wifi_get_bandwidth(ifx, bw); -} - -esp_err_t remote_esp_wifi_set_channel(uint8_t primary, wifi_second_chan_t second) -{ - return esp_hosted_wifi_set_channel(primary, second); -} - -esp_err_t remote_esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second) -{ - return esp_hosted_wifi_get_channel(primary, second); -} - -esp_err_t remote_esp_wifi_set_country_code(const char *country, bool ieee80211d_enabled) -{ - return esp_hosted_wifi_set_country_code(country, ieee80211d_enabled); -} - -esp_err_t remote_esp_wifi_get_country_code(char *country) -{ - return esp_hosted_wifi_get_country_code(country); -} - -esp_err_t remote_esp_wifi_set_country(const wifi_country_t *country) -{ - return esp_hosted_wifi_set_country(country); -} - -esp_err_t remote_esp_wifi_get_country(wifi_country_t *country) -{ - return esp_hosted_wifi_get_country(country); -} - -esp_err_t remote_esp_wifi_ap_get_sta_list(wifi_sta_list_t *sta) -{ - return esp_hosted_wifi_ap_get_sta_list(sta); -} - -esp_err_t remote_esp_wifi_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid) -{ - return esp_hosted_wifi_ap_get_sta_aid(mac, aid); -} - -esp_err_t remote_esp_wifi_sta_get_rssi(int *rssi) -{ - return esp_hosted_wifi_sta_get_rssi(rssi); -} - -esp_err_t remote_esp_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap) -{ - return esp_hosted_wifi_set_protocol(ifx, protocol_bitmap); -} - -esp_err_t remote_esp_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap) -{ - return esp_hosted_wifi_get_protocol(ifx, protocol_bitmap); -}