Skip to content

Commit

Permalink
[CSA-CP] Pull In Wi-Fi refactor (#101)
Browse files Browse the repository at this point in the history
Co-authored-by: Restyled.io <[email protected]>
Co-authored-by: Rohan Sahay <[email protected]>
Co-authored-by: Junior Martinez <[email protected]>
  • Loading branch information
4 people authored Nov 14, 2024
1 parent 9b14aa9 commit 937321f
Show file tree
Hide file tree
Showing 129 changed files with 2,098 additions and 3,667 deletions.
2 changes: 1 addition & 1 deletion build_overrides/efr32_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@

declare_args() {
# Root directory for efr32 SDK build files.
efr32_sdk_build_root = "//third_party/silabs"
silabs_sdk_build_root = "//third_party/silabs"
}
4 changes: 2 additions & 2 deletions examples/air-quality-sensor-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import("//build_overrides/efr32_sdk.gni")
import("//build_overrides/pigweed.gni")

import("${build_root}/config/defaults.gni")
import("${efr32_sdk_build_root}/silabs_executable.gni")
import("${silabs_sdk_build_root}/silabs_executable.gni")

import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/device.gni")
Expand All @@ -38,7 +38,7 @@ if (wifi_soc) {
import("${chip_root}/third_party/silabs/SiWx917_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917"
} else {
import("${efr32_sdk_build_root}/efr32_sdk.gni")
import("${silabs_sdk_build_root}/efr32_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
}

Expand Down
1 change: 1 addition & 0 deletions examples/air-quality-sensor-app/silabs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ combination with JLinkRTTClient as follows:
- _Press and Release_ : Start, or restart, BLE advertisement in fast mode. It will advertise in this mode
for 30 seconds. The device will then switch to a slower interval advertisement.
After 15 minutes, the advertisement stops.
Additionally, it will cycle through the QR code, application status screen and device status screen, respectively.

- _Pressed and hold for 6 s_ : Initiates the factory reset of the device.
Releasing the button within the 6-second window cancels the factory reset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import("//build_overrides/chip.gni")
import("${chip_root}/config/standalone/args.gni")

silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain")
import("${chip_root}/src/platform/silabs/wifi_args.gni")
import("${chip_root}/src/platform/silabs/wifi/args.gni")
chip_enable_wifi = true
chip_enable_ota_requestor = true
app_data_model =
Expand Down
2 changes: 1 addition & 1 deletion examples/build_overrides/efr32_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@

declare_args() {
# Root directory for erf32 SDK.
efr32_sdk_build_root = "//third_party/connectedhomeip/third_party/silabs"
silabs_sdk_build_root = "//third_party/connectedhomeip/third_party/silabs"
}
4 changes: 2 additions & 2 deletions examples/chef/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import("//build_overrides/efr32_sdk.gni")
import("//build_overrides/pigweed.gni")

import("${build_root}/config/defaults.gni")
import("${efr32_sdk_build_root}/efr32_sdk.gni")
import("${efr32_sdk_build_root}/silabs_executable.gni")
import("${silabs_sdk_build_root}/efr32_sdk.gni")
import("${silabs_sdk_build_root}/silabs_executable.gni")

import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/device.gni")
Expand Down
2 changes: 1 addition & 1 deletion examples/chef/silabs/build_for_wifi_args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ import("//build_overrides/chip.gni")

silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain")
chip_enable_openthread = false
import("${chip_root}/src/platform/silabs/wifi_args.gni")
import("${chip_root}/src/platform/silabs/wifi/args.gni")

chip_enable_ota_requestor = true
4 changes: 2 additions & 2 deletions examples/energy-management-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import("//build_overrides/efr32_sdk.gni")
import("//build_overrides/pigweed.gni")

import("${build_root}/config/defaults.gni")
import("${efr32_sdk_build_root}/silabs_executable.gni")
import("${silabs_sdk_build_root}/silabs_executable.gni")

import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/device.gni")
Expand All @@ -38,7 +38,7 @@ if (wifi_soc) {
import("${chip_root}/third_party/silabs/SiWx917_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917"
} else {
import("${efr32_sdk_build_root}/efr32_sdk.gni")
import("${silabs_sdk_build_root}/efr32_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
}

Expand Down
1 change: 1 addition & 0 deletions examples/energy-management-app/silabs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ combination with JLinkRTTClient as follows:
- _Press and Release_ : Start, or restart, BLE advertisement in fast mode. It will advertise in this mode
for 30 seconds. The device will then switch to a slower interval advertisement.
After 15 minutes, the advertisement stops.
Additionally, it will cycle through the QR code, application status screen and device status screen, respectively.

- _Pressed and hold for 6 s_ : Initiates the factory reset of the device.
Releasing the button within the 6-second window cancels the factory reset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import("${chip_root}/config/standalone/args.gni")

silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain")
chip_enable_openthread = false
import("${chip_root}/src/platform/silabs/wifi_args.gni")
import("${chip_root}/src/platform/silabs/wifi/args.gni")

sl_enable_test_event_trigger = true
chip_enable_ota_requestor = false
Expand Down
4 changes: 2 additions & 2 deletions examples/light-switch-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import("//build_overrides/efr32_sdk.gni")
import("//build_overrides/pigweed.gni")

import("${build_root}/config/defaults.gni")
import("${efr32_sdk_build_root}/silabs_executable.gni")
import("${silabs_sdk_build_root}/silabs_executable.gni")

import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/device.gni")
Expand All @@ -38,7 +38,7 @@ if (wifi_soc) {
import("${chip_root}/third_party/silabs/SiWx917_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917"
} else {
import("${efr32_sdk_build_root}/efr32_sdk.gni")
import("${silabs_sdk_build_root}/efr32_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
}

Expand Down
1 change: 1 addition & 0 deletions examples/light-switch-app/silabs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ combination with JLinkRTTClient as follows:
- _Press and Release_ : Start, or restart, BLE advertisement in fast mode. It will advertise in this mode
for 30 seconds. The device will then switch to a slower interval advertisement.
After 15 minutes, the advertisement stops.
Additionally, it will cycle through the QR code, application status screen and device status screen, respectively.

- _Pressed and hold for 6 s_ : Initiates the factory reset of the device.
Releasing the button within the 6-second window cancels the factory reset
Expand Down
2 changes: 1 addition & 1 deletion examples/light-switch-app/silabs/build_for_wifi_args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import("${chip_root}/config/standalone/args.gni")

silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain")
chip_enable_openthread = false
import("${chip_root}/src/platform/silabs/wifi_args.gni")
import("${chip_root}/src/platform/silabs/wifi/args.gni")

chip_enable_ota_requestor = true
app_data_model = "${chip_root}/examples/light-switch-app/light-switch-common"
4 changes: 2 additions & 2 deletions examples/lighting-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import("//build_overrides/efr32_sdk.gni")
import("//build_overrides/pigweed.gni")

import("${build_root}/config/defaults.gni")
import("${efr32_sdk_build_root}/silabs_executable.gni")
import("${silabs_sdk_build_root}/silabs_executable.gni")

import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/device.gni")
Expand All @@ -38,7 +38,7 @@ if (wifi_soc) {
import("${chip_root}/third_party/silabs/SiWx917_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917"
} else {
import("${efr32_sdk_build_root}/efr32_sdk.gni")
import("${silabs_sdk_build_root}/efr32_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
}

Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/silabs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ combination with JLinkRTTClient as follows:
- _Press and Release_ : Start, or restart, BLE advertisement in fast mode. It will advertise in this mode
for 30 seconds. The device will then switch to a slower interval advertisement.
After 15 minutes, the advertisement stops.
Additionally, it will cycle through the QR code, application status screen and device status screen, respectively.

- _Pressed and hold for 6 s_ : Initiates the factory reset of the device.
Releasing the button within the 6-second window cancels the factory reset
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/silabs/build_for_wifi_args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import("${chip_root}/config/standalone/args.gni")

silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain")
chip_enable_openthread = false
import("${chip_root}/src/platform/silabs/wifi_args.gni")
import("${chip_root}/src/platform/silabs/wifi/args.gni")

# Not needed for the Lighting-app
chip_enable_read_client = false
Expand Down
4 changes: 2 additions & 2 deletions examples/lit-icd-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import("//build_overrides/efr32_sdk.gni")
import("//build_overrides/pigweed.gni")

import("${build_root}/config/defaults.gni")
import("${efr32_sdk_build_root}/silabs_executable.gni")
import("${silabs_sdk_build_root}/silabs_executable.gni")

import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/device.gni")
Expand All @@ -39,7 +39,7 @@ if (wifi_soc) {
import("${chip_root}/third_party/silabs/SiWx917_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917"
} else {
import("${efr32_sdk_build_root}/efr32_sdk.gni")
import("${silabs_sdk_build_root}/efr32_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
}

Expand Down
1 change: 1 addition & 0 deletions examples/lit-icd-app/silabs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ combination with JLinkRTTClient as follows:
- _Press and Release_ : Start, or restart, BLE advertisement in fast mode. It will advertise in this mode
for 30 seconds. The device will then switch to a slower interval advertisement.
After 15 minutes, the advertisement stops.
Additionally, it will cycle through the QR code, application status screen and device status screen, respectively.

- _Pressed and hold for 6 s_ : Initiates the factory reset of the device.
Releasing the button within the 6-second window cancels the factory reset
Expand Down
2 changes: 1 addition & 1 deletion examples/lit-icd-app/silabs/build_for_wifi_args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import("${chip_root}/config/standalone/args.gni")

silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain")
chip_enable_openthread = false
import("${chip_root}/src/platform/silabs/wifi_args.gni")
import("${chip_root}/src/platform/silabs/wifi/args.gni")

chip_enable_ota_requestor = true
app_data_model = "${chip_root}/examples/lit-icd-app/lit-icd-common"
Expand Down
4 changes: 2 additions & 2 deletions examples/lock-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import("//build_overrides/efr32_sdk.gni")
import("//build_overrides/pigweed.gni")

import("${build_root}/config/defaults.gni")
import("${efr32_sdk_build_root}/silabs_executable.gni")
import("${silabs_sdk_build_root}/silabs_executable.gni")

import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/src/platform/device.gni")
Expand All @@ -38,7 +38,7 @@ if (wifi_soc) {
import("${chip_root}/third_party/silabs/SiWx917_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917"
} else {
import("${efr32_sdk_build_root}/efr32_sdk.gni")
import("${silabs_sdk_build_root}/efr32_sdk.gni")
examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32"
}

Expand Down
1 change: 1 addition & 0 deletions examples/lock-app/silabs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ combination with JLinkRTTClient as follows:
- _Press and Release_ : Start, or restart, BLE advertisement in fast mode. It will advertise in this mode
for 30 seconds. The device will then switch to a slower interval advertisement.
After 15 minutes, the advertisement stops.
Additionally, it will cycle through the QR code, application status screen and device status screen, respectively.

- _Pressed and hold for 6 s_ : Initiates the factory reset of the device.
Releasing the button within the 6-second window cancels the factory reset
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/silabs/build_for_wifi_args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import("${chip_root}/config/standalone/args.gni")

silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain")
chip_enable_openthread = false
import("${chip_root}/src/platform/silabs/wifi_args.gni")
import("${chip_root}/src/platform/silabs/wifi/args.gni")

chip_enable_ota_requestor = true
app_data_model = "${chip_root}/examples/lock-app/silabs/data_model:silabs-lock"
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/BaseApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
#include <platform/silabs/platformAbstraction/SilabsPlatform.h>

#ifdef SL_WIFI
#include "wfx_host_events.h"
#include <app/clusters/network-commissioning/network-commissioning.h>
#include <platform/silabs/NetworkCommissioningWiFiDriver.h>
#include <platform/silabs/wifi/WifiInterfaceAbstraction.h>
#endif // SL_WIFI

#ifdef DIC_ENABLE
Expand Down
2 changes: 0 additions & 2 deletions examples/platform/silabs/FreeRTOSConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@
extern "C" {
#endif

#include <CHIPProjectConfig.h>

#include <stdint.h>
#include <stdio.h>

Expand Down
47 changes: 23 additions & 24 deletions examples/platform/silabs/MatterConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <mbedtls/platform.h>

#ifdef SL_WIFI
#include "wfx_host_events.h"
#include <platform/silabs/wifi/WifiInterfaceAbstraction.h>
#endif /* SL_WIFI */

#if PW_RPC_ENABLED
Expand All @@ -40,9 +40,10 @@
#include "MemMonitoring.h"
#endif

#ifdef SLI_SI91X_MCU_INTERFACE
#include "wfx_rsi.h"
#endif /* SLI_SI91X_MCU_INTERFACE */
#if defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE == 1
#include <platform/silabs/SiWx917/SiWxPlatformInterface.h>
#include <platform/silabs/wifi/wiseconnect-abstraction/WiseconnectInterfaceAbstraction.h>
#endif // SLI_SI91X_MCU_INTERFACE

#include <crypto/CHIPCryptoPAL.h>
// If building with the EFR32-provided crypto backend, we can use the
Expand Down Expand Up @@ -128,7 +129,7 @@ void UnlockOpenThreadTask(void)

CHIP_ERROR SilabsMatterConfig::InitOpenThread(void)
{
SILABS_LOG("Initializing OpenThread stack");
ChipLogProgress(DeviceLayer, "Initializing OpenThread stack");
ReturnErrorOnFailure(ThreadStackMgr().InitThreadStack());

#if CHIP_DEVICE_CONFIG_THREAD_FTD
Expand All @@ -145,7 +146,7 @@ CHIP_ERROR SilabsMatterConfig::InitOpenThread(void)
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER
#endif // CHIP_DEVICE_CONFIG_THREAD_FTD

SILABS_LOG("Starting OpenThread task");
ChipLogProgress(DeviceLayer, "Starting OpenThread task");
return ThreadStackMgrImpl().StartThreadTask();
}
#endif // CHIP_ENABLE_OPENTHREAD
Expand Down Expand Up @@ -178,7 +179,7 @@ void ApplicationStart(void * unused)
SetDeviceAttestationCredentialsProvider(&Provision::Manager::GetInstance().GetStorage());
chip::DeviceLayer::PlatformMgr().UnlockChipStack();

SILABS_LOG("Starting App Task");
ChipLogProgress(DeviceLayer, "Starting App Task");
err = AppTask::GetAppTask().StartAppTask();
if (err != CHIP_NO_ERROR)
appError(err);
Expand All @@ -198,13 +199,13 @@ void SilabsMatterConfig::AppInit()

GetPlatform().Init();
sMainTaskHandle = osThreadNew(ApplicationStart, nullptr, &kMainTaskAttr);
SILABS_LOG("Starting scheduler");
ChipLogProgress(DeviceLayer, "Starting scheduler");
VerifyOrDie(sMainTaskHandle); // We can't proceed if the Main Task creation failed.
GetPlatform().StartScheduler();

// Should never get here.
chip::Platform::MemoryShutdown();
SILABS_LOG("Start Scheduler Failed");
ChipLogProgress(DeviceLayer, "Start Scheduler Failed");
appError(CHIP_ERROR_INTERNAL);
}

Expand All @@ -217,9 +218,9 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName)
// initialization.
mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree);
#endif
SILABS_LOG("==================================================");
SILABS_LOG("%s starting", appName);
SILABS_LOG("==================================================");
ChipLogProgress(DeviceLayer, "==================================================");
ChipLogProgress(DeviceLayer, "%s starting", appName);
ChipLogProgress(DeviceLayer, "==================================================");

#if PW_RPC_ENABLED
chip::rpc::Init();
Expand All @@ -232,7 +233,7 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName)
//==============================================
// Init Matter Stack
//==============================================
SILABS_LOG("Init CHIP Stack");
ChipLogProgress(DeviceLayer, "Init CHIP Stack");

#ifdef SL_WIFI
// Init Chip memory management before the stack
Expand Down Expand Up @@ -322,16 +323,13 @@ CHIP_ERROR SilabsMatterConfig::InitWiFi(void)
// Start wfx bus communication task.
wfx_bus_start();
#ifdef SL_WFX_USE_SECURE_LINK
wfx_securelink_task_start(); // start securelink key renegotiation task
#endif // SL_WFX_USE_SECURE_LINK
#endif /* WF200_WIFI */

#ifdef SLI_SI91X_MCU_INTERFACE
sl_status_t status;
if ((status = wfx_wifi_rsi_init()) != SL_STATUS_OK)
{
ReturnErrorOnFailure((CHIP_ERROR) status);
}
// start securelink key renegotiation task
wfx_securelink_task_start();
#endif // SL_WFX_USE_SECURE_LINK
#endif // WF200_WIFI

#if defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE == 1
VerifyOrReturnError(sl_matter_wifi_platform_init() == SL_STATUS_OK, CHIP_ERROR_INTERNAL);
#endif // SLI_SI91X_MCU_INTERFACE

return CHIP_NO_ERROR;
Expand All @@ -344,6 +342,7 @@ CHIP_ERROR SilabsMatterConfig::InitWiFi(void)
extern "C" void vApplicationIdleHook(void)
{
#if (SLI_SI91X_MCU_INTERFACE && CHIP_CONFIG_ENABLE_ICD_SERVER)
sl_si91x_invoke_btn_press_event();
SiWxPlatformInterface::sl_si91x_btn_event_handler();
SiWxPlatformInterface::sl_si91x_uart_power_requirement_handler();
#endif
}
1 change: 1 addition & 0 deletions examples/platform/silabs/MatterConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once

#include <lib/support/CHIPMem.h>
#include <lib/support/CHIPPlatformMemory.h>
Expand Down
Loading

0 comments on commit 937321f

Please sign in to comment.