From 2357760589e056c3cd3c040bd040902e86e8114f Mon Sep 17 00:00:00 2001 From: chirag-silabs <100861685+chirag-silabs@users.noreply.github.com> Date: Thu, 12 Oct 2023 20:24:24 +0530 Subject: [PATCH] [Silabs] Updating the wifi sdk pointer to v3.1.0 (#29718) * changes for wifi sdk 3_1_0 * updating the matter support to point to main * added missed commas * Restyled by clang-format * Restyled by gn --------- Co-authored-by: Restyled.io --- .../SiWx917/SiWx917/hal/rsi_hal_mcu_m4.c | 304 ------------------ .../platformAbstraction/WiseMcuSpam.cpp | 19 +- third_party/silabs/SiWx917_sdk.gni | 10 +- third_party/silabs/matter_support | 2 +- third_party/silabs/wifi_sdk | 2 +- 5 files changed, 12 insertions(+), 325 deletions(-) delete mode 100644 examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_m4.c diff --git a/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_m4.c b/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_m4.c deleted file mode 100644 index ac24d5c4f61dd4..00000000000000 --- a/examples/platform/silabs/SiWx917/SiWx917/hal/rsi_hal_mcu_m4.c +++ /dev/null @@ -1,304 +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_board.h" -#include "rsi_chip.h" -#include "rsi_driver.h" -#include "rsi_m4.h" -#ifdef COMMON_FLASH_EN -#include "rsi_power_save.h" -#endif - -rsi_m4ta_desc_t tx_desc[2]; -rsi_m4ta_desc_t rx_desc[2]; - -uint8_t btn0 = 1; -uint8_t btn1 = 1; - -void sl_button_on_change(uint8_t btn, uint8_t btnAction); - -uint32_t NVIC_GetIRQEnable(IRQn_Type IRQn) -{ - return ((NVIC->ICER[((uint32_t) (IRQn) >> 5)] & (1 << ((uint32_t) (IRQn) &0x1F))) ? 1 : 0); -} - -void rsi_assertion(uint16_t assertion_val, const char * string) -{ - uint16_t i; - if (assertion_val == 0) - { - for (i = 0; i < strlen(string); i++) - { -#ifdef DEBUG_UART -#ifdef DEBUG_ASSERTION - Board_UARTPutChar(string[i]); -#endif -#endif - } - - return; - } - else - { - for (i = 0; i < strlen(string); i++) - { -#ifdef DEBUG_UART -#ifdef DEBUG_ASSERTION - Board_UARTPutChar(string[i]); -#endif -#endif - } - - while (1) - ; - } -} - -void IRQ074_Handler(void) -{ - ROM_WL_rsi_m4_interrupt_isr(global_cb_p); -} - -void IRQ021_Handler(void) -{ - // TODO: Replace with rsi_delay once that is fixed - for (int i = 0; i < 10000; i++) - __asm__("nop;"); - /* clear NPSS GPIO interrupt*/ - RSI_NPSSGPIO_ClrIntr(NPSS_GPIO_0_INTR); - RSI_NPSSGPIO_ClrIntr(NPSS_GPIO_2_INTR); - // if the btn is not pressed setting the state to 1 - if (RSI_NPSSGPIO_GetPin(NPSS_GPIO_2) && (!btn1)) - { - btn1 = 1; - sl_button_on_change(1, 0); - } - // geting the state of the gpio 2 pin and checking if the btn is already pressed or not - if (!RSI_NPSSGPIO_GetPin(NPSS_GPIO_2) && btn1) - { - btn1 = 0; - sl_button_on_change(1, 1); - } - if (RSI_NPSSGPIO_GetPin(NPSS_GPIO_0) && (!btn0)) - { - btn0 = 1; - sl_button_on_change(0, 0); - } - if (!RSI_NPSSGPIO_GetPin(NPSS_GPIO_0) && btn0) - { - btn0 = 0; - sl_button_on_change(0, 1); - } -} - -/*==============================================*/ -/** - * @fn void rsi_raise_pkt_pending_interrupt_to_ta() - * @brief This function raises the packet pending interrupt to TA - * @param[in] none - * @param[out] none - * @return none - * @section description - * This function raises the packet pending interrupt to TA - * - * - */ -void rsi_m4_ta_interrupt_init(void) -{ - //! Unmask the interrupt - unmask_ta_interrupt(TX_PKT_TRANSFER_DONE_INTERRUPT | RX_PKT_TRANSFER_DONE_INTERRUPT); - - P2P_STATUS_REG |= M4_is_active; - - *(volatile uint32_t *) 0xE000E108 = 0x00000400; - -#ifdef RSI_WITH_OS - //! Set P2P Intr priority - NVIC_SetPriority(TASS_P2P_IRQn, TASS_P2P_INTR_PRI); -#endif - - return; -} - -void mask_ta_interrupt(uint32_t interrupt_no) -{ -#ifdef ROM_WIRELESS - ROMAPI_WL->mask_ta_interrupt(interrupt_no); -#else - api_wl->mask_ta_interrupt(interrupt_no); -#endif -} - -void unmask_ta_interrupt(uint32_t interrupt_no) -{ -#ifdef ROM_WIRELESS - ROMAPI_WL->unmask_ta_interrupt(interrupt_no); -#else - api_wl->unmask_ta_interrupt(interrupt_no); -#endif -} - -int rsi_submit_rx_pkt(void) -{ -#ifdef ROM_WIRELESS - return ROMAPI_WL->rsi_submit_rx_pkt(global_cb_p); -#else - return api_wl->rsi_submit_rx_pkt(global_cb_p); -#endif -} - -/*====================================================*/ -/** - * @fn int16_t rsi_frame_read(uint8_t *pkt_buffer) - * @brief This function is used to read the response from module. - * @param[in] uint8_t *pkt_buffer, pointer to the buffer to which packet has to read - * which is used to store the response from the module - * @param[out] none - * @return errCode - * -1 = SPI busy / Timeout - * -2 = SPI Failure - * 0 = SUCCESS - * @section description - * This is a common function to read response for all the command and data from Wi-Fi module. - */ - -rsi_pkt_t * rsi_frame_read(void) -{ -#ifdef ROM_WIRELESS - return ROMAPI_WL->rsi_frame_read(global_cb_p); -#else - return api_wl->rsi_frame_read(global_cb_p); -#endif -} - -/*====================================================*/ -/** - * @fn int16_t rsi_frame_write(rsi_frame_desc_t *uFrameDscFrame,uint8_t *payloadparam,uint16_t size_param) - * @brief Common function for all the commands. - * @param[in] uFrameDsc uFrameDscFrame, frame descriptor - * @param[in] uint8_t *payloadparam, pointer to the command payload parameter structure - * @param[in] uint16_t size_param, size of the payload for the command - * @return errCode - * -1 = SPI busy / Timeout - * -2 = SPI Failure - * 0 = SUCCESS - * @section description - * This is a common function used to process a command to the Wi-Fi module. - */ - -int16_t rsi_frame_write(rsi_frame_desc_t * uFrameDscFrame, uint8_t * payloadparam, uint16_t size_param) -{ -#ifdef ROM_WIRELESS - return ROMAPI_WL->rsi_frame_write(global_cb_p, uFrameDscFrame, payloadparam, size_param); -#else - return api_wl->rsi_frame_write(global_cb_p, uFrameDscFrame, payloadparam, size_param); -#endif -} -/*==============================================*/ -/** - * @fn void rsi_update_tx_dma_desc(uint8 skip_dma_valid) - * @brief This function updates the TX DMA descriptor address - * @param[in] skip_dma_valid - * @param[out] none - * @return none - * @section description - * This function updates the TX DMA descriptor address - * - * - */ - -void rsi_update_tx_dma_desc(uint8_t skip_dma_valid) -{ - if (!skip_dma_valid) - { -#ifdef COMMON_FLASH_EN - if (!(M4_ULP_SLP_STATUS_REG & MCU_ULP_WAKEUP)) -#endif - { - while (M4_TX_DMA_DESC_REG & DMA_DESC_REG_VALID) - ; - } - } - M4_TX_DMA_DESC_REG = (uint32_t) &tx_desc; -} - -/*==============================================*/ -/** - * @fn void rsi_update_rx_dma_desc() - * @brief This function updates the RX DMA descriptor address - * @param[in] none - * @param[out] none - * @return none - * @section description - * This function updates the RX DMA descriptor address - * - * - */ -void rsi_update_rx_dma_desc(void) -{ - M4_RX_DMA_DESC_REG = (uint32_t) &rx_desc; -} - -/*==============================================*/ -/** - * @fn void rsi_config_m4_dma_desc_on_reset() - * @brief This function updates the RX DMA and TX DMA descriptor address after reset - * @param[in] none - * @param[out] none - * @return none - * @section description - * This function updates the RX DMA and TX DMA descriptor address - * - * - */ -void rsi_config_m4_dma_desc_on_reset(void) -{ - //! Wait for TA to go to sleep - while (P2P_STATUS_REG & TA_is_active) - ; - //! Wait for TA to wakeup and should be in bootloader - while (!(P2P_STATUS_REG & TA_is_active)) - ; - //! UPdate M4 TX and RX dma descriptors - M4_TX_DMA_DESC_REG = (uint32_t) &tx_desc; - M4_RX_DMA_DESC_REG = (uint32_t) &rx_desc; -} - -/*==================================================*/ -/** - * @fn int16_t rsi_device_interrupt_status(uint8_t *int_status) - * @brief Returns the value of the Interrupt register - * @param[in] status - * @param[out] buffer full status reg value - * @return errorcode - * 0 = Success - * -2 = Reg read failure - */ -int16_t rsi_device_interrupt_status(uint8_t * int_status) -{ - - //! Check for TA active .If it is not active Buffer full status is not valid, - //! SO return fail from here - if (!(P2P_STATUS_REG & TA_is_active)) - { - return RSI_FAIL; - } - //! copy buffer full status reg value - *int_status = (uint8_t) HOST_INTR_STATUS_REG; - - return RSI_SUCCESS; -} diff --git a/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp b/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp index a9cb0c0f5f540e..b5075514d46dbb 100644 --- a/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp +++ b/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp @@ -27,16 +27,9 @@ // TODO add includes ? extern "C" { #include "em_core.h" +#include "rsi_board.h" #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); -#ifdef SI917_RADIO_BOARD_V2 -void RSI_Wakeupsw_config_gpio11(void); -#endif -void sl_system_init(void); +#include "sl_system_init.h" void soc_pll_config(void); } @@ -63,14 +56,6 @@ CHIP_ERROR SilabsPlatform::Init(void) // Configuration the clock rate soc_pll_config(); - // BTN0 and BTN1 init - RSI_Wakeupsw_config(); -#ifdef SI917_RADIO_BOARD_V2 - RSI_Wakeupsw_config_gpio11(); -#else - RSI_Wakeupsw_config_gpio0(); -#endif - #if SILABS_LOG_ENABLED silabsInitLog(); #endif diff --git a/third_party/silabs/SiWx917_sdk.gni b/third_party/silabs/SiWx917_sdk.gni index d3639adf3b87ec..eb9a35240833c4 100644 --- a/third_party/silabs/SiWx917_sdk.gni +++ b/third_party/silabs/SiWx917_sdk.gni @@ -52,7 +52,6 @@ template("siwx917_sdk") { _include_dirs = [ "${chip_root}", "${chip_root}/examples/platform/silabs/SiWx917/SiWx917", - "${sdk_support_root}/matter/si91x/siwx917/${sdk_support_board}/support/hal", "${efr32_sdk_root}/platform/emdrv/nvm3/inc", "${efr32_sdk_root}/platform/emdrv/common/inc", "${efr32_sdk_root}/platform/service/device_init/inc", @@ -130,6 +129,9 @@ template("siwx917_sdk") { "${efr32_sdk_root}/platform/service/sleeptimer/config", "${efr32_sdk_root}/platform/service/sleeptimer/src", "${sdk_support_root}/matter/si91x/siwx917/${sdk_support_board}/support/inc", + + "${efr32_sdk_root}/platform/service/iostream/inc", + "${wifi_sdk_root}/components/siwx917_soc/drivers/hardware_drivers/button/inc", ] if (silabs_board == "BRD4338A") { @@ -191,6 +193,7 @@ template("siwx917_sdk") { "SL_NVM3_PRESENT", "ROM_WIRELESS", "BRD4325A", #TODO: should be removed after SoC macro clean-up + "CONNECTIVITY_PLATFORM", ] if (silabs_board == "BRD4325B") { @@ -410,7 +413,6 @@ template("siwx917_sdk") { "${efr32_sdk_root}/util/third_party/freertos/kernel/timers.c", "${sdk_support_root}/matter/si91x/siwx917/${sdk_support_board}/autogen/sl_event_handler.c", "${sdk_support_root}/matter/si91x/siwx917/${sdk_support_board}/support/hal/rsi_hal_mcu_m4.c", - "${sdk_support_root}/matter/si91x/siwx917/${sdk_support_board}/support/hal/rsi_hal_mcu_platform_init.c", "${wifi_sdk_root}/components/siwx917_soc/drivers/service/nvm3/src/sl_si91x_nvm3_hal_flash.c", # mbedtls @@ -436,6 +438,8 @@ template("siwx917_sdk") { "${chip_root}/third_party/mbedtls/repo/library/sha256.c", "${chip_root}/third_party/mbedtls/repo/library/sha512.c", "${chip_root}/third_party/mbedtls/repo/library/x509_create.c", + "${efr32_sdk_root}/platform/service/iostream/src/sl_iostream.c", + "${efr32_sdk_root}/platform/service/iostream/src/sl_iostream_rtt.c", "${sdk_support_root}/matter/mbedtls/tinycrypt/src/ecc.c", "${sdk_support_root}/matter/mbedtls/tinycrypt/src/ecc_dh.c", "${sdk_support_root}/matter/mbedtls/tinycrypt/src/ecc_dsa.c", @@ -448,6 +452,8 @@ template("siwx917_sdk") { "${sdk_support_root}/matter/mbedtls/tinycrypt/src/platform_util.c", "${sdk_support_root}/matter/mbedtls/tinycrypt/src/x509_crt.c", "${sdk_support_root}/matter/mbedtls/tinycrypt/src/x509write_csr.c", + "${sdk_support_root}/matter/si91x/siwx917/${sdk_support_board}/autogen/sl_si91x_button_instances.c", + "${wifi_sdk_root}/components/siwx917_soc/drivers/hardware_drivers/button/src/sl_si91x_button.c", ] # nvm3 ans startup diff --git a/third_party/silabs/matter_support b/third_party/silabs/matter_support index 220e87668200a1..13a673847df004 160000 --- a/third_party/silabs/matter_support +++ b/third_party/silabs/matter_support @@ -1 +1 @@ -Subproject commit 220e87668200a1ac3c4bc3604a9408c2b12d440e +Subproject commit 13a673847df004cdb6e3a4346e7629f6a548d4ec diff --git a/third_party/silabs/wifi_sdk b/third_party/silabs/wifi_sdk index f84bf6683b124b..58a240448abd15 160000 --- a/third_party/silabs/wifi_sdk +++ b/third_party/silabs/wifi_sdk @@ -1 +1 @@ -Subproject commit f84bf6683b124b62475cd456869c6db7c21ae24e +Subproject commit 58a240448abd15f7a4604b3f1a19ff398c341863