Skip to content

Commit

Permalink
[Silabs] Move Wi-Fi interface to src/platform from examples/platform …
Browse files Browse the repository at this point in the history
…(#36477)

* Restructure platform files

* Move all files to src/platform

* Build the wf200 in the new wifi structure

* rename directory

* Build the rs9116 in the new wifi structure

* Build the SiWx917 NCP in the new wifi structure

* Build the SiWx917 SoC in the new wifi structure

* Delete wfx_host_events header in favor of the new abstraction structure

* remove unnecessary includes in gn files and the cflag changes

* restyle

* add todo comment

* remove cflag inclusion

* add missing incllude

* Add missing includes

* Restyled by clang-format

* Move wifi_args.gni file to the wifi directory

* Rename Wf200WifiInterface to WifiInterface

* Rename SiWxWifiInterface to WifiInterface

* Rename Rsi91xWifiInterface.cpp to WifiInterface.cpp

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
mkardous-silabs and restyled-commits committed Nov 13, 2024
1 parent bed8482 commit e8a15af
Show file tree
Hide file tree
Showing 73 changed files with 454 additions and 764 deletions.
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/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
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
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"
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
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
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
3 changes: 1 addition & 2 deletions examples/platform/silabs/BaseApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,9 @@
#include <platform/silabs/platformAbstraction/SilabsPlatform.h>

#ifdef SL_WIFI
#include "WifiInterfaceAbstraction.h"
#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
6 changes: 3 additions & 3 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 @@ -41,8 +41,8 @@
#endif

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

#include <crypto/CHIPCryptoPAL.h>
Expand Down
92 changes: 2 additions & 90 deletions examples/platform/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni")
import("${chip_root}/examples/platform/silabs/args.gni")
import("${chip_root}/src/lib/lib.gni")
import("${chip_root}/src/platform/device.gni")
import("${chip_root}/src/platform/silabs/wifi_args.gni")
import("${chip_root}/src/platform/silabs/wifi/args.gni")
import("${chip_root}/third_party/silabs/silabs_board.gni")
import("${silabs_sdk_build_root}/SiWx917_sdk.gni")

Expand All @@ -28,19 +28,6 @@ declare_args() {
# OTA timeout in seconds
ota_periodic_query_timeout_sec = 86400

# Wifi related stuff - they are overridden by gn -args="use_wf200=true"
sl_wfx_config_softap = false
sl_wfx_config_scan = true

# Argument to force enable WPA3 security on rs91x
rs91x_wpa3_transition = true

#default WiFi SSID
chip_default_wifi_ssid = ""

#default Wifi Password
chip_default_wifi_psk = ""

# The EnableKey in hex string format used by TestEventTrigger command in
# GeneralDiagnostics cluster. The length of the string should be 16 bytes.
sl_test_event_trigger_enable_key = "00112233445566778899AABBCCDDEEFF"
Expand Down Expand Up @@ -105,41 +92,6 @@ source_set("matter-shell") {
]
}

config("wifi-interface-config") {
include_dirs = [
"${silabs_plat_dir}/wifi",
"${silabs_common_plat_dir}/wifi",
]
}

source_set("wifi-interface") {
sources = [
"${silabs_common_plat_dir}/wifi/WifiInterfaceAbstraction.cpp",
"${silabs_common_plat_dir}/wifi/WiseconnectInterfaceAbstraction.cpp",
"SiWxWifiInterface.cpp",

# Wi-Fi Config - Using the file sdk support until the wiseconnect file is fixed
"${sdk_support_root}/components/service/network_manager/src/sl_net_for_lwip.c",
]

public_deps = [
"${chip_root}/src/app/icd/server:icd-server-config",
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
"${chip_root}/src/platform:platform",
"${chip_root}/src/platform/silabs/SiWx917:SiWx917",
"${lwip_root}:lwip",
]

public_configs = [
":siwx917-common-config",
"${silabs_sdk_build_root}:silabs_config",
":chip_examples_project_config",
":wifi-interface-config",
":silabs-wifi-config",
]
}

config("siwx917-common-config") {
defines = [ "OTA_PERIODIC_TIMEOUT=${ota_periodic_query_timeout_sec}" ]

Expand All @@ -164,46 +116,10 @@ config("siwx917-common-config") {
ldflags = [ "-Wl,--no-warn-rwx-segment" ]
}

config("silabs-wifi-config") {
defines = []
include_dirs = []

if (chip_default_wifi_ssid != "") {
defines += [
"SL_ONNETWORK_PAIRING=1",
"SL_WIFI_SSID=\"${chip_default_wifi_ssid}\"",
]
}
if (chip_default_wifi_psk != "") {
assert(chip_default_wifi_ssid != "",
"ssid can't be null if psk is provided")
defines += [ "SL_WIFI_PSK=\"${chip_default_wifi_psk}\"" ]
}

if (sl_wfx_config_softap) {
defines += [ "SL_WFX_CONFIG_SOFTAP" ]
}

if (sl_wfx_config_scan) {
defines += [ "SL_WFX_CONFIG_SCAN" ]
}

if (chip_enable_wifi_ipv4) {
defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ]
}

if (rs91x_wpa3_transition) {
defines += [ "WIFI_ENABLE_SECURITY_WPA3_TRANSITION=1" ]
}
}

source_set("siwx917-common") {
deps = [ "${silabs_common_plat_dir}/provision:storage" ]
defines = []
public_deps = [
":wifi-interface",
"${lwip_root}:lwip",
]
public_deps = []

public_configs = [
":siwx917-common-config",
Expand Down Expand Up @@ -250,10 +166,6 @@ source_set("siwx917-common") {
sources += [ "${silabs_common_plat_dir}/MemMonitoring.cpp" ]
}

if (chip_enable_wifi) {
public_configs += [ ":silabs-wifi-config" ]
}

if (chip_build_libshell) {
deps += [ ":matter-shell" ]

Expand Down
3 changes: 1 addition & 2 deletions examples/platform/silabs/display/demo-ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
#include "sl_memlcd.h"
#include <app/icd/server/ICDServerConfig.h>
#if SL_WIFI && !SLI_SI91X_MCU_INTERFACE
#include "spi_multiplex.h"
#include <platform/silabs/wifi/wf200/platform/spi_multiplex.h>
#endif // SL_WIFI && !SLI_SI91X_MCU_INTERFACE
#include <stdio.h>
#include <string.h>

// Main Logo and App image
Expand Down
87 changes: 0 additions & 87 deletions examples/platform/silabs/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,6 @@ declare_args() {
# OTA timeout in seconds
ota_periodic_query_timeout_sec = 86400

# Wifi related stuff - they are overridden by gn -args="use_wf200=true"
sl_wfx_config_softap = false
sl_wfx_config_scan = true

# Argument to force enable WPA3 security on rs91x
rs91x_wpa3_transition = true

#default WiFi SSID
chip_default_wifi_ssid = ""

#default Wifi Password
chip_default_wifi_psk = ""

# The EnableKey in hex string format used by TestEventTrigger command in
# GeneralDiagnostics cluster. The length of the string should be 16 bytes.
sl_test_event_trigger_enable_key = "00112233445566778899AABBCCDDEEFF"
Expand All @@ -53,20 +40,6 @@ assert(!(use_rs9116 && chip_enable_openthread))
assert(!(use_SiWx917 && chip_enable_openthread))
assert(!(use_wf200 && chip_enable_openthread))

if (chip_enable_wifi) {
assert(use_rs9116 || use_wf200 || use_SiWx917)
import("${chip_root}/src/platform/silabs/wifi_args.gni")

if (use_rs9116) {
import("rs911x/rs911x.gni")
} else if (use_SiWx917) {
import("rs911x/rs9117.gni")
}
if (use_wf200) {
import("wf200/wf200.gni")
}
}

config("chip_examples_project_config") {
include_dirs = [ "project_include" ]

Expand Down Expand Up @@ -167,40 +140,6 @@ config("efr32-common-config") {
ldflags = [ "-Wl,--no-warn-rwx-segment" ]
}

config("silabs-wifi-config") {
defines = []
include_dirs = []

if (chip_default_wifi_ssid != "") {
defines += [
"SL_ONNETWORK_PAIRING=1",
"SL_WIFI_SSID=\"${chip_default_wifi_ssid}\"",
]
}
if (chip_default_wifi_psk != "") {
assert(chip_default_wifi_ssid != "",
"ssid can't be null if psk is provided")
defines += [ "SL_WIFI_PSK=\"${chip_default_wifi_psk}\"" ]
}

if (sl_wfx_config_softap) {
defines += [ "SL_WFX_CONFIG_SOFTAP" ]
}

if (sl_wfx_config_scan) {
defines += [ "SL_WFX_CONFIG_SCAN" ]
}

if (chip_enable_wifi_ipv4) {
defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ]
}

if (rs91x_wpa3_transition) {
# TODO: Change this macro once WF200 support is provided
defines += [ "WIFI_ENABLE_SECURITY_WPA3_TRANSITION=1" ]
}
}

source_set("efr32-common") {
deps = [ "${silabs_common_plat_dir}/provision:storage" ]
defines = []
Expand Down Expand Up @@ -265,32 +204,6 @@ source_set("efr32-common") {
]
}

if (chip_enable_wifi) {
if (use_rs9116) {
sources += rs911x_src_plat

# All the stuff from wiseconnect
sources += rs911x_src_sapi
include_dirs += rs911x_inc_plat

#add compilation flags for rs991x build. This will be addressed directly in wiseconnect sdk in the next version release of that sdk
cflags = rs911x_cflags
} else if (use_SiWx917) {
sources += rs911x_src_plat

# All the stuff from wiseconnect
sources += rs9117_src_sapi
include_dirs += rs9117_inc_plat

#add compilation flags for rs991x build. This will be addressed directly in wiseconnect sdk in the next version release of that sdk
} else if (use_wf200) {
sources += wf200_plat_src
include_dirs += wf200_plat_incs
}

public_configs += [ ":silabs-wifi-config" ]
}

if (chip_build_libshell) {
deps += [ ":matter-shell" ]

Expand Down
30 changes: 0 additions & 30 deletions examples/platform/silabs/efr32/wf200/sl_wfx_configuration.h

This file was deleted.

Loading

0 comments on commit e8a15af

Please sign in to comment.