Feature/wifi 917soc wifi sdk 3.0 integration (#28558)
* Added changes for wifisdk v3.0.10
* Added startup file and linker file for dual flash 917 soc
* Added wifisdk build files and removed wisemcu files from SiWx917_sdk.gni
* Added matter_support for 917 soc
* Si917 Common flash initial changes
* Main.cpp modified
* reverting Siwx917 linker file
* Added changes for nvm3 to use from gecko_sdk
* SiWx917 Common Flash modifications
* rs9116 BLE changes
* Adds fix for 917SoC build errors
* Adds fix for 917SoC LED0 and window-app button
* Adds WiFi SDK repository
* Adds sdk_3.0 platform init call
* submodule update for matter support
* Added matter build libshell
* Adds fix for wifi-join retries
* Clean Up done
* Moved Wifi Init code to Matter_config.cpp
* Resolved review comments
* Review Comment solved
* ethernetif.cpp file low level output api changes
* Addressed review Comments
* Review comment addressed
* Restyler applied
* Restyler applied
* Review comment addressed
* Review comment addressed
* Changed Matter Support Pointer
* Updated Matter support to latest
* Review comment addressed
* Removed newly added file from this PR
* Review comment addressed
* Build issues solved
* Wifi SDK and Matter_support pointer updated
* Restyled by clang-format
* Restyled by gn
* Changed path of NVM3 lib from gecko_sdk to Matter_support
---------
Co-authored-by: bhmanda-silabs <bhavani.manda@silabs.com>
Co-authored-by: thirupathi <ths@silabs.com>
Co-authored-by: rosahay-silabs <rohan.sahay@silabs.com>
Co-authored-by: Restyled.io <commits@restyled.io>
diff --git a/.gitmodules b/.gitmodules
index 1508216..74298af 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -318,3 +318,8 @@
url = https://github.com/asriot/ASR550X_Freertos.git
branch = matter
platforms = asr
+[submodule "third_party/silabs/wifi_sdk"]
+ path = third_party/silabs/wifi_sdk
+ url = https://github.com/SiliconLabs/wiseconnect
+ branch = master
+ platforms = efr32
diff --git a/examples/platform/silabs/FreeRTOSConfig.h b/examples/platform/silabs/FreeRTOSConfig.h
index 4c1d29f..55cbd31 100644
--- a/examples/platform/silabs/FreeRTOSConfig.h
+++ b/examples/platform/silabs/FreeRTOSConfig.h
@@ -108,6 +108,7 @@
#include <stdint.h>
#ifdef SIWX_917
+#include "RS1xxxx_9117.h"
extern uint32_t SystemCoreClock;
#else // For EFR32
#include "RTE_Components.h"
@@ -168,6 +169,13 @@
#define configTIMER_QUEUE_LENGTH (10)
#define configTIMER_TASK_STACK_DEPTH (1024)
+#ifdef SIWX_917
+#ifdef __NVIC_PRIO_BITS
+#undef __NVIC_PRIO_BITS
+#endif
+#define configPRIO_BITS 6 /* 6 priority levels. */
+#endif // SIWX_917
+
/* Interrupt priorities used by the kernel port layer itself. These are generic
to all Cortex-M ports, and do not rely on any particular library functions. */
#define configKERNEL_INTERRUPT_PRIORITY (255)
@@ -215,13 +223,13 @@
#ifdef DIC_ENABLE
#define configTOTAL_HEAP_SIZE ((size_t)(68 * 1024))
#else
-#define configTOTAL_HEAP_SIZE ((size_t)(34 * 1024))
+#define configTOTAL_HEAP_SIZE ((size_t)(42 * 1024))
#endif // DIC
#else // SL_WIFI
#if SL_CONFIG_OPENTHREAD_LIB == 1
-#define configTOTAL_HEAP_SIZE ((size_t)(22 * 1024))
+#define configTOTAL_HEAP_SIZE ((size_t)(28 * 1024))
#else
-#define configTOTAL_HEAP_SIZE ((size_t)(20 * 1024))
+#define configTOTAL_HEAP_SIZE ((size_t)(26 * 1024))
#endif // SL_CONFIG_OPENTHREAD_LIB
#endif // configTOTAL_HEAP_SIZE
#endif // configTOTAL_HEAP_SIZE
diff --git a/examples/platform/silabs/MatterConfig.cpp b/examples/platform/silabs/MatterConfig.cpp
index b050abb..59503db 100644
--- a/examples/platform/silabs/MatterConfig.cpp
+++ b/examples/platform/silabs/MatterConfig.cpp
@@ -41,6 +41,10 @@
#include "MemMonitoring.h"
#endif
+#ifdef SIWX_917
+#include "wfx_rsi.h"
+#endif /* SIWX_917 */
+
using namespace ::chip;
using namespace ::chip::Inet;
using namespace ::chip::DeviceLayer;
@@ -263,14 +267,16 @@
#ifdef SL_WFX_USE_SECURE_LINK
wfx_securelink_task_start(); // start securelink key renegotiation task
#endif // SL_WFX_USE_SECURE_LINK
-#elif defined(SIWX_917)
- SILABS_LOG("Init RSI 917 Platform");
- if (wfx_rsi_platform() != SL_STATUS_OK)
+#endif /* WF200_WIFI */
+
+#ifdef SIWX_917
+ sl_status_t status;
+ if ((status = wfx_wifi_rsi_init()) != SL_STATUS_OK)
{
- SILABS_LOG("RSI init failed");
- return CHIP_ERROR_INTERNAL;
+ ReturnErrorOnFailure((CHIP_ERROR) status);
}
-#endif /* WF200_WIFI */
+#endif // SIWX_917
+
return CHIP_NO_ERROR;
}
#endif // SL_WIFI
diff --git a/examples/platform/silabs/SiWx917/BUILD.gn b/examples/platform/silabs/SiWx917/BUILD.gn
index f18e89d..ac2f893 100644
--- a/examples/platform/silabs/SiWx917/BUILD.gn
+++ b/examples/platform/silabs/SiWx917/BUILD.gn
@@ -58,7 +58,6 @@
# Sanity check
assert(chip_enable_wifi)
-wisemcu_sdk_root = "${chip_root}/third_party/silabs/wisemcu-wifi-bt-sdk"
silabs_common_plat_dir = "${chip_root}/examples/platform/silabs"
config("chip_examples_project_config") {
@@ -87,11 +86,7 @@
if (chip_build_libshell) {
defines = [ "ENABLE_CHIP_SHELL" ]
- sources = [
- "${silabs_common_plat_dir}/matter_shell.cpp",
- "${wisemcu_sdk_root}/platforms/si91x/drivers/cmsis_driver/UDMA.c",
- "${wisemcu_sdk_root}/platforms/si91x/drivers/cmsis_driver/USART.c",
- ]
+ sources = [ "${silabs_common_plat_dir}/matter_shell.cpp" ]
include_dirs = [
".",
"${silabs_common_plat_dir}",
@@ -232,7 +227,7 @@
"${wifi_sdk_dir}/ethernetif.cpp",
"${wifi_sdk_dir}/lwip_netif.cpp",
"${wifi_sdk_dir}/wfx_notify.cpp",
- "SiWx917/rsi_if.c",
+ "SiWx917/sl_wifi_if.c",
"SiWx917/wfx_rsi_host.c",
]
diff --git a/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_platform_init.c b/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_platform_init.c
deleted file mode 100644
index 3801ebd..0000000
--- a/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_platform_init.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- *
- * Copyright (c) 2022 Project CHIP Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Includes
- */
-#include "rsi_board.h"
-#include "rsi_pll.h"
-#include "rsi_rom_clks.h"
-#include "silabs_utils.h"
-#include "system_RS1xxxx.h"
-
-#define SOC_PLL_REF_FREQUENCY 32000000 /* PLL input REFERENCE clock 32MHZ */
-
-// Note: Change this macro to required PLL frequency in hertz
-#define PS4_SOC_FREQ 180000000 /* PLL out clock 180MHz */
-#define SWITCH_QSPI_TO_SOC_PLL
-#define ICACHE_DISABLE
-#define DEBUG_DISABLE
-
-/* QSPI clock config params */
-#define INTF_PLL_500_CTRL_VALUE 0xD900
-#define INTF_PLL_CLK 80000000 /* PLL out clock 80 MHz */
-
-#define PMU_GOOD_TIME 31 /*Duration in us*/
-#define XTAL_GOOD_TIME 31 /*Duration in us*/
-
-/*Pre-fetch and regestring */
-#define ICACHE2_ADDR_TRANSLATE_1_REG *(volatile uint32_t *) (0x20280000 + 0x24)
-#define MISC_CFG_SRAM_REDUNDANCY_CTRL *(volatile uint32_t *) (0x46008000 + 0x18)
-#define MISC_CONFIG_MISC_CTRL1 *(volatile uint32_t *) (0x46008000 + 0x44)
-#define MISC_QUASI_SYNC_MODE *(volatile uint32_t *) (0x46008000 + 0x84)
-
-/**
- * @fn void soc_pll_config()
- * @brief This function to configure clock for SiWx917 SoC (80MHz)
- * Configure the PLL frequency and Switch M4 clock to PLL clock for speed operations
- *
- * @param[in] none
- * @param[out] none
- * @return int
- * @section description
- * configure clock for SiWx917 SoC
- *
- */
-int soc_pll_config(void)
-{
- int32_t status = RSI_OK;
-
- RSI_CLK_SocPllLockConfig(1, 1, 7);
-
- RSI_CLK_SocPllRefClkConfig(2);
-
- RSI_CLK_M4SocClkConfig(M4CLK, M4_ULPREFCLK, 0);
-
- /*Enable fre-fetch and register if SOC-PLL frequency is more than or equal to 120M*/
-#if (PS4_SOC_FREQ >= 120000000)
- ICACHE2_ADDR_TRANSLATE_1_REG = BIT(21);
- MISC_CFG_SRAM_REDUNDANCY_CTRL = BIT(4);
- MISC_CONFIG_MISC_CTRL1 |= BIT(4);
-#if !(defined WISE_AOC_4)
- MISC_QUASI_SYNC_MODE |= BIT(6);
- MISC_QUASI_SYNC_MODE |= (BIT(6) | BIT(7));
-#endif /* !WISE_AOC_4 */
-#endif /* (PS4_SOC_FREQ > 120000000) */
-
- RSI_CLK_SetSocPllFreq(M4CLK, PS4_SOC_FREQ, SOC_PLL_REF_FREQUENCY);
-
- RSI_CLK_M4SocClkConfig(M4CLK, M4_SOCPLLCLK, 0);
-
-#ifdef SWITCH_QSPI_TO_SOC_PLL
- /* program intf pll to 160Mhz */
- SPI_MEM_MAP_PLL(INTF_PLL_500_CTRL_REG9) = INTF_PLL_500_CTRL_VALUE;
- status = RSI_CLK_SetIntfPllFreq(M4CLK, INTF_PLL_CLK, SOC_PLL_REF_FREQUENCY);
- if (status != RSI_OK)
- {
- SILABS_LOG("Failed to Config Interface PLL Clock, status:%d", status);
- }
- else
- {
- SILABS_LOG("Configured Interface PLL Clock to %d", INTF_PLL_CLK);
- }
-
- RSI_CLK_QspiClkConfig(M4CLK, QSPI_INTFPLLCLK, 0, 0, 1);
-#endif /* SWITCH_QSPI_TO_SOC_PLL */
-
- return 0;
-}
-
-/*==============================================*/
-/**
- * @fn void RSI_Wakeupsw_config()
- * @brief This function Initializes the platform
- * @param[in] none
- * @param[out] none
- * @return none
- * @section description
- * This function initializes the platform
- *
- */
-void RSI_Wakeupsw_config(void)
-{
- /*Enable the REN*/
- RSI_NPSSGPIO_InputBufferEn(NPSS_GPIO_2, 1);
-
- /*Configure the NPSS GPIO mode to wake up */
- RSI_NPSSGPIO_SetPinMux(NPSS_GPIO_2, NPSSGPIO_PIN_MUX_MODE2);
-
- /*Configure the NPSS GPIO direction to input */
- RSI_NPSSGPIO_SetDir(NPSS_GPIO_2, NPSS_GPIO_DIR_OUTPUT);
-
- /* Enables fall edge interrupt detection for UULP_VBAT_GPIO_0 */
- RSI_NPSSGPIO_SetIntFallEdgeEnable(NPSS_GPIO_2_INTR);
-
- /* Un mask the NPSS GPIO interrupt*/
- RSI_NPSSGPIO_IntrUnMask(NPSS_GPIO_2_INTR);
-
- /*Select wake up sources */
- RSI_PS_SetWkpSources(GPIO_BASED_WAKEUP);
-
- /* clear NPSS GPIO interrupt*/
- RSI_NPSSGPIO_ClrIntr(NPSS_GPIO_2_INTR);
-
- /*Enable the NPSS GPIO interrupt slot*/
- NVIC_EnableIRQ(NPSS_TO_MCU_GPIO_INTR_IRQn);
-
- NVIC_SetPriority(NPSS_TO_MCU_GPIO_INTR_IRQn, 7);
-}
-
-void RSI_Wakeupsw_config_gpio0(void)
-{
- /*Configure the NPSS GPIO mode to wake up */
- RSI_NPSSGPIO_SetPinMux(NPSS_GPIO_0, NPSSGPIO_PIN_MUX_MODE2);
-
- /*Configure the NPSS GPIO direction to input */
- RSI_NPSSGPIO_SetDir(NPSS_GPIO_0, NPSS_GPIO_DIR_INPUT);
-
- /*Configure the NPSS GPIO interrupt polarity */
- RSI_NPSSGPIO_SetPolarity(NPSS_GPIO_0, NPSS_GPIO_INTR_HIGH);
-
- /*Enable the REN*/
- RSI_NPSSGPIO_InputBufferEn(NPSS_GPIO_0, 1);
-
- /* Set the GPIO to wake from deep sleep */
- RSI_NPSSGPIO_SetWkpGpio(NPSS_GPIO_0_INTR);
-
- /* Enables fall edge interrupt detection for UULP_VBAT_GPIO_0 */
- RSI_NPSSGPIO_SetIntFallEdgeEnable(NPSS_GPIO_0_INTR);
-
- /* Un mask the NPSS GPIO interrupt*/
- RSI_NPSSGPIO_IntrUnMask(NPSS_GPIO_0_INTR);
-
- /*Select wake up sources */
- RSI_PS_SetWkpSources(GPIO_BASED_WAKEUP);
-
- /* clear NPSS GPIO interrupt*/
- RSI_NPSSGPIO_ClrIntr(NPSS_GPIO_0_INTR);
-
- // 21 being the NPSS_TO_MCU_GPIO_INTR_IRQn
- NVIC_EnableIRQ(NPSS_TO_MCU_GPIO_INTR_IRQn);
- NVIC_SetPriority(NPSS_TO_MCU_GPIO_INTR_IRQn, 7);
-}
-
-/*==============================================*/
-/**
- * @fn void rsi_hal_board_init()
- * @brief This function Initializes the platform
- * @param[in] none
- * @param[out] none
- * @return none
- * @section description
- * This function initializes the platform
- *
- */
-void rsi_hal_board_init(void)
-{
- SystemCoreClockUpdate();
-
- // initialize the LED pins
- RSI_Board_Init();
-
- /* configure clock for SiWx917 SoC */
- soc_pll_config();
- SILABS_LOG("%s, soc_pll_config, SystemCoreClock=%d\n", __func__, SystemCoreClock);
-
-#ifdef COMMON_FLASH_EN
- /* Before TA going to power save mode ,set m4ss_ref_clk_mux_ctrl ,tass_ref_clk_mux_ctrl,
- AON domain power supply controls form TA to M4 */
- RSI_Set_Cntrls_To_M4();
-#endif
-#ifdef DEBUG_UART
- DEBUGINIT();
-#endif
-}
diff --git a/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_timer.c b/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_timer.c
deleted file mode 100644
index 023fb47..0000000
--- a/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_timer.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- *
- * Copyright (c) 2022 Project CHIP Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Includes
- */
-
-#include "rsi_driver.h"
-#ifdef RSI_WITH_OS
-/* FreeRTOS includes. */
-#include "FreeRTOS.h"
-#include "stack_macros.h"
-#include "task.h"
-#include "timers.h"
-
-#if defined(SysTick)
-#undef SysTick_Handler
-/* FreeRTOS SysTick interrupt handler prototype */
-extern void SysTick_Handler(void);
-/* FreeRTOS tick timer interrupt handler prototype */
-extern void xPortSysTickHandler(void);
-#endif /* SysTick */
-#endif
-
-static volatile uint32_t _dwTickCount; // systick cout variable
-
-/*===================================================*/
-/**
- * @fn int32_t rsi_timer_start(uint8_t timer_no, uint8_t mode,uint8_t type,uint32_t duration,void (*
- * rsi_timer_expiry_handler)())
- * @brief Starts and configures timer
- * @param[in] timer_node, timer node to be configured.
- * @param[in] mode , mode of the timer
- * 0 - Micro seconds mode
- * 1 - Milli seconds mode
- * @param[in] type, type of the timer
- * 0 - single shot type
- * 1 - periodic type
- * @param[in] duration, timer duration
- * @param[in] rsi_timer_expiry_handler() ,call back function to handle timer interrupt
- * @param[out] none
- * @return 0 - success
- * !0 - Failure
- * @description This HAL API should contain the code to initialize the timer and start the timer
- *
- */
-
-int32_t rsi_timer_start(uint8_t timer_node, uint8_t mode, uint8_t type, uint32_t duration, void (*rsi_timer_expiry_handler)(void))
-{
-
- //! Initialise the timer
-
- //! register the call back
-
- //! Start timer
-
- return 0;
-}
-
-/*===================================================*/
-/**
- * @fn int32_t rsi_timer_stop(uint8_t timer_no)
- * @brief Stops timer
- * @param[in] timer_node, timer node to stop
- * @param[out] none
- * @return 0 - success
- * !0 - Failure
- * @description This HAL API should contain the code to stop the timer
- *
- */
-
-int32_t rsi_timer_stop(uint8_t timer_node)
-{
-
- //! Stop the timer
-
- return 0;
-}
-
-/*===================================================*/
-/**
- * @fn uint32_t rsi_timer_read(uint8_t timer_node)
- * @brief read timer
- * @param[in] timer_node, timer node to read
- * @param[out] none
- * @return timer value
- * @description This HAL API should contain API to read the timer
- *
- */
-
-uint32_t rsi_timer_read(uint8_t timer_node)
-{
-
- volatile uint32_t timer_val = 0;
-
- //! read the timer and return timer value
-
- return timer_val;
-}
-
-/*===================================================*/
-/**
- * @fn void rsi_delay_us(uint32_t delay)
- * @brief create delay in micro seconds
- * @param[in] delay_us, timer delay in micro seconds
- * @param[out] none
- * @return none
- * @description This HAL API should contain the code to create delay in micro seconds
- *
- */
-void rsi_delay_us(uint32_t delay_us)
-{
-
- //! call the API for delay in micro seconds
-
- return;
-}
-
-/*===================================================*/
-/**
- * @fn void rsi_delay_ms(uint32_t delay)
- * @brief create delay in micro seconds
- * @param[in] delay, timer delay in micro seconds
- * @param[out] none
- * @return none
- * @description This HAL API should contain the code to create delay in micro seconds
- *
- */
-void rsi_delay_ms1(uint32_t delay_ms)
-{
-
- //! call the API for delay in milli seconds
-
- return;
-}
-
-/*===================================================*/
-/**
- * @fn void SysTick_Handler(void);
- * @brief systick cout variable
- * @param[in] none
- * @param[out] none
- * @return none
- * @description This HAL API is systick cout variable
- *
- */
-
-void SysTick_Handler(void)
-{
- _dwTickCount++;
-#ifdef RSI_WITH_OS
- if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)
- {
- xPortSysTickHandler();
- }
-#endif
-}
-/*===================================================*/
-/**
- * @fn uint32_t GetTickCount( void )
- * @brief gets the tick count from systic ISR
- * @param[in] delay, timer delay in micro seconds
- * @param[out] none
- * @return Returns the systick current tick count
- * @description This HAL API gets the tick count from systic ISR
- *
- */
-
-uint32_t GetTickCount(void)
-{
- return _dwTickCount; // gets the tick count from systic ISR
-}
-
-/*===================================================*/
-/**
- * @fn void rsi_delay_ms(uint32_t delay)
- * @brief create delay in milli seconds
- * @param[in] delay, timer delay in milli seconds
- * @param[out] none
- * @return none
- * @description This HAL API should contain the code to create delay in milli seconds
- *
- */
-
-void rsi_delay_ms(uint32_t delay_ms)
-{
- uint64_t waitTime = rsi_hal_gettickcount() + delay_ms;
-
- while (waitTime > rsi_hal_gettickcount())
- {
- // we busy wait
- }
-}
-
-/*===================================================*/
-/**
- * @fn uint32_t rsi_hal_gettickcount()
- * @brief provides a tick value in milliseconds
- * @return tick value
- * @description This HAL API should contain the code to read the timer tick count value in milliseconds
- *
- */
-
-uint32_t rsi_hal_gettickcount(void)
-{
- return GetTickCount();
-}
diff --git a/examples/platform/silabs/SiWx917/SiWx917/rsi_if.c b/examples/platform/silabs/SiWx917/SiWx917/rsi_if.c
deleted file mode 100644
index 6f9afa5..0000000
--- a/examples/platform/silabs/SiWx917/SiWx917/rsi_if.c
+++ /dev/null
@@ -1,887 +0,0 @@
-/*
- *
- * Copyright (c) 2022 Project CHIP Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "sl_status.h"
-
-#include "FreeRTOS.h"
-#include "event_groups.h"
-#include "task.h"
-
-#include "wfx_host_events.h"
-
-#include "rsi_driver.h"
-#include "rsi_wlan_non_rom.h"
-
-#include "silabs_utils.h"
-
-#include "rsi_bootup_config.h"
-#include "rsi_common_apis.h"
-#include "rsi_data_types.h"
-#include "rsi_error.h"
-#include "rsi_nwk.h"
-#include "rsi_socket.h"
-#include "rsi_utils.h"
-#include "rsi_wlan.h"
-#include "rsi_wlan_apis.h"
-#include "rsi_wlan_config.h"
-
-#include "dhcp_client.h"
-#include "lwip/nd6.h"
-#include "wfx_rsi.h"
-
-/* Rsi driver Task will use as its stack */
-StackType_t driverRsiTaskStack[WFX_RSI_WLAN_TASK_SZ] = { 0 };
-
-/* Structure that will hold the TCB of the wfxRsi Task being created. */
-StaticTask_t driverRsiTaskBuffer;
-
-/* Declare a variable to hold the data associated with the created event group. */
-StaticEventGroup_t rsiDriverEventGroup;
-
-/* Declare a flag to differentiate between after boot-up first IP connection or reconnection */
-static bool is_wifi_disconnection_event = false;
-
-/* Declare a variable to hold connection time intervals */
-static uint32_t retryInterval = WLAN_MIN_RETRY_TIMER_MS;
-
-bool hasNotifiedIPV6 = false;
-#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4)
-bool hasNotifiedIPV4 = false;
-#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */
-bool hasNotifiedWifiConnectivity = false;
-
-extern rsi_semaphore_handle_t sl_rs_ble_init_sem;
-/*
- * This file implements the interface to the RSI SAPIs
- */
-static uint8_t wfx_rsi_drv_buf[WFX_RSI_BUF_SZ];
-static wfx_wifi_scan_ext_t * temp_reset;
-
-/******************************************************************
- * @fn int32_t wfx_rsi_get_ap_info(wfx_wifi_scan_result_t *ap)
- * @brief
- * Getting the AP details
- * @param[in] ap: access point
- * @return
- * status
- *********************************************************************/
-int32_t wfx_rsi_get_ap_info(wfx_wifi_scan_result_t * ap)
-{
- int32_t status;
- uint8_t rssi;
- ap->security = wfx_rsi.sec.security;
- ap->chan = wfx_rsi.ap_chan;
- memcpy(&ap->bssid[0], &wfx_rsi.ap_mac.octet[0], BSSID_MAX_STR_LEN);
- status = rsi_wlan_get(RSI_RSSI, &rssi, sizeof(rssi));
- if (status == RSI_SUCCESS)
- {
- ap->rssi = (-1) * rssi;
- }
- return status;
-}
-
-/******************************************************************
- * @fn int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t *extra_info)
- * @brief
- * Getting the AP extra details
- * @param[in] extra info: access point extra information
- * @return
- * status
- *********************************************************************/
-int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info)
-{
- int32_t status;
- uint8_t buff[RSI_RESPONSE_MAX_SIZE] = { 0 };
- status = rsi_wlan_get(RSI_WLAN_EXT_STATS, buff, sizeof(buff));
- if (status != RSI_SUCCESS)
- {
- SILABS_LOG("Failed, Error Code : 0x%lX", status);
- }
- else
- {
- rsi_wlan_ext_stats_t * test = (rsi_wlan_ext_stats_t *) buff;
- extra_info->beacon_lost_count = test->beacon_lost_count - temp_reset->beacon_lost_count;
- extra_info->beacon_rx_count = test->beacon_rx_count - temp_reset->beacon_rx_count;
- extra_info->mcast_rx_count = test->mcast_rx_count - temp_reset->mcast_rx_count;
- extra_info->mcast_tx_count = test->mcast_tx_count - temp_reset->mcast_tx_count;
- extra_info->ucast_rx_count = test->ucast_rx_count - temp_reset->ucast_rx_count;
- extra_info->ucast_tx_count = test->ucast_tx_count - temp_reset->ucast_tx_count;
- extra_info->overrun_count = test->overrun_count - temp_reset->overrun_count;
- }
- return status;
-}
-
-/******************************************************************
- * @fn int32_t wfx_rsi_reset_count()
- * @brief
- * Getting the driver reset count
- * @param[in] None
- * @return
- * status
- *********************************************************************/
-int32_t wfx_rsi_reset_count()
-{
- int32_t status;
- uint8_t buff[RSI_RESPONSE_MAX_SIZE] = { 0 };
- status = rsi_wlan_get(RSI_WLAN_EXT_STATS, buff, sizeof(buff));
- if (status != RSI_SUCCESS)
- {
- SILABS_LOG("Failed, Error Code : 0x%lX", status);
- }
- else
- {
- rsi_wlan_ext_stats_t * test = (rsi_wlan_ext_stats_t *) buff;
- temp_reset->beacon_lost_count = test->beacon_lost_count;
- temp_reset->beacon_rx_count = test->beacon_rx_count;
- temp_reset->mcast_rx_count = test->mcast_rx_count;
- temp_reset->mcast_tx_count = test->mcast_tx_count;
- temp_reset->ucast_rx_count = test->ucast_rx_count;
- temp_reset->ucast_tx_count = test->ucast_tx_count;
- temp_reset->overrun_count = test->overrun_count;
- }
- return status;
-}
-
-/******************************************************************
- * @fn wfx_rsi_disconnect()
- * @brief
- * Getting the driver disconnect status
- * @param[in] None
- * @return
- * status
- *********************************************************************/
-int32_t wfx_rsi_disconnect()
-{
- int32_t status = rsi_wlan_disconnect();
- return status;
-}
-
-/******************************************************************
- * @fn wfx_rsi_join_cb(uint16_t status, const uint8_t *buf, const uint16_t len)
- * @brief
- * called when driver join with cb
- * @param[in] status:
- * @param[in] buf:
- * @param[in] len:
- * @return
- * None
- *********************************************************************/
-static void wfx_rsi_join_cb(uint16_t status, const uint8_t * buf, const uint16_t len)
-{
- SILABS_LOG("%s: status: %02x", __func__, status);
- wfx_rsi.dev_state &= ~WFX_RSI_ST_STA_CONNECTING;
- if (status != RSI_SUCCESS)
- {
- /*
- * We should enable retry.. (Need config variable for this)
- */
- SILABS_LOG("%s: failed. retry: %d", __func__, wfx_rsi.join_retries);
- wfx_retry_interval_handler(is_wifi_disconnection_event, wfx_rsi.join_retries++);
- if (is_wifi_disconnection_event || wfx_rsi.join_retries <= WFX_RSI_CONFIG_MAX_JOIN)
- xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_START_JOIN);
- }
- else
- {
- /*
- * Join was complete - Do the DHCP
- */
- SILABS_LOG("%s: join completed.", __func__);
- xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_CONN);
- wfx_rsi.join_retries = 0;
- retryInterval = WLAN_MIN_RETRY_TIMER_MS;
- if (is_wifi_disconnection_event)
- is_wifi_disconnection_event = false;
- }
-}
-
-/******************************************************************
- * @fn wfx_rsi_join_fail_cb(uint16_t status, uint8_t *buf, uint32_t len)
- * @brief
- * called when driver fail to join with cb
- * @param[in] status:
- * @param[in] buf:
- * @param[in] len:
- * @return
- * None
- *********************************************************************/
-static void wfx_rsi_join_fail_cb(uint16_t status, uint8_t * buf, uint32_t len)
-{
- SILABS_LOG("%s: error: failed status: %02x", __func__, status);
- wfx_rsi.join_retries += 1;
- wfx_rsi.dev_state &= ~(WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED);
- is_wifi_disconnection_event = true;
- xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_START_JOIN);
-}
-
-/*************************************************************************************
- * @fn wfx_rsi_wlan_pkt_cb(uint16_t status, uint8_t *buf, uint32_t len)
- * @brief
- * Got RAW WLAN data pkt
- * @param[in] status:
- * @param[in] buf:
- * @param[in] len:
- * @return
- * None
- *****************************************************************************************/
-static void wfx_rsi_wlan_pkt_cb(uint16_t status, uint8_t * buf, uint32_t len)
-{
- if (status != RSI_SUCCESS)
- {
- return;
- }
- wfx_host_received_sta_frame_cb(buf, len);
-}
-
-/*************************************************************************************
- * @fn static int32_t wfx_rsi_init(void)
- * @brief
- * driver initialization
- * @param[in] None
- * @return
- * None
- *****************************************************************************************/
-static int32_t wfx_rsi_init(void)
-{
- int32_t status;
- uint8_t buf[RSI_RESPONSE_HOLD_BUFF_SIZE];
-
- SILABS_LOG("%s: start wireless drv task", __func__);
- /*
- * Create the driver task
- */
- wfx_rsi.drv_task = xTaskCreateStatic((TaskFunction_t) rsi_wireless_driver_task, "rsi_drv", WFX_RSI_WLAN_TASK_SZ, NULL,
- WLAN_TASK_PRIORITY, driverRsiTaskStack, &driverRsiTaskBuffer);
- if (NULL == wfx_rsi.drv_task)
- {
- SILABS_LOG("%s: error: rsi_wireless_driver_task failed", __func__);
- return RSI_ERROR_INVALID_PARAM;
- }
-
- /* Initialize WiSeConnect or Module features. */
- SILABS_LOG("%s: rsi_wireless_init", __func__);
- if ((status = rsi_wireless_init(OPER_MODE_0, RSI_OPERMODE_WLAN_BLE)) != RSI_SUCCESS)
- {
- SILABS_LOG("%s: error: rsi_wireless_init failed with status: %02x", __func__, status);
- return status;
- }
-
- SILABS_LOG("%s: get FW version..", __func__);
- /*
- * Get the MAC and other info to let the user know about it.
- */
- if (rsi_wlan_get(RSI_FW_VERSION, buf, sizeof(buf)) != RSI_SUCCESS)
- {
- SILABS_LOG("%s: error: rsi_wlan_get(RSI_FW_VERSION) failed with status: %02x", __func__, status);
- return status;
- }
-
- buf[sizeof(buf) - 1] = 0;
- SILABS_LOG("%s: RSI firmware version: %s", __func__, buf);
- //! Send feature frame
- if ((status = rsi_send_feature_frame()) != RSI_SUCCESS)
- {
- SILABS_LOG("%s: error: rsi_send_feature_frame failed with status: %02x", __func__, status);
- return status;
- }
-
- SILABS_LOG("%s: sent rsi_send_feature_frame", __func__);
- /* initializes wlan radio parameters and WLAN supplicant parameters.
- */
- (void) rsi_wlan_radio_init(); /* Required so we can get MAC address */
- if ((status = rsi_wlan_get(RSI_MAC_ADDRESS, &wfx_rsi.sta_mac.octet[0], RESP_BUFF_SIZE)) != RSI_SUCCESS)
- {
- SILABS_LOG("%s: error: rsi_wlan_get failed with status: %02x", __func__, status);
- return status;
- }
-
- SILABS_LOG("%s: WLAN: MAC %02x:%02x:%02x %02x:%02x:%02x", __func__, wfx_rsi.sta_mac.octet[0], wfx_rsi.sta_mac.octet[1],
- wfx_rsi.sta_mac.octet[2], wfx_rsi.sta_mac.octet[3], wfx_rsi.sta_mac.octet[4], wfx_rsi.sta_mac.octet[5]);
- wfx_rsi.events = xEventGroupCreateStatic(&rsiDriverEventGroup);
- /*
- * Register callbacks - We are only interested in the connectivity CBs
- */
- if ((status = rsi_wlan_register_callbacks(RSI_JOIN_FAIL_CB, wfx_rsi_join_fail_cb)) != RSI_SUCCESS)
- {
- SILABS_LOG("%s: RSI callback register join failed with status: %02x", __func__, status);
- return status;
- }
- if ((status = rsi_wlan_register_callbacks(RSI_WLAN_DATA_RECEIVE_NOTIFY_CB, wfx_rsi_wlan_pkt_cb)) != RSI_SUCCESS)
- {
- SILABS_LOG("%s: RSI callback register data-notify failed with status: %02x", __func__, status);
- return status;
- }
- wfx_rsi.dev_state |= WFX_RSI_ST_DEV_READY;
- rsi_semaphore_post(&sl_rs_ble_init_sem);
- SILABS_LOG("%s: RSI: OK", __func__);
- return RSI_SUCCESS;
-}
-
-/***************************************************************************************
- * @fn static void wfx_rsi_save_ap_info()
- * @brief
- * Saving the details of the AP
- * @param[in] None
- * @return
- * None
- *******************************************************************************************/
-static void wfx_rsi_save_ap_info()
-{
- int32_t status;
- rsi_rsp_scan_t rsp;
-
- status =
- rsi_wlan_scan_with_bitmap_options((int8_t *) &wfx_rsi.sec.ssid[0], AP_CHANNEL_NO_0, &rsp, sizeof(rsp), SCAN_BITMAP_OPTN_1);
-
- if (status == RSI_SUCCESS)
- {
- /*
- * Scan is done - failed
- */
-#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION
- wfx_rsi.sec.security = WFX_SEC_WPA3;
-#else /* !WIFI_ENABLE_SECURITY_WPA3_TRANSITION */
- wfx_rsi.sec.security = WFX_SEC_WPA2;
-#endif /* WIFI_ENABLE_SECURITY_WPA3_TRANSITION */
- SILABS_LOG("%s: warn: failed with status: %02x", __func__, status);
- return;
- }
- else
- {
- wfx_rsi.sec.security = WFX_SEC_UNSPECIFIED;
- wfx_rsi.ap_chan = rsp.scan_info->rf_channel;
- memcpy(&wfx_rsi.ap_mac.octet[0], &rsp.scan_info->bssid[0], BSSID_MAX_STR_LEN);
- }
-
- switch (rsp.scan_info->security_mode)
- {
- case SME_OPEN:
- wfx_rsi.sec.security = WFX_SEC_NONE;
- break;
- case SME_WPA:
- case SME_WPA_ENTERPRISE:
- wfx_rsi.sec.security = WFX_SEC_WPA;
- break;
- case SME_WPA2:
- case SME_WPA2_ENTERPRISE:
- wfx_rsi.sec.security = WFX_SEC_WPA2;
- break;
- case SME_WEP:
- wfx_rsi.sec.security = WFX_SEC_WEP;
- break;
- case SME_WPA3_TRANSITION:
-#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION
- case SME_WPA3:
- wfx_rsi.sec.security = RSI_WPA3;
-#else
- wfx_rsi.sec.security = WFX_SEC_WPA2;
-#endif /* WIFI_ENABLE_SECURITY_WPA3_TRANSITION */
- break;
- default:
- wfx_rsi.sec.security = WFX_SEC_UNSPECIFIED;
- break;
- }
- SILABS_LOG("%s: WLAN: connecting to %s==%s, sec=%d, status=%02x", __func__, &wfx_rsi.sec.ssid[0], &wfx_rsi.sec.passkey[0],
- wfx_rsi.sec.security, status);
-}
-
-/********************************************************************************************
- * @fn static void wfx_rsi_do_join(void)
- * @brief
- * Start an async Join command
- * @return
- * None
- **********************************************************************************************/
-static void wfx_rsi_do_join(void)
-{
- int32_t status;
- rsi_security_mode_t connect_security_mode;
-
- if (wfx_rsi.dev_state & (WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED))
- {
- SILABS_LOG("%s: not joining - already in progress", __func__);
- }
- else
- {
- switch (wfx_rsi.sec.security)
- {
- case WFX_SEC_WEP:
- connect_security_mode = RSI_WEP;
- break;
- case WFX_SEC_WPA:
- case WFX_SEC_WPA2:
- connect_security_mode = RSI_WPA_WPA2_MIXED;
- break;
-#if WIFI_ENABLE_SECURITY_WPA3_TRANSITION
- case WFX_SEC_WPA3:
- connect_security_mode = RSI_WPA3_TRANSITION;
- break;
-#endif /* WIFI_ENABLE_SECURITY_WPA3_TRANS */
- case WFX_SEC_NONE:
- connect_security_mode = RSI_OPEN;
- break;
- default:
- SILABS_LOG("%s: error: unknown security type.", __func__);
- return;
- }
-
- SILABS_LOG("%s: WLAN: connecting to %s==%s, sec=%d", __func__, &wfx_rsi.sec.ssid[0], &wfx_rsi.sec.passkey[0],
- wfx_rsi.sec.security);
- /*
- * Join the network
- */
- /* TODO - make the WFX_SECURITY_xxx - same as RSI_xxx
- * Right now it's done by hand - we need something better
- */
- wfx_rsi.dev_state |= WFX_RSI_ST_STA_CONNECTING;
-
- if ((status = rsi_wlan_register_callbacks(RSI_JOIN_FAIL_CB, wfx_rsi_join_fail_cb)) != RSI_SUCCESS)
- {
- SILABS_LOG("%s: RSI callback register join failed with status: %02x", __func__, status);
- }
-
- /* Try to connect Wifi with given Credentials
- * untill there is a success or maximum number of tries allowed
- */
- while (is_wifi_disconnection_event || wfx_rsi.join_retries <= WFX_RSI_CONFIG_MAX_JOIN)
- {
- /* Call rsi connect call with given ssid and password
- * And check there is a success
- */
- if ((status = rsi_wlan_connect_async((int8_t *) &wfx_rsi.sec.ssid[0], connect_security_mode, &wfx_rsi.sec.passkey[0],
- wfx_rsi_join_cb)) != RSI_SUCCESS)
- {
-
- wfx_rsi.dev_state &= ~WFX_RSI_ST_STA_CONNECTING;
- SILABS_LOG("%s: rsi_wlan_connect_async failed with status: %02x on try %d", __func__, status, wfx_rsi.join_retries);
-
- wfx_retry_interval_handler(is_wifi_disconnection_event, wfx_rsi.join_retries);
- wfx_rsi.join_retries++;
- }
- else
- {
- SILABS_LOG("%s: starting JOIN to %s after %d tries\n", __func__, (char *) &wfx_rsi.sec.ssid[0],
- wfx_rsi.join_retries);
- break; // exit while loop
- }
- }
- SILABS_LOG("Returning the do join");
- }
-}
-
-/*********************************************************************************
- * @fn void wfx_rsi_task(void *arg)
- * @brief
- * The main WLAN task - started by wfx_wifi_start () that interfaces with RSI.
- * The rest of RSI stuff come in call-backs.
- * The initialization has been already done.
- * @param[in] arg:
- * @return
- * None
- **********************************************************************************/
-/* ARGSUSED */
-void wfx_rsi_task(void * arg)
-{
- EventBits_t flags;
- int32_t status;
- TickType_t last_dhcp_poll, now;
- struct netif * sta_netif;
- (void) arg;
- status = wfx_rsi_init();
- if (status != RSI_SUCCESS)
- {
- SILABS_LOG("%s: error: wfx_rsi_init with status: %02x", __func__, status);
- return;
- }
- wfx_lwip_start();
- last_dhcp_poll = xTaskGetTickCount();
- sta_netif = wfx_get_netif(SL_WFX_STA_INTERFACE);
- wfx_started_notify();
-
- SILABS_LOG("%s: starting event wait", __func__);
- for (;;)
- {
- /*
- * This is the main job of this task.
- * Wait for commands from the ConnectivityManager
- * Make state changes (based on call backs)
- */
- flags = xEventGroupWaitBits(wfx_rsi.events,
- WFX_EVT_STA_CONN | WFX_EVT_STA_DISCONN | WFX_EVT_STA_START_JOIN
-#ifdef SL_WFX_CONFIG_SOFTAP
- | WFX_EVT_AP_START | WFX_EVT_AP_STOP
-#endif /* SL_WFX_CONFIG_SOFTAP */
-#ifdef SL_WFX_CONFIG_SCAN
- | WFX_EVT_SCAN
-#endif /* SL_WFX_CONFIG_SCAN */
- | 0,
- pdTRUE, /* Clear the bits */
- pdFALSE, /* Wait for any bit */
- pdMS_TO_TICKS(250)); /* 250 mSec */
-
- if (flags)
- {
- SILABS_LOG("%s: wait event encountered: %x", __func__, flags);
- }
- /*
- * Let's handle DHCP polling here
- */
- if (wfx_rsi.dev_state & WFX_RSI_ST_STA_CONNECTED)
- {
- if ((now = xTaskGetTickCount()) > (last_dhcp_poll + pdMS_TO_TICKS(250)))
- {
-#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4)
- uint8_t dhcp_state = dhcpclient_poll(sta_netif);
- if (dhcp_state == DHCP_ADDRESS_ASSIGNED && !hasNotifiedIPV4)
- {
- wfx_dhcp_got_ipv4((uint32_t) sta_netif->ip_addr.u_addr.ip4.addr);
- hasNotifiedIPV4 = true;
- if (!hasNotifiedWifiConnectivity)
- {
- wfx_connected_notify(CONNECTION_STATUS_SUCCESS, &wfx_rsi.ap_mac);
- hasNotifiedWifiConnectivity = true;
- }
- }
- else if (dhcp_state == DHCP_OFF)
- {
- wfx_ip_changed_notify(IP_STATUS_FAIL);
- hasNotifiedIPV4 = false;
- }
-#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */
- /*
- * Checks if the IPv6 event has been notified, if not invoke the nd6_tmr,
- * which starts the duplicate address detectation.
- */
- if (!hasNotifiedIPV6)
- {
- nd6_tmr();
- }
- /*
- * Checks if the assigned IPv6 address is preferred by evaluating
- * the first block of IPv6 address ( block 0)
- */
- if ((ip6_addr_ispreferred(netif_ip6_addr_state(sta_netif, 0))) && !hasNotifiedIPV6)
- {
- wfx_ipv6_notify(GET_IPV6_SUCCESS);
- hasNotifiedIPV6 = true;
- if (!hasNotifiedWifiConnectivity)
- {
- wfx_connected_notify(CONNECTION_STATUS_SUCCESS, &wfx_rsi.ap_mac);
- hasNotifiedWifiConnectivity = true;
- }
- }
- last_dhcp_poll = now;
- }
- }
- if (flags & WFX_EVT_STA_START_JOIN)
- {
- // saving the AP related info
- wfx_rsi_save_ap_info();
- // Joining to the network
- wfx_rsi_do_join();
- }
- if ((flags & WFX_EVT_STA_CONN))
- {
- /*
- * Initiate the Join command (assuming we have been provisioned)
- */
- SILABS_LOG("%s: starting LwIP STA", __func__);
- wfx_rsi.dev_state |= WFX_RSI_ST_STA_CONNECTED;
- hasNotifiedWifiConnectivity = false;
-#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4)
- hasNotifiedIPV4 = false;
-#endif // CHIP_DEVICE_CONFIG_ENABLE_IPV4
- hasNotifiedIPV6 = false;
- wfx_lwip_set_sta_link_up();
- /* We need to get AP Mac - TODO */
- // Uncomment once the hook into MATTER is moved to IP connectivity instead
- // of AP connectivity. wfx_connected_notify(0, &wfx_rsi.ap_mac); // This
- // is independent of IP connectivity.
- }
- if (flags & WFX_EVT_STA_DISCONN)
- {
- wfx_rsi.dev_state &=
- ~(WFX_RSI_ST_STA_READY | WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED | WFX_RSI_ST_STA_DHCP_DONE);
- SILABS_LOG("%s: disconnect notify", __func__);
- /* TODO: Implement disconnect notify */
- wfx_lwip_set_sta_link_down(); // Internally dhcpclient_poll(netif) ->
- // wfx_ip_changed_notify(0) for IPV4
-#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4)
- wfx_ip_changed_notify(IP_STATUS_FAIL);
- hasNotifiedIPV4 = false;
-#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */
- wfx_ipv6_notify(GET_IPV6_FAIL);
- hasNotifiedIPV6 = false;
- hasNotifiedWifiConnectivity = false;
- }
-#ifdef SL_WFX_CONFIG_SCAN
- if (flags & WFX_EVT_SCAN)
- {
- if (!(wfx_rsi.dev_state & WFX_RSI_ST_SCANSTARTED))
- {
- SILABS_LOG("%s: start SSID scan", __func__);
- int x;
- wfx_wifi_scan_result_t ap;
- rsi_scan_info_t * scan;
- int32_t status;
- uint8_t bgscan_results[BG_SCAN_RES_SIZE] = { 0 };
- status = rsi_wlan_bgscan_profile(1, (rsi_rsp_scan_t *) bgscan_results, BG_SCAN_RES_SIZE);
-
- SILABS_LOG("%s: status: %02x size = %d", __func__, status, BG_SCAN_RES_SIZE);
- rsi_rsp_scan_t * rsp = (rsi_rsp_scan_t *) bgscan_results;
- if (status)
- {
- /*
- * Scan is done - failed
- */
- }
- else
- for (x = 0; x < rsp->scan_count[0]; x++)
- {
- scan = &rsp->scan_info[x];
- strcpy(&ap.ssid[0], (char *) &scan->ssid[0]);
- if (wfx_rsi.scan_ssid)
- {
- SILABS_LOG("Inside scan_ssid");
- SILABS_LOG("SCAN SSID: %s , ap scan: %s", wfx_rsi.scan_ssid, ap.ssid);
- if (strcmp(wfx_rsi.scan_ssid, ap.ssid) == CMP_SUCCESS)
- {
- SILABS_LOG("Inside ap details");
- ap.security = scan->security_mode;
- ap.rssi = (-1) * scan->rssi_val;
- memcpy(&ap.bssid[0], &scan->bssid[0], BSSID_MAX_STR_LEN);
- (*wfx_rsi.scan_cb)(&ap);
- }
- }
- else
- {
- SILABS_LOG("Inside else");
- ap.security = scan->security_mode;
- ap.rssi = (-1) * scan->rssi_val;
- memcpy(&ap.bssid[0], &scan->bssid[0], BSSID_MAX_STR_LEN);
- (*wfx_rsi.scan_cb)(&ap);
- }
- }
- wfx_rsi.dev_state &= ~WFX_RSI_ST_SCANSTARTED;
- /* Terminate with end of scan which is no ap sent back */
- (*wfx_rsi.scan_cb)((wfx_wifi_scan_result_t *) 0);
- wfx_rsi.scan_cb = (void (*)(wfx_wifi_scan_result_t *)) 0;
-
- if (wfx_rsi.scan_ssid)
- {
- vPortFree(wfx_rsi.scan_ssid);
- wfx_rsi.scan_ssid = (char *) 0;
- }
- }
- }
-#endif /* SL_WFX_CONFIG_SCAN */
-#ifdef SL_WFX_CONFIG_SOFTAP
- /* TODO */
- if (flags & WFX_EVT_AP_START)
- {
- }
- if (flags & WFX_EVT_AP_STOP)
- {
- }
-#endif /* SL_WFX_CONFIG_SOFTAP */
- }
-}
-
-#if CHIP_DEVICE_CONFIG_ENABLE_IPV4
-/********************************************************************************************
- * @fn void wfx_dhcp_got_ipv4(uint32_t ip)
- * @brief
- * Acquire the new ip address
- * @param[in] ip: internet protocol
- * @return
- * None
- **********************************************************************************************/
-void wfx_dhcp_got_ipv4(uint32_t ip)
-{
- /*
- * Acquire the new IP address
- */
- wfx_rsi.ip4_addr[0] = (ip) &HEX_VALUE_FF;
- wfx_rsi.ip4_addr[1] = (ip >> 8) & HEX_VALUE_FF;
- wfx_rsi.ip4_addr[2] = (ip >> 16) & HEX_VALUE_FF;
- wfx_rsi.ip4_addr[3] = (ip >> 24) & HEX_VALUE_FF;
- SILABS_LOG("%s: DHCP OK: IP=%d.%d.%d.%d", __func__, wfx_rsi.ip4_addr[0], wfx_rsi.ip4_addr[1], wfx_rsi.ip4_addr[2],
- wfx_rsi.ip4_addr[3]);
- wfx_rsi.dev_state |= WFX_RSI_ST_STA_DHCP_DONE;
- /* Notify the Connectivity Manager - via the app */
- wfx_ip_changed_notify(IP_STATUS_SUCCESS);
- wfx_rsi.dev_state |= WFX_RSI_ST_STA_READY;
-}
-#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */
-
-/*
- * WARNING - Taken from RSI and broken up
- * This is my own RSI stuff for not copying code and allocating an extra
- * level of indirection - when using LWIP buffers
- * see also: int32_t rsi_wlan_send_data_xx(uint8_t *buffer, uint32_t length)
- */
-/********************************************************************************************
- * @fn void *wfx_rsi_alloc_pkt()
- * @brief
- * Allocate packet to send data
- * @param[in] None
- * @return
- * None
- **********************************************************************************************/
-void * wfx_rsi_alloc_pkt()
-{
- rsi_pkt_t * pkt;
-
- // Allocate packet to send data
- if ((pkt = rsi_pkt_alloc(&rsi_driver_cb->wlan_cb->wlan_tx_pool)) == NULL)
- {
- return (void *) 0;
- }
-
- return (void *) pkt;
-}
-
-/********************************************************************************************
- * @fn void wfx_rsi_pkt_add_data(void *p, uint8_t *buf, uint16_t len, uint16_t off)
- * @brief
- * add the data into packet
- * @param[in] p:
- * @param[in] buf:
- * @param[in] len:
- * @param[in] off:
- * @return
- * None
- **********************************************************************************************/
-void wfx_rsi_pkt_add_data(void * p, uint8_t * buf, uint16_t len, uint16_t off)
-{
- rsi_pkt_t * pkt;
-
- pkt = (rsi_pkt_t *) p;
- memcpy(((char *) pkt->data) + off, buf, len);
-}
-
-/********************************************************************************************
- * @fn int32_t wfx_rsi_send_data(void *p, uint16_t len)
- * @brief
- * Driver send a data
- * @param[in] p:
- * @param[in] len:
- * @return
- * None
- **********************************************************************************************/
-int32_t wfx_rsi_send_data(void * p, uint16_t len)
-{
- int32_t status;
- register uint8_t * host_desc;
- rsi_pkt_t * pkt;
-
- pkt = (rsi_pkt_t *) p;
- host_desc = pkt->desc;
- memset(host_desc, 0, RSI_HOST_DESC_LENGTH);
- rsi_uint16_to_2bytes(host_desc, (len & 0xFFF));
-
- // Fill packet type
- host_desc[1] |= (RSI_WLAN_DATA_Q << 4);
- host_desc[2] |= 0x01;
-
- rsi_enqueue_pkt(&rsi_driver_cb->wlan_tx_q, pkt);
-
-#ifndef RSI_SEND_SEM_BITMAP
- rsi_driver_cb_non_rom->send_wait_bitmap |= BIT(0);
-#endif
- // Set TX packet pending event
- rsi_set_event(RSI_TX_EVENT);
-
- if (rsi_wait_on_wlan_semaphore(&rsi_driver_cb_non_rom->send_data_sem, RSI_SEND_DATA_RESPONSE_WAIT_TIME) != RSI_ERROR_NONE)
- {
- return RSI_ERROR_RESPONSE_TIMEOUT;
- }
- status = rsi_wlan_get_status();
-
- return status;
-}
-
-int32_t wfx_rsi_init_platform()
-{
- int32_t status;
- /*init task - RS911x*/
- SILABS_LOG("RSI_INIT");
- SILABS_LOG("%s: starting(HEAP_SZ = %d)", __func__, SL_HEAP_SIZE);
- //! Driver initialization
- status = rsi_driver_init(wfx_rsi_drv_buf, WFX_RSI_BUF_SZ);
- if ((status < RSI_DRIVER_STATUS) || (status > WFX_RSI_BUF_SZ))
- {
- SILABS_LOG("%s: error: RSI drv init failed with status: %02x", __func__, status);
- }
-
- SILABS_LOG("%s: rsi_device_init", __func__);
- /* ! Redpine module intialisation */
- if ((status = rsi_device_init(LOAD_NWP_FW)) != RSI_SUCCESS)
- {
- SILABS_LOG("%s: error: rsi_device_init failed with status: %02x", __func__, status);
- return status;
- }
-
- return status;
-}
-
-/********************************************************************************************
- * @fn void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retryJoin)
- * @brief
- * Based on condition will delay for a certain period of time.
- * @param[in] is_wifi_disconnection_event
- * @param[in] retryJoin
- * @return None
- ********************************************************************************************/
-void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retryJoin)
-{
- if (!is_wifi_disconnection_event)
- {
- /* After the reboot or a commissioning time device failed to connect with AP.
- * Device will retry to connect with AP upto WFX_RSI_CONFIG_MAX_JOIN retries.
- */
- if (retryJoin < MAX_JOIN_RETRIES_COUNT)
- {
- SILABS_LOG("%s: Next attempt after %d Seconds", __func__, CONVERT_MS_TO_SEC(WLAN_RETRY_TIMER_MS));
- vTaskDelay(pdMS_TO_TICKS(WLAN_RETRY_TIMER_MS));
- }
- else
- {
- SILABS_LOG("Connect failed after max %d tries", retryJoin);
- }
- }
- else
- {
- /* After disconnection
- * At the telescopic time interval device try to reconnect with AP, upto WLAN_MAX_RETRY_TIMER_MS intervals
- * are telescopic. If interval exceed WLAN_MAX_RETRY_TIMER_MS then it will try to reconnect at
- * WLAN_MAX_RETRY_TIMER_MS intervals.
- */
- if (retryInterval > WLAN_MAX_RETRY_TIMER_MS)
- {
- retryInterval = WLAN_MAX_RETRY_TIMER_MS;
- }
- SILABS_LOG("%s: Next attempt after %d Seconds", __func__, CONVERT_MS_TO_SEC(retryInterval));
- vTaskDelay(pdMS_TO_TICKS(retryInterval));
- retryInterval += retryInterval;
- }
-}
-
-struct wfx_rsi wfx_rsi;
diff --git a/examples/platform/silabs/SiWx917/SiWx917/rsi_wlan_config.h b/examples/platform/silabs/SiWx917/SiWx917/rsi_wlan_config.h
deleted file mode 100644
index 4f2dc07..0000000
--- a/examples/platform/silabs/SiWx917/SiWx917/rsi_wlan_config.h
+++ /dev/null
@@ -1,570 +0,0 @@
-/*
- *
- * Copyright (c) 2022 Project CHIP Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef RSI_CONFIG_H
-#define RSI_CONFIG_H
-
-#include "rsi_wlan_defines.h"
-
-//! Enable feature
-#define RSI_ENABLE 1
-//! Disable feature
-#define RSI_DISABLE 0
-
-//! To enable concurrent mode
-#define CONCURRENT_MODE RSI_DISABLE
-
-//! opermode command paramaters
-/*=======================================================================*/
-//! To set wlan feature select bit map
-#define RSI_FEATURE_BIT_MAP (FEAT_SECURITY_OPEN)
-
-//! TCP IP BYPASS feature check
-//#define RSI_TCP_IP_BYPASS RSI_DISABLE
-//! TCP/IP feature select bitmap for selecting TCP/IP features
-//#define RSI_TCP_IP_FEATURE_BIT_MAP (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_ICMP)
-
-#define RSI_TCP_IP_BYPASS RSI_ENABLE
-//#define RSI_TCP_IP_FEATURE_BIT_MAP (TCP_IP_FEAT_DHCPV4_CLIENT | TCP_IP_FEAT_ICMP)
-#define RSI_TCP_IP_FEATURE_BIT_MAP (TCP_IP_FEAT_BYPASS /*| TCP_IP_FEAT_EXTENSION_VALID*/)
-
-//! To set custom feature select bit map
-#define RSI_CUSTOM_FEATURE_BIT_MAP FEAT_CUSTOM_FEAT_EXTENTION_VALID
-
-//! To set Extended custom feature select bit map
-#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP EXT_FEAT_UART_SEL_FOR_DEBUG_PRINTS
-
-#define RSI_EXT_TCPIP_FEATURE_BITMAP 0
-
-/*=======================================================================*/
-//! Feature frame parameters
-/*=======================================================================*/
-#define PLL_MODE 0
-#define RF_TYPE 1 //! 0 - External RF 1- Internal RF
-#define WIRELESS_MODE 0
-#define ENABLE_PPP 0
-#define AFE_TYPE 1
-#define FEATURE_ENABLES 0
-/*=======================================================================*/
-//! Band command paramters
-/*=======================================================================*/
-
-//! RSI_BAND_2P4GHZ(2.4GHz) or RSI_BAND_5GHZ(5GHz) or RSI_DUAL_BAND
-#define RSI_BAND RSI_BAND_2P4GHZ
-/*=======================================================================*/
-//! set region command paramters
-/*=======================================================================*/
-
-//! RSI_ENABLE or RSI_DISABLE Set region support
-#define RSI_SET_REGION_SUPPORT RSI_DISABLE //@ RSI_ENABLE or RSI_DISABLE set region
-
-//! If 1:region configurations taken from user ;0:region configurations taken from beacon
-#define RSI_SET_REGION_FROM_USER_OR_BEACON 1
-
-//! 0-Default Region domain ,1-US, 2-EUROPE, 3-JAPAN
-#define RSI_REGION_CODE 3
-
-//! 0- Without On Board Antenna , 1- With On Board Antenna
-#define RSI_MODULE_TYPE 1
-
-/*=======================================================================*/
-//! set region AP command paramters
-/*=======================================================================*/
-
-//! RSI_ENABLE or RSI_DISABLE Set region AP support
-#define RSI_SET_REGION_AP_SUPPORT RSI_DISABLE
-
-//! If 1:region configurations taken from user ;0:region configurations taken from firmware
-#define RSI_SET_REGION_AP_FROM_USER RSI_DISABLE
-
-//! "US" or "EU" or "JP" or other region codes
-#define RSI_COUNTRY_CODE "US "
-
-/*=======================================================================*/
-
-//! Rejoin parameters
-/*=======================================================================*/
-
-//! RSI_ENABLE or RSI_DISABLE rejoin params
-#define RSI_REJOIN_PARAMS_SUPPORT RSI_DISABLE
-
-//! Rejoin retry count. If 0 retries infinity times
-#define RSI_REJOIN_MAX_RETRY 0
-
-//! Periodicity of rejoin attempt
-#define RSI_REJOIN_SCAN_INTERVAL 4
-
-//! Beacon missed count
-#define RSI_REJOIN_BEACON_MISSED_COUNT 40
-
-//! RSI_ENABLE or RSI_DISABLE retry for first time join failure
-#define RSI_REJOIN_FIRST_TIME_RETRY RSI_DISABLE
-
-/*=======================================================================*/
-
-//! BG scan command parameters
-/*=======================================================================*/
-
-//! RSI_ENABLE or RSI_DISABLE BG Scan support
-#define RSI_BG_SCAN_SUPPORT RSI_DISABLE
-
-//! RSI_ENABLE or RSI_DISABLE BG scan
-#define RSI_BG_SCAN_ENABLE RSI_ENABLE
-
-//! RSI_ENABLE or RSI_DISABLE instant BG scan
-#define RSI_INSTANT_BG 1 // RSI_DISABLE
-
-//! BG scan threshold value
-#define RSI_BG_SCAN_THRESHOLD 63
-
-//! RSSI tolerance Threshold
-#define RSI_RSSI_TOLERANCE_THRESHOLD 4
-
-//! BG scan periodicity
-#define RSI_BG_SCAN_PERIODICITY 2
-
-//! Active scan duration
-#define RSI_ACTIVE_SCAN_DURATION 50
-
-//! Passive scan duration
-#define RSI_PASSIVE_SCAN_DURATION 50
-
-//! Multi probe
-#define RSI_MULTIPROBE RSI_DISABLE
-
-/*=======================================================================*/
-
-//! RSI_ENABLE or RSI_DISABLE to set RTS threshold config
-#define RSI_WLAN_CONFIG_ENABLE RSI_ENABLE
-
-#define CONFIG_RTSTHRESHOLD 1
-
-#define RSI_RTS_THRESHOLD 2346
-
-/*=======================================================================*/
-
-//! Roaming parameters
-/*=======================================================================*/
-
-//! RSI_ENABLE or RSI_DISABLE Roaming support
-#define RSI_ROAMING_SUPPORT RSI_DISABLE
-
-//! roaming threshold value
-#define RSI_ROAMING_THRESHOLD 67
-
-//! roaming hysterisis value
-#define RSI_ROAMING_HYSTERISIS 4
-
-/*=======================================================================*/
-//! High Throughput Capabilies related information
-/*=======================================================================*/
-
-//! RSI_ENABLE or RSI_DISABLE 11n mode in AP mode
-#define RSI_MODE_11N_ENABLE RSI_DISABLE
-
-//! HT caps bit map.
-#define RSI_HT_CAPS_BIT_MAP 10
-
-/*=======================================================================*/
-//! Scan command parameters
-/*=======================================================================*/
-
-//! scan channel bit map in 2.4GHz band,valid if given channel to scan is 0
-#define RSI_SCAN_CHANNEL_BIT_MAP_2_4 0
-
-//! scan channle bit map in 5GHz band ,valid if given channel to scan is 0
-#define RSI_SCAN_CHANNEL_BIT_MAP_5 0
-
-//! scan_feature_bitmap ,valid only if specific channel to scan and ssid are given
-#define RSI_SCAN_FEAT_BITMAP 0
-
-/*=======================================================================*/
-//! Enterprise configuration command parameters
-/*=======================================================================*/
-
-//! Enterprise method ,should be one of among TLS, TTLS, FAST or PEAP
-#define RSI_EAP_METHOD "TTLS"
-//! This parameter is used to configure the module in Enterprise security mode
-#define RSI_EAP_INNER_METHOD "\"auth=MSCHAPV2\""
-//! Private Key Password is required for encrypted private key, format is like "\"12345678\""
-#define RSI_PRIVATE_KEY_PASSWORD ""
-/*=======================================================================*/
-//! AP configuration command parameters
-/*=======================================================================*/
-
-//! This Macro is used to enable AP keep alive functionality
-#define RSI_AP_KEEP_ALIVE_ENABLE RSI_ENABLE
-
-//! This parameter is used to configure keep alive type
-#define RSI_AP_KEEP_ALIVE_TYPE RSI_NULL_BASED_KEEP_ALIVE
-
-//! This parameter is used to configure keep alive period
-#define RSI_AP_KEEP_ALIVE_PERIOD 100
-
-//! This parameter is used to configure maximum stations supported
-#define RSI_MAX_STATIONS_SUPPORT 4
-/*=======================================================================*/
-//! Join command parameters
-/*=======================================================================*/
-
-//! Tx power level
-#define RSI_POWER_LEVEL RSI_POWER_LEVEL_HIGH
-
-//! RSI_JOIN_FEAT_STA_BG_ONLY_MODE_ENABLE or RSI_JOIN_FEAT_LISTEN_INTERVAL_VALID
-#define RSI_JOIN_FEAT_BIT_MAP 0
-
-//!
-#define RSI_LISTEN_INTERVAL 0
-
-//! Transmission data rate. Physical rate at which data has to be transmitted.
-#define RSI_DATA_RATE RSI_DATA_RATE_AUTO
-
-/*=======================================================================*/
-//! Ipconf command parameters
-/*=======================================================================*/
-
-//! DHCP client host name
-#define RSI_DHCP_HOST_NAME "dhcp_client"
-
-//! Transmit test command parameters
-/*=======================================================================*/
-//! TX TEST rate flags
-#define RSI_TX_TEST_RATE_FLAGS 0
-
-//! TX TEST per channel bandwidth
-#define RSI_TX_TEST_PER_CH_BW 0
-
-//! TX TEST aggregation enable or disable
-#define RSI_TX_TEST_AGGR_ENABLE RSI_DISABLE
-
-//! TX TEST delay
-#define RSI_TX_TEST_DELAY 0
-
-/*======================================================================*/
-//! ssl parameters
-/*=======================================================================*/
-//! ssl version
-#define RSI_SSL_VERSION 0
-
-//! ssl ciphers
-#define RSI_SSL_CIPHERS SSL_ALL_CIPHERS
-
-//! Enable TCP over SSL with TLS version depends on remote side
-#define PROTOCOL_DFLT_VERSION BIT(0)
-
-//! Enable TCP over SSL with TLS version 1.0
-#define PROTOCOL_TLS_1_0 (BIT(0) | BIT(13))
-
-//! Enable TCP over SSL with TLS version 1.1
-#define PROTOCOL_TLS_1_1 (BIT(0) | BIT(14))
-
-//! Enable TCP over SSL with TLS version 1.2
-#define PROTOCOL_TLS_1_2 (BIT(0) | BIT(15))
-/*=======================================================================*/
-//! Power save command parameters
-/*=======================================================================*/
-//! set handshake type of power mode
-#define RSI_HAND_SHAKE_TYPE MSG_BASED
-
-//! 0 - LP, 1- ULP mode with RAM retention and 2 - ULP with Non RAM retention
-#define RSI_SELECT_LP_OR_ULP_MODE RSI_ULP_WITH_RAM_RET
-
-//! set DTIM aligment required
-//! 0 - module wakes up at beacon which is just before or equal to listen_interval
-//! 1 - module wakes up at DTIM beacon which is just before or equal to listen_interval
-#define RSI_DTIM_ALIGNED_TYPE 0
-
-//! Monitor interval for the FAST PSP mode
-//! default is 50 ms, and this parameter is valid for FAST PSP only
-#define RSI_MONITOR_INTERVAL 50
-
-//! Number of DTIMs to skip during powersave
-#define RSI_NUM_OF_DTIM_SKIP 0
-
-//! WMM PS parameters
-//! set wmm enable or disable
-#define RSI_WMM_PS_ENABLE RSI_DISABLE
-
-//! set wmm enable or disable
-//! 0- TX BASED 1 - PERIODIC
-#define RSI_WMM_PS_TYPE 0
-
-//! set wmm wake up interval
-#define RSI_WMM_PS_WAKE_INTERVAL 20
-
-//! set wmm UAPSD bitmap
-#define RSI_WMM_PS_UAPSD_BITMAP 15
-
-/*=======================================================================*/
-//! Socket configuration
-/*=======================================================================*/
-//! RSI_ENABLE or RSI_DISABLE High performance socket
-#define HIGH_PERFORMANCE_ENABLE RSI_ENABLE //@ RSI_ENABLE or RSI_DISABLE High performance socket
-
-#define TOTAL_SOCKETS 1 //@ Total number of sockets. TCP TX + TCP RX + UDP TX + UDP RX
-#define TOTAL_TCP_SOCKETS 1 //@ Total TCP sockets. TCP TX + TCP RX
-#define TOTAL_UDP_SOCKETS 0 //@ Total UDP sockets. UDP TX + UDP RX
-#define TCP_TX_ONLY_SOCKETS 0 //@ Total TCP TX only sockets. TCP TX
-#define TCP_RX_ONLY_SOCKETS 1 //@ Total TCP RX only sockets. TCP RX
-#define UDP_TX_ONLY_SOCKETS 0 //@ Total UDP TX only sockets. UDP TX
-#define UDP_RX_ONLY_SOCKETS 0 //@ Total UDP RX only sockets. UDP RX
-#define TCP_RX_HIGH_PERFORMANCE_SOCKETS 1 //@ Total TCP RX High Performance sockets
-#define TCP_RX_WINDOW_SIZE_CAP 10 //@ TCP RX Window size
-#define TCP_RX_WINDOW_DIV_FACTOR 10 //@ TCP RX Window division factor
-/*=======================================================================*/
-
-//! Socket Create parameters
-/*=======================================================================*/
-
-//! Initial timeout for Socket
-#define RSI_SOCKET_KEEPALIVE_TIMEOUT 1200
-
-//! VAP ID for Concurrent mode
-#define RSI_VAP_ID 0
-
-//! Timeout for join or scan
-/*=======================================================================*/
-
-//! RSI_ENABLE or RSI_DISABLE Timeout support
-#define RSI_TIMEOUT_SUPPORT RSI_DISABLE
-
-//! roaming threshold value
-#define RSI_TIMEOUT_BIT_MAP 1
-
-//! roaming hysterisis value
-#define RSI_TIMEOUT_VALUE 1500
-
-//! Timeout for ping request
-/*=======================================================================*/
-
-//! Timeout for PING_REQUEST
-#define RSI_PING_REQ_TIMEOUT_MS 1000
-
-//! Store Config Profile parameters
-/*=======================================================================*/
-
-//! Client profile
-#define RSI_WLAN_PROFILE_CLIENT 0
-//! P2P profile
-#define RSI_WLAN_PROFILE_P2P 1
-//! EAP profile
-#define RSI_WLAN_PROFILE_EAP 2
-//! AP profile
-#define RSI_WLAN_PROFILE_AP 6
-//! All profiles
-#define RSI_WLAN_PROFILE_ALL 0xFF
-
-//! AP Config Profile Parameters
-/*==============================================================================*/
-
-//! Transmission data rate. Physical rate at which data has to be transmitted.
-#define RSI_CONFIG_AP_DATA_RATE RSI_DATA_RATE_AUTO
-//! To set wlan feature select bit map
-#define RSI_CONFIG_AP_WLAN_FEAT_BIT_MAP (FEAT_SECURITY_PSK)
-//! TCP/IP feature select bitmap for selecting TCP/IP features
-#define RSI_CONFIG_AP_TCP_IP_FEAT_BIT_MAP (TCP_IP_FEAT_DHCPV4_SERVER)
-//! To set custom feature select bit map
-#define RSI_CONFIG_AP_CUSTOM_FEAT_BIT_MAP 0
-//! Tx power level
-#define RSI_CONFIG_AP_TX_POWER RSI_POWER_LEVEL_HIGH
-//! AP SSID
-#define RSI_CONFIG_AP_SSID "SILABS_AP"
-//! RSI_BAND_2P4GHZ(2.4GHz) or RSI_BAND_5GHZ(5GHz) or RSI_DUAL_BAND
-#define RSI_CONFIG_AP_BAND RSI_BAND_2P4GHZ
-//! To configure AP channle number
-#define RSI_CONFIG_AP_CHANNEL 6
-//! To configure security type
-#define RSI_CONFIG_AP_SECURITY_TYPE RSI_WPA
-//! To configure encryption type
-#define RSI_CONFIG_AP_ENCRYPTION_TYPE 1
-//! To configure PSK
-#define RSI_CONFIG_AP_PSK "1234567890"
-//! To configure beacon interval
-#define RSI_CONFIG_AP_BEACON_INTERVAL 100
-//! To configure DTIM period
-#define RSI_CONFIG_AP_DTIM 2
-//! This parameter is used to configure keep alive type
-#define RSI_CONFIG_AP_KEEP_ALIVE_TYPE 0 //! RSI_NULL_BASED_KEEP_ALIVE
-
-#define RSI_CONFIG_AP_KEEP_ALIVE_COUNTER 0 //! 100
-//! This parameter is used to configure keep alive period
-#define RSI_CONFIG_AP_KEEP_ALIVE_PERIOD 100
-//! This parameter is used to configure maximum stations supported
-#define RSI_CONFIG_AP_MAX_STATIONS_COUNT 4
-//! P2P Network parameters
-//! TCP_STACK_USED BIT(0) - IPv4, BIT(1) -IPv6, (BIT(0) | BIT(1)) - Both IPv4 and IPv6
-#define RSI_CONFIG_AP_TCP_STACK_USED BIT(0)
-//! IP address of the module
-//! E.g: 0x0A0AA8C0 == 192.168.10.10
-#define RSI_CONFIG_AP_IP_ADDRESS 0x0A0AA8C0
-//! IP address of netmask
-//! E.g: 0x00FFFFFF == 255.255.255.0
-#define RSI_CONFIG_AP_SN_MASK_ADDRESS 0x00FFFFFF
-//! IP address of Gateway
-//! E.g: 0x0A0AA8C0 == 192.168.10.10
-#define RSI_CONFIG_AP_GATEWAY_ADDRESS 0x0A0AA8C0
-
-//! Client Profile Parameters
-/* ===================================================================================== */
-
-//! To configure data rate
-#define RSI_CONFIG_CLIENT_DATA_RATE RSI_DATA_RATE_AUTO
-//! To configure wlan feature bitmap
-#define RSI_CONFIG_CLIENT_WLAN_FEAT_BIT_MAP 0
-//! To configure tcp/ip feature bitmap
-#define RSI_CONFIG_CLIENT_TCP_IP_FEAT_BIT_MAP BIT(2)
-//! To configure custom feature bit map
-#define RSI_CONFIG_CLIENT_CUSTOM_FEAT_BIT_MAP 0
-//! To configure TX power
-#define RSI_CONFIG_CLIENT_TX_POWER RSI_POWER_LEVEL_HIGH
-//! To configure listen interval
-#define RSI_CONFIG_CLIENT_LISTEN_INTERVAL 0
-//! To configure SSID
-#define RSI_CONFIG_CLIENT_SSID "SILABS_AP"
-//! RSI_BAND_2P4GHZ(2.4GHz) or RSI_BAND_5GHZ(5GHz) or RSI_DUAL_BAND
-#define RSI_CONFIG_CLIENT_BAND RSI_BAND_2P4GHZ
-//! To configure channel number
-#define RSI_CONFIG_CLIENT_CHANNEL 0
-//! To configure security type
-#define RSI_CONFIG_CLIENT_SECURITY_TYPE 0 // RSI_WPA
-//! To configure encryption type
-#define RSI_CONFIG_CLIENT_ENCRYPTION_TYPE 0
-//! To configure PSK
-#define RSI_CONFIG_CLIENT_PSK "1234567890"
-//! To configure PMK
-#define RSI_CONFIG_CLIENT_PMK ""
-//! Client Network parameters
-//! TCP_STACK_USED BIT(0) - IPv4, BIT(1) -IPv6, (BIT(0) | BIT(1)) - Both IPv4 and IPv6
-#define RSI_CONFIG_CLIENT_TCP_STACK_USED BIT(0)
-//! DHCP mode 1- Enable 0- Disable
-//! If DHCP mode is disabled given IP statically
-#define RSI_CONFIG_CLIENT_DHCP_MODE RSI_DHCP
-//! IP address of the module
-//! E.g: 0x0A0AA8C0 == 192.168.10.10
-#define RSI_CONFIG_CLIENT_IP_ADDRESS 0x0A0AA8C0
-//! IP address of netmask
-//! E.g: 0x00FFFFFF == 255.255.255.0
-#define RSI_CONFIG_CLIENT_SN_MASK_ADDRESS 0x00FFFFFF
-//! IP address of Gateway
-//! E.g: 0x010AA8C0 == 192.168.10.1
-#define RSI_CONFIG_CLIENT_GATEWAY_ADDRESS 0x010AA8C0
-//! scan channel bit map in 2.4GHz band,valid if given channel to scan is 0
-#define RSI_CONFIG_CLIENT_SCAN_FEAT_BITMAP 0
-//! Scan channel magic code
-#define RSI_CONFIG_CLIENT_MAGIC_CODE 0x4321
-//! scan channel bit map in 2.4GHz band,valid if given channel to scan is 0
-#define RSI_CONFIG_CLIENT_SCAN_CHAN_BITMAP_2_4_GHZ 0
-//! scan channle bit map in 5GHz band ,valid if given channel to scan is 0
-#define RSI_CONFIG_CLIENT_SCAN_CHAN_BITMAP_5_0_GHZ 0
-
-//! EAP Client Profile Parameters
-/* =========================================================================== */
-
-//! To configure data rate
-#define RSI_CONFIG_EAP_DATA_RATE RSI_DATA_RATE_AUTO
-//! To configure wlan feature bitmap
-#define RSI_CONFIG_EAP_WLAN_FEAT_BIT_MAP 0
-//! To configure tcp/ip feature bitmap
-#define RSI_CONFIG_EAP_TCP_IP_FEAT_BIT_MAP BIT(2)
-//! To configure custom feature bit map
-#define RSI_CONFIG_EAP_CUSTOM_FEAT_BIT_MAP 0
-//! To configure EAP TX power
-#define RSI_CONFIG_EAP_TX_POWER RSI_POWER_LEVEL_HIGH
-//! To Configure scan channel feature bitmap
-#define RSI_CONFIG_EAP_SCAN_FEAT_BITMAP 0
-//! scan channel bit map in 2.4GHz band,valid if given channel to scan is 0
-#define RSI_CONFIG_EAP_CHAN_MAGIC_CODE 0 // 0x4321
-//! scan channel bit map in 2.4GHz band,valid if given channel to scan is 0
-#define RSI_CONFIG_EAP_SCAN_CHAN_BITMAP_2_4_GHZ 0
-//! scan channle bit map in 5GHz band ,valid if given channel to scan is 0
-#define RSI_CONFIG_EAP_SCAN_CHAN_BITMAP_5_0_GHZ 0
-//! To configure SSID
-#define RSI_CONFIG_EAP_SSID "SILABS_AP"
-//! RSI_BAND_2P4GHZ(2.4GHz) or RSI_BAND_5GHZ(5GHz) or RSI_DUAL_BAND
-#define RSI_CONFIG_EAP_BAND RSI_BAND_2P4GHZ
-//! To set security type
-#define RSI_CONFIG_EAP_SECURITY_TYPE RSI_WPA2_EAP
-//! To set encryption type
-#define RSI_CONFIG_EAP_ENCRYPTION_TYPE 0
-//! To set channel number
-#define RSI_CONFIG_EAP_CHANNEL 0
-//! Enterprise method ,should be one of among TLS, TTLS, FAST or PEAP
-#define RSI_CONFIG_EAP_METHOD "TLS"
-//! This parameter is used to configure the module in Enterprise security mode
-#define RSI_CONFIG_EAP_INNER_METHOD "\"auth=MSCHAPV2\""
-//! To configure EAP user identity
-#define RSI_CONFIG_EAP_USER_IDENTITY "\"user1\""
-//! TO configure EAP password
-#define RSI_CONFIG_EAP_PASSWORD "\"test123\""
-//! EAP Network parameters
-//! TCP_STACK_USED BIT(0) - IPv4, BIT(1) -IPv6, (BIT(0) | BIT(1)) - Both IPv4 and IPv6
-#define RSI_CONFIG_EAP_TCP_STACK_USED BIT(0)
-//! DHCP mode 1- Enable 0- Disable
-//! If DHCP mode is disabled given IP statically
-#define RSI_CONFIG_EAP_DHCP_MODE RSI_DHCP
-//! IP address of the module
-//! E.g: 0x0A0AA8C0 == 192.168.10.10
-#define RSI_CONFIG_EAP_IP_ADDRESS 0x0A0AA8C0
-//! IP address of netmask
-//! E.g: 0x00FFFFFF == 255.255.255.0
-#define RSI_CONFIG_EAP_SN_MASK_ADDRESS 0x00FFFFFF
-//! IP address of Gateway
-//! E.g: 0x010AA8C0 == 192.168.10.1
-#define RSI_CONFIG_EAP_GATEWAY_ADDRESS 0x010AA8C0
-
-//! P2P Profile parameters
-/* ================================================================================= */
-
-//! To configure data rate
-#define RSI_CONFIG_P2P_DATA_RATE RSI_DATA_RATE_AUTO
-//! To configure wlan feature bitmap
-#define RSI_CONFIG_P2P_WLAN_FEAT_BIT_MAP 0
-//! To configure P2P tcp/ip feature bitmap
-#define RSI_CONFIG_P2P_TCP_IP_FEAT_BIT_MAP BIT(2)
-//! To configure P2P custom feature bitmap
-#define RSI_CONFIG_P2P_CUSTOM_FEAT_BIT_MAP 0
-//! TO configure P2P tx power level
-#define RSI_CONFIG_P2P_TX_POWER RSI_POWER_LEVEL_HIGH
-//! Set P2P go intent
-#define RSI_CONFIG_P2P_GO_INTNET 16 //! Support only Autonomous GO mode
-//! Set device name
-#define RSI_CONFIG_P2P_DEVICE_NAME "WSC1.1"
-//! Set device operating channel
-#define RSI_CONFIG_P2P_OPERATING_CHANNEL 11
-//! Set SSID postfix
-#define RSI_CONFIG_P2P_SSID_POSTFIX "WSC_1_0_0"
-//! Set P2P join SSID
-#define RSI_CONFIG_P2P_JOIN_SSID "SILABS_AP"
-//! Set psk key
-#define RSI_CONFIG_P2P_PSK_KEY "12345678"
-//! P2P Network parameters
-//! TCP_STACK_USED BIT(0) - IPv4, BIT(1) -IPv6, (BIT(0) | BIT(1)) - Both IPv4 and IPv6
-#define RSI_CONFIG_P2P_TCP_STACK_USED BIT(0)
-//! DHCP mode 1- Enable 0- Disable
-//! If DHCP mode is disabled given IP statically
-#define RSI_CONFIG_P2P_DHCP_MODE 1
-//! IP address of the module
-//! E.g: 0x0A0AA8C0 == 192.168.10.10
-#define RSI_CONFIG_P2P_IP_ADDRESS 0x0A0AA8C0
-//! IP address of netmask
-//! E.g: 0x00FFFFFF == 255.255.255.0
-#define RSI_CONFIG_P2P_SN_MASK_ADDRESS 0x00FFFFFF
-//! IP address of Gateway
-//! E.g: 0x010AA8C0 == 192.168.10.1
-#define RSI_CONFIG_P2P_GATEWAY_ADDRESS 0x010AA8C0
-
-#endif
diff --git a/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi.h b/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi.h
index 5155553..e7869cf 100644
--- a/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi.h
+++ b/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi.h
@@ -17,6 +17,9 @@
#ifndef _WFX_RSI_H_
#define _WFX_RSI_H_
+
+#include "event_groups.h"
+
/*
* Interface to RSI Sapis
*/
@@ -88,7 +91,7 @@
int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info);
int32_t wfx_rsi_reset_count();
int32_t wfx_rsi_disconnect();
-int32_t wfx_rsi_init_platform();
+int32_t wfx_wifi_rsi_init(void);
#ifdef __cplusplus
}
diff --git a/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi_host.c b/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi_host.c
index 0fa1c2f..eef6cdb 100644
--- a/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi_host.c
+++ b/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi_host.c
@@ -20,12 +20,10 @@
#include <stdlib.h>
#include <string.h>
-#include "sl_status.h"
-
-#include "silabs_utils.h"
-
#include "FreeRTOS.h"
#include "event_groups.h"
+#include "silabs_utils.h"
+#include "sl_status.h"
#include "task.h"
#include "wfx_host_events.h"
@@ -69,11 +67,6 @@
return SL_STATUS_OK;
}
-int32_t wfx_rsi_platform()
-{
- return wfx_rsi_init_platform();
-}
-
/*********************************************************************
* @fn void wfx_enable_sta_mode(void)
* @brief
@@ -197,6 +190,25 @@
return SL_STATUS_OK;
}
+#if SL_ICD_ENABLED
+/*********************************************************************
+ * @fn sl_status_t wfx_power_save()
+ * @brief
+ * Implements the power save in sleepy application
+ * @param[in] None
+ * @return SL_STATUS_OK if successful,
+ * SL_STATUS_FAIL otherwise
+ ***********************************************************************/
+sl_status_t wfx_power_save()
+{
+ if (wfx_rsi_power_save() != SL_STATUS_OK)
+ {
+ return SL_STATUS_FAIL;
+ }
+ return SL_STATUS_OK;
+}
+#endif /* SL_ICD_ENABLED */
+
/*********************************************************************
* @fn void wfx_setup_ip6_link_local(sl_wfx_interface_t whichif)
* @brief
diff --git a/examples/platform/silabs/SiWx917/device/inc/system_si917.h b/examples/platform/silabs/SiWx917/device/inc/system_si917.h
deleted file mode 100644
index 9c56651..0000000
--- a/examples/platform/silabs/SiWx917/device/inc/system_si917.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- *
- * Copyright (c) 2022 Project CHIP Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "core_cm4.h" /* Cortex-M4 processor and core peripherals */
-#include <stdint.h>
-//#include "cmsis_gcc.h"
-
-/*******************************************************************************
- * @addtogroup Parts
- * @{
- ******************************************************************************/
-/*******************************************************************************
- * @addtogroup EFR32 EFR32
- * @{
- ******************************************************************************/
-
-/*******************************************************************************
- ****************************** TYPEDEFS ***********************************
- ******************************************************************************/
-
-/* Interrupt vectortable entry */
-typedef union
-{
- void (*VECTOR_TABLE_Type)(void);
- void * topOfStack;
-} tVectorEntry;
-
-/*******************************************************************************
- ************************** GLOBAL VARIABLES *******************************
- ******************************************************************************/
-//#ifndef CCP_SI917_BRINGUP
-extern uint32_t SystemCoreClock; /**< System Clock Frequency (Core Clock) */
-//#endif /* CCP_SI917_BRINGUP */
-extern uint32_t SystemHfrcoFreq; /**< System HFRCO frequency */
-
-/*******************************************************************************
- ***************************** PROTOTYPES **********************************
- ******************************************************************************/
-
-void Reset_Handler(void); /**< Reset Handler */
-void NMI_Handler(void); /**< NMI Handler */
-void HardFault_Handler(void); /**< Hard Fault Handler */
-void MemManage_Handler(void); /**< MPU Fault Handler */
-void BusFault_Handler(void); /**< Bus Fault Handler */
-void UsageFault_Handler(void); /**< Usage Fault Handler */
-void SVC_Handler(void); /**< SVCall Handler */
-void DebugMon_Handler(void); /**< Debug Monitor Handler */
-void PendSV_Handler(void); /**< PendSV Handler */
-void SysTick_Handler(void); /**< SysTick Handler */
-
-void EMU_IRQHandler(void); /**< EMU IRQ Handler */
-void FRC_PRI_IRQHandler(void); /**< FRC_PRI IRQ Handler */
-void WDOG0_IRQHandler(void); /**< WDOG0 IRQ Handler */
-void WDOG1_IRQHandler(void); /**< WDOG1 IRQ Handler */
-void FRC_IRQHandler(void); /**< FRC IRQ Handler */
-void MODEM_IRQHandler(void); /**< MODEM IRQ Handler */
-void RAC_SEQ_IRQHandler(void); /**< RAC_SEQ IRQ Handler */
-void RAC_RSM_IRQHandler(void); /**< RAC_RSM IRQ Handler */
-void BUFC_IRQHandler(void); /**< BUFC IRQ Handler */
-void LDMA_IRQHandler(void); /**< LDMA IRQ Handler */
-void GPIO_EVEN_IRQHandler(void); /**< GPIO_EVEN IRQ Handler */
-void TIMER0_IRQHandler(void); /**< TIMER0 IRQ Handler */
-void USART0_RX_IRQHandler(void); /**< USART0_RX IRQ Handler */
-void USART0_TX_IRQHandler(void); /**< USART0_TX IRQ Handler */
-void ACMP0_IRQHandler(void); /**< ACMP0 IRQ Handler */
-void ADC0_IRQHandler(void); /**< ADC0 IRQ Handler */
-void IDAC0_IRQHandler(void); /**< IDAC0 IRQ Handler */
-void I2C0_IRQHandler(void); /**< I2C0 IRQ Handler */
-void GPIO_ODD_IRQHandler(void); /**< GPIO_ODD IRQ Handler */
-void TIMER1_IRQHandler(void); /**< TIMER1 IRQ Handler */
-void USART1_RX_IRQHandler(void); /**< USART1_RX IRQ Handler */
-void USART1_TX_IRQHandler(void); /**< USART1_TX IRQ Handler */
-void LEUART0_IRQHandler(void); /**< LEUART0 IRQ Handler */
-void PCNT0_IRQHandler(void); /**< PCNT0 IRQ Handler */
-void CMU_IRQHandler(void); /**< CMU IRQ Handler */
-void MSC_IRQHandler(void); /**< MSC IRQ Handler */
-void CRYPTO0_IRQHandler(void); /**< CRYPTO IRQ Handler */
-void LETIMER0_IRQHandler(void); /**< LETIMER0 IRQ Handler */
-void AGC_IRQHandler(void); /**< AGC IRQ Handler */
-void PROTIMER_IRQHandler(void); /**< PROTIMER IRQ Handler */
-void RTCC_IRQHandler(void); /**< RTCC IRQ Handler */
-void SYNTH_IRQHandler(void); /**< SYNTH IRQ Handler */
-void CRYOTIMER_IRQHandler(void); /**< CRYOTIMER IRQ Handler */
-void RFSENSE_IRQHandler(void); /**< RFSENSE IRQ Handler */
-void FPUEH_IRQHandler(void); /**< FPUEH IRQ Handler */
-void SMU_IRQHandler(void); /**< SMU IRQ Handler */
-void WTIMER0_IRQHandler(void); /**< WTIMER0 IRQ Handler */
-void WTIMER1_IRQHandler(void); /**< WTIMER1 IRQ Handler */
-void PCNT1_IRQHandler(void); /**< PCNT1 IRQ Handler */
-void PCNT2_IRQHandler(void); /**< PCNT2 IRQ Handler */
-void USART2_RX_IRQHandler(void); /**< USART2_RX IRQ Handler */
-void USART2_TX_IRQHandler(void); /**< USART2_TX IRQ Handler */
-void I2C1_IRQHandler(void); /**< I2C1 IRQ Handler */
-void USART3_RX_IRQHandler(void); /**< USART3_RX IRQ Handler */
-void USART3_TX_IRQHandler(void); /**< USART3_TX IRQ Handler */
-void VDAC0_IRQHandler(void); /**< VDAC0 IRQ Handler */
-void CSEN_IRQHandler(void); /**< CSEN IRQ Handler */
-void LESENSE_IRQHandler(void); /**< LESENSE IRQ Handler */
-void CRYPTO1_IRQHandler(void); /**< CRYPTO1 IRQ Handler */
-void TRNG0_IRQHandler(void); /**< TRNG0 IRQ Handler */
-void SYSCFG_IRQHandler(void); /**< SYSCFG IRQ Handler */
-
-uint32_t SystemCoreClockGet(void);
-
-/*******************************************************************************
- * @brief
- * Update CMSIS SystemCoreClock variable.
- *
- * @details
- * CMSIS defines a global variable SystemCoreClock
- *that shall hold the core frequency in Hz. If the
- *core frequency is dynamically changed, the variable
- *must be kept updated in order to be CMSIS compliant.
- *
- * Notice that only if changing the core clock
- *frequency through the EFR CMU API, this variable
- *will be kept updated. This function is only provided
- * for CMSIS compliance and if a user modifies the
- *the core clock outside the CMU API.
- ******************************************************************************/
-#ifndef CCP_SI917_BRINGUP
-static __INLINE void SystemCoreClockUpdate(void)
-{
- (void) SystemCoreClockGet();
-}
-#endif /* CCP_SI917_BRINGUP */
-
-uint32_t SystemMaxCoreClockGet(void);
-
-void SystemInit(void);
-uint32_t SystemHFClockGet(void);
-
-uint32_t SystemHFXOClockGet(void);
-void SystemHFXOClockSet(uint32_t freq);
-
-uint32_t SystemLFRCOClockGet(void);
-uint32_t SystemULFRCOClockGet(void);
-
-uint32_t SystemLFXOClockGet(void);
-void SystemLFXOClockSet(uint32_t freq);
-
-/** @} End of group */
-/** @} End of group Parts */
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/examples/platform/silabs/SiWx917/device/src/startup_RS1xxxx.c b/examples/platform/silabs/SiWx917/device/src/startup_RS1xxxx.c
deleted file mode 100644
index db9b05f..0000000
--- a/examples/platform/silabs/SiWx917/device/src/startup_RS1xxxx.c
+++ /dev/null
@@ -1,530 +0,0 @@
-/*
- *
- * Copyright (c) 2022 Project CHIP Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "rsi_ps_ram_func.h"
-#include "system_RS1xxxx.h"
-#include "system_si917.h"
-
-/*----------Stack Configuration-----------------------------------------------*/
-#define STACK_SIZE 0x00000C00 /*!< Stack size (in Words) */
-__attribute__((section(".co_stack"))) unsigned long pulStack[STACK_SIZE];
-
-#define EXT_IRQ_COUNT 98 /**< Number of External (NVIC) interrupts */ // senthil copied from "efr32mg12p432f1024gl125.h"
-#define TOTAL_INTERRUPTS (16 + EXT_IRQ_COUNT)
-
-#ifndef __INITIAL_SP
-#define __INITIAL_SP __StackTop
-#endif
-#ifndef __VECTOR_TABLE_ATTRIBUTE
-#define __VECTOR_TABLE_ATTRIBUTE __attribute__((used, section(".vectors")))
-#endif
-
-/*----------Macro definition--------------------------------------------------*/
-#define WEAK __attribute__((weak))
-
-/*----------Declaration of the default fault handlers-------------------------*/
-#ifndef __START
-extern void _start(void) __attribute__((noreturn)); /* Pre Main (C library entry point) */
-#else
-extern int __START(void) __attribute__((noreturn)); /* main entry point */
-#endif
-
-/* System exception vector handler */
-__attribute__((used)) void WEAK Reset_Handler(void);
-void WEAK NMI_Handler(void);
-void WEAK HardFault_Handler(void);
-void WEAK MemManage_Handler(void);
-void WEAK BusFault_Handler(void);
-void WEAK UsageFault_Handler(void);
-void WEAK SVC_Handler(void);
-void WEAK DebugMon_Handler(void);
-void WEAK PendSV_Handler(void);
-void WEAK SysTick_Handler(void);
-
-/*Boot up functions*/
-void RSI_Default_Reset_Handler(void);
-void RSI_Default_WakeUp_Handler(void);
-void RSI_PS_RestoreCpuContext(void);
-
-void WEAK IRQ000_Handler(void); /*!< ULP Processor Interrupt 0 */
-void WEAK IRQ001_Handler(void); /*!< ULP Processor Interrupt 1 */
-void WEAK IRQ002_Handler(void); /*!< ULP Processor Interrupt 2 */
-void WEAK IRQ003_Handler(void); /*!< ULP Processor Interrupt 3 */
-void WEAK IRQ004_Handler(void); /*!< ULP Processor Interrupt 4 */
-void WEAK IRQ005_Handler(void); /*!< ULP Processor Interrupt 5 */
-void WEAK IRQ006_Handler(void); /*!< ULP Processor Interrupt 6 */
-void WEAK IRQ007_Handler(void); /*!< ULP Processor Interrupt 7 */
-void WEAK IRQ008_Handler(void); /*!< ULP Processor Interrupt 8 */
-void WEAK IRQ009_Handler(void); /*!< ULP Processor Interrupt 9 */
-void WEAK IRQ010_Handler(void); /*!< ULP Processor Interrupt 10 */
-void WEAK IRQ011_Handler(void); /*!< ULP Processor Interrupt 11 */
-void WEAK IRQ012_Handler(void); /*!< ULP Processor Interrupt 12 */
-void WEAK IRQ013_Handler(void); /*!< ULP Processor Interrupt 13 */
-void WEAK IRQ014_Handler(void); /*!< ULP Processor Interrupt 14 */
-void WEAK IRQ015_Handler(void); /*!< ULP Processor Interrupt 15 */
-void WEAK IRQ016_Handler(void); /*!< ULP Processor Interrupt 15 */
-void WEAK IRQ017_Handler(void); /*!< ULP Processor Interrupt 17 */
-void WEAK IRQ018_Handler(void); /*!< ULP Processor Interrupt 18 */
-void WEAK IRQ019_Handler(void); /*!< ULP Processor Interrupt 19 */
-void WEAK IRQ020_Handler(void); /*!< Sleep Sensor Interrupts 0 */ /*WDT*/
-void WEAK IRQ021_Handler(void); /*!< Sleep Sensor Interrupts 1 */
-void WEAK IRQ022_Handler(void); /*!< Sleep Sensor Interrupts 2 */
-void WEAK IRQ023_Handler(void); /*!< Sleep Sensor Interrupts 3 */
-void WEAK IRQ024_Handler(void); /*!< Sleep Sensor Interrupts 4 */
-void WEAK IRQ025_Handler(void); /*!< Sleep Sensor Interrupts 5 */
-void WEAK IRQ026_Handler(void); /*!< Sleep Sensor Interrupts 6 */
-void WEAK IRQ027_Handler(void); /*!< Sleep Sensor Interrupts 7 */
-void WEAK IRQ028_Handler(void); /*!< Sleep Sensor Interrupts 8 */ /*Alarm*/
-void WEAK IRQ029_Handler(void); /*!< Sleep Sensor Interrupts 9 */ /*Msec and sec interrupt */
-void WEAK IRQ030_Handler(void); /*!< Reserved */
-void WEAK IRQ031_Handler(void); /*!< M4SS DMA interrupt */
-void WEAK IRQ032_Handler(void); /*!< Reserved */
-void WEAK IRQ033_Handler(void); /*!< M4SS DMA interrupt */
-void WEAK IRQ034_Handler(void); /*!< M4SS SCT interrupt */
-void WEAK HIF1_IRQHandler(void); /*!< HIF Interrupt 1 */
-void WEAK HIF2_IRQHandler(void); /*!< HIF Interrupt 2 */
-void WEAK IRQ037_Handler(void); /*!< SIO Interrupt */
-void WEAK IRQ038_Handler(void); /*!< USART 1 Interrupt */
-void WEAK IRQ039_Handler(void); /*!< Reserved */
-void WEAK IRQ040_Handler(void); /*!< Reserved */
-void WEAK IRQ041_Handler(void); /*!< Reserved */
-void WEAK IRQ042_Handler(void); /*!< I2C Interrupt */
-void WEAK IRQ043_Handler(void); /*!< Reserved */
-void WEAK IRQ044_Handler(void); /*!< SSI Slave Interrupt */
-void WEAK IRQ045_Handler(void); /*!< Reserved */
-void WEAK IRQ046_Handler(void); /*!< GSPI Master 1 Interrupt */
-void WEAK IRQ047_Handler(void); /*!< Reserved */
-void WEAK IRQ048_Handler(void); /*!< MCPWM Interrupt */
-void WEAK IRQ049_Handler(void); /*!< QEI Interrupt */
-void WEAK IRQ050_Handler(void); /*!< GPIO Group Interrupt 0 */
-void WEAK IRQ051_Handler(void); /*!< GPIO Group Interrupt 1 */
-void WEAK IRQ052_Handler(void); /*!< GPIO Pin Interrupt 0 */
-void WEAK IRQ053_Handler(void); /*!< GPIO Pin Interrupt 1 */
-void WEAK IRQ054_Handler(void); /*!< GPIO Pin Interrupt 2 */
-void WEAK IRQ055_Handler(void); /*!< GPIO Pin Interrupt 3 */
-void WEAK IRQ056_Handler(void); /*!< GPIO Pin Interrupt 4 */
-void WEAK IRQ057_Handler(void); /*!< GPIO Pin Interrupt 5 */
-void WEAK IRQ058_Handler(void); /*!< GPIO Pin Interrupt 6 */
-void WEAK IRQ059_Handler(void); /*!< GPIO Pin Interrupt 7 */
-void WEAK IRQ060_Handler(void); /*!< QSPI Interrupt */
-void WEAK IRQ061_Handler(void); /*!< I2C 2 Interrupt */
-void WEAK IRQ062_Handler(void); /*!< Ethernet Interrupt */
-void WEAK IRQ063_Handler(void); /*!< Reserved */
-void WEAK IRQ064_Handler(void); /*!< I2S master Interrupt */
-void WEAK IRQ065_Handler(void); /*!< Reserved */
-void WEAK IRQ066_Handler(void); /*!< Can 1 Interrupt */
-void WEAK IRQ067_Handler(void); /*!< Reserved */
-void WEAK IRQ068_Handler(void); /*!< SDMEM Interrupt */
-void WEAK IRQ069_Handler(void); /*!< PLL clock ind Interrupt */
-void WEAK IRQ070_Handler(void); /*!< Reserved */
-void WEAK IRQ071_Handler(void); /*!< CCI system Interrupt Out */
-void WEAK IRQ072_Handler(void); /*!< FPU exception */
-void WEAK IRQ073_Handler(void); /*!< USB INTR */
-void WEAK IRQ074_Handler(void); /*!< TASS_P2P_INTR */
-void WEAK IRQ075_Handler(void); /*!< WLAN Band1 intr0 */
-void WEAK IRQ076_Handler(void); /*!< WLAN Band1 intr1 */
-void WEAK IRQ077_Handler(void); /*!< Reserved */
-void WEAK IRQ078_Handler(void); /*!< Reserved */
-void WEAK IRQ079_Handler(void); /*!< BT intr */
-void WEAK IRQ080_Handler(void); /*!< ZB intr */
-void WEAK IRQ081_Handler(void); /*!< Reserved */
-void WEAK IRQ082_Handler(void); /*!< Modem disabled mode trigger intr */
-void WEAK IRQ083_Handler(void); /*!< gpio intr */
-void WEAK IRQ084_Handler(void); /*!< uart intr */
-void WEAK IRQ085_Handler(void); /*!< watch dog level intr */
-void WEAK IRQ086_Handler(void); /*!< ULP Sleep sensor interrupt */
-void WEAK IRQ087_Handler(void); /*!< ECDH intr */
-void WEAK IRQ088_Handler(void); /*!< DH intr */
-void WEAK IRQ089_Handler(void); /*!< QSPI intr */
-void WEAK IRQ090_Handler(void); /*!< ULP processor interrupt TASS */
-void WEAK IRQ091_Handler(void); /*!< Sys Tick Timer */
-void WEAK IRQ092_Handler(void); /*!< Real Timer interrupt */
-void WEAK IRQ093_Handler(void); /*!< PLL lock interrupt */
-void WEAK IRQ094_Handler(void); /*!< Reserved */
-void WEAK IRQ095_Handler(void); /*!< UART2 Interrupt */
-void WEAK IRQ096_Handler(void); /*!< I2S Interrupt */
-void WEAK IRQ097_Handler(void); /*!< I2C Interrupt */
-void WEAK IRQ098_Handler(void); /*!< RESERVED */
-
-/*----------Symbols defined in linker script----------------------------------*/
-extern unsigned long _sidata; /*!< Start address for the initialization
- values of the .data section. */
-extern unsigned long _sdata; /*!< Start address for the .data section */
-extern unsigned long _edata; /*!< End address for the .data section */
-extern unsigned long _sbss; /*!< Start address for the .bss section */
-extern unsigned long _ebss; /*!< End address for the .bss section */
-extern void _eram; /*!< End address for ram */
-extern uint32_t __etext;
-extern unsigned long __StackTop;
-
-/*----------Function prototypes-----------------------------------------------*/
-extern int main(void); /*!< The entry point for the application */
-void Default_Reset_Handler(void); /*!< Default reset handler */
-static void Default_Handler(void); /*!< Default exception handler */
-/**
- *@brief The minimal vector table for a Cortex M4. Note that the proper constructs
- * must be placed on this to ensure that it ends up at physical address
- * 0x00000000.
- */
-
-//(void *)0x300001
-/*CCP new */
-extern const tVectorEntry __VECTOR_TABLE[TOTAL_INTERRUPTS];
-const tVectorEntry __VECTOR_TABLE[TOTAL_INTERRUPTS] __attribute__((aligned(512))) __VECTOR_TABLE_ATTRIBUTE = {
- /* Cortex-M Exception Handlers */
- { .topOfStack = &__INITIAL_SP }, /* Initial Stack Pointer */
- /*{ (void *)&pulStack[STACK_SIZE - 1] },*/
- { (void *) 0x300001 }, /* Reset Handler : IN CCP Platform system start
- from bootloader which inturn call reset handler */
- { NMI_Handler }, /* NMI Handler */
- { HardFault_Handler }, /* Hard Fault Handler */
- { MemManage_Handler }, /* MPU Fault Handler */
- { BusFault_Handler }, /* Bus Fault Handler */
- { UsageFault_Handler }, /* Usage Fault Handler */
- { 0 }, /* Reserved */
- { 0 }, /* Reserved */
- { 0 }, /* Reserved */
- { 0 }, /* Reserved */
- { SVC_Handler }, /* SVCall Handler */
- { DebugMon_Handler }, /* Debug Monitor Handler */
- { 0 }, /* Application properties*/
- { PendSV_Handler }, /* PendSV Handler */
- { SysTick_Handler }, /* SysTick Handler */
-
- /* External interrupts */
-
- { IRQ000_Handler }, /* 0 */
- { IRQ001_Handler }, /* 1 */
- { IRQ002_Handler }, /* 2 */
- { IRQ003_Handler }, /* 3 */
- { IRQ004_Handler }, /* 4 */
- { IRQ005_Handler }, /* 5 */
- { IRQ006_Handler }, /* 6 */
- { IRQ007_Handler }, /* 7 */
- { IRQ008_Handler }, /* 8 */
- { IRQ009_Handler }, /* 9 */
- { IRQ010_Handler }, /* 10 */
- { IRQ011_Handler }, /* 11 */
- { IRQ012_Handler }, /* 12 */
- { IRQ013_Handler }, /* 13 */
- { IRQ014_Handler }, /* 14 */
- { IRQ015_Handler }, /* 15 */
- { IRQ016_Handler }, /* 16 */
- { IRQ017_Handler }, /* 17 */
- { IRQ018_Handler }, /* 18 */
- { IRQ019_Handler }, /* 19 */
- { IRQ020_Handler }, /* 20 */
- { IRQ021_Handler }, /* 21 */
- { IRQ022_Handler }, /* 22 */
- { IRQ023_Handler }, /* 23 */
- { IRQ024_Handler }, /* 24 */
- { IRQ025_Handler }, /* 25 */
- { IRQ026_Handler }, /* 26 */
- { IRQ027_Handler }, /* 27 */
- { IRQ028_Handler }, /* 28 */
- { IRQ029_Handler }, /* 29 */
- { (void *) &__StackTop - 0x0c }, /* 30 */
- { IRQ031_Handler }, /* 31 */
- { RSI_Default_Reset_Handler }, /* 32 */
- { IRQ033_Handler }, /* 33 */
- { IRQ034_Handler }, /* 34 */
- { HIF1_IRQHandler }, /* 35 */
- { HIF2_IRQHandler }, /* 36 */
- { IRQ037_Handler }, /* 37 */
- { IRQ038_Handler }, /* 38 */
- { IRQ039_Handler }, /* 39 */
- { RSI_PS_RestoreCpuContext }, /* 40 */
- { IRQ041_Handler }, /* 41 */
- { IRQ042_Handler }, /* 42 */
- { (void *) 0x10AD10AD }, /* 43 */
- { IRQ044_Handler }, /* 44 */
- { 0 }, /* 45 */
- { IRQ046_Handler }, /* 46 */
- { IRQ047_Handler }, /* 47 */
- { IRQ048_Handler }, /* 48 */
- { IRQ049_Handler }, /* 49 */
- { IRQ050_Handler }, /* 50 - Reserved */
- { IRQ051_Handler },
- { IRQ052_Handler },
- { IRQ053_Handler },
- { IRQ054_Handler },
- { IRQ055_Handler },
- { IRQ056_Handler },
- { IRQ057_Handler },
- { IRQ058_Handler },
- { IRQ059_Handler },
- { IRQ060_Handler },
- { IRQ061_Handler },
- { IRQ062_Handler },
- { IRQ063_Handler },
- { IRQ064_Handler },
- { 0 },
- { IRQ066_Handler },
- { 0 },
- { IRQ068_Handler },
- { IRQ069_Handler },
- { 0 },
- { IRQ071_Handler },
- { IRQ072_Handler },
- { IRQ073_Handler },
- { IRQ074_Handler },
- { IRQ075_Handler },
- { IRQ076_Handler },
- { 0 },
- { 0 },
- { IRQ079_Handler },
- { IRQ080_Handler },
- { 0 },
- { IRQ082_Handler },
- { IRQ083_Handler },
- { IRQ084_Handler },
- { IRQ085_Handler },
- { IRQ086_Handler },
- { IRQ087_Handler },
- { IRQ088_Handler },
- { IRQ089_Handler },
- { IRQ090_Handler },
- { IRQ091_Handler },
- { IRQ092_Handler },
- { IRQ093_Handler },
- { 0 },
- { IRQ095_Handler },
- { 0 },
- { IRQ097_Handler },
-};
-
-/**
- * @brief This is the code that gets never called, Dummy handler
- * @param None
- * @retval None
- */
-void Default_Reset_Handler(void)
-{
- /*Generic Default reset handler for CM4 */
- while (1)
- ;
-}
-
-void Copy_Table()
-{
- uint32_t *pSrc, *pDest;
- extern uint32_t __etext;
- extern uint32_t __data_start__;
- extern uint32_t __data_end__;
- pSrc = &__etext;
- pDest = &__data_start__;
-
- for (; pDest < &__data_end__;)
- {
- *pDest++ = *pSrc++;
- }
-}
-
-void Zero_Table()
-{
- uint32_t * pDest;
- extern uint32_t __bss_start__;
- extern uint32_t __bss_end__;
- pDest = &__bss_start__;
-
- for (; pDest < &__bss_end__;)
- {
- *pDest++ = 0UL;
- }
-}
-void Reset_Handler(void)
-{
-#ifndef __NO_SYSTEM_INIT
- SystemInit(); /* CMSIS System Initialization */
-#endif
-
-#ifdef BOOTLOADER_ENABLE
- SystemInit2();
-#endif /* BOOTLOADER_ENABLE */
-
-#if defined(__GNUC__) && defined(__START)
- Copy_Table();
- Zero_Table();
- __START();
-#else
-#if 0 // senthil_ccp
- __PROGRAM_START(); /* Enter PreMain (C library entry point) */
-#else
- Copy_Table();
- Zero_Table();
- _start();
-#endif
-#endif /* __GNUC__ */
-}
-
-void RSI_Default_Reset_Handler(void)
-{
-#ifndef __NO_SYSTEM_INIT
- SystemInit(); /* CMSIS System Initialization */
-#endif
-
-#ifdef BOOTLOADER_ENABLE
- SystemInit2();
-#endif /* BOOTLOADER_ENABLE */
-
-#if defined(__GNUC__) && defined(__START)
- Copy_Table();
- Zero_Table();
- __START();
-#else
-#if 0 // senthil_ccp
- __PROGRAM_START(); /* Enter PreMain (C library entry point) */
-#else
- Copy_Table();
- Zero_Table();
- _start();
-#endif
-#endif /* __GNUC__ */
-}
-
-/**
- *@brief Provide weak aliases for each Exception handler to the Default_Handler.
- * As they are weak aliases, any function with the same name will override
- * this definition.
- */
-//#pragma weak Reset_Handler = RSI_Default_Reset_Handler
-#pragma weak NMI_Handler = Default_Handler
-#pragma weak HardFault_Handler = Default_Handler
-#pragma weak MemManage_Handler = Default_Handler
-#pragma weak BusFault_Handler = Default_Handler
-#pragma weak UsageFault_Handler = Default_Handler
-#pragma weak SVC_Handler = Default_Handler
-#pragma weak DebugMon_Handler = Default_Handler
-#pragma weak PendSV_Handler = Default_Handler
-#pragma weak SysTick_Handler = Default_Handler
-/*----------------------------------external interrupts------------------------------ */
-#pragma weak IRQ000_Handler = Default_Handler
-#pragma weak IRQ001_Handler = Default_Handler
-#pragma weak IRQ002_Handler = Default_Handler
-#pragma weak IRQ003_Handler = Default_Handler
-#pragma weak IRQ004_Handler = Default_Handler
-#pragma weak IRQ005_Handler = Default_Handler
-#pragma weak IRQ006_Handler = Default_Handler
-#pragma weak IRQ007_Handler = Default_Handler
-#pragma weak IRQ008_Handler = Default_Handler
-#pragma weak IRQ009_Handler = Default_Handler
-#pragma weak IRQ010_Handler = Default_Handler
-#pragma weak IRQ011_Handler = Default_Handler
-#pragma weak IRQ012_Handler = Default_Handler
-#pragma weak IRQ013_Handler = Default_Handler
-#pragma weak IRQ014_Handler = Default_Handler
-#pragma weak IRQ015_Handler = Default_Handler
-#pragma weak IRQ016_Handler = Default_Handler
-#pragma weak IRQ017_Handler = Default_Handler
-#pragma weak IRQ018_Handler = Default_Handler
-#pragma weak IRQ019_Handler = Default_Handler
-#pragma weak IRQ020_Handler = Default_Handler
-#pragma weak IRQ021_Handler = Default_Handler
-#pragma weak IRQ022_Handler = Default_Handler
-#pragma weak IRQ023_Handler = Default_Handler
-#pragma weak IRQ024_Handler = Default_Handler
-#pragma weak IRQ025_Handler = Default_Handler
-#pragma weak IRQ026_Handler = Default_Handler
-#pragma weak IRQ027_Handler = Default_Handler
-#pragma weak IRQ028_Handler = Default_Handler
-#pragma weak IRQ029_Handler = Default_Handler
-#pragma weak IRQ030_Handler = Default_Handler
-#pragma weak IRQ031_Handler = Default_Handler
-#pragma weak IRQ032_Handler = Default_Handler
-#pragma weak IRQ033_Handler = Default_Handler
-#pragma weak IRQ034_Handler = Default_Handler
-#pragma weak HIF1_IRQHandler = Default_Handler
-#pragma weak HIF2_IRQHandler = Default_Handler
-#pragma weak IRQ037_Handler = Default_Handler
-#pragma weak IRQ038_Handler = Default_Handler
-#pragma weak IRQ039_Handler = Default_Handler
-#pragma weak IRQ040_Handler = Default_Handler
-#pragma weak IRQ041_Handler = Default_Handler
-#pragma weak IRQ042_Handler = Default_Handler
-#pragma weak IRQ043_Handler = Default_Handler
-#pragma weak IRQ044_Handler = Default_Handler
-#pragma weak IRQ045_Handler = Default_Handler
-#pragma weak IRQ046_Handler = Default_Handler
-#pragma weak IRQ047_Handler = Default_Handler
-#pragma weak IRQ048_Handler = Default_Handler
-#pragma weak IRQ049_Handler = Default_Handler
-#pragma weak IRQ050_Handler = Default_Handler
-#pragma weak IRQ051_Handler = Default_Handler
-#pragma weak IRQ052_Handler = Default_Handler
-#pragma weak IRQ053_Handler = Default_Handler
-#pragma weak IRQ054_Handler = Default_Handler
-#pragma weak IRQ055_Handler = Default_Handler
-#pragma weak IRQ056_Handler = Default_Handler
-#pragma weak IRQ057_Handler = Default_Handler
-#pragma weak IRQ058_Handler = Default_Handler
-#pragma weak IRQ059_Handler = Default_Handler
-#pragma weak IRQ060_Handler = Default_Handler
-#pragma weak IRQ061_Handler = Default_Handler
-#pragma weak IRQ062_Handler = Default_Handler
-#pragma weak IRQ063_Handler = Default_Handler
-#pragma weak IRQ064_Handler = Default_Handler
-#pragma weak IRQ065_Handler = Default_Handler
-#pragma weak IRQ066_Handler = Default_Handler
-#pragma weak IRQ067_Handler = Default_Handler
-#pragma weak IRQ068_Handler = Default_Handler
-#pragma weak IRQ069_Handler = Default_Handler
-#pragma weak IRQ070_Handler = Default_Handler
-#pragma weak IRQ071_Handler = Default_Handler
-#pragma weak IRQ072_Handler = Default_Handler
-#pragma weak IRQ073_Handler = Default_Handler
-#pragma weak IRQ074_Handler = Default_Handler
-#pragma weak IRQ075_Handler = Default_Handler
-#pragma weak IRQ076_Handler = Default_Handler
-#pragma weak IRQ077_Handler = Default_Handler
-#pragma weak IRQ078_Handler = Default_Handler
-#pragma weak IRQ079_Handler = Default_Handler
-#pragma weak IRQ080_Handler = Default_Handler
-#pragma weak IRQ081_Handler = Default_Handler
-#pragma weak IRQ082_Handler = Default_Handler
-#pragma weak IRQ083_Handler = Default_Handler
-#pragma weak IRQ084_Handler = Default_Handler
-#pragma weak IRQ085_Handler = Default_Handler
-#pragma weak IRQ086_Handler = Default_Handler
-#pragma weak IRQ087_Handler = Default_Handler
-#pragma weak IRQ088_Handler = Default_Handler
-#pragma weak IRQ089_Handler = Default_Handler
-#pragma weak IRQ090_Handler = Default_Handler
-#pragma weak IRQ091_Handler = Default_Handler
-#pragma weak IRQ092_Handler = Default_Handler
-#pragma weak IRQ093_Handler = Default_Handler
-#pragma weak IRQ094_Handler = Default_Handler
-#pragma weak IRQ095_Handler = Default_Handler
-#pragma weak IRQ096_Handler = Default_Handler
-#pragma weak IRQ097_Handler = Default_Handler
-#pragma weak IRQ098_Handler = Default_Handler
-
-/**
- * @brief This is the code that gets called when the processor receives an
- * unexpected interrupt. This simply enters an infinite loop,
- * preserving the system state for examination by a debugger.
- * @param None
- * @retval None
- */
-static void Default_Handler(void)
-{
- /* Go into an infinite loop. */
- while (1)
- {
- }
-}
-
-/*********************** (C) COPYRIGHT 2009 Coocox ************END OF FILE*****/
diff --git a/examples/platform/silabs/SiWx917/device/src/startup_si917.c b/examples/platform/silabs/SiWx917/device/src/startup_si917.c
deleted file mode 100644
index 03cb7ff..0000000
--- a/examples/platform/silabs/SiWx917/device/src/startup_si917.c
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- *
- * Copyright (c) 2022 Project CHIP Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "system_si917.h"
-#include <stdbool.h>
-#include <stdint.h>
-//#include "cmsis_gcc.h"
-
-#ifdef BOOTLOADER_ENABLE
-#include "api/btl_interface.h"
-
-#endif
-
-#ifdef SL_APP_PROPERTIES
-#include "api/application_properties.h"
-
-#endif
-
-#define EXT_IRQ_COUNT 51 /**< Number of External (NVIC) interrupts */ // senthil copied from "efr32mg12p432f1024gl125.h"
-#define TOTAL_INTERRUPTS (16 + EXT_IRQ_COUNT)
-
-#ifdef BOOTLOADER_ENABLE
-extern MainBootloaderTable_t mainStageTable;
-
-extern void SystemInit2(void);
-
-/*----------------------------------------------------------------------------
- * Exception / Interrupt Handler Function Prototype
- *----------------------------------------------------------------------------*/
-typedef void (*VECTOR_TABLE_Type)(void);
-#endif
-
-#ifdef SL_APP_PROPERTIES
-extern ApplicationProperties_t sl_app_properties;
-
-/*----------------------------------------------------------------------------
- * Exception / Interrupt Handler Function Prototype
- *----------------------------------------------------------------------------*/
-typedef void (*VECTOR_TABLE_Type)(void);
-#endif
-
-/*---------------------------------------------------------------------------
- * External References
- *---------------------------------------------------------------------------*/
-extern uint32_t __INITIAL_SP;
-extern uint32_t __StackTop;
-
-#ifndef __INITIAL_SP
-#define __INITIAL_SP __StackTop
-#endif
-#ifndef __VECTOR_TABLE_ATTRIBUTE
-#define __VECTOR_TABLE_ATTRIBUTE __attribute__((used, section(".vectors")))
-#endif
-
-extern void __PROGRAM_START(void);
-
-#if defined(__START) && defined(__GNUC__)
-extern int __START(void) __attribute__((noreturn)); /* main entry point */
-void Zero_Table();
-void Copy_Table();
-#endif /* __START */
-
-/*---------------------------------------------------------------------------
- * Internal References
- *---------------------------------------------------------------------------*/
-void Reset_Handler(void);
-void Default_Handler(void);
-
-#if defined(__GNUC__)
-#ifndef __STACK_SIZE
-#define __STACK_SIZE 0x00000400
-#endif /* __STACK_SIZE */
-
-#ifndef __HEAP_SIZE
-#define __HEAP_SIZE 0x00000C00
-#endif /* __HEAP_SIZE */
-#endif /* __GNUC__ */
-
-/*----------------------------------------------------------------------------
- * Exception / Interrupt Handler
- *----------------------------------------------------------------------------*/
-/* Cortex-M Processor Exceptions */
-void NMI_Handler(void) __attribute__((weak, alias("Default_Handler")));
-void HardFault_Handler(void) __attribute__((weak, alias("Default_Handler")));
-void MemManage_Handler(void) __attribute__((weak, alias("Default_Handler")));
-void BusFault_Handler(void) __attribute__((weak, alias("Default_Handler")));
-void UsageFault_Handler(void) __attribute__((weak, alias("Default_Handler")));
-void DebugMon_Handler(void) __attribute__((weak, alias("Default_Handler")));
-void SVC_Handler(void) __attribute__((weak, alias("Default_Handler")));
-void PendSV_Handler(void) __attribute__((weak, alias("Default_Handler")));
-void SysTick_Handler(void) __attribute__((weak, alias("Default_Handler")));
-#ifndef SL_APP_PROPERTIES
-/* Provide a dummy value for the sl_app_properties symbol. */
-void sl_app_properties(void); /* Prototype to please MISRA checkers. */
-void sl_app_properties(void) __attribute__((weak, alias("Default_Handler")));
-#endif
-
-/* Part Specific Interrupts */
-
-void EMU_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void FRC_PRI_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void WDOG0_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void WDOG1_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void FRC_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void MODEM_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void RAC_SEQ_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void RAC_RSM_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void BUFC_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void LDMA_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void GPIO_EVEN_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void TIMER0_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void USART0_RX_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void USART0_TX_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void ACMP0_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void ADC0_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void IDAC0_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void I2C0_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void GPIO_ODD_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void TIMER1_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void USART1_RX_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void USART1_TX_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void LEUART0_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void PCNT0_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void CMU_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void MSC_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void CRYPTO0_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void LETIMER0_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void AGC_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void PROTIMER_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void RTCC_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void SYNTH_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void CRYOTIMER_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void RFSENSE_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void FPUEH_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void SMU_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void WTIMER0_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void WTIMER1_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void PCNT1_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void PCNT2_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void USART2_RX_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void USART2_TX_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void I2C1_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void USART3_RX_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void USART3_TX_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void VDAC0_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void CSEN_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void LESENSE_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void CRYPTO1_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-void TRNG0_IRQHandler(void) __attribute__((weak, alias("Default_Handler")));
-
-#if 0 // senthil_ccp
-
-#ifndef __PROGRAM_START
-
-/**
- \brief Initializes data and bss sections
- \details This default implementations initialized all data and additional bss
- sections relying on .copy.table and .zero.table specified properly
- in the used linker script.
-
- */
-void __cmsis_start(void)
-{
- extern void _start(void) __NO_RETURN;
-
- typedef struct {
- uint32_t const* src;
- uint32_t* dest;
- uint32_t wlen;
- } __copy_table_t;
-
- typedef struct {
- uint32_t* dest;
- uint32_t wlen;
- } __zero_table_t;
-
- extern const __copy_table_t __copy_table_start__;
- extern const __copy_table_t __copy_table_end__;
- extern const __zero_table_t __zero_table_start__;
- extern const __zero_table_t __zero_table_end__;
-
- for (__copy_table_t const* pTable = &__copy_table_start__; pTable < &__copy_table_end__; ++pTable) {
- for(uint32_t i=0u; i<pTable->wlen; ++i) {
- pTable->dest[i] = pTable->src[i];
- }
- }
-
- for (__zero_table_t const* pTable = &__zero_table_start__; pTable < &__zero_table_end__; ++pTable) {
- for(uint32_t i=0u; i<pTable->wlen; ++i) {
- pTable->dest[i] = 0u;
- }
- }
-
- _start();
-}
-
-#define __PROGRAM_START __cmsis_start
-#endif
-
-#endif / senthil_ccp
-/*----------------------------------------------------------------------------
- * Exception / Interrupt Vector table
- *----------------------------------------------------------------------------*/
-
-#if defined(__GNUC__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wpedantic"
-#endif
-
-#if defined(__ICCARM__)
-#pragma data_alignment = 512
-extern const tVectorEntry __VECTOR_TABLE[TOTAL_INTERRUPTS];
-const tVectorEntry __VECTOR_TABLE[TOTAL_INTERRUPTS] __VECTOR_TABLE_ATTRIBUTE = {
-#elif defined(__GNUC__)
-extern const tVectorEntry __VECTOR_TABLE[TOTAL_INTERRUPTS];
-// const tVectorEntry __VECTOR_TABLE[TOTAL_INTERRUPTS] __attribute__((aligned(512))) __VECTOR_TABLE_ATTRIBUTE = {
-const tVectorEntry __VECTOR_TABLE[TOTAL_INTERRUPTS] __attribute__((aligned(512))) __VECTOR_TABLE_ATTRIBUTE = {
-#else
-extern const tVectorEntry __VECTOR_TABLE[TOTAL_INTERRUPTS];
-const tVectorEntry __VECTOR_TABLE[TOTAL_INTERRUPTS] __VECTOR_TABLE_ATTRIBUTE = {
-#endif
- /* Cortex-M Exception Handlers */
- { .topOfStack = &__INITIAL_SP }, /* Initial Stack Pointer */
- { Reset_Handler }, /* Reset Handler */
- { NMI_Handler }, /* NMI Handler */
- { HardFault_Handler }, /* Hard Fault Handler */
- { MemManage_Handler }, /* MPU Fault Handler */
- { BusFault_Handler }, /* Bus Fault Handler */
- { UsageFault_Handler }, /* Usage Fault Handler */
- { Default_Handler }, /* Reserved */
- { Default_Handler }, /* Reserved */
- { Default_Handler }, /* Reserved */
-#ifdef BOOTLOADER_ENABLE
- { (VECTOR_TABLE_Type) &mainStageTable },
-#else
- { Default_Handler }, /* Reserved */
-#endif
- { SVC_Handler }, /* SVCall Handler */
- { DebugMon_Handler }, /* Debug Monitor Handler */
-#ifdef SL_APP_PROPERTIES
- { (VECTOR_TABLE_Type) &sl_app_properties }, /* Application properties*/
-#else
- { sl_app_properties }, /* Application properties*/
-#endif
- { PendSV_Handler }, /* PendSV Handler */
- { SysTick_Handler }, /* SysTick Handler */
-
- /* External interrupts */
-
- { EMU_IRQHandler }, /* 0 */
- { FRC_PRI_IRQHandler }, /* 1 */
- { WDOG0_IRQHandler }, /* 2 */
- { WDOG1_IRQHandler }, /* 3 */
- { FRC_IRQHandler }, /* 4 */
- { MODEM_IRQHandler }, /* 5 */
- { RAC_SEQ_IRQHandler }, /* 6 */
- { RAC_RSM_IRQHandler }, /* 7 */
- { BUFC_IRQHandler }, /* 8 */
- { LDMA_IRQHandler }, /* 9 */
- { GPIO_EVEN_IRQHandler }, /* 10 */
- { TIMER0_IRQHandler }, /* 11 */
- { USART0_RX_IRQHandler }, /* 12 */
- { USART0_TX_IRQHandler }, /* 13 */
- { ACMP0_IRQHandler }, /* 14 */
- { ADC0_IRQHandler }, /* 15 */
- { IDAC0_IRQHandler }, /* 16 */
- { I2C0_IRQHandler }, /* 17 */
- { GPIO_ODD_IRQHandler }, /* 18 */
- { TIMER1_IRQHandler }, /* 19 */
- { USART1_RX_IRQHandler }, /* 20 */
- { USART1_TX_IRQHandler }, /* 21 */
- { LEUART0_IRQHandler }, /* 22 */
- { PCNT0_IRQHandler }, /* 23 */
- { CMU_IRQHandler }, /* 24 */
- { MSC_IRQHandler }, /* 25 */
- { CRYPTO0_IRQHandler }, /* 26 */
- { LETIMER0_IRQHandler }, /* 27 */
- { AGC_IRQHandler }, /* 28 */
- { PROTIMER_IRQHandler }, /* 29 */
- { RTCC_IRQHandler }, /* 30 */
- { SYNTH_IRQHandler }, /* 31 */
- { CRYOTIMER_IRQHandler }, /* 32 */
- { RFSENSE_IRQHandler }, /* 33 */
- { FPUEH_IRQHandler }, /* 34 */
- { SMU_IRQHandler }, /* 35 */
- { WTIMER0_IRQHandler }, /* 36 */
- { WTIMER1_IRQHandler }, /* 37 */
- { PCNT1_IRQHandler }, /* 38 */
- { PCNT2_IRQHandler }, /* 39 */
- { USART2_RX_IRQHandler }, /* 40 */
- { USART2_TX_IRQHandler }, /* 41 */
- { I2C1_IRQHandler }, /* 42 */
- { USART3_RX_IRQHandler }, /* 43 */
- { USART3_TX_IRQHandler }, /* 44 */
- { VDAC0_IRQHandler }, /* 45 */
- { CSEN_IRQHandler }, /* 46 */
- { LESENSE_IRQHandler }, /* 47 */
- { CRYPTO1_IRQHandler }, /* 48 */
- { TRNG0_IRQHandler }, /* 49 */
- { Default_Handler }, /* 50 - Reserved */
-};
-
-#if defined(__GNUC__)
-#pragma GCC diagnostic pop
-#endif
-
-//#if defined (__START) && defined (__GNUC__) //senthil_ccp
-void Copy_Table()
-{
- uint32_t *pSrc, *pDest;
- extern uint32_t __etext;
- extern uint32_t __data_start__;
- extern uint32_t __data_end__;
- pSrc = &__etext;
- pDest = &__data_start__;
-
- for (; pDest < &__data_end__;)
- {
- *pDest++ = *pSrc++;
- }
-}
-
-void Zero_Table()
-{
- uint32_t * pDest;
- extern uint32_t __bss_start__;
- extern uint32_t __bss_end__;
- pDest = &__bss_start__;
-
- for (; pDest < &__bss_end__;)
- {
- *pDest++ = 0UL;
- }
-}
-//#endif /* __START */
-
-/*---------------------------------------------------------------------------
- * Reset Handler called on controller reset
- *---------------------------------------------------------------------------*/
-#if 0
- void SysTick_Handler(void)
-{
- SysTick_Handler();
-}
-#endif
-
-void Reset_Handler(void)
-{
-#ifndef __NO_SYSTEM_INIT
- SystemInit(); /* CMSIS System Initialization */
-#endif
-
-#ifdef BOOTLOADER_ENABLE
- SystemInit2();
-#endif /* BOOTLOADER_ENABLE */
-
-#if defined(__GNUC__) && defined(__START)
- Copy_Table();
- Zero_Table();
- __START();
-#else
-#if 0 // senthil_ccp
- __PROGRAM_START(); /* Enter PreMain (C library entry point) */
-#else
- Copy_Table();
- Zero_Table();
- _start();
-#endif
-#endif /* __GNUC__ */
-}
-
-#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wmissing-noreturn"
-#endif
-
-/*----------------------------------------------------------------------------
- * Default Handler for Exceptions / Interrupts
- *----------------------------------------------------------------------------*/
-void Default_Handler(void)
-{
- while (true)
- {
- }
-}
-
-#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
-#pragma clang diagnostic pop
-#endif
diff --git a/examples/platform/silabs/ldscripts/SiWx917.ld b/examples/platform/silabs/ldscripts/SiWx917-dual.ld
similarity index 99%
rename from examples/platform/silabs/ldscripts/SiWx917.ld
rename to examples/platform/silabs/ldscripts/SiWx917-dual.ld
index eeafb23..1c39478 100644
--- a/examples/platform/silabs/ldscripts/SiWx917.ld
+++ b/examples/platform/silabs/ldscripts/SiWx917-dual.ld
@@ -216,4 +216,4 @@
/* Check if FLASH usage exceeds FLASH size */
/* ASSERT( LENGTH(FLASH) >= (__etext), "FLASH memory overflowed !") */ /* Build error need to be checked for CCP */
ASSERT((__etext + SIZEOF(.data)) <= __nvm3Base, "FLASH memory overlapped with NVM section.")
-}
+}
\ No newline at end of file
diff --git a/examples/platform/silabs/main.cpp b/examples/platform/silabs/main.cpp
index 03fb25b..fc4f087 100644
--- a/examples/platform/silabs/main.cpp
+++ b/examples/platform/silabs/main.cpp
@@ -33,11 +33,24 @@
#include <platform/silabs/platformAbstraction/SilabsPlatform.h>
+#include "FreeRTOS.h"
+#include "FreeRTOSConfig.h"
+#include "event_groups.h"
+#include "task.h"
+
+/**********************************************************
+ * Defines
+ *********************************************************/
+#define MAIN_TASK_STACK_SIZE (1024 * 8)
+#define MAIN_TASK_PRIORITY (configMAX_PRIORITIES - 1)
+
using namespace ::chip;
using namespace ::chip::DeviceLayer;
using namespace ::chip::Credentials;
using namespace chip::DeviceLayer::Silabs;
+TaskHandle_t main_Task;
+void application_start(void * unused);
volatile int apperror_cnt;
static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider;
@@ -48,6 +61,19 @@
{
GetPlatform().Init();
+ xTaskCreate(application_start, "main_task", MAIN_TASK_STACK_SIZE, NULL, MAIN_TASK_PRIORITY, &main_Task);
+
+ SILABS_LOG("Starting scheduler");
+ GetPlatform().StartScheduler();
+
+ // Should never get here.
+ chip::Platform::MemoryShutdown();
+ SILABS_LOG("vTaskStartScheduler() failed");
+ appError(CHIP_ERROR_INTERNAL);
+}
+
+void application_start(void * unused)
+{
if (SilabsMatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR)
appError(CHIP_ERROR_INTERNAL);
@@ -67,11 +93,5 @@
if (AppTask::GetAppTask().StartAppTask() != CHIP_NO_ERROR)
appError(CHIP_ERROR_INTERNAL);
- SILABS_LOG("Starting scheduler");
- GetPlatform().StartScheduler();
-
- // Should never get here.
- chip::Platform::MemoryShutdown();
- SILABS_LOG("vTaskStartScheduler() failed");
- appError(CHIP_ERROR_INTERNAL);
+ vTaskDelete(main_Task);
}
diff --git a/scripts/examples/gn_silabs_example.sh b/scripts/examples/gn_silabs_example.sh
index 90adc9f..cdde74c 100755
--- a/scripts/examples/gn_silabs_example.sh
+++ b/scripts/examples/gn_silabs_example.sh
@@ -272,7 +272,7 @@
fi
# 917 exception. TODO find a more generic way
- if [ "$SILABS_BOARD" == "BRD4325B" ]; then
+ if [ "$SILABS_BOARD" == "BRD4325B" ] || [ "$SILABS_BOARD" == "BRD4325C" ]; then
echo "Compiling for 917 WiFi SOC"
USE_WIFI=true
optArgs+="chip_device_platform =\"SiWx917\" "
diff --git a/src/platform/silabs/BLEManagerImpl.h b/src/platform/silabs/BLEManagerImpl.h
index 12e5c7c..b13f9fb 100644
--- a/src/platform/silabs/BLEManagerImpl.h
+++ b/src/platform/silabs/BLEManagerImpl.h
@@ -25,7 +25,7 @@
#pragma once
#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
-#ifdef RSI_BLE_ENABLE
+#if (BLE_ENABLE || RSI_BLE_ENABLE)
#define BLE_MIN_CONNECTION_INTERVAL_MS 45 // 45 msec
#define BLE_MAX_CONNECTION_INTERVAL_MS 45 // 45 msec
#define BLE_SLAVE_LATENCY_MS 0
@@ -33,7 +33,7 @@
#endif // RSI_BLE_ENABLE
#include "FreeRTOS.h"
#include "timers.h"
-#ifdef RSI_BLE_ENABLE
+#if (BLE_ENABLE || RSI_BLE_ENABLE)
#ifdef __cplusplus
extern "C" {
#endif
@@ -64,7 +64,7 @@
public:
void HandleBootEvent(void);
-#ifdef RSI_BLE_ENABLE
+#if (BLE_ENABLE || RSI_BLE_ENABLE)
void HandleConnectEvent(void);
void HandleConnectionCloseEvent(uint16_t reason);
void HandleWriteEvent(rsi_ble_event_write_t evt);
@@ -81,12 +81,12 @@
void HandleTxConfirmationEvent(BLE_CONNECTION_OBJECT conId);
void HandleTXCharCCCDWrite(volatile sl_bt_msg_t * evt);
void HandleSoftTimerEvent(volatile sl_bt_msg_t * evt);
-#endif // RSI_BLE_ENABLE
+#endif // RSI_BLE_ENABLEHandleConnectEvent
CHIP_ERROR StartAdvertising(void);
CHIP_ERROR StopAdvertising(void);
#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
-#ifdef RSI_BLE_ENABLE
+#if (BLE_ENABLE || RSI_BLE_ENABLE)
static void HandleC3ReadRequest(void);
#else
#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
@@ -163,7 +163,7 @@
struct CHIPoBLEConState
{
-#ifndef RSI_BLE_ENABLE
+#if !(BLE_ENABLE || RSI_BLE_ENABLE)
bd_addr address;
#endif
uint16_t mtu : 10;
@@ -192,7 +192,7 @@
CHIP_ERROR EncodeAdditionalDataTlv();
#endif
-#ifdef RSI_BLE_ENABLE
+#if (BLE_ENABLE || RSI_BLE_ENABLE)
void HandleRXCharWrite(rsi_ble_event_write_t * evt);
#else
void HandleRXCharWrite(volatile sl_bt_msg_t * evt);
diff --git a/src/platform/silabs/SiWx917/wifi/ethernetif.cpp b/src/platform/silabs/SiWx917/wifi/ethernetif.cpp
index 73cc46c..bc38b87 100644
--- a/src/platform/silabs/SiWx917/wifi/ethernetif.cpp
+++ b/src/platform/silabs/SiWx917/wifi/ethernetif.cpp
@@ -21,29 +21,29 @@
#include <stdlib.h>
#include <string.h>
-#ifndef WF200_WIFI
-#include "FreeRTOS.h"
-#include "event_groups.h"
-#include "task.h"
-#endif
-
#include "wfx_host_events.h"
#include "wifi_config.h"
-#ifdef WF200_WIFI
-#include "sl_wfx.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "cmsis_os2.h"
+#include "sl_board_configuration.h"
+#include "sl_net.h"
+#include "sl_si91x_driver.h"
+#include "sl_si91x_host_interface.h"
+#include "sl_si91x_types.h"
+#include "sl_wifi_callback_framework.h"
+#include "sl_wifi_constants.h"
+#include "sl_wifi_types.h"
+#ifdef __cplusplus
+}
#endif
/* LwIP includes. */
#include "ethernetif.h"
#include "lwip/ethip6.h"
#include "lwip/timeouts.h"
#include "netif/etharp.h"
-
-#ifndef SILABS_LOG
-extern "C" {
-void silabsLog(const char * aFormat, ...);
-#define SILABS_LOG(...) silabsLog(__VA_ARGS__);
-}
-#endif
+#include "silabs_utils.h"
StaticSemaphore_t xEthernetIfSemaBuffer;
@@ -165,14 +165,12 @@
if (netif->input(p, netif) != ERR_OK)
{
gOverrunCount++;
- SILABS_LOG("overrun count entering when fail to alloc value %d", gOverrunCount);
pbuf_free(p);
}
}
else
{
gOverrunCount++;
- SILABS_LOG("overrun count entering when fail to alloc value %d", gOverrunCount);
}
}
@@ -192,14 +190,42 @@
******************************************************************************/
static err_t low_level_output(struct netif * netif, struct pbuf * p)
{
+ sl_wifi_buffer_t * buffer;
+ sl_si91x_packet_t * packet;
+ sl_status_t status = SL_STATUS_OK;
void * rsipkt;
struct pbuf * q;
- uint16_t framelength;
+ uint16_t framelength = 0;
+ uint16_t datalength = 0;
+#ifdef WIFI_DEBUG_ENABLED
+ SILABS_LOG("LWIP : low_level_output");
+#endif
if (xSemaphoreTake(ethout_sem, portMAX_DELAY) != pdTRUE)
{
return ERR_IF;
}
+ /* Calculate total packet size */
+ for (q = p, framelength = 0; q != NULL; q = q->next)
+ {
+ framelength += q->len;
+ }
+ if (framelength < LWIP_FRAME_ALIGNMENT)
+ {
+ framelength = LWIP_FRAME_ALIGNMENT;
+ }
+
+ /* Confirm if packet is allocated */
+ status = sl_si91x_allocate_command_buffer(&buffer, (void **) &packet, sizeof(sl_si91x_packet_t) + framelength,
+ SL_WIFI_ALLOCATE_COMMAND_BUFFER_WAIT_TIME);
+ VERIFY_STATUS_AND_RETURN(status);
+ if (packet == NULL)
+ {
+ SILABS_LOG("EN-RSI:No buf");
+ xSemaphoreGive(ethout_sem);
+ return SL_STATUS_ALLOCATION_FAILED;
+ }
+ memset(packet->desc, 0, sizeof(packet->desc));
#ifdef WIFI_DEBUG_ENABLED
SILABS_LOG("EN-RSI: Output");
#endif
@@ -209,55 +235,44 @@
xSemaphoreGive(ethout_sem);
return ERR_IF;
}
- /* Confirm if packet is allocated */
- rsipkt = wfx_rsi_alloc_pkt();
- if (!rsipkt)
- {
- SILABS_LOG("EN-RSI:No buf");
- xSemaphoreGive(ethout_sem);
- return ERR_IF;
- }
-
#ifdef WIFI_DEBUG_ENABLED
uint8_t * b = (uint8_t *) p->payload;
SILABS_LOG("EN-RSI: Out [%02x:%02x:%02x:%02x:%02x:%02x][%02x:%02x:%02x:%02x:%02x:%02x]type=%02x%02x", b[0], b[1], b[2], b[3],
b[4], b[5], b[6], b[7], b[8], b[9], b[10], b[11], b[12], b[13]);
#endif
/* Generate the packet */
- for (q = p, framelength = 0; q != NULL; q = q->next)
+ for (q = p, datalength = 0; q != NULL; q = q->next)
{
- wfx_rsi_pkt_add_data(rsipkt, (uint8_t *) (q->payload), (uint16_t) q->len, framelength);
- framelength += q->len;
+ wfx_rsi_pkt_add_data(packet, (uint8_t *) (q->payload), (uint16_t) q->len, datalength);
+ datalength += q->len;
}
- if (framelength < LWIP_FRAME_ALIGNMENT)
+ if (datalength < LWIP_FRAME_ALIGNMENT)
{
/* Add junk data to the end for frame alignment if framelength is less than 60 */
- wfx_rsi_pkt_add_data(rsipkt, (uint8_t *) (p->payload), LWIP_FRAME_ALIGNMENT - framelength, framelength);
+ wfx_rsi_pkt_add_data(packet, (uint8_t *) (p->payload), LWIP_FRAME_ALIGNMENT - datalength, datalength);
}
#ifdef WIFI_DEBUG_ENABLED
SILABS_LOG("EN-RSI: Sending %d", framelength);
#endif
-
- /* forward the generated packet to RSI to
- * send the data over wifi network
- */
- if (wfx_rsi_send_data(rsipkt, framelength))
+ packet->length = framelength & 0xFFF;
+ packet->command = RSI_SEND_RAW_DATA;
+ if (sl_si91x_driver_send_data_packet(SI91X_WLAN_CMD_QUEUE, buffer, 1000))
{
SILABS_LOG("*ERR*EN-RSI:Send fail");
xSemaphoreGive(ethout_sem);
return ERR_IF;
}
-
-#ifdef WIFI_DEBUG_ENABLED
- SILABS_LOG("EN-RSI:Xmit %d", framelength);
-#endif
+ /*
+ * forward the generated packet to RSI to
+ * send the data over wifi network
+ */
xSemaphoreGive(ethout_sem);
return ERR_OK;
}
/*****************************************************************************
- * @fn void wfx_host_received_sta_frame_cb(uint8_t *buf, int len)
+ * @fn void sl_si91x_host_process_data_frame(uint8_t *buf, int len)
* @brief
* host received frame cb
*
@@ -268,17 +283,23 @@
* @return
* None
******************************************************************************/
-void wfx_host_received_sta_frame_cb(uint8_t * buf, int len)
+sl_status_t sl_si91x_host_process_data_frame(sl_wifi_interface_t interface, sl_wifi_buffer_t * buffer)
{
+ struct pbuf * pbuf_packet;
+ void * packet;
struct netif * ifp;
+ sl_si91x_packet_t * rsi_pkt;
+ packet = sl_si91x_host_get_buffer_data(buffer, 0, NULL);
+ rsi_pkt = (sl_si91x_packet_t *) packet;
/* get the network interface for STATION interface,
* and forward the received frame buffer to LWIP
*/
if ((ifp = wfx_get_netif(SL_WFX_STA_INTERFACE)) != (struct netif *) 0)
{
- low_level_input(ifp, buf, len);
+ low_level_input(ifp, rsi_pkt->data, rsi_pkt->length);
}
+ return SL_STATUS_OK;
}
/*****************************************************************************
diff --git a/src/platform/silabs/SiWx917/wifi/wfx_host_events.h b/src/platform/silabs/SiWx917/wifi/wfx_host_events.h
index 7e5e842..3251882 100644
--- a/src/platform/silabs/SiWx917/wifi/wfx_host_events.h
+++ b/src/platform/silabs/SiWx917/wifi/wfx_host_events.h
@@ -17,7 +17,9 @@
#pragma once
+#include "sl_si91x_types.h"
#include "stdbool.h"
+
#include "wfx_msgs.h"
/* LwIP includes. */
@@ -26,9 +28,11 @@
#include "lwip/netif.h"
#include "lwip/netifapi.h"
#include "lwip/tcpip.h"
+#include "sl_wifi_constants.h"
#include "sl_status.h"
+#define SL_WIFI_ALLOCATE_COMMAND_BUFFER_WAIT_TIME 1000
/* Wi-Fi events*/
#define SL_WFX_STARTUP_IND_ID (1)
#define SL_WFX_CONNECT_IND_ID (2)
@@ -206,7 +210,6 @@
int32_t wfx_get_ap_info(wfx_wifi_scan_result_t * ap);
int32_t wfx_get_ap_ext(wfx_wifi_scan_ext_t * extra_info);
int32_t wfx_reset_counts();
-int32_t wfx_rsi_platform();
void wfx_clear_wifi_provision(void);
sl_status_t wfx_connect_to_ap(void);
@@ -240,12 +243,21 @@
void wfx_ip_changed_notify(int got_ip);
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */
+sl_status_t sl_si91x_host_process_data_frame(sl_wifi_interface_t interface, sl_wifi_buffer_t * buffer);
+void * sl_si91x_host_get_buffer_data(sl_wifi_buffer_t * buffer, uint16_t offset, uint16_t * data_length);
+
+#if SL_ICD_ENABLED
+sl_status_t wfx_power_save();
+#endif /* SL_ICD_ENABLED */
+
void wfx_ipv6_notify(int got_ip);
/* RSI for LWIP */
-void * wfx_rsi_alloc_pkt(void);
void wfx_rsi_pkt_add_data(void * p, uint8_t * buf, uint16_t len, uint16_t off);
int32_t wfx_rsi_send_data(void * p, uint16_t len);
+sl_status_t sl_si91x_driver_send_data_packet(sl_si91x_queue_type_t queue_type, sl_wifi_buffer_t * buffer, uint32_t wait_time);
+sl_status_t sl_si91x_allocate_command_buffer(sl_wifi_buffer_t ** host_buffer, void ** buffer, uint32_t requested_buffer_size,
+ uint32_t wait_duration_ms);
void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retryJoin);
diff --git a/src/platform/silabs/SiWx917/wifi/wfx_notify.cpp b/src/platform/silabs/SiWx917/wifi/wfx_notify.cpp
index 86bba19..215555c 100644
--- a/src/platform/silabs/SiWx917/wifi/wfx_notify.cpp
+++ b/src/platform/silabs/SiWx917/wifi/wfx_notify.cpp
@@ -23,8 +23,8 @@
#include "FreeRTOS.h"
#include "event_groups.h"
+#include "silabs_utils.h"
#include "task.h"
-
#include "wfx_host_events.h"
#ifdef RS911X_WIFI
@@ -39,6 +39,7 @@
using namespace ::chip;
using namespace ::chip::DeviceLayer;
+extern uint32_t retryInterval;
/*
* Notifications to the upper-layer
* All done in the context of the RSI/WiFi task (rsi_if.c)
@@ -180,3 +181,44 @@
chip::DeviceLayer::PlatformMgr().UnlockChipStack();
}
}
+
+/**************************************************************************************
+ * @fn void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retryJoin)
+ * @brief
+ * Based on condition will delay for a certain period of time.
+ * @param[in] is_wifi_disconnection_event, retryJoin
+ * @return None
+ ********************************************************************************************/
+void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retryJoin)
+{
+ if (!is_wifi_disconnection_event)
+ {
+ /* After the reboot or a commissioning time device failed to connect with AP.
+ * Device will retry to connect with AP upto WFX_RSI_CONFIG_MAX_JOIN retries.
+ */
+ if (retryJoin < MAX_JOIN_RETRIES_COUNT)
+ {
+ SILABS_LOG("wfx_retry_interval_handler : Next attempt after %d Seconds", CONVERT_MS_TO_SEC(WLAN_RETRY_TIMER_MS));
+ vTaskDelay(pdMS_TO_TICKS(WLAN_RETRY_TIMER_MS));
+ }
+ else
+ {
+ SILABS_LOG("Connect failed after max %d tries", retryJoin);
+ }
+ }
+ else
+ {
+ /* After disconnection
+ * At the telescopic time interval device try to reconnect with AP, upto WLAN_MAX_RETRY_TIMER_MS intervals
+ * are telescopic. If interval exceed WLAN_MAX_RETRY_TIMER_MS then it will try to reconnect at
+ * WLAN_MAX_RETRY_TIMER_MS intervals.
+ */
+ if (retryInterval > WLAN_MAX_RETRY_TIMER_MS)
+ {
+ retryInterval = WLAN_MAX_RETRY_TIMER_MS;
+ }
+ SILABS_LOG("wfx_retry_interval_handler : Next attempt after %d Seconds", CONVERT_MS_TO_SEC(retryInterval));
+ vTaskDelay(pdMS_TO_TICKS(retryInterval));
+ retryInterval += retryInterval;
+ }
+}
diff --git a/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp b/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp
index 08ca04e..3ee9440 100644
--- a/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp
+++ b/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp
@@ -25,10 +25,14 @@
#endif
// TODO add includes ?
-extern "C" void RSI_Board_LED_Set(int, bool);
-extern "C" void RSI_Board_LED_Toggle(int);
-extern "C" void RSI_Wakeupsw_config(void);
-extern "C" void RSI_Wakeupsw_config_gpio0(void);
+extern "C" {
+#include "sl_event_handler.h"
+
+void RSI_Board_LED_Set(int, bool);
+void RSI_Board_LED_Toggle(int);
+void RSI_Wakeupsw_config(void);
+void RSI_Wakeupsw_config_gpio0(void);
+}
#if SILABS_LOG_ENABLED
#include "silabs_utils.h"
@@ -47,6 +51,9 @@
RSI_Wakeupsw_config();
RSI_Wakeupsw_config_gpio0();
+
+ sl_platform_init(); // platform initialization for wifi-sdk 3.0
+
#if SILABS_LOG_ENABLED
silabsInitLog();
#endif
diff --git a/src/platform/silabs/rs911x/BLEManagerImpl.cpp b/src/platform/silabs/rs911x/BLEManagerImpl.cpp
index 4f04daf..9b2b543 100644
--- a/src/platform/silabs/rs911x/BLEManagerImpl.cpp
+++ b/src/platform/silabs/rs911x/BLEManagerImpl.cpp
@@ -26,8 +26,8 @@
#include <platform/internal/CHIPDeviceLayerInternal.h>
#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
+#include "cmsis_os2.h"
#include <platform/internal/BLEManager.h>
-
#ifndef SIWX_917
#include "rail.h"
#endif
@@ -42,7 +42,9 @@
#include "wfx_host_events.h"
#include "wfx_rsi.h"
#include "wfx_sl_ble_init.h"
+#ifndef SIWX_917
#include <rsi_driver.h>
+#endif
#include <rsi_utils.h>
#include <stdbool.h>
#ifdef __cplusplus
@@ -63,8 +65,9 @@
extern sl_wfx_msg_t event_msg;
StaticTask_t rsiBLETaskStruct;
-rsi_semaphore_handle_t sl_rs_ble_init_sem;
-rsi_semaphore_handle_t sl_ble_event_sem;
+
+osSemaphoreId_t sl_ble_event_sem;
+osSemaphoreId_t sl_rs_ble_init_sem;
/* wfxRsi Task will use as its stack */
StackType_t wfxBLETaskStack[WFX_RSI_TASK_SZ] = { 0 };
@@ -103,7 +106,7 @@
int32_t event_id;
//! This semaphore is waiting for wifi module initialization.
- rsi_semaphore_wait(&sl_rs_ble_init_sem, 0);
+ osSemaphoreAcquire(sl_rs_ble_init_sem, osWaitForever);
// This function initialize BLE and start BLE advertisement.
sl_ble_init();
@@ -111,11 +114,14 @@
// Application event map
while (1)
{
- //! This semaphore is waiting for next ble event task
- rsi_semaphore_wait(&sl_ble_event_sem, 0);
-
// checking for events list
event_id = rsi_ble_app_get_event();
+ if (event_id == -1)
+ {
+ //! This semaphore is waiting for next ble event task
+ osSemaphoreAcquire(sl_ble_event_sem, osWaitForever);
+ continue;
+ }
switch (event_id)
{
case RSI_BLE_CONN_EVENT: {
@@ -221,8 +227,9 @@
CHIP_ERROR BLEManagerImpl::_Init()
{
CHIP_ERROR err;
- rsi_semaphore_create(&sl_rs_ble_init_sem, 0);
- rsi_semaphore_create(&sl_ble_event_sem, 0);
+
+ sl_rs_ble_init_sem = osSemaphoreNew(1, 0, NULL);
+ sl_ble_event_sem = osSemaphoreNew(1, 0, NULL);
wfx_rsi.ble_task = xTaskCreateStatic((TaskFunction_t) sl_ble_event_handling_task, "rsi_ble", WFX_RSI_TASK_SZ, NULL, 1,
wfxBLETaskStack, &rsiBLETaskStruct);
diff --git a/src/platform/silabs/rs911x/rsi_ble_config.h b/src/platform/silabs/rs911x/rsi_ble_config.h
index c308a39..1b60405 100644
--- a/src/platform/silabs/rs911x/rsi_ble_config.h
+++ b/src/platform/silabs/rs911x/rsi_ble_config.h
@@ -19,7 +19,11 @@
#define RSI_BLE_CONFIG_H
#include "rsi_ble_apis.h"
+#ifdef SIWX_917
+#include "rsi_user.h"
+#else
#include <rsi_data_types.h>
+#endif
/******************************************************
* * Macros
* ******************************************************/
@@ -77,17 +81,34 @@
#ifdef RSI_M4_INTERFACE
#define RSI_BLE_MAX_NBR_ATT_REC (20)
+
+#ifdef SIWX_917
+#define RSI_BLE_MAX_NBR_PERIPHERALS (1)
+#else
#define RSI_BLE_MAX_NBR_SLAVES (1)
+#endif
+
#define RSI_BLE_NUM_CONN_EVENTS (2)
#else
#define RSI_BLE_MAX_NBR_ATT_REC (80)
+
+#ifdef SIWX_917
+#define RSI_BLE_MAX_NBR_PERIPHERALS (3)
+#else
#define RSI_BLE_MAX_NBR_SLAVES (3)
+#endif
+
#define RSI_BLE_NUM_CONN_EVENTS (20)
#endif
#define RSI_BLE_MAX_NBR_ATT_SERV (10)
+#ifdef SIWX_917
+#define RSI_BLE_MAX_NBR_CENTRALS (1)
+#else
#define RSI_BLE_MAX_NBR_MASTERS (1)
+#endif
+
#define RSI_BLE_GATT_ASYNC_ENABLE (1)
#define RSI_BLE_GATT_INIT (0)
@@ -230,12 +251,31 @@
/*=======================================================================*/
//! Power save command parameters
/*=======================================================================*/
-//! set handshake type of power mode
-#define RSI_HAND_SHAKE_TYPE GPIO_BASED
#define BLE_ATT_REC_SIZE (500)
#define NO_OF_VAL_ATT (5) //! Attribute value count
+#ifdef SIWX_917
+#define RSI_FEATURE_BIT_MAP \
+ (SL_SI91X_FEAT_ULP_GPIO_BASED_HANDSHAKE | SL_SI91X_FEAT_DEV_TO_HOST_ULP_GPIO_1) //! To set wlan feature select bit map
+#define RSI_TCP_IP_FEATURE_BIT_MAP \
+ (SL_SI91X_TCP_IP_FEAT_DHCPV4_CLIENT) //! TCP/IP feature select bitmap for selecting TCP/IP features
+#define RSI_CUSTOM_FEATURE_BIT_MAP SL_SI91X_FEAT_CUSTOM_FEAT_EXTENTION_VALID //! To set custom feature select bit map
+#ifdef CHIP_9117
+#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP \
+ (SL_SI91X_EXT_FEAT_LOW_POWER_MODE | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(1) | RAM_LEVEL_NWP_BASIC_MCU_ADV | FRONT_END_SWITCH_SEL2)
+#else
+#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP (SL_SI91X_EXT_FEAT_LOW_POWER_MODE | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(2))
+#endif
+#define RSI_EXT_TCPIP_FEATURE_BITMAP 0
+#define RSI_BT_FEATURE_BITMAP (SL_SI91X_BT_RF_TYPE | SL_SI91X_ENABLE_BLE_PROTOCOL)
+#define RSI_CONFIG_FEATURE_BITMAP 0
+#define RSI_TCP_IP_BYPASS RSI_ENABLE //! TCP IP BYPASS feature check
+#else
+//! set handshake type of power mode
+#define RSI_HAND_SHAKE_TYPE GPIO_BASED
+#endif
+
/***********************************************************************************************************************************************/
//! user defined structure
/***********************************************************************************************************************************************/
@@ -256,4 +296,4 @@
rsi_ble_att_list_t att_rec_list[NO_OF_VAL_ATT];
} rsi_ble_t;
-#endif
+#endif
\ No newline at end of file
diff --git a/src/platform/silabs/rs911x/wfx_sl_ble_init.c b/src/platform/silabs/rs911x/wfx_sl_ble_init.c
index f73a18e..b62777d 100644
--- a/src/platform/silabs/rs911x/wfx_sl_ble_init.c
+++ b/src/platform/silabs/rs911x/wfx_sl_ble_init.c
@@ -21,13 +21,13 @@
* limitations under the License.
*/
#include "wfx_sl_ble_init.h"
-#include "rsi_ble_config.h"
-
+#include "ble_config.h"
+#include "silabs_utils.h"
// Global Variables
-rsi_ble_event_conn_status_t conn_event_to_app;
rsi_ble_t att_list;
sl_wfx_msg_t event_msg;
-extern rsi_semaphore_handle_t sl_ble_event_sem;
+
+extern osSemaphoreId_t sl_ble_event_sem;
// Memory to initialize driver
uint8_t bt_global_buf[BT_GLOBAL_BUFF_LEN];
@@ -184,8 +184,9 @@
*/
void rsi_ble_app_set_event(uint32_t event_num)
{
+ SILABS_LOG("%s: starting", __func__);
event_msg.ble_app_event_map |= BIT(event_num);
- rsi_semaphore_post(&sl_ble_event_sem);
+ osSemaphoreRelease(sl_ble_event_sem);
return;
}
@@ -207,7 +208,7 @@
{
if ((p_val->DATA_ix + data_len) >= BLE_ATT_REC_SIZE)
{ //! Check for max data length for the characteristic value
- LOG_PRINT("\r\n no data memory for att rec values \r\n");
+ SILABS_LOG("\r\n no data memory for att rec values \r\n");
return;
}
diff --git a/src/platform/silabs/rs911x/wfx_sl_ble_init.h b/src/platform/silabs/rs911x/wfx_sl_ble_init.h
index 435cfe0..73e29e7 100644
--- a/src/platform/silabs/rs911x/wfx_sl_ble_init.h
+++ b/src/platform/silabs/rs911x/wfx_sl_ble_init.h
@@ -33,8 +33,8 @@
// BLE include file to refer BLE APIs
#include "FreeRTOS.h"
+#include "ble_config.h"
#include "event_groups.h"
-#include "rsi_ble_config.h"
#include "task.h"
#include "timers.h"
#include "wfx_host_events.h"
@@ -42,22 +42,19 @@
#include <rsi_ble.h>
#include <rsi_ble_apis.h>
#include <rsi_ble_common_config.h>
-#include <rsi_ble_config.h>
+#ifndef SIWX_917
#include <rsi_bootup_config.h>
-#include <rsi_bt_common.h>
-#include <rsi_bt_common_apis.h>
-#include <rsi_common_apis.h>
#include <rsi_driver.h>
#include <rsi_wlan_apis.h>
#include <rsi_wlan_config.h>
#include <rsi_wlan_non_rom.h>
+#endif
+#include <rsi_bt_common.h>
+#include <rsi_bt_common_apis.h>
+#include <rsi_common_apis.h>
#include <stdbool.h>
#include <string.h>
-#ifdef RSI_M4_INTERFACE
-#include "rsi_board.h"
-#endif
-
typedef struct sl_wfx_msg_s
{
uint8_t connectionHandle;
@@ -132,4 +129,4 @@
void rsi_ble_app_init_events();
void rsi_ble_event_handling_task(void);
-#endif
\ No newline at end of file
+#endif
diff --git a/third_party/silabs/BUILD.gn b/third_party/silabs/BUILD.gn
index bff6ac8..f6852db 100644
--- a/third_party/silabs/BUILD.gn
+++ b/third_party/silabs/BUILD.gn
@@ -18,7 +18,7 @@
import("${chip_root}/src/platform/device.gni")
import("${efr32_sdk_build_root}/silabs_board.gni")
-if (silabs_board == "BRD4325B") { # CCP board
+if (wifi_soc == true) { # CCP board
import("${efr32_sdk_build_root}/SiWx917_sdk.gni")
} else {
import("${efr32_sdk_build_root}/efr32_sdk.gni")
@@ -52,7 +52,7 @@
public_configs = [ ":silabs_config" ]
}
-if (silabs_board != "BRD4325B") { # CCP board
+if (wifi_soc != true) { # CCP board
# Openthread GSDK libraries configurations
if (use_silabs_thread_lib) {
config("libopenthread-platform_config") {
diff --git a/third_party/silabs/SiWx917_sdk.gni b/third_party/silabs/SiWx917_sdk.gni
index 28c1b73..8d649dd 100644
--- a/third_party/silabs/SiWx917_sdk.gni
+++ b/third_party/silabs/SiWx917_sdk.gni
@@ -23,14 +23,14 @@
import("silabs_board.gni")
declare_args() {
- wisemcu_sdk_root = "${chip_root}/third_party/silabs/wisemcu-wifi-bt-sdk"
+ wifi_sdk_root = "${chip_root}/third_party/silabs/wifi_sdk"
examples_plat_dir = "${chip_root}/examples/platform/silabs/SiWx917"
}
# Defines an siwx917 SDK build target.
#
# Parameters:
-# wisemcu_sdk_root - The location of the wisemcu SDK.
+# wifi_sdk_root - The location of the wifi SDK.
# sources - The sources files to build.
template("siwx917_sdk") {
sdk_target_name = target_name
@@ -45,32 +45,66 @@
# Treat these includes as system includes, so warnings in them are not fatal.
_include_dirs = [
"${chip_root}/examples/platform/silabs/SiWx917/SiWx917",
- "${chip_root}/examples/platform/silabs/SiWx917/SiWx917/hal",
- "${sdk_support_root}/platform/emdrv/nvm3/inc",
+ "${sdk_support_root}/matter/si91x/siwx917/BRD4325x/support/hal",
+ "${efr32_sdk_root}/platform/emdrv/nvm3/inc",
+ "${efr32_sdk_root}/platform/emdrv/common/inc",
"${sdk_support_root}/matter/mbedtls/tinycrypt/inc",
+ "${sdk_support_root}/matter/si91x/siwx917/BRD4325x/autogen",
+ "${sdk_support_root}/matter/si91x/siwx917/BRD4325x/config",
"${chip_root}/third_party/mbedtls/repo/include",
"${chip_root}/third_party/mbedtls/repo/library",
- "${wisemcu_sdk_root}/platforms/si91x/hal/inc",
- "${wisemcu_sdk_root}/sapi/include",
- "${chip_root}/src/platform/silabs/SiWx917/bluetooth",
-
- ### CCP includes ###
- "${wisemcu_sdk_root}/platforms/si91x/drivers/peripheral_drivers/inc",
- "${wisemcu_sdk_root}/platforms/si91x/core/chip/inc",
- "${wisemcu_sdk_root}/platforms/si91x/core/config",
- "${wisemcu_sdk_root}/platforms/si91x/drivers/cmsis_driver/config",
- "${wisemcu_sdk_root}/platforms/si91x/drivers/rom_driver/inc",
- "${wisemcu_sdk_root}/platforms/si91x/drivers/systemlevel/inc",
-
- "${wisemcu_sdk_root}/platforms/si91x/drivers/cmsis_driver",
- "${wisemcu_sdk_root}/platforms/si91x/drivers/cmsis_driver/CMSIS/Driver/Include",
- "${wisemcu_sdk_root}/platforms/si91x/boards/brd4325x/inc",
- "${wisemcu_sdk_root}/platforms/si91x/core/cmsis",
- "${wisemcu_sdk_root}/third_party/freertos/include",
- "${wisemcu_sdk_root}/third_party/freertos/portable/GCC/ARM_CM4F",
- "${examples_plat_dir}/device/inc",
"${chip_root}/src/platform/silabs/rs911x",
+
+ # ble component
+ "${wifi_sdk_root}/components/si91x/ble/inc",
+
+ # si91x component
+ "${wifi_sdk_root}/components/si91x/inc",
+ "${wifi_sdk_root}/components/si91x/memory",
+ "${wifi_sdk_root}/components/si91x/sl_net/inc",
+
+ # siwx917_soc component
+ "${wifi_sdk_root}/components/siwx917_soc/inc",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/cmsis_driver",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/cmsis_driver/config",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/cmsis_driver/CMSIS/Driver/Include",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/systemlevel/inc",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/peripheral_drivers/inc",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/rom_driver/inc",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/unified_api/inc",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/unified_api/config",
+ "${wifi_sdk_root}/components/siwx917_soc/boards/brd4325x/inc",
+ "${wifi_sdk_root}/components/siwx917_soc/wifi_inc",
+
+ # wifi component
+ "${wifi_sdk_root}/components/protocol/wifi/inc",
+
+ # si91x_support component
+ "${wifi_sdk_root}/components/si91x_support/inc",
+ "${wifi_sdk_root}/components/si91x_support/brd4325b",
+ "${wifi_sdk_root}/components/si91x_support/siwx917_soc",
+
+ # wifi_resources component
+ "${wifi_sdk_root}/resources/certificates",
+ "${wifi_sdk_root}/resources/defaults",
+ "${wifi_sdk_root}/resources/other",
+
+ # network_manager component
+ "${wifi_sdk_root}/components/service/network_manager/inc",
+
+ # nvm3
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/middleware/nvm3/inc",
+ "${efr32_sdk_root}/platform/common/inc",
+ "${efr32_sdk_root}/platform/emlib/inc",
+ "${efr32_sdk_root}/platform/service/system/inc",
+ "${efr32_sdk_root}/platform/CMSIS/RTOS2/Include",
+ "${efr32_sdk_root}/platform/CMSIS/Core/Include",
+ "${efr32_sdk_root}/util/third_party/freertos/cmsis/Include",
+ "${efr32_sdk_root}/util/third_party/freertos/kernel/include",
+ "${wifi_sdk_root}/components/protocol/wifi/si91x",
+ "${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM4F",
+ "${sdk_support_root}/matter/si91x/siwx917/BRD4325x/support/inc",
]
# Note that we're setting the mbedTLS and PSA configuration files through a
@@ -86,6 +120,7 @@
"SL_HEAP_SIZE=32768",
"SL_WIFI=1",
"CCP_SI917_BRINGUP",
+ "SL_COMPONENT_CATALOG_PRESENT",
"RS911X_WIFI",
"RSI_WLAN_ENABLE",
"RSI_WITH_OS",
@@ -103,15 +138,48 @@
"USE_NVM3=1",
"RSI_ARM_CM4F",
"SIWX_917",
- "BRD4325A",
"CHIP_9117",
- "RSI_BLE_ENABLE=1",
+ "BLE_ENABLE=1",
+ "RSI_LITTLE_ENDIAN=1",
"TINYCRYPT_PRIMITIVES",
"OPTIMIZE_TINYCRYPT_ASM",
"__error_t_defined",
"RSI_SAMPLE_HAL",
+ "ENABLE_IPMU_APIS",
+ "ROM_BYPASS",
+ "DEBUG_UART",
+ "FLASH_BASED_EXECUTION_ENABLE",
+ "TA_DEEP_SLEEP_COMMON_FLASH",
+ "SL_WIFI_COMPONENT_INCLUDED",
+ "CHIP_917=1",
+ "ROMDRIVER_PRESENT",
+ "SL_CATALOG_FREERTOS_KERNEL_PRESENT=1",
+ "SL_PLATFORM_EXAMPLES_ENABLE",
+ "SI91X_DEVICE",
+ "SI917_RADIO_BOARD",
+ "FLASH_PAGE_SIZE",
+ "SL_NVM3_PRESENT",
+ "ROM_WIRELESS",
]
+ if (silabs_board == "BRD4325B") {
+ defines += [
+ "BRD4325A",
+ "BRD4325B",
+ "DUAL_FLASH_EN",
+ ]
+ }
+ if (silabs_board == "BRD4325C") {
+ defines += [
+ "BRD4325C",
+ "CHIP_917B0 = 1",
+ "SL_BOARD_NAME=\"BRD4325C\"",
+ "COMMON_FLASH_EN=1",
+ "EXECUTION_FROM_RAM",
+ "SL_BOARD_REV=\"A01\"",
+ ]
+ }
+
if (chip_build_libshell) {
defines += [ "ENABLE_CHIP_SHELL" ]
}
@@ -208,90 +276,91 @@
source_set(sdk_target_name) {
sources = [
- # sapi
- "${wisemcu_sdk_root}/sapi/bluetooth/rsi_ble_gap_apis.c",
- "${wisemcu_sdk_root}/sapi/bluetooth/rsi_ble_gatt_apis.c",
- "${wisemcu_sdk_root}/sapi/bluetooth/rsi_bt_common_apis.c",
- "${wisemcu_sdk_root}/sapi/common/rsi_apis_non_rom.c",
- "${wisemcu_sdk_root}/sapi/common/rsi_apis_rom.c",
- "${wisemcu_sdk_root}/sapi/common/rsi_common_apis.c",
- "${wisemcu_sdk_root}/sapi/common/rsi_device_init_apis.c",
- "${wisemcu_sdk_root}/sapi/driver/rsi_bt_ble.c",
- "${wisemcu_sdk_root}/sapi/driver/rsi_common.c",
- "${wisemcu_sdk_root}/sapi/driver/rsi_device_init.c",
- "${wisemcu_sdk_root}/sapi/driver/rsi_driver.c",
- "${wisemcu_sdk_root}/sapi/driver/rsi_driver_event_handlers.c",
- "${wisemcu_sdk_root}/sapi/driver/rsi_events.c",
- "${wisemcu_sdk_root}/sapi/driver/rsi_events_rom.c",
- "${wisemcu_sdk_root}/sapi/driver/rsi_iap.c",
- "${wisemcu_sdk_root}/sapi/driver/rsi_nwk.c",
- "${wisemcu_sdk_root}/sapi/driver/rsi_nwk_rom.c",
- "${wisemcu_sdk_root}/sapi/driver/rsi_pkt_mgmt.c",
- "${wisemcu_sdk_root}/sapi/driver/rsi_pkt_mgmt_rom.c",
- "${wisemcu_sdk_root}/sapi/driver/rsi_queue.c",
- "${wisemcu_sdk_root}/sapi/driver/rsi_queue_rom.c",
- "${wisemcu_sdk_root}/sapi/driver/rsi_scheduler.c",
- "${wisemcu_sdk_root}/sapi/driver/rsi_scheduler_rom.c",
- "${wisemcu_sdk_root}/sapi/driver/rsi_setregion_countryinfo.c",
- "${wisemcu_sdk_root}/sapi/driver/rsi_timer.c",
- "${wisemcu_sdk_root}/sapi/driver/rsi_utils.c",
- "${wisemcu_sdk_root}/sapi/driver/rsi_utils_rom.c",
- "${wisemcu_sdk_root}/sapi/driver/rsi_wlan.c",
- "${wisemcu_sdk_root}/sapi/network/socket/rsi_socket.c",
- "${wisemcu_sdk_root}/sapi/network/socket/rsi_socket_rom.c",
- "${wisemcu_sdk_root}/sapi/rtos/freertos_wrapper/rsi_os_wrapper.c",
- "${wisemcu_sdk_root}/sapi/wlan/rsi_wlan_apis.c",
+ # si91x component
+ "${efr32_sdk_root}/platform/CMSIS/RTOS2/Source/os_systick.c",
+ "${efr32_sdk_root}/platform/common/src/sl_assert.c",
+ "${efr32_sdk_root}/platform/common/src/sl_slist.c",
+ "${efr32_sdk_root}/util/third_party/freertos/cmsis/Source/cmsis_os2.c",
+ "${wifi_sdk_root}/components/protocol/wifi/si91x/sl_wifi.c",
- # platform
- "${wisemcu_sdk_root}/platforms/si91x/boards/brd4325x/src/rsi_board.c",
- "${wisemcu_sdk_root}/platforms/si91x/core/chip/src/rsi_deepsleep_commonflash.c",
- "${wisemcu_sdk_root}/platforms/si91x/core/chip/src/rsi_ps_ram_func.c",
- "${wisemcu_sdk_root}/platforms/si91x/core/chip/src/rsi_system_config.c",
- "${wisemcu_sdk_root}/platforms/si91x/core/chip/src/system_RS1xxxx.c",
- "${wisemcu_sdk_root}/platforms/si91x/drivers/peripheral_drivers/src/clock_update.c",
- "${wisemcu_sdk_root}/platforms/si91x/drivers/peripheral_drivers/src/rsi_comparator.c",
- "${wisemcu_sdk_root}/platforms/si91x/drivers/peripheral_drivers/src/rsi_egpio.c",
- "${wisemcu_sdk_root}/platforms/si91x/drivers/peripheral_drivers/src/rsi_udma.c",
- "${wisemcu_sdk_root}/platforms/si91x/drivers/peripheral_drivers/src/rsi_udma_wrapper.c",
- "${wisemcu_sdk_root}/platforms/si91x/drivers/peripheral_drivers/src/rsi_usart.c",
- "${wisemcu_sdk_root}/platforms/si91x/drivers/systemlevel/src/rsi_ipmu.c",
- "${wisemcu_sdk_root}/platforms/si91x/drivers/systemlevel/src/rsi_pll.c",
- "${wisemcu_sdk_root}/platforms/si91x/drivers/systemlevel/src/rsi_power_save.c",
- "${wisemcu_sdk_root}/platforms/si91x/drivers/systemlevel/src/rsi_processor_sensor.c",
- "${wisemcu_sdk_root}/platforms/si91x/drivers/systemlevel/src/rsi_rtc.c",
- "${wisemcu_sdk_root}/platforms/si91x/drivers/systemlevel/src/rsi_temp_sensor.c",
- "${wisemcu_sdk_root}/platforms/si91x/drivers/systemlevel/src/rsi_time_period.c",
- "${wisemcu_sdk_root}/platforms/si91x/drivers/systemlevel/src/rsi_ulpss_clk.c",
- "${wisemcu_sdk_root}/platforms/si91x/drivers/systemlevel/src/rsi_wwdt.c",
- "${wisemcu_sdk_root}/platforms/si91x/hal/src/rsi_bootup_config.c",
- "${wisemcu_sdk_root}/platforms/si91x/hal/src/rsi_hal_mcu_interrupt.c",
- "${wisemcu_sdk_root}/platforms/si91x/hal/src/rsi_hal_mcu_m4_rom.c",
+ # wifi component
+ "${wifi_sdk_root}/components/protocol/wifi/src/sl_wifi_callback_framework.c",
+ "${wifi_sdk_root}/components/service/network_manager/src/sl_net.c",
+
+ # network_manager component
+ "${wifi_sdk_root}/components/service/network_manager/src/sl_net_basic_certificate_store.c",
+
+ # basic_network_manager component
+ "${wifi_sdk_root}/components/service/network_manager/src/sl_net_basic_credentials.c",
+ "${wifi_sdk_root}/components/service/network_manager/src/sl_net_basic_profiles.c",
+
+ # ble component
+ "${wifi_sdk_root}/components/si91x/ble/src/rsi_ble_gap_apis.c",
+ "${wifi_sdk_root}/components/si91x/ble/src/rsi_ble_gatt_apis.c",
+ "${wifi_sdk_root}/components/si91x/ble/src/rsi_bt_ble.c",
+ "${wifi_sdk_root}/components/si91x/ble/src/rsi_bt_common_apis.c",
+ "${wifi_sdk_root}/components/si91x/ble/src/rsi_common_apis.c",
+ "${wifi_sdk_root}/components/si91x/ble/src/rsi_utils.c",
+ "${wifi_sdk_root}/components/si91x/ble/src/sl_si91x_ble.c",
+
+ # si91x_basic_buffers component
+ "${wifi_sdk_root}/components/si91x/memory/malloc_buffers.c",
+ "${wifi_sdk_root}/components/si91x/platforms/siwx917_soc/siwx917_soc_ncp_host.c",
+ "${wifi_sdk_root}/components/si91x/sl_net/src/sl_net_rsi_utility.c",
+ "${wifi_sdk_root}/components/si91x/sl_net/src/sl_net_si91x.c",
+ "${wifi_sdk_root}/components/si91x/sl_net/src/sl_net_si91x_integration_handler.c",
+ "${wifi_sdk_root}/components/si91x/src/sl_rsi_utility.c",
+ "${wifi_sdk_root}/components/si91x/src/sl_si91x_callback_framework.c",
+ "${wifi_sdk_root}/components/si91x/src/sl_si91x_driver.c",
+ "${wifi_sdk_root}/components/si91x/threading/sli_si91x_multithreaded.c",
+
+ # si91x_support component
+ "${wifi_sdk_root}/components/si91x_support/src/sl_utility.c",
+ "${wifi_sdk_root}/components/siwx917_soc/boards/brd4325x/src/rsi_board.c",
+ "${wifi_sdk_root}/components/siwx917_soc/core/chip/src/rsi_deepsleep_soc.c",
+ "${wifi_sdk_root}/components/siwx917_soc/core/chip/src/system_si91x.c",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/cmsis_driver/UDMA.c",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/cmsis_driver/USART.c",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/ipmu/ipmu_apis.c",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/ipmu/rsi_system_config_9117.c",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/peripheral_drivers/src/clock_update.c",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/peripheral_drivers/src/rsi_egpio.c",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/peripheral_drivers/src/rsi_udma.c",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/peripheral_drivers/src/rsi_udma_wrapper.c",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/peripheral_drivers/src/rsi_usart.c",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/systemlevel/src/rsi_ipmu.c",
+
+ # siwx917_soc component
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/systemlevel/src/rsi_pll.c",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/systemlevel/src/rsi_power_save.c",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/systemlevel/src/rsi_temp_sensor.c",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/systemlevel/src/rsi_ulpss_clk.c",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/unified_api/src/sl_si91x_usart.c",
+ "${wifi_sdk_root}/components/siwx917_soc/rsi_hal_mcu_m4_ram.c",
+ "${wifi_sdk_root}/components/siwx917_soc/rsi_hal_mcu_m4_rom.c",
+ "${wifi_sdk_root}/components/siwx917_soc/sl_platform.c",
+ "${wifi_sdk_root}/components/siwx917_soc/sl_platform_wireless.c",
+ "${wifi_sdk_root}/components/siwx917_soc/sl_si91x_bus.c",
+ "${wifi_sdk_root}/components/siwx917_soc/sl_si91x_timer.c",
+ "${wifi_sdk_root}/components/siwx917_soc/sli_siwx917_soc.c",
# modified hal
- "${examples_plat_dir}/SiWx917/hal/rsi_hal_mcu_m4.c",
- "${examples_plat_dir}/SiWx917/hal/rsi_hal_mcu_platform_init.c",
- "${examples_plat_dir}/SiWx917/hal/rsi_hal_mcu_timer.c",
-
- # startup
- "${examples_plat_dir}/device/src/startup_RS1xxxx.c",
-
- # nvm3
- "${sdk_support_root}/platform/emdrv/nvm3/src/ccp_flash_dev.c",
- "${sdk_support_root}/platform/emdrv/nvm3/src/ccp_flash_intf.c",
- "${sdk_support_root}/platform/emdrv/nvm3/src/ccp_flash_prg.c",
- "${sdk_support_root}/platform/emdrv/nvm3/src/nvm3_default.c",
- "${sdk_support_root}/platform/emdrv/nvm3/src/nvm3_hal_flash_ccp.c",
- "${sdk_support_root}/platform/emdrv/nvm3/src/nvm3_lock.c",
-
- # freertos
- "${wisemcu_sdk_root}/third_party/freertos/croutine.c",
- "${wisemcu_sdk_root}/third_party/freertos/event_groups.c",
- "${wisemcu_sdk_root}/third_party/freertos/list.c",
- "${wisemcu_sdk_root}/third_party/freertos/portable/GCC/ARM_CM4F/port.c",
- "${wisemcu_sdk_root}/third_party/freertos/queue.c",
- "${wisemcu_sdk_root}/third_party/freertos/stream_buffer.c",
- "${wisemcu_sdk_root}/third_party/freertos/tasks.c",
- "${wisemcu_sdk_root}/third_party/freertos/timers.c",
+ "${efr32_sdk_root}/platform/emdrv/nvm3/src/nvm3_default_common_linker.c",
+ "${efr32_sdk_root}/platform/emdrv/nvm3/src/nvm3_lock.c",
+ "${efr32_sdk_root}/platform/emlib/src/em_core.c",
+ "${efr32_sdk_root}/platform/service/system/src/sl_system_init.c",
+ "${efr32_sdk_root}/util/third_party/freertos/kernel/croutine.c",
+ "${efr32_sdk_root}/util/third_party/freertos/kernel/event_groups.c",
+ "${efr32_sdk_root}/util/third_party/freertos/kernel/list.c",
+ "${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM4F/port.c",
+ "${efr32_sdk_root}/util/third_party/freertos/kernel/queue.c",
+ "${efr32_sdk_root}/util/third_party/freertos/kernel/stream_buffer.c",
+ "${efr32_sdk_root}/util/third_party/freertos/kernel/tasks.c",
+ "${efr32_sdk_root}/util/third_party/freertos/kernel/timers.c",
+ "${sdk_support_root}/matter/si91x/siwx917/BRD4325x/autogen/sl_event_handler.c",
+ "${sdk_support_root}/matter/si91x/siwx917/BRD4325x/support/hal/rsi_hal_mcu_m4.c",
+ "${sdk_support_root}/matter/si91x/siwx917/BRD4325x/support/hal/rsi_hal_mcu_platform_init.c",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/middleware/nvm3/src/sl_si91x_nvm3_hal_flash.c",
# mbedtls
"${chip_root}/third_party/mbedtls/repo/library/aes.c",
@@ -330,6 +399,21 @@
"${sdk_support_root}/matter/mbedtls/tinycrypt/src/x509write_csr.c",
]
+ # nvm3 ans startup
+ if (silabs_board == "BRD4325B") {
+ sources += [
+ "${sdk_support_root}/matter/si91x/siwx917/BRD4325x/support/src/startup_RS1xxxx.c",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/middleware/nvm3/src/sl_si91x_dual_flash_intf.c",
+ ]
+ }
+
+ if (silabs_board == "BRD4325C") {
+ sources += [
+ "${sdk_support_root}/matter/si91x/siwx917/BRD4325x/support/src/startup_common_RS1xxxx.c",
+ "${wifi_sdk_root}/components/siwx917_soc/drivers/middleware/nvm3/src/sl_si91x_common_flash_intf.c",
+ ]
+ }
+
public_deps = [
":siwx917_mbedtls_config",
"${segger_rtt_root}:segger_rtt",
diff --git a/third_party/silabs/matter_support b/third_party/silabs/matter_support
index 05dc47d..9e65d62 160000
--- a/third_party/silabs/matter_support
+++ b/third_party/silabs/matter_support
@@ -1 +1 @@
-Subproject commit 05dc47da941d6a5e4a578f167da0fbdb5c651ec7
+Subproject commit 9e65d627070ae0c2fac8a0cfb07bb9dc7831c6bc
diff --git a/third_party/silabs/silabs_arm.gni b/third_party/silabs/silabs_arm.gni
index 68126f5..5c13882 100644
--- a/third_party/silabs/silabs_arm.gni
+++ b/third_party/silabs/silabs_arm.gni
@@ -14,7 +14,7 @@
import("silabs_board.gni")
-if (silabs_family == "efr32mg12" || silabs_family == "SiWx917") {
+if (silabs_family == "efr32mg12" || wifi_soc == true) {
arm_arch = "armv7e-m"
arm_abi = "aapcs"
arm_cpu = "cortex-m4"
diff --git a/third_party/silabs/silabs_board.gni b/third_party/silabs/silabs_board.gni
index a48e862..e12a7fa 100644
--- a/third_party/silabs/silabs_board.gni
+++ b/third_party/silabs/silabs_board.gni
@@ -100,8 +100,20 @@
silabs_family = "efr32mg12"
silabs_mcu = "EFR32MG12P433F1024GM68"
} else if (silabs_board == "BRD4325B") {
- silabs_family = "SiWx917"
- silabs_mcu = "EFR32MG12P432F1024GL125"
+ silabs_family = "SiWx917-dual"
+ silabs_mcu = "SiWG917M111MGTBA"
+ disable_lcd = true
+ show_qr_code = false
+ wifi_soc = true
+} else if (silabs_board == "BRD4325C") {
+ silabs_family = "SiWx917-common"
+ silabs_mcu = "SiWG917M111MGTBA"
+ disable_lcd = true
+ show_qr_code = false
+ wifi_soc = true
+} else if (silabs_board == "BRD4325G") {
+ silabs_family = "SiWx917-common"
+ silabs_mcu = "SiWG917M111MGTBA"
disable_lcd = true
show_qr_code = false
wifi_soc = true
diff --git a/third_party/silabs/wifi_sdk b/third_party/silabs/wifi_sdk
new file mode 160000
index 0000000..0a9db52
--- /dev/null
+++ b/third_party/silabs/wifi_sdk
@@ -0,0 +1 @@
+Subproject commit 0a9db52aa98a2f9c56ef1160281f9daf5d50079f