diff --git a/examples/light-switch-app/qpg/zap/switch.matter b/examples/light-switch-app/qpg/zap/switch.matter
index b0e5f87deffa58..82d8b7a51a1770 100644
--- a/examples/light-switch-app/qpg/zap/switch.matter
+++ b/examples/light-switch-app/qpg/zap/switch.matter
@@ -178,199 +178,6 @@ cluster Groups = 4 {
fabric command access(invoke: manage) AddGroupIfIdentifying(AddGroupIfIdentifyingRequest): DefaultSuccess = 5;
}
-/** Attributes and commands for scene configuration and manipulation. */
-provisional cluster Scenes = 5 {
- revision 5;
-
- bitmap CopyModeBitmap : bitmap8 {
- kCopyAllScenes = 0x1;
- }
-
- bitmap Feature : bitmap32 {
- kSceneNames = 0x1;
- kExplicit = 0x2;
- kTableSize = 0x4;
- kFabricScenes = 0x8;
- }
-
- bitmap NameSupportBitmap : bitmap8 {
- kSceneNames = 0x80;
- }
-
- struct AttributeValuePair {
- attrib_id attributeID = 0;
- int32u attributeValue = 1;
- }
-
- struct ExtensionFieldSet {
- cluster_id clusterID = 0;
- AttributeValuePair attributeValueList[] = 1;
- }
-
- fabric_scoped struct SceneInfoStruct {
- int8u sceneCount = 0;
- fabric_sensitive int8u currentScene = 1;
- fabric_sensitive group_id currentGroup = 2;
- fabric_sensitive boolean sceneValid = 3;
- int8u remainingCapacity = 4;
- fabric_idx fabricIndex = 254;
- }
-
- readonly attribute optional int8u sceneCount = 0;
- readonly attribute optional int8u currentScene = 1;
- readonly attribute optional group_id currentGroup = 2;
- readonly attribute optional boolean sceneValid = 3;
- readonly attribute NameSupportBitmap nameSupport = 4;
- readonly attribute optional nullable node_id lastConfiguredBy = 5;
- readonly attribute int16u sceneTableSize = 6;
- readonly attribute SceneInfoStruct fabricSceneInfo[] = 7;
- readonly attribute command_id generatedCommandList[] = 65528;
- readonly attribute command_id acceptedCommandList[] = 65529;
- readonly attribute event_id eventList[] = 65530;
- readonly attribute attrib_id attributeList[] = 65531;
- readonly attribute bitmap32 featureMap = 65532;
- readonly attribute int16u clusterRevision = 65533;
-
- request struct AddSceneRequest {
- group_id groupID = 0;
- int8u sceneID = 1;
- int16u transitionTime = 2;
- char_string sceneName = 3;
- ExtensionFieldSet extensionFieldSets[] = 4;
- }
-
- response struct AddSceneResponse = 0 {
- status status = 0;
- group_id groupID = 1;
- int8u sceneID = 2;
- }
-
- request struct ViewSceneRequest {
- group_id groupID = 0;
- int8u sceneID = 1;
- }
-
- response struct ViewSceneResponse = 1 {
- status status = 0;
- group_id groupID = 1;
- int8u sceneID = 2;
- optional int16u transitionTime = 3;
- optional char_string sceneName = 4;
- optional ExtensionFieldSet extensionFieldSets[] = 5;
- }
-
- request struct RemoveSceneRequest {
- group_id groupID = 0;
- int8u sceneID = 1;
- }
-
- response struct RemoveSceneResponse = 2 {
- status status = 0;
- group_id groupID = 1;
- int8u sceneID = 2;
- }
-
- request struct RemoveAllScenesRequest {
- group_id groupID = 0;
- }
-
- response struct RemoveAllScenesResponse = 3 {
- status status = 0;
- group_id groupID = 1;
- }
-
- request struct StoreSceneRequest {
- group_id groupID = 0;
- int8u sceneID = 1;
- }
-
- response struct StoreSceneResponse = 4 {
- status status = 0;
- group_id groupID = 1;
- int8u sceneID = 2;
- }
-
- request struct RecallSceneRequest {
- group_id groupID = 0;
- int8u sceneID = 1;
- optional nullable int16u transitionTime = 2;
- }
-
- request struct GetSceneMembershipRequest {
- group_id groupID = 0;
- }
-
- response struct GetSceneMembershipResponse = 6 {
- status status = 0;
- nullable int8u capacity = 1;
- group_id groupID = 2;
- optional int8u sceneList[] = 3;
- }
-
- request struct EnhancedAddSceneRequest {
- group_id groupID = 0;
- int8u sceneID = 1;
- int16u transitionTime = 2;
- char_string sceneName = 3;
- ExtensionFieldSet extensionFieldSets[] = 4;
- }
-
- response struct EnhancedAddSceneResponse = 64 {
- status status = 0;
- group_id groupID = 1;
- int8u sceneID = 2;
- }
-
- request struct EnhancedViewSceneRequest {
- group_id groupID = 0;
- int8u sceneID = 1;
- }
-
- response struct EnhancedViewSceneResponse = 65 {
- status status = 0;
- group_id groupID = 1;
- int8u sceneID = 2;
- optional int16u transitionTime = 3;
- optional char_string sceneName = 4;
- optional ExtensionFieldSet extensionFieldSets[] = 5;
- }
-
- request struct CopySceneRequest {
- CopyModeBitmap mode = 0;
- group_id groupIdentifierFrom = 1;
- int8u sceneIdentifierFrom = 2;
- group_id groupIdentifierTo = 3;
- int8u sceneIdentifierTo = 4;
- }
-
- response struct CopySceneResponse = 66 {
- status status = 0;
- group_id groupIdentifierFrom = 1;
- int8u sceneIdentifierFrom = 2;
- }
-
- /** Add a scene to the scene table. Extension field sets are supported, and are inputed as '{"ClusterID": VALUE, "AttributeValueList":[{"AttributeId": VALUE, "AttributeValue": VALUE}]}' */
- fabric command access(invoke: manage) AddScene(AddSceneRequest): AddSceneResponse = 0;
- /** Retrieves the requested scene entry from its Scene table. */
- fabric command ViewScene(ViewSceneRequest): ViewSceneResponse = 1;
- /** Removes the requested scene entry, corresponding to the value of the GroupID field, from its Scene Table */
- fabric command access(invoke: manage) RemoveScene(RemoveSceneRequest): RemoveSceneResponse = 2;
- /** Remove all scenes, corresponding to the value of the GroupID field, from its Scene Table */
- fabric command access(invoke: manage) RemoveAllScenes(RemoveAllScenesRequest): RemoveAllScenesResponse = 3;
- /** Adds the scene entry into its Scene Table along with all extension field sets corresponding to the current state of other clusters on the same endpoint */
- fabric command access(invoke: manage) StoreScene(StoreSceneRequest): StoreSceneResponse = 4;
- /** Set the attributes and corresponding state for each other cluster implemented on the endpoint accordingly to the resquested scene entry in the Scene Table */
- fabric command RecallScene(RecallSceneRequest): DefaultSuccess = 5;
- /** Get an unused scene identifier when no commissioning tool is in the network, or for a commissioning tool to get the used scene identifiers within a certain group */
- fabric command GetSceneMembership(GetSceneMembershipRequest): GetSceneMembershipResponse = 6;
- /** Allows a scene to be added using a finer scene transition time than the AddScene command. */
- fabric command EnhancedAddScene(EnhancedAddSceneRequest): EnhancedAddSceneResponse = 64;
- /** Allows a scene to be retrieved using a finer scene transition time than the ViewScene command */
- fabric command EnhancedViewScene(EnhancedViewSceneRequest): EnhancedViewSceneResponse = 65;
- /** Allows a client to efficiently copy scenes from one group/scene identifier pair to another group/scene identifier pair. */
- fabric command CopyScene(CopySceneRequest): CopySceneResponse = 66;
-}
-
/** Attributes and commands for switching devices between 'On' and 'Off' states. */
cluster OnOff = 6 {
revision 6;
@@ -2488,7 +2295,6 @@ endpoint 1 {
device type ma_onofflightswitch = 259, version 1;
binding cluster Identify;
- binding cluster Scenes;
binding cluster OnOff;
binding cluster ColorControl;
diff --git a/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi_host.c b/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi_host.c
index eef6cdb8a7db61..8f1f895f9683f9 100644
--- a/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi_host.c
+++ b/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi_host.c
@@ -25,7 +25,6 @@
#include "silabs_utils.h"
#include "sl_status.h"
#include "task.h"
-
#include "wfx_host_events.h"
#include "wfx_rsi.h"
diff --git a/examples/platform/silabs/efr32/BUILD.gn b/examples/platform/silabs/efr32/BUILD.gn
index a4fb8f1ac684dc..effbe038389f06 100644
--- a/examples/platform/silabs/efr32/BUILD.gn
+++ b/examples/platform/silabs/efr32/BUILD.gn
@@ -281,7 +281,7 @@ source_set("efr32-common") {
}
if (chip_enable_wifi) {
- if (use_rs9116 || use_SiWx917) {
+ if (use_rs9116) {
sources += rs911x_src_plat
# All the stuff from wiseconnect
@@ -290,6 +290,14 @@ source_set("efr32-common") {
#add compilation flags for rs991x build. This will be addressed directly in wiseconnect sdk in the next version release of that sdk
cflags = rs911x_cflags
+ } else if (use_SiWx917) {
+ sources += rs911x_src_plat
+
+ # All the stuff from wiseconnect
+ sources += rs9117_src_sapi
+ include_dirs += rs9117_inc_plat
+
+ #add compilation flags for rs991x build. This will be addressed directly in wiseconnect sdk in the next version release of that sdk
} else if (use_wf200) {
sources += wf200_plat_src
include_dirs += wf200_plat_incs
diff --git a/examples/platform/silabs/efr32/rs911x/hal/efx32_ncp_host.c b/examples/platform/silabs/efr32/rs911x/hal/efx32_ncp_host.c
new file mode 100644
index 00000000000000..414153ecd0164c
--- /dev/null
+++ b/examples/platform/silabs/efr32/rs911x/hal/efx32_ncp_host.c
@@ -0,0 +1,302 @@
+/*******************************************************************************
+ * @file efx32_ncp_host.c
+ * @brief
+ *******************************************************************************
+ * # License
+ * Copyright 2023 Silicon Laboratories Inc. www.silabs.com
+ *******************************************************************************
+ *
+ * The licensor of this software is Silicon Laboratories Inc. Your use of this
+ * software is governed by the terms of Silicon Labs Master Software License
+ * Agreement (MSLA) available at
+ * www.silabs.com/about-us/legal/master-software-license-agreement. This
+ * software is distributed to you in Source Code format and is governed by the
+ * sections of the MSLA applicable to Source Code.
+ *
+ ******************************************************************************/
+
+#include "FreeRTOS.h"
+#include "cmsis_os2.h"
+#include "dmadrv.h"
+#include "em_cmu.h"
+#include "em_core.h"
+#include "em_gpio.h"
+#include "em_usart.h"
+#include "gpiointerrupt.h"
+#include "sl_board_configuration_SiWx917.h"
+#include "sl_constants.h"
+#include "sl_rsi_utility.h"
+#include "sl_si91x_host_interface.h"
+#include "sl_si91x_status.h"
+#include "sl_status.h"
+#include "sl_wifi_constants.h"
+#include
+#include
+
+#if defined(SL_CATLOG_POWER_MANAGER_PRESENT)
+#include "sl_power_manager.h"
+#endif
+
+static bool dma_callback(unsigned int channel, unsigned int sequenceNo, void * userParam);
+
+unsigned int rx_ldma_channel;
+unsigned int tx_ldma_channel;
+osMutexId_t spi_transfer_mutex = 0;
+
+static uint32_t dummy_buffer;
+
+// LDMA descriptor and transfer configuration structures for USART TX channel
+LDMA_Descriptor_t ldmaTXDescriptor;
+LDMA_TransferCfg_t ldmaTXConfig;
+
+// LDMA descriptor and transfer configuration structures for USART RX channel
+LDMA_Descriptor_t ldmaRXDescriptor;
+LDMA_TransferCfg_t ldmaRXConfig;
+
+static osSemaphoreId_t transfer_done_semaphore = NULL;
+
+static bool dma_callback(unsigned int channel, unsigned int sequenceNo, void * userParam)
+{
+ UNUSED_PARAMETER(channel);
+ UNUSED_PARAMETER(sequenceNo);
+ UNUSED_PARAMETER(userParam);
+#if defined(SL_CATLOG_POWER_MANAGER_PRESENT)
+ sl_power_manager_remove_em_requirement(SL_POWER_MANAGER_EM1);
+#endif
+ osSemaphoreRelease(transfer_done_semaphore);
+ return false;
+}
+
+static void gpio_interrupt(uint8_t interrupt_number)
+{
+ UNUSED_PARAMETER(interrupt_number);
+ sl_si91x_host_set_bus_event(NCP_HOST_BUS_RX_EVENT);
+ // GPIO_IntClear(0xAAAA);
+}
+
+void sl_si91x_host_set_sleep_indicator(void)
+{
+ GPIO_PinOutSet(SLEEP_CONFIRM_PIN.port, SLEEP_CONFIRM_PIN.pin);
+}
+
+void sl_si91x_host_clear_sleep_indicator(void)
+{
+ GPIO_PinOutClear(SLEEP_CONFIRM_PIN.port, SLEEP_CONFIRM_PIN.pin);
+}
+
+uint32_t sl_si91x_host_get_wake_indicator(void)
+{
+ return GPIO_PinInGet(WAKE_INDICATOR_PIN.port, WAKE_INDICATOR_PIN.pin);
+}
+
+sl_status_t sl_si91x_host_init(void)
+{
+ // Enable clock (not needed on xG21)
+ CMU_ClockEnable(cmuClock_GPIO, true);
+
+#if SL_SPICTRL_MUX
+ spi_board_init();
+#endif
+ // Configure SPI bus pins
+ GPIO_PinModeSet(SPI_MISO_PIN.port, SPI_MISO_PIN.pin, gpioModeInput, 0);
+ GPIO_PinModeSet(SPI_MOSI_PIN.port, SPI_MOSI_PIN.pin, gpioModePushPull, 0);
+ GPIO_PinModeSet(SPI_CLOCK_PIN.port, SPI_CLOCK_PIN.pin, gpioModePushPullAlternate, 0);
+ GPIO_PinModeSet(SPI_CS_PIN.port, SPI_CS_PIN.pin, gpioModePushPull, 1);
+ // Enable clock (not needed on xG21)
+ CMU_ClockEnable(SPI_USART_CMU_CLOCK, true);
+
+ // Default asynchronous initializer (master mode, 1 Mbps, 8-bit data)
+ USART_InitSync_TypeDef init = USART_INITSYNC_DEFAULT;
+
+ init.msbf = true; // MSB first transmission for SPI compatibility
+ init.autoCsEnable = true; // Allow the USART to assert CS
+ init.baudrate = 12500000;
+ /*
+ * Route USART RX, TX, and CLK to the specified pins. Note that CS is
+ * not controlled by USART so there is no write to the corresponding
+ * USARTROUTE register to do this.
+ */
+ GPIO->USARTROUTE[SPI_USART_ROUTE_INDEX].RXROUTE =
+ (SPI_MISO_PIN.port << _GPIO_USART_RXROUTE_PORT_SHIFT) | (SPI_MISO_PIN.pin << _GPIO_USART_RXROUTE_PIN_SHIFT);
+ GPIO->USARTROUTE[SPI_USART_ROUTE_INDEX].TXROUTE =
+ (SPI_MOSI_PIN.port << _GPIO_USART_TXROUTE_PORT_SHIFT) | (SPI_MOSI_PIN.pin << _GPIO_USART_TXROUTE_PIN_SHIFT);
+ GPIO->USARTROUTE[SPI_USART_ROUTE_INDEX].CLKROUTE =
+ (SPI_CLOCK_PIN.port << _GPIO_USART_CLKROUTE_PORT_SHIFT) | (SPI_CLOCK_PIN.pin << _GPIO_USART_CLKROUTE_PIN_SHIFT);
+ GPIO->USARTROUTE[SPI_USART_ROUTE_INDEX].CSROUTE =
+ (SPI_CS_PIN.port << _GPIO_USART_CSROUTE_PORT_SHIFT) | (SPI_CS_PIN.pin << _GPIO_USART_CSROUTE_PIN_SHIFT);
+
+ // Enable USART interface pins
+ GPIO->USARTROUTE[SPI_USART_ROUTE_INDEX].ROUTEEN = GPIO_USART_ROUTEEN_RXPEN | // MISO
+ GPIO_USART_ROUTEEN_TXPEN | // MOSI
+ GPIO_USART_ROUTEEN_CLKPEN | GPIO_USART_ROUTEEN_CSPEN;
+
+ // Set slew rate for alternate usage pins
+ GPIO_SlewrateSet(SPI_CLOCK_PIN.port, 7, 7);
+
+ // Configure and enable USART
+ USART_InitSync(SPI_USART, &init);
+
+ SPI_USART->TIMING |= /*USART_TIMING_TXDELAY_ONE | USART_TIMING_CSSETUP_ONE |*/ USART_TIMING_CSHOLD_ONE;
+
+ // SPI_USART->CTRL_SET |= USART_CTRL_SMSDELAY;
+ if (transfer_done_semaphore == NULL)
+ {
+ transfer_done_semaphore = osSemaphoreNew(1, 0, NULL);
+ }
+
+ if (spi_transfer_mutex == 0)
+ {
+ spi_transfer_mutex = osMutexNew(NULL);
+ }
+
+ DMADRV_Init();
+ DMADRV_AllocateChannel(&rx_ldma_channel, NULL);
+ DMADRV_AllocateChannel(&tx_ldma_channel, NULL);
+
+ // Start reset line low
+ GPIO_PinModeSet(RESET_PIN.port, RESET_PIN.pin, gpioModePushPull, 0);
+
+ // configure packet pending interrupt priority
+ NVIC_SetPriority(GPIO_ODD_IRQn, PACKET_PENDING_INT_PRI);
+
+ // Configure interrupt, sleep and wake confirmation pins
+ GPIOINT_CallbackRegister(INTERRUPT_PIN.pin, gpio_interrupt);
+ GPIO_PinModeSet(INTERRUPT_PIN.port, INTERRUPT_PIN.pin, gpioModeInputPullFilter, 0);
+ GPIO_ExtIntConfig(INTERRUPT_PIN.port, INTERRUPT_PIN.pin, INTERRUPT_PIN.pin, true, false, true);
+ GPIO_PinModeSet(SLEEP_CONFIRM_PIN.port, SLEEP_CONFIRM_PIN.pin, gpioModeWiredOrPullDown, 1);
+ GPIO_PinModeSet(WAKE_INDICATOR_PIN.port, WAKE_INDICATOR_PIN.pin, gpioModeWiredOrPullDown, 0);
+
+ return SL_STATUS_OK;
+}
+
+sl_status_t sl_si91x_host_deinit(void)
+{
+ return SL_STATUS_OK;
+}
+
+void sl_si91x_host_enable_high_speed_bus()
+{
+ // SPI_USART->CTRL_SET |= USART_CTRL_SMSDELAY | USART_CTRL_SSSEARLY;
+ // USART_BaudrateSyncSet(SPI_USART, 0, 20000000);
+}
+
+/*==================================================================*/
+/**
+ * @fn sl_status_t sl_si91x_host_spi_transfer(const void *tx_buffer, void *rx_buffer, uint16_t buffer_length)
+ * @param[in] uint8_t *tx_buff, pointer to the buffer with the data to be transferred
+ * @param[in] uint8_t *rx_buff, pointer to the buffer to store the data received
+ * @param[in] uint16_t transfer_length, Number of bytes to send and receive
+ * @param[in] uint8_t mode, To indicate mode 8 BIT/32 BIT mode transfers.
+ * @param[out] None
+ * @return 0, 0=success
+ * @section description
+ * This API is used to transfer/receive data to the Wi-Fi module through the SPI interface.
+ */
+sl_status_t sl_si91x_host_spi_transfer(const void * tx_buffer, void * rx_buffer, uint16_t buffer_length)
+{
+ osMutexAcquire(spi_transfer_mutex, 0xFFFFFFFFUL);
+
+#if SL_SPICTRL_MUX
+ sl_wfx_host_spi_cs_assert();
+#endif // SL_SPICTRL_MUX
+
+ if (buffer_length < 16)
+ {
+ uint8_t * tx = (tx_buffer != NULL) ? (uint8_t *) tx_buffer : (uint8_t *) &dummy_buffer;
+ uint8_t * rx = (rx_buffer != NULL) ? (uint8_t *) rx_buffer : (uint8_t *) &dummy_buffer;
+ while (buffer_length > 0)
+ {
+ while (!(SPI_USART->STATUS & USART_STATUS_TXBL))
+ {
+ }
+ SPI_USART->TXDATA = (uint32_t) *tx;
+ while (!(SPI_USART->STATUS & USART_STATUS_TXC))
+ {
+ }
+ *rx = (uint8_t) SPI_USART->RXDATA;
+ if (tx_buffer != NULL)
+ {
+ tx++;
+ }
+ if (rx_buffer != NULL)
+ {
+ rx++;
+ }
+ buffer_length--;
+ }
+ }
+ else
+ {
+ if (tx_buffer == NULL)
+ {
+ dummy_buffer = 0;
+ ldmaTXDescriptor =
+ (LDMA_Descriptor_t) LDMA_DESCRIPTOR_SINGLE_P2P_BYTE(&dummy_buffer, &(SPI_USART->TXDATA), buffer_length);
+ }
+ else
+ {
+ ldmaTXDescriptor = (LDMA_Descriptor_t) LDMA_DESCRIPTOR_SINGLE_M2P_BYTE(tx_buffer, &(SPI_USART->TXDATA), buffer_length);
+ }
+
+ if (rx_buffer == NULL)
+ {
+ ldmaRXDescriptor =
+ (LDMA_Descriptor_t) LDMA_DESCRIPTOR_SINGLE_P2P_BYTE(&(SPI_USART->RXDATA), &dummy_buffer, buffer_length);
+ }
+ else
+ {
+ ldmaRXDescriptor = (LDMA_Descriptor_t) LDMA_DESCRIPTOR_SINGLE_P2M_BYTE(&(SPI_USART->RXDATA), rx_buffer, buffer_length);
+ }
+
+ // Transfer a byte on free space in the USART buffer
+ ldmaTXConfig = (LDMA_TransferCfg_t) LDMA_TRANSFER_CFG_PERIPHERAL(SPI_USART_LDMA_TX);
+
+ // Transfer a byte on receive data valid
+ ldmaRXConfig = (LDMA_TransferCfg_t) LDMA_TRANSFER_CFG_PERIPHERAL(SPI_USART_LDMA_RX);
+
+#if defined(SL_CATLOG_POWER_MANAGER_PRESENT)
+ sl_power_manager_remove_em_requirement(SL_POWER_MANAGER_EM1);
+#endif
+
+ // Start both channels
+ DMADRV_LdmaStartTransfer(rx_ldma_channel, &ldmaRXConfig, &ldmaRXDescriptor, dma_callback, NULL);
+ DMADRV_LdmaStartTransfer(tx_ldma_channel, &ldmaTXConfig, &ldmaTXDescriptor, NULL, NULL);
+
+ if (osSemaphoreAcquire(transfer_done_semaphore, 1000) != osOK)
+ {
+ BREAKPOINT();
+ }
+ }
+
+ osMutexRelease(spi_transfer_mutex);
+#if SL_SPICTRL_MUX
+ sl_wfx_host_spi_cs_deassert();
+#endif // SL_SPICTRL_MUX
+ return SL_STATUS_OK;
+}
+
+void sl_si91x_host_hold_in_reset(void)
+{
+ GPIO_PinModeSet(RESET_PIN.port, RESET_PIN.pin, gpioModePushPull, 1);
+ GPIO_PinOutClear(RESET_PIN.port, RESET_PIN.pin);
+}
+
+void sl_si91x_host_release_from_reset(void)
+{
+ GPIO_PinModeSet(RESET_PIN.port, RESET_PIN.pin, gpioModeWiredOrPullDown, 1);
+}
+
+void sl_si91x_host_enable_bus_interrupt(void)
+{
+ NVIC_EnableIRQ(GPIO_ODD_IRQn);
+}
+
+void sl_si91x_host_disable_bus_interrupt(void)
+{
+ NVIC_DisableIRQ(GPIO_ODD_IRQn);
+}
+
+bool sl_si91x_host_is_in_irq_context(void)
+{
+ return (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) != 0U;
+}
\ No newline at end of file
diff --git a/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c b/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c
index 1e30b8bdf2f9c6..ad6b5ed5e3418d 100644
--- a/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c
+++ b/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c
@@ -38,7 +38,6 @@
#include "spidrv.h"
#include "sl_device_init_clocks.h"
-#include "sl_device_init_dpll.h"
#include "sl_device_init_hfxo.h"
#include "sl_spidrv_instances.h"
#include "sl_status.h"
@@ -48,27 +47,15 @@
#include "wfx_host_events.h"
#include "wfx_rsi.h"
+#define DEFAULT_SPI_TRASFER_MODE 0
+// Macro to drive semaphore block minimun timer in milli seconds
+#define RSI_SEM_BLOCK_MIN_TIMER_VALUE_MS (50)
#if defined(SL_CATALOG_POWER_MANAGER_PRESENT)
#include "sl_power_manager.h"
#endif
-#ifdef CHIP_9117
-#include "cmsis_os2.h"
-#include "sl_board_configuration.h"
-#include "sl_net.h"
-#include "sl_si91x_driver.h"
-#include "sl_si91x_types.h"
-#include "sl_wifi_callback_framework.h"
-#include "sl_wifi_constants.h"
-#include "sl_wifi_types.h"
-
-// macro to drive semaphore block minimum timer in milli seconds
-// ported from rsi_hal.h (rs911x)
-#define RSI_SEM_BLOCK_MIN_TIMER_VALUE_MS (50)
-#else
#include "rsi_board_configuration.h"
#include "rsi_driver.h"
-#endif // CHIP_9117
#if SL_BTLCTRL_MUX
#include "btl_interface.h"
@@ -110,6 +97,16 @@ static TaskHandle_t spiInitiatorTaskHandle = NULL;
static uint32_t dummy_buffer; /* Used for DMA - when results don't matter */
+#if defined(EFR32MG12)
+#include "sl_spidrv_exp_config.h"
+extern SPIDRV_Handle_t sl_spidrv_exp_handle;
+#define SL_SPIDRV_HANDLE sl_spidrv_exp_handle
+#elif defined(EFR32MG24)
+#include "spi_multiplex.h"
+#else
+#error "Unknown platform"
+#endif
+
// variable to identify spi configured for expansion header
// EUSART configuration available on the SPIDRV
static bool spi_enabled = false;
@@ -174,6 +171,11 @@ void sl_wfx_host_reset_chip(void)
vTaskDelay(pdMS_TO_TICKS(3));
}
+void gpio_interrupt(uint8_t interrupt_number)
+{
+ UNUSED_PARAMETER(interrupt_number);
+}
+
/*****************************************************************
* @fn void rsi_hal_board_init(void)
* @brief
@@ -202,13 +204,6 @@ void rsi_hal_board_init(void)
sl_wfx_host_reset_chip();
}
-// wifi-sdk
-sl_status_t sl_si91x_host_bus_init(void)
-{
- rsi_hal_board_init();
- return SL_STATUS_OK;
-}
-
void sl_si91x_host_enable_high_speed_bus()
{
// dummy function for wifi-sdk
@@ -461,20 +456,3 @@ int16_t rsi_spi_transfer(uint8_t * tx_buf, uint8_t * rx_buf, uint16_t xlen, uint
#endif // SL_SPICTRL_MUX
return rsiError;
}
-
-#ifdef CHIP_9117
-/*********************************************************************
- * @fn int16_t sl_si91x_host_spi_transfer(uint8_t *tx_buf, uint8_t *rx_buf, uint16_t xlen)
- * @param[in] uint8_t *tx_buff, pointer to the buffer with the data to be transferred
- * @param[in] uint8_t *rx_buff, pointer to the buffer to store the data received
- * @param[in] uint16_t transfer_length, Number of bytes to send and receive
- * @param[out] None
- * @return 0, 0=success
- * @section description
- * This API is used to transfer/receive data to the Wi-Fi module through the SPI interface.
- **************************************************************************/
-sl_status_t sl_si91x_host_spi_transfer(const void * tx_buf, void * rx_buf, uint16_t xlen)
-{
- return (rsi_spi_transfer((uint8_t *) tx_buf, rx_buf, xlen, RSI_MODE_8BIT));
-}
-#endif // CHIP_9117
diff --git a/examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_interrupt.c b/examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_interrupt.c
index b57bd9cf988f4f..f7a40551fdc5b5 100644
--- a/examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_interrupt.c
+++ b/examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_interrupt.c
@@ -41,6 +41,7 @@
#if (SIWX_917 | EXP_BOARD)
#include "sl_board_configuration.h"
+#include "sl_rsi_utility.h"
#include "sl_si91x_host_interface.h"
void gpio_interrupt(uint8_t interrupt_number);
diff --git a/examples/platform/silabs/efr32/rs911x/hal/sl_board_configuration_SiWx917.h b/examples/platform/silabs/efr32/rs911x/hal/sl_board_configuration_SiWx917.h
new file mode 100644
index 00000000000000..7145e318b33d30
--- /dev/null
+++ b/examples/platform/silabs/efr32/rs911x/hal/sl_board_configuration_SiWx917.h
@@ -0,0 +1,62 @@
+#pragma once
+
+#ifdef SL_UART
+#include "sl_device_registers.h"
+#include "sl_uart.h"
+
+#define DEFAULT_UART USART0
+
+#define SL_UART_VCOM_PORT SL_GPIO_PORT_D
+#define SL_UART_VCOM_PIN 4
+static const sl_gpio_t vcom_enable_pin = { SL_UART_VCOM_PORT, SL_UART_VCOM_PIN };
+
+#define DEFAULT_UART_PIN_CONFIG &default_uart_pin_configuration
+
+// XXX: HACK to get things working
+#define UART_CLOCK cmuClock_USART0
+#define UART_RX_IRQ USART0_RX_IRQn
+
+/* Note: This creates a static instance for each C file that includes this header and references the variable */
+static const sl_uart_pin_configuration_t default_uart_pin_configuration = {
+ .tx_port = SL_GPIO_PORT_A,
+ .tx_pin = 5,
+ .rx_port = SL_GPIO_PORT_A,
+ .rx_pin = 6,
+ .cts_port = SL_GPIO_PORT_A,
+ .cts_pin = 4,
+ .rts_port = SL_GPIO_PORT_C,
+ .rts_pin = 1,
+ .uart_number = 0,
+ //.route_loc = USART_ROUTELOC0_RXLOC_LOC4 | USART_ROUTELOC0_TXLOC_LOC4,
+};
+#endif
+
+typedef struct
+{
+ unsigned char port;
+ unsigned char pin;
+} sl_pin_t;
+
+#define PIN(port_id, pin_id) \
+ (sl_pin_t) \
+ { \
+ .port = gpioPort##port_id, .pin = pin_id \
+ }
+
+#define SLEEP_CONFIRM_PIN PIN(D, 2)
+#define WAKE_INDICATOR_PIN PIN(A, 5)
+#define RESET_PIN PIN(A, 6)
+#define INTERRUPT_PIN PIN(A, 7)
+
+#define SPI_CLOCK_PIN PIN(C, 3)
+#define SPI_MOSI_PIN PIN(C, 1)
+#define SPI_MISO_PIN PIN(C, 2)
+#define SPI_CS_PIN PIN(C, 0)
+
+#define SPI_USART USART0
+#define SPI_USART_CMU_CLOCK cmuClock_USART0
+#define SPI_USART_LDMA_TX ldmaPeripheralSignal_USART0_TXBL
+#define SPI_USART_LDMA_RX ldmaPeripheralSignal_USART0_RXDATAV
+#define SPI_USART_ROUTE_INDEX 0
+
+#define PACKET_PENDING_INT_PRI 3
diff --git a/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.c b/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.c
new file mode 100644
index 00000000000000..6a9d02f47dd027
--- /dev/null
+++ b/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.c
@@ -0,0 +1,280 @@
+/*
+ *
+ * Copyright (c) 2023 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
+#include
+#include
+
+#include "FreeRTOS.h"
+#include "dmadrv.h"
+#include "em_chip.h"
+#include "em_cmu.h"
+#include "em_core.h"
+#include "em_device.h"
+#include "em_gpio.h"
+#include "em_ldma.h"
+#include "event_groups.h"
+#include "gpiointerrupt.h"
+#include "semphr.h"
+#include "spidrv.h"
+#include "task.h"
+
+#include "sl_device_init_clocks.h"
+#include "sl_device_init_hfxo.h"
+#include "sl_status.h"
+
+#include "silabs_utils.h"
+#include "sl_si91x_ncp_utility.h"
+#include "wfx_host_events.h"
+#include "wfx_rsi.h"
+
+#if SL_MX25CTRL_MUX
+sl_status_t sl_wfx_host_spiflash_cs_assert(void);
+sl_status_t sl_wfx_host_spiflash_cs_deassert(void);
+#endif
+
+#if SL_BTLCTRL_MUX
+#include "btl_interface.h"
+#endif // SL_BTLCTRL_MUX
+#if SL_LCDCTRL_MUX
+#include "sl_memlcd.h"
+#endif // SL_LCDCTRL_MUX
+#if SL_MX25CTRL_MUX
+#include "sl_mx25_flash_shutdown_usart_config.h"
+#endif // SL_MX25CTRL_MUX
+
+#define CONCAT(A, B) (A##B)
+#define SPI_CLOCK(N) CONCAT(cmuClock_USART, N)
+
+#if SL_SPICTRL_MUX
+StaticSemaphore_t spi_sem_peripheral;
+SemaphoreHandle_t spi_sem_sync_hdl;
+#endif // SL_SPICTRL_MUX
+
+#if SL_LCDCTRL_MUX
+
+/********************************************************
+ * @fn sl_wfx_host_pre_lcd_spi_transfer(void)
+ * @brief
+ * Deal with the SPI PINS MUX that are associated with LCD. for setup before data transfer PINS.
+ * @return
+ * None
+ **********************************************************/
+sl_status_t sl_wfx_host_pre_lcd_spi_transfer(void)
+{
+#if SL_SPICTRL_MUX
+ if (sl_wfx_host_spi_cs_deassert() != SL_STATUS_OK)
+ {
+ return SL_STATUS_FAIL;
+ }
+ xSemaphoreTake(spi_sem_sync_hdl, portMAX_DELAY);
+#endif // SL_SPICTRL_MUX
+ // sl_memlcd_refresh takes care of SPIDRV_Init()
+ if (SL_STATUS_OK != sl_memlcd_refresh(sl_memlcd_get()))
+ {
+#if SL_SPICTRL_MUX
+ xSemaphoreGive(spi_sem_sync_hdl);
+#endif // SL_SPICTRL_MUX
+ SILABS_LOG("%s error.", __func__);
+ return SL_STATUS_FAIL;
+ }
+ return SL_STATUS_OK;
+}
+
+/********************************************************
+ * @fn sl_wfx_host_post_lcd_spi_transfer(void)
+ * @brief
+ * Deal with the SPI PINS MUX that are associated with LCD. for setup after data transfer PINS.
+ * @return
+ * None
+ **********************************************************/
+sl_status_t sl_wfx_host_post_lcd_spi_transfer(void)
+{
+ USART_Enable(SL_MEMLCD_SPI_PERIPHERAL, usartDisable);
+ CMU_ClockEnable(SPI_CLOCK(SL_MEMLCD_SPI_PERIPHERAL_NO), false);
+ GPIO->USARTROUTE[SL_MEMLCD_SPI_PERIPHERAL_NO].ROUTEEN = PINOUT_CLEAR;
+#if SL_SPICTRL_MUX
+ xSemaphoreGive(spi_sem_sync_hdl);
+#endif // SL_SPICTRL_MUX
+ return SL_STATUS_OK;
+}
+#endif // SL_LCDCTRL_MUX
+
+#if SL_SPICTRL_MUX
+
+void SPIDRV_SetBaudrate(uint32_t baudrate)
+{
+#if !defined(CHIP_9117)
+ if (EUSART_BaudrateGet(MY_USART) == baudrate)
+ {
+ // EUSART synced to baudrate already
+ return;
+ }
+ EUSART_BaudrateSet(MY_USART, 0, baudrate);
+#endif
+}
+
+/********************************************************
+ * @fn spi_board_init(void)
+ * @brief
+ * Deal with the SPI PINS multiplexing related changes for the initialization.
+ * @return
+ * None
+ **********************************************************/
+sl_status_t spi_board_init()
+{
+#if SL_SPICTRL_MUX
+ if (spi_sem_sync_hdl == NULL)
+ {
+ spi_sem_sync_hdl = xSemaphoreCreateBinaryStatic(&spi_sem_peripheral);
+ }
+ configASSERT(spi_sem_sync_hdl);
+ xSemaphoreGive(spi_sem_sync_hdl);
+#endif /* SL_SPICTRL_MUX */
+ return SL_STATUS_OK;
+}
+
+/********************************************************
+ * @fn sl_wfx_host_spi_cs_assert(void)
+ * @brief
+ * Deal with the SPI PINS multiplexing related changes for the initialization.
+ * @return
+ * None
+ **********************************************************/
+sl_status_t sl_wfx_host_spi_cs_assert(void)
+{
+ xSemaphoreTake(spi_sem_sync_hdl, portMAX_DELAY);
+
+ if (!spi_enabled) // Reduce sl_spidrv_init_instances
+ {
+
+#if defined(EFR32MG24)
+#if defined(CHIP_9117)
+ GPIO_PinOutClear(SPI_CS_PIN.port, SPI_CS_PIN.pin);
+#else
+ sl_spidrv_init_instances();
+ GPIO_PinOutClear(SL_SPIDRV_EUSART_EXP_CS_PORT, SL_SPIDRV_EUSART_EXP_CS_PIN);
+#endif // CHIP_9117
+#endif // EFR32MG24
+ spi_enabled = true;
+ }
+ return SL_STATUS_OK;
+}
+
+sl_status_t sl_wfx_host_spi_cs_deassert(void)
+{
+ if (spi_enabled)
+ {
+#if defined(CHIP_9117)
+ LDMA_DeInit();
+ xSemaphoreGive(spi_sem_sync_hdl);
+ SILABS_LOG("%s error.", __func__);
+#else
+ if (ECODE_EMDRV_SPIDRV_OK != SPIDRV_DeInit(SL_SPIDRV_HANDLE))
+ {
+ xSemaphoreGive(spi_sem_sync_hdl);
+ SILABS_LOG("%s error.", __func__);
+ return SL_STATUS_FAIL;
+ }
+#endif
+#if defined(EFR32MG24)
+#if defined(CHIP_9117)
+ GPIO_PinModeSet(SPI_CS_PIN.port, SPI_CS_PIN.pin, gpioModePushPull, 1);
+ GPIO->USARTROUTE[SPI_USART_ROUTE_INDEX].ROUTEEN = PINOUT_CLEAR;
+#else
+ GPIO_PinOutSet(SL_SPIDRV_EUSART_EXP_CS_PORT, SL_SPIDRV_EUSART_EXP_CS_PIN);
+ GPIO->EUSARTROUTE[SL_SPIDRV_EUSART_EXP_PERIPHERAL_NO].ROUTEEN = PINOUT_CLEAR;
+#endif // CHIP_9117
+#endif // EFR32MG24
+ spi_enabled = false;
+ }
+ xSemaphoreGive(spi_sem_sync_hdl);
+ return SL_STATUS_OK;
+}
+#endif // SL_SPICTRL_MUX
+
+#if SL_BTLCTRL_MUX
+sl_status_t sl_wfx_host_pre_bootloader_spi_transfer(void)
+{
+#if SL_SPICTRL_MUX
+ if (sl_wfx_host_spi_cs_deassert() != SL_STATUS_OK)
+ {
+ return SL_STATUS_FAIL;
+ }
+ xSemaphoreTake(spi_sem_sync_hdl, portMAX_DELAY);
+#endif // SL_SPICTRL_MUX
+ int32_t status = BOOTLOADER_OK;
+#if defined(CHIP_9117)
+ LDMA_Init_t ldma_init = LDMA_INIT_DEFAULT;
+ LDMA_Init(&ldma_init);
+#else
+ // bootloader_init takes care of SPIDRV_Init()
+ status = bootloader_init();
+#endif
+ if (status != BOOTLOADER_OK)
+ {
+ SILABS_LOG("bootloader_init error: %x", status);
+#if SL_SPICTRL_MUX
+ xSemaphoreGive(spi_sem_sync_hdl);
+#endif // SL_SPICTRL_MUX
+ return SL_STATUS_FAIL;
+ }
+#if SL_MX25CTRL_MUX
+ sl_wfx_host_spiflash_cs_assert();
+#endif // SL_MX25CTRL_MUX
+ return SL_STATUS_OK;
+}
+
+sl_status_t sl_wfx_host_post_bootloader_spi_transfer(void)
+{
+ // bootloader_deinit will do USART disable
+ int32_t status = bootloader_deinit();
+ if (status != BOOTLOADER_OK)
+ {
+ SILABS_LOG("bootloader_deinit error: %x", status);
+#if SL_SPICTRL_MUX
+ xSemaphoreGive(spi_sem_sync_hdl);
+#endif // SL_SPICTRL_MUX
+ return SL_STATUS_FAIL;
+ }
+ GPIO->USARTROUTE[SL_MX25_FLASH_SHUTDOWN_PERIPHERAL_NO].ROUTEEN = PINOUT_CLEAR;
+#if SL_MX25CTRL_MUX
+ sl_wfx_host_spiflash_cs_deassert();
+#endif // SL_MX25CTRL_MUX
+#if SL_SPICTRL_MUX
+ xSemaphoreGive(spi_sem_sync_hdl);
+#endif // SL_SPICTRL_MUX
+ return SL_STATUS_OK;
+}
+#endif // SL_BTLCTRL_MUX
+
+#if SL_MX25CTRL_MUX
+sl_status_t sl_wfx_host_spiflash_cs_assert(void)
+{
+ GPIO_PinOutClear(SL_MX25_FLASH_SHUTDOWN_CS_PORT, SL_MX25_FLASH_SHUTDOWN_CS_PIN);
+ return SL_STATUS_OK;
+}
+
+sl_status_t sl_wfx_host_spiflash_cs_deassert(void)
+{
+ GPIO_PinOutSet(SL_MX25_FLASH_SHUTDOWN_CS_PORT, SL_MX25_FLASH_SHUTDOWN_CS_PIN);
+ return SL_STATUS_OK;
+}
+#endif // SL_MX25CTRL_MUX
\ No newline at end of file
diff --git a/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.h b/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.h
new file mode 100644
index 00000000000000..a1e6f4525e5bb2
--- /dev/null
+++ b/examples/platform/silabs/efr32/rs911x/hal/sl_si91x_ncp_utility.h
@@ -0,0 +1,55 @@
+/*
+ *
+ * Copyright (c) 2023 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.
+ */
+
+/*
+ * This file contains all the functions specific to the MG24 family for
+ * multiplexing the SPI port with WiFi NCP and other WSTK
+ * devices such as External Flash and LCD.
+ * That can be extended to other families as well.
+ */
+
+#include "silabs_utils.h"
+#include "sl_status.h"
+#include "spi_multiplex.h"
+
+#if defined(CHIP_9117)
+#include "sl_board_configuration_SiWx917.h"
+#else
+#include "sl_board_configuration.h"
+#if defined(EFR32MG12)
+#include "em_usart.h"
+#include "sl_spidrv_exp_config.h"
+extern SPIDRV_Handle_t sl_spidrv_exp_handle;
+#define SL_SPIDRV_HANDLE sl_spidrv_exp_handle
+#elif defined(EFR32MG24)
+#include "em_eusart.h"
+#include "sl_spidrv_eusart_exp_config.h"
+#include "sl_spidrv_instances.h"
+
+#define SL_SPIDRV_HANDLE sl_spidrv_eusart_exp_handle
+#else // EFR32MG12 || EFR32MG24
+#error "Unknown platform"
+#endif
+#endif // CHIP_9117
+
+// variable to identify spi configured for expansion header
+// EUSART configuration available on the SPIDRV
+
+#if SL_SPICTRL_MUX
+sl_status_t spi_board_init(void);
+static bool spi_enabled = false;
+#endif // SL_SPICTRL_MUX
diff --git a/examples/platform/silabs/efr32/rs911x/rs9117.gni b/examples/platform/silabs/efr32/rs911x/rs9117.gni
index a753a66153bec4..251de0be213fe6 100644
--- a/examples/platform/silabs/efr32/rs911x/rs9117.gni
+++ b/examples/platform/silabs/efr32/rs911x/rs9117.gni
@@ -6,47 +6,28 @@ rs911x_src_plat = [
"${examples_plat_dir}/rs911x/sl_wifi_if.c",
"${examples_plat_dir}/rs911x/wfx_rsi_host.c",
"${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_interrupt.c",
- "${examples_plat_dir}/rs911x/hal/efx_spi.c",
+ "${examples_plat_dir}/rs911x/hal/sl_si91x_ncp_utility.c",
+ "${examples_plat_dir}/rs911x/hal/efx32_ncp_host.c",
"${silabs_plat_efr32_wifi_dir}/wfx_notify.cpp",
]
-rs911x_inc_plat = [
+rs9117_inc_plat = [
"${examples_plat_dir}/rs911x",
"${examples_plat_dir}/rs911x/hal",
"${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",
-
- # wifi component
- "${wifi_sdk_root}/components/protocol/wifi/inc",
-
- # si91x_support component
- "${wifi_sdk_root}/components/si91x_support/inc",
-
- # 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",
-
- "${wifi_sdk_root}/components/protocol/wifi/si91x",
]
rs911x_cflags = [ "-Wno-empty-body" ]
-rs911x_src_sapi = [
- "${wifi_sdk_root}/components/si91x/src/sl_si91x_driver.c",
- "${wifi_sdk_root}/components/si91x/spi_interface/sl_si91x_spi_driver.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/threading/sli_si91x_multithreaded.c",
- "${wifi_sdk_root}/components/si91x/sl_net/src/sl_net_si91x.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_integration_handler.c",
+rs9117_src_sapi = [
+ # sl_si91x_wireless component
+ "${wifi_sdk_root}/components/device/silabs/si91x/wireless/src/sl_si91x_driver.c",
+ "${wifi_sdk_root}/components/device/silabs/si91x/wireless/src/sl_rsi_utility.c",
+ "${wifi_sdk_root}/components/device/silabs/si91x/wireless/src/sl_si91x_callback_framework.c",
+ "${wifi_sdk_root}/components/device/silabs/si91x/wireless/threading/sli_si91x_multithreaded.c",
+ "${wifi_sdk_root}/components/device/silabs/si91x/wireless/sl_net/src/sl_net_rsi_utility.c",
+ "${wifi_sdk_root}/components/device/silabs/si91x/wireless/sl_net/src/sl_net_si91x_integration_handler.c",
+ "${wifi_sdk_root}/components/device/silabs/si91x/wireless/sl_net/src/sl_si91x_net_credentials.c",
+ "${wifi_sdk_root}/components/device/silabs/si91x/wireless/spi_interface/sl_si91x_spi_driver.c",
# wifi component
"${wifi_sdk_root}/components/protocol/wifi/src/sl_wifi_callback_framework.c",
@@ -57,13 +38,12 @@ rs911x_src_sapi = [
"${wifi_sdk_root}/components/service/network_manager/src/sl_net_basic_profiles.c",
# si91x_basic_buffers component
- "${wifi_sdk_root}/components/si91x/memory/malloc_buffers.c",
+ "${wifi_sdk_root}/components/device/silabs/si91x/wireless/memory/malloc_buffers.c",
# si91x_support component
- "${wifi_sdk_root}/components/si91x_support/src/sl_utility.c",
+ "${wifi_sdk_root}/components/common/src/sl_utility.c",
# network_manager component
"${wifi_sdk_root}/components/service/network_manager/src/sl_net_basic_certificate_store.c",
"${wifi_sdk_root}/components/service/network_manager/src/sl_net.c",
- "${wifi_sdk_root}/components/si91x/platforms/efx32/efx32_ncp_host.c",
]
diff --git a/examples/platform/silabs/efr32/rs911x/sl_wlan_config.h b/examples/platform/silabs/efr32/rs911x/sl_wlan_config.h
index 91acde1ecbcb2a..c8eef5c60e830e 100644
--- a/examples/platform/silabs/efr32/rs911x/sl_wlan_config.h
+++ b/examples/platform/silabs/efr32/rs911x/sl_wlan_config.h
@@ -34,7 +34,7 @@ static const sl_wifi_device_configuration_t config = {
.boot_config = { .oper_mode = SL_SI91X_CLIENT_MODE,
.coex_mode = SL_SI91X_WLAN_BLE_MODE,
.feature_bit_map =
-#ifdef RSI_M4_INTERFACE
+#ifdef SLI_SI91X_MCU_INTERFACE
(SL_SI91X_FEAT_SECURITY_OPEN | SL_SI91X_FEAT_WPS_DISABLE),
#else
(SL_SI91X_FEAT_SECURITY_OPEN | SL_SI91X_FEAT_AGGREGATION),
@@ -45,12 +45,12 @@ static const sl_wifi_device_configuration_t config = {
| SL_SI91X_TCP_IP_FEAT_DHCPV6_CLIENT | SL_SI91X_TCP_IP_FEAT_IPV6
#endif
| SL_SI91X_TCP_IP_FEAT_ICMP | SL_SI91X_TCP_IP_FEAT_EXTENSION_VALID),
- .custom_feature_bit_map = (SL_SI91X_FEAT_CUSTOM_FEAT_EXTENTION_VALID | RSI_CUSTOM_FEATURE_BIT_MAP),
+ .custom_feature_bit_map = (SL_SI91X_CUSTOM_FEAT_EXTENTION_VALID | RSI_CUSTOM_FEATURE_BIT_MAP),
.ext_custom_feature_bit_map = (
-#ifdef CHIP_917
+#ifdef SLI_SI917
(RSI_EXT_CUSTOM_FEATURE_BIT_MAP)
#else // defaults
-#ifdef RSI_M4_INTERFACE
+#ifdef SLI_SI91X_MCU_INTERFACE
(SL_SI91X_EXT_FEAT_256K_MODE | RSI_EXT_CUSTOM_FEATURE_BIT_MAP)
#else
(SL_SI91X_EXT_FEAT_384K_MODE | RSI_EXT_CUSTOM_FEATURE_BIT_MAP)
diff --git a/examples/platform/silabs/efr32/rs911x/wfx_rsi.h b/examples/platform/silabs/efr32/rs911x/wfx_rsi.h
index 2275549ef7af41..4d692064a5768f 100644
--- a/examples/platform/silabs/efr32/rs911x/wfx_rsi.h
+++ b/examples/platform/silabs/efr32/rs911x/wfx_rsi.h
@@ -51,6 +51,7 @@
#define WFX_RSI_ST_STA_READY (WFX_RSI_ST_STA_CONNECTED | WFX_RSI_ST_STA_DHCP_DONE)
#define WFX_RSI_ST_STARTED (0x200) /* RSI task started */
#define WFX_RSI_ST_SCANSTARTED (0x400) /* Scan Started */
+#define WFX_RSI_ST_SLEEP_READY (0x800) /* Notify the M4 to go to sleep*/
struct wfx_rsi
{
diff --git a/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c b/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c
index 3482f222b3bc35..331895bd3e524e 100644
--- a/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c
+++ b/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c
@@ -31,7 +31,6 @@
#include "FreeRTOS.h"
#include "event_groups.h"
#include "task.h"
-
#include "wfx_host_events.h"
#include "wfx_rsi.h"
diff --git a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter
index 06285dfbaebaa7..8fa6b50f6c87e7 100644
--- a/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter
+++ b/examples/thermostat/qpg/zap/thermostaticRadiatorValve.matter
@@ -1536,6 +1536,16 @@ cluster Thermostat = 513 {
kCoolingAndHeatingWithReheat = 5;
}
+ enum PresetScenarioEnum : enum8 {
+ kUnspecified = 0;
+ kOccupied = 1;
+ kUnoccupied = 2;
+ kSleep = 3;
+ kWake = 4;
+ kVacation = 5;
+ kUserDefined = 6;
+ }
+
enum SetpointChangeSourceEnum : enum8 {
kManual = 0;
kSchedule = 1;
@@ -1597,6 +1607,10 @@ cluster Thermostat = 513 {
kSetback = 0x10;
kAutoMode = 0x20;
kLocalTemperatureNotExposed = 0x40;
+ kMatterScheduleConfiguration = 0x80;
+ kPresets = 0x100;
+ kSetpoints = 0x200;
+ kQueuedPresetsSupported = 0x400;
}
bitmap HVACSystemTypeBitmap : bitmap8 {
@@ -1606,6 +1620,11 @@ cluster Thermostat = 513 {
kHeatingUsesFuel = 0x20;
}
+ bitmap PresetTypeFeaturesBitmap : bitmap16 {
+ kAutomatic = 0x1;
+ kSupportsNames = 0x2;
+ }
+
bitmap ProgrammingOperationModeBitmap : bitmap8 {
kScheduleActive = 0x1;
kAutoRecovery = 0x2;
@@ -1644,6 +1663,62 @@ cluster Thermostat = 513 {
kCoolSetpointPresent = 0x2;
}
+ bitmap ScheduleTypeFeaturesBitmap : bitmap16 {
+ kSupportsPresets = 0x1;
+ kSupportsSetpoints = 0x2;
+ kSupportsNames = 0x4;
+ kSupportsOff = 0x8;
+ }
+
+ bitmap TemperatureSetpointHoldPolicyBitmap : bitmap8 {
+ kHoldDurationElapsed = 0x1;
+ kHoldDurationElapsedOrPresetChanged = 0x2;
+ }
+
+ struct ScheduleTransitionStruct {
+ ScheduleDayOfWeekBitmap dayOfWeek = 0;
+ int16u transitionTime = 1;
+ optional octet_string<16> presetHandle = 2;
+ optional SystemModeEnum systemMode = 3;
+ optional temperature coolingSetpoint = 4;
+ optional temperature heatingSetpoint = 5;
+ }
+
+ struct ScheduleStruct {
+ nullable octet_string<16> scheduleHandle = 0;
+ SystemModeEnum systemMode = 1;
+ optional char_string<64> name = 2;
+ optional octet_string<16> presetHandle = 3;
+ ScheduleTransitionStruct transitions[] = 4;
+ optional nullable boolean builtIn = 5;
+ }
+
+ struct PresetStruct {
+ nullable octet_string<16> presetHandle = 0;
+ PresetScenarioEnum presetScenario = 1;
+ optional nullable char_string<64> name = 2;
+ optional temperature coolingSetpoint = 3;
+ optional temperature heatingSetpoint = 4;
+ nullable boolean builtIn = 5;
+ }
+
+ struct PresetTypeStruct {
+ PresetScenarioEnum presetScenario = 0;
+ int8u numberOfPresets = 1;
+ PresetTypeFeaturesBitmap presetTypeFeatures = 2;
+ }
+
+ struct QueuedPresetStruct {
+ nullable octet_string<16> presetHandle = 0;
+ nullable epoch_s transitionTimestamp = 1;
+ }
+
+ struct ScheduleTypeStruct {
+ SystemModeEnum systemMode = 0;
+ int8u numberOfSchedules = 1;
+ ScheduleTypeFeaturesBitmap scheduleTypeFeatures = 2;
+ }
+
struct WeeklyScheduleTransitionStruct {
int16u transitionTime = 0;
nullable temperature heatSetpoint = 1;
@@ -1699,6 +1774,20 @@ cluster Thermostat = 513 {
attribute access(write: manage) optional ACLouverPositionEnum ACLouverPosition = 69;
readonly attribute optional nullable temperature ACCoilTemperature = 70;
attribute access(write: manage) optional ACCapacityFormatEnum ACCapacityformat = 71;
+ readonly attribute optional PresetTypeStruct presetTypes[] = 72;
+ readonly attribute optional ScheduleTypeStruct scheduleTypes[] = 73;
+ readonly attribute optional int8u numberOfPresets = 74;
+ readonly attribute optional int8u numberOfSchedules = 75;
+ readonly attribute optional int8u numberOfScheduleTransitions = 76;
+ readonly attribute optional nullable int8u numberOfScheduleTransitionPerDay = 77;
+ readonly attribute optional nullable octet_string<16> activePresetHandle = 78;
+ readonly attribute optional nullable octet_string<16> activeScheduleHandle = 79;
+ attribute access(write: manage) optional PresetStruct presets[] = 80;
+ attribute access(write: manage) optional ScheduleStruct schedules[] = 81;
+ readonly attribute optional boolean presetsSchedulesEditable = 82;
+ readonly attribute optional TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 83;
+ readonly attribute optional nullable epoch_s setpointHoldExpiryTimestamp = 84;
+ readonly attribute optional nullable QueuedPresetStruct queuedPreset = 85;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
@@ -1730,14 +1819,45 @@ cluster Thermostat = 513 {
ScheduleModeBitmap modeToReturn = 1;
}
+ request struct SetActiveScheduleRequestRequest {
+ octet_string<16> scheduleHandle = 0;
+ }
+
+ request struct SetActivePresetRequestRequest {
+ octet_string<16> presetHandle = 0;
+ optional int16u delayMinutes = 1;
+ }
+
+ request struct StartPresetsSchedulesEditRequestRequest {
+ int16u timeoutSeconds = 0;
+ }
+
+ request struct SetTemperatureSetpointHoldPolicyRequest {
+ TemperatureSetpointHoldPolicyBitmap temperatureSetpointHoldPolicy = 0;
+ }
+
/** Command description for SetpointRaiseLower */
command SetpointRaiseLower(SetpointRaiseLowerRequest): DefaultSuccess = 0;
/** Command description for SetWeeklySchedule */
command access(invoke: manage) SetWeeklySchedule(SetWeeklyScheduleRequest): DefaultSuccess = 1;
/** Command description for GetWeeklySchedule */
command GetWeeklySchedule(GetWeeklyScheduleRequest): GetWeeklyScheduleResponse = 2;
- /** The Clear Weekly Schedule command is used to clear the weekly schedule. */
+ /** This command is used to clear the weekly schedule. The ClearWeeklySchedule command has no payload. */
command access(invoke: manage) ClearWeeklySchedule(): DefaultSuccess = 3;
+ /** This command is used to set the active schedule. */
+ command SetActiveScheduleRequest(SetActiveScheduleRequestRequest): DefaultSuccess = 5;
+ /** This command is used to set the active preset. */
+ command SetActivePresetRequest(SetActivePresetRequestRequest): DefaultSuccess = 6;
+ /** This command is used to start editing the presets and schedules. */
+ command access(invoke: manage) StartPresetsSchedulesEditRequest(StartPresetsSchedulesEditRequestRequest): DefaultSuccess = 7;
+ /** This command is used to cancel editing presets and schedules. */
+ command access(invoke: manage) CancelPresetsSchedulesEditRequest(): DefaultSuccess = 8;
+ /** This command is used to notify the server that all edits are done and should be committed. */
+ command access(invoke: manage) CommitPresetsSchedulesRequest(): DefaultSuccess = 9;
+ /** This command is sent to cancel a queued preset. */
+ command access(invoke: manage) CancelSetActivePresetRequest(): DefaultSuccess = 10;
+ /** This command sets the set point hold policy. */
+ command SetTemperatureSetpointHoldPolicy(SetTemperatureSetpointHoldPolicyRequest): DefaultSuccess = 11;
}
/** An interface for configuring the user interface of a thermostat (which may be remote from the thermostat). */
diff --git a/scripts/examples/gn_silabs_example.sh b/scripts/examples/gn_silabs_example.sh
index b3f9906e0dae38..fc8fcfd387f8fa 100755
--- a/scripts/examples/gn_silabs_example.sh
+++ b/scripts/examples/gn_silabs_example.sh
@@ -292,7 +292,7 @@ else
if [ "$SILABS_BOARD" == "BRD4338A" ]; then
echo "Compiling for 917 WiFi SOC"
USE_WIFI=true
- optArgs+="chip_device_platform =\"SiWx917\" "
+ optArgs+="chip_device_platform =\"SiWx917\" is_debug=false "
fi
if [ "$USE_GIT_SHA_FOR_VERSION" == true ]; then
diff --git a/src/controller/python/chip/ChipDeviceCtrl.py b/src/controller/python/chip/ChipDeviceCtrl.py
index 5f57c5e8266d9e..20e21177fe2b1d 100644
--- a/src/controller/python/chip/ChipDeviceCtrl.py
+++ b/src/controller/python/chip/ChipDeviceCtrl.py
@@ -852,6 +852,34 @@ def GetRemoteSessionParameters(self, nodeid) -> typing.Optional[SessionParameter
return res
+ async def TestOnlySendBatchCommands(self, nodeid: int, commands: typing.List[ClusterCommand.InvokeRequestInfo],
+ timedRequestTimeoutMs: typing.Optional[int] = None,
+ interactionTimeoutMs: typing.Optional[int] = None, busyWaitMs: typing.Optional[int] = None,
+ suppressResponse: typing.Optional[bool] = None, remoteMaxPathsPerInvoke: typing.Optional[int] = None,
+ suppressTimedRequestMessage: bool = False, commandRefsOverride: typing.Optional[typing.List[int]] = None):
+ '''
+
+ Please see SendBatchCommands for description.
+ TestOnly overridable arguments:
+ remoteMaxPathsPerInvoke: Overrides the number of batch commands we think can be sent to remote node.
+ suppressTimedRequestMessage: When set to true, we suppress sending Timed Request Message.
+ commandRefsOverride: List of commandRefs to use for each command with the same index in `commands`.
+ '''
+ self.CheckIsActive()
+
+ eventLoop = asyncio.get_running_loop()
+ future = eventLoop.create_future()
+
+ device = self.GetConnectedDeviceSync(nodeid, timeoutMs=interactionTimeoutMs)
+
+ ClusterCommand.TestOnlySendBatchCommands(
+ future, eventLoop, device.deviceProxy, commands,
+ timedRequestTimeoutMs=timedRequestTimeoutMs,
+ interactionTimeoutMs=interactionTimeoutMs, busyWaitMs=busyWaitMs, suppressResponse=suppressResponse,
+ remoteMaxPathsPerInvoke=remoteMaxPathsPerInvoke, suppressTimedRequestMessage=suppressTimedRequestMessage,
+ commandRefsOverride=commandRefsOverride).raise_on_error()
+ return await future
+
async def TestOnlySendCommandTimedRequestFlagWithNoTimedInvoke(self, nodeid: int, endpoint: int,
payload: ClusterObjects.ClusterCommand, responseType=None):
'''
@@ -927,7 +955,7 @@ async def SendBatchCommands(self, nodeid: int, commands: typing.List[ClusterComm
- A value of `None` indicates success.
- If only a single command fails, for example with `UNSUPPORTED_COMMAND`, the corresponding index associated with the command will,
contain `interaction_model.Status.UnsupportedCommand`.
- - If a command is not responded to by server, command will contain `interaction_model.Status.Failure`
+ - If a command is not responded to by server, command will contain `interaction_model.Status.NoCommandResponse`
Raises:
- InteractionModelError if error with sending of InvokeRequestMessage fails as a whole.
'''
diff --git a/src/controller/python/chip/clusters/Command.py b/src/controller/python/chip/clusters/Command.py
index 6e25a76d50230f..4c556fd97f6e45 100644
--- a/src/controller/python/chip/clusters/Command.py
+++ b/src/controller/python/chip/clusters/Command.py
@@ -27,7 +27,7 @@
import chip.exceptions
import chip.interaction_model
-from chip.interaction_model import PyInvokeRequestData
+from chip.interaction_model import PyInvokeRequestData, TestOnlyPyBatchCommandsOverrides
from chip.native import PyChipError
from .ClusterObjects import ClusterCommand
@@ -204,7 +204,9 @@ def handleError(self, status: Status, chipError: PyChipError):
)
def _handleDone(self):
- self._future.set_result(self._responses)
+ # Future might already be set with exception from `handleError`
+ if not self._future.done():
+ self._future.set_result(self._responses)
ctypes.pythonapi.Py_DecRef(ctypes.py_object(self))
def handleDone(self):
@@ -296,24 +298,7 @@ def SendCommand(future: Future, eventLoop, responseType: Type, device, commandPa
))
-def SendBatchCommands(future: Future, eventLoop, device, commands: List[InvokeRequestInfo],
- timedRequestTimeoutMs: Optional[int] = None, interactionTimeoutMs: Optional[int] = None, busyWaitMs: Optional[int] = None,
- suppressResponse: Optional[bool] = None) -> PyChipError:
- ''' Send a cluster-object encapsulated command to a device and does the following:
- - On receipt of a successful data response, returns the cluster-object equivalent through the provided future.
- - None (on a successful response containing no data)
- - Raises an exception if any errors are encountered.
-
- If no response type is provided above, the type will be automatically deduced.
-
- If a valid timedRequestTimeoutMs is provided, a timed interaction will be initiated instead.
- If a valid interactionTimeoutMs is provided, the interaction will terminate with a CHIP_ERROR_TIMEOUT if a response
- has not been received within that timeout. If it isn't provided, a sensible value will be automatically computed that
- accounts for the underlying characteristics of both the transport and the responsiveness of the receiver.
- '''
- handle = chip.native.GetLibraryHandle()
-
- responseTypes = []
+def _BuildPyInvokeRequestData(commands: List[InvokeRequestInfo], timedRequestTimeoutMs: Optional[int], responseTypes, suppressTimedRequestMessage: bool = False) -> List[PyInvokeRequestData]:
numberOfCommands = len(commands)
pyBatchCommandsDataArrayType = PyInvokeRequestData * numberOfCommands
pyBatchCommandsData = pyBatchCommandsDataArrayType()
@@ -323,7 +308,8 @@ def SendBatchCommands(future: Future, eventLoop, device, commands: List[InvokeRe
if (responseType is not None) and (not issubclass(responseType, ClusterCommand)):
raise ValueError("responseType must be a ClusterCommand or None")
if clusterCommand.must_use_timed_invoke and timedRequestTimeoutMs is None or timedRequestTimeoutMs == 0:
- raise chip.interaction_model.InteractionModelError(chip.interaction_model.Status.NeedsTimedInteraction)
+ if not suppressTimedRequestMessage:
+ raise chip.interaction_model.InteractionModelError(chip.interaction_model.Status.NeedsTimedInteraction)
payloadTLV = clusterCommand.ToTLV()
@@ -335,6 +321,41 @@ def SendBatchCommands(future: Future, eventLoop, device, commands: List[InvokeRe
responseTypes.append(responseType)
+ return pyBatchCommandsData
+
+
+def SendBatchCommands(future: Future, eventLoop, device, commands: List[InvokeRequestInfo],
+ timedRequestTimeoutMs: Optional[int] = None, interactionTimeoutMs: Optional[int] = None, busyWaitMs: Optional[int] = None,
+ suppressResponse: Optional[bool] = None) -> PyChipError:
+ ''' Initiates an InvokeInteraction with the batch commands provided.
+
+ Arguments:
+ - timedRequestTimeoutMs: If a valid value is provided, a timed interaction will be initiated.
+ - interactionTimeoutMs: If a valid value is provided, the interaction will terminate with a
+ CHIP_ERROR_TIMEOUT if a response is not received within the specified timeout. If not provided,
+ a suitable value will be automatically computed based on transport characteristics and
+ receiver responsiveness.
+
+ Returns:
+ - PyChipError: Indicates the outcome of initiating the InvokeRequest. Upon success the caller
+ is expected to await on `future` to get result of the InvokeInteraction.
+
+ Results passed via the provided future:
+ - Successful InvokeInteraction with path-specific responses (including path-specific errors):
+ - A list of responses is returned in the same order as the `commands` argument.
+ - Possible response elements:
+ - `None`: Successful command execution without additional cluster data.
+ - Encapsulated cluster-object: Successful command with response data.
+ - interaction_model.Status.*: Command failure with IM Status.
+ - interaction_model.Status.NoCommandResponse: No response from the server for
+ a specific command.
+ - Non-path-specific error: An `InteractionModelError` exception is raised through the future.
+ '''
+ handle = chip.native.GetLibraryHandle()
+
+ responseTypes = []
+ pyBatchCommandsData = _BuildPyInvokeRequestData(commands, timedRequestTimeoutMs, responseTypes)
+
transaction = AsyncBatchCommandsTransaction(future, eventLoop, responseTypes)
ctypes.pythonapi.Py_IncRef(ctypes.py_object(transaction))
@@ -345,7 +366,50 @@ def SendBatchCommands(future: Future, eventLoop, device, commands: List[InvokeRe
c_uint16(0 if interactionTimeoutMs is None else interactionTimeoutMs),
c_uint16(0 if busyWaitMs is None else busyWaitMs),
c_bool(False if suppressResponse is None else suppressResponse),
- pyBatchCommandsData, c_size_t(numberOfCommands))
+ pyBatchCommandsData, c_size_t(len(pyBatchCommandsData)))
+ )
+
+
+def TestOnlySendBatchCommands(future: Future, eventLoop, device, commands: List[InvokeRequestInfo],
+ timedRequestTimeoutMs: Optional[int] = None, interactionTimeoutMs: Optional[int] = None, busyWaitMs: Optional[int] = None,
+ suppressResponse: Optional[bool] = None, remoteMaxPathsPerInvoke: Optional[int] = None,
+ suppressTimedRequestMessage: bool = False, commandRefsOverride: Optional[List[int]] = None) -> PyChipError:
+ ''' ONLY TO BE USED FOR TEST: Send batch commands using various overrides.
+ '''
+ if suppressTimedRequestMessage and timedRequestTimeoutMs is not None:
+ raise ValueError("timedRequestTimeoutMs has non-None value while suppressTimedRequestMessage")
+
+ overrideCommandRefs = None
+ if commandRefsOverride is not None:
+ if len(commandRefsOverride) != len(commands):
+ raise ValueError("Mismatch in the number of elements provided in commandRefsOverride")
+ overrideCommandRefsType = c_uint16 * len(commandRefsOverride)
+ overrideCommandRefs = overrideCommandRefsType()
+
+ handle = chip.native.GetLibraryHandle()
+
+ responseTypes = []
+ pyBatchCommandsData = _BuildPyInvokeRequestData(commands, timedRequestTimeoutMs,
+ responseTypes, suppressTimedRequestMessage=suppressTimedRequestMessage)
+
+ transaction = AsyncBatchCommandsTransaction(future, eventLoop, responseTypes)
+ ctypes.pythonapi.Py_IncRef(ctypes.py_object(transaction))
+
+ testOnlyOverrides = TestOnlyPyBatchCommandsOverrides()
+ testOnlyOverrides.suppressTimedRequestMessage = suppressTimedRequestMessage
+ testOnlyOverrides.overrideRemoteMaxPathsPerInvoke = 0 if remoteMaxPathsPerInvoke is None else c_uint16(remoteMaxPathsPerInvoke)
+ testOnlyOverrides.overrideCommandRefsList = overrideCommandRefs
+ testOnlyOverrides.overrideCommandRefsListLength = 0 if overrideCommandRefs is None else c_size_t(len(overrideCommandRefs))
+
+ return builtins.chipStack.Call(
+ lambda: handle.pychip_CommandSender_TestOnlySendBatchCommands(
+ py_object(transaction), device,
+ c_uint16(0 if timedRequestTimeoutMs is None else timedRequestTimeoutMs),
+ c_uint16(0 if interactionTimeoutMs is None else interactionTimeoutMs),
+ c_uint16(0 if busyWaitMs is None else busyWaitMs),
+ c_bool(False if suppressResponse is None else suppressResponse),
+ testOnlyOverrides,
+ pyBatchCommandsData, c_size_t(len(pyBatchCommandsData)))
)
@@ -377,6 +441,8 @@ def Init():
PyChipError, [py_object, c_void_p, c_uint16, c_uint32, c_uint32, c_char_p, c_size_t, c_uint16, c_bool])
setter.Set('pychip_CommandSender_SendBatchCommands',
PyChipError, [py_object, c_void_p, c_uint16, c_uint16, c_uint16, c_bool, POINTER(PyInvokeRequestData), c_size_t])
+ setter.Set('pychip_CommandSender_TestOnlySendBatchCommands',
+ PyChipError, [py_object, c_void_p, c_uint16, c_uint16, c_uint16, c_bool, TestOnlyPyBatchCommandsOverrides, POINTER(PyInvokeRequestData), c_size_t])
setter.Set('pychip_CommandSender_TestOnlySendCommandTimedRequestNoTimedInvoke',
PyChipError, [py_object, c_void_p, c_uint32, c_uint32, c_char_p, c_size_t, c_uint16, c_bool])
setter.Set('pychip_CommandSender_SendGroupCommand',
diff --git a/src/controller/python/chip/clusters/command.cpp b/src/controller/python/chip/clusters/command.cpp
index 7195cefe16eba1..9d718aa2aca222 100644
--- a/src/controller/python/chip/clusters/command.cpp
+++ b/src/controller/python/chip/clusters/command.cpp
@@ -181,6 +181,132 @@ class CommandSenderCallback : public CommandSender::ExtendableCallback
bool mIsBatchedCommands;
};
+PyChipError SendBatchCommandsInternal(void * appContext, DeviceProxy * device, uint16_t timedRequestTimeoutMs,
+ uint16_t interactionTimeoutMs, uint16_t busyWaitMs, bool suppressResponse,
+ python::TestOnlyPyBatchCommandsOverrides * testOnlyOverrides,
+ python::PyInvokeRequestData * batchCommandData, size_t length)
+{
+ CommandSender::ConfigParameters config;
+ CHIP_ERROR err = CHIP_NO_ERROR;
+
+ bool testOnlySuppressTimedRequestMessage = false;
+ uint16_t * testOnlyCommandRefsOverride = nullptr;
+
+ VerifyOrReturnError(device->GetSecureSession().HasValue(), ToPyChipError(CHIP_ERROR_MISSING_SECURE_SESSION));
+
+ // Test only override validation checks and setup
+ if (testOnlyOverrides != nullptr)
+ {
+ if (testOnlyOverrides->suppressTimedRequestMessage)
+ {
+ VerifyOrReturnError(timedRequestTimeoutMs == 0, ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT));
+ testOnlySuppressTimedRequestMessage = true;
+ }
+ if (testOnlyOverrides->overrideCommandRefsList != nullptr)
+ {
+ VerifyOrReturnError(length == testOnlyOverrides->overrideCommandRefsListLength,
+ ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT));
+ testOnlyCommandRefsOverride = testOnlyOverrides->overrideCommandRefsList;
+ }
+ }
+
+ if (testOnlyOverrides != nullptr && testOnlyOverrides->overrideRemoteMaxPathsPerInvoke)
+ {
+ config.SetRemoteMaxPathsPerInvoke(testOnlyOverrides->overrideRemoteMaxPathsPerInvoke);
+ }
+ else
+ {
+ auto remoteSessionParameters = device->GetSecureSession().Value()->GetRemoteSessionParameters();
+ config.SetRemoteMaxPathsPerInvoke(remoteSessionParameters.GetMaxPathsPerInvoke());
+ }
+
+ std::unique_ptr callback =
+ std::make_unique(appContext, /* isBatchedCommands =*/true);
+
+ bool isTimedRequest = timedRequestTimeoutMs != 0 || testOnlySuppressTimedRequestMessage;
+ std::unique_ptr sender =
+ std::make_unique(callback.get(), device->GetExchangeManager(), isTimedRequest, suppressResponse);
+
+ SuccessOrExit(err = sender->SetCommandSenderConfig(config));
+
+ for (size_t i = 0; i < length; i++)
+ {
+ chip::EndpointId endpointId = batchCommandData[i].commandPath.endpointId;
+ chip::ClusterId clusterId = batchCommandData[i].commandPath.clusterId;
+ chip::CommandId commandId = batchCommandData[i].commandPath.commandId;
+ void * tlv = batchCommandData[i].tlvData;
+ size_t tlvLength = batchCommandData[i].tlvLength;
+
+ const uint8_t * tlvBuffer = reinterpret_cast(tlv);
+
+ app::CommandPathParams cmdParams = { endpointId, /* group id */ 0, clusterId, commandId,
+ (app::CommandPathFlags::kEndpointIdValid) };
+
+ CommandSender::AdditionalCommandParameters additionalParams;
+
+ SuccessOrExit(err = sender->PrepareCommand(cmdParams, additionalParams));
+ if (testOnlyCommandRefsOverride != nullptr)
+ {
+ additionalParams.commandRef.SetValue(testOnlyCommandRefsOverride[i]);
+ }
+ {
+ auto writer = sender->GetCommandDataIBTLVWriter();
+ VerifyOrExit(writer != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
+ TLV::TLVReader reader;
+ reader.Init(tlvBuffer, static_cast(tlvLength));
+ reader.Next();
+ SuccessOrExit(err = writer->CopyContainer(TLV::ContextTag(CommandDataIB::Tag::kFields), reader));
+ }
+
+ SuccessOrExit(err = sender->FinishCommand(timedRequestTimeoutMs != 0 ? Optional(timedRequestTimeoutMs)
+ : Optional::Missing(),
+ additionalParams));
+
+ // CommandSender provides us with the CommandReference for this associated command. In order to match responses
+ // we have to add CommandRef to index lookup.
+ VerifyOrExit(additionalParams.commandRef.HasValue(), err = CHIP_ERROR_INVALID_ARGUMENT);
+ if (testOnlyCommandRefsOverride != nullptr)
+ {
+ // Making sure the value we used to override CommandRef was actually used.
+ VerifyOrDie(additionalParams.commandRef.Value() == testOnlyCommandRefsOverride[i]);
+ // Ignoring the result of adding to index as the test might be trying to set duplicate CommandRefs.
+ callback->AddCommandRefToIndexLookup(additionalParams.commandRef.Value(), i);
+ }
+ else
+ {
+ SuccessOrExit(err = callback->AddCommandRefToIndexLookup(additionalParams.commandRef.Value(), i));
+ }
+ }
+
+ {
+ Optional interactionTimeout = interactionTimeoutMs != 0
+ ? MakeOptional(System::Clock::Milliseconds32(interactionTimeoutMs))
+ : Optional::Missing();
+ if (testOnlySuppressTimedRequestMessage)
+ {
+ SuccessOrExit(err = sender->TestOnlyCommandSenderTimedRequestFlagWithNoTimedInvoke(device->GetSecureSession().Value(),
+ interactionTimeout));
+ }
+ else
+ {
+ SuccessOrExit(err = sender->SendCommandRequest(device->GetSecureSession().Value(), interactionTimeout));
+ }
+ }
+
+ sender.release();
+ callback.release();
+
+ // TODO(#30985): Reconsider the purpose of busyWait and if it can be broken out into it's
+ // own method/primitive.
+ if (busyWaitMs)
+ {
+ usleep(busyWaitMs * 1000);
+ }
+
+exit:
+ return ToPyChipError(err);
+}
+
} // namespace python
} // namespace chip
@@ -251,81 +377,23 @@ PyChipError pychip_CommandSender_SendBatchCommands(void * appContext, DeviceProx
uint16_t interactionTimeoutMs, uint16_t busyWaitMs, bool suppressResponse,
python::PyInvokeRequestData * batchCommandData, size_t length)
{
- CHIP_ERROR err = CHIP_NO_ERROR;
-
- VerifyOrReturnError(device->GetSecureSession().HasValue(), ToPyChipError(CHIP_ERROR_MISSING_SECURE_SESSION));
- auto remoteSessionParameters = device->GetSecureSession().Value()->GetRemoteSessionParameters();
- CommandSender::ConfigParameters config;
-
- // TODO(#30986): Need to create a separate pychip_CommandSender_TestOnlySendBatchCommands so that we perform
- // operations that is very clear at callsite that violating certain aspects like setting this MaxPathsPerInvoke
- // to a number other than what is reported by the remote node is allowed. Right now the only user of this
- // function is cert test script. To implement pychip_CommandSender_TestOnlySendBatchCommands in a clean way
- // we need to move away from the variadic arguments.
- // config.SetRemoteMaxPathsPerInvoke(remoteSessionParameters.GetMaxPathsPerInvoke());
- (void) remoteSessionParameters; // Still want to get remoteSessionParameters, just wont use it right now.
- config.SetRemoteMaxPathsPerInvoke(std::numeric_limits::max());
-
- std::unique_ptr callback =
- std::make_unique(appContext, /* isBatchedCommands =*/true);
- std::unique_ptr sender =
- std::make_unique(callback.get(), device->GetExchangeManager(),
- /* is timed request */ timedRequestTimeoutMs != 0, suppressResponse);
-
- SuccessOrExit(err = sender->SetCommandSenderConfig(config));
-
- for (size_t i = 0; i < length; i++)
- {
- chip::EndpointId endpointId = batchCommandData[i].commandPath.endpointId;
- chip::ClusterId clusterId = batchCommandData[i].commandPath.clusterId;
- chip::CommandId commandId = batchCommandData[i].commandPath.commandId;
- void * tlv = batchCommandData[i].tlvData;
- size_t tlvLength = batchCommandData[i].tlvLength;
-
- const uint8_t * tlvBuffer = reinterpret_cast(tlv);
-
- app::CommandPathParams cmdParams = { endpointId, /* group id */ 0, clusterId, commandId,
- (app::CommandPathFlags::kEndpointIdValid) };
-
- CommandSender::AdditionalCommandParameters additionalParams;
-
- SuccessOrExit(err = sender->PrepareCommand(cmdParams, additionalParams));
- {
- auto writer = sender->GetCommandDataIBTLVWriter();
- VerifyOrExit(writer != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
- TLV::TLVReader reader;
- reader.Init(tlvBuffer, static_cast(tlvLength));
- reader.Next();
- SuccessOrExit(err = writer->CopyContainer(TLV::ContextTag(CommandDataIB::Tag::kFields), reader));
- }
-
- SuccessOrExit(err = sender->FinishCommand(timedRequestTimeoutMs != 0 ? Optional(timedRequestTimeoutMs)
- : Optional::Missing(),
- additionalParams));
-
- // CommandSender provides us with the CommandReference for this associated command. In order to match responses
- // we have to add CommandRef to index lookup.
- VerifyOrExit(additionalParams.commandRef.HasValue(), err = CHIP_ERROR_INVALID_ARGUMENT);
- SuccessOrExit(err = callback->AddCommandRefToIndexLookup(additionalParams.commandRef.Value(), i));
- }
-
- SuccessOrExit(err = sender->SendCommandRequest(device->GetSecureSession().Value(),
- interactionTimeoutMs != 0
- ? MakeOptional(System::Clock::Milliseconds32(interactionTimeoutMs))
- : Optional::Missing()));
-
- sender.release();
- callback.release();
-
- // TODO(#30985): Reconsider the purpose of busyWait and if it can be broken out into it's
- // own method/primitive.
- if (busyWaitMs)
- {
- usleep(busyWaitMs * 1000);
- }
+ python::TestOnlyPyBatchCommandsOverrides * testOnlyOverrides = nullptr;
+ return SendBatchCommandsInternal(appContext, device, timedRequestTimeoutMs, interactionTimeoutMs, busyWaitMs, suppressResponse,
+ testOnlyOverrides, batchCommandData, length);
+}
-exit:
- return ToPyChipError(err);
+PyChipError pychip_CommandSender_TestOnlySendBatchCommands(void * appContext, DeviceProxy * device, uint16_t timedRequestTimeoutMs,
+ uint16_t interactionTimeoutMs, uint16_t busyWaitMs,
+ bool suppressResponse,
+ python::TestOnlyPyBatchCommandsOverrides testOnlyOverrides,
+ python::PyInvokeRequestData * batchCommandData, size_t length)
+{
+#if CONFIG_BUILD_FOR_HOST_UNIT_TEST
+ return SendBatchCommandsInternal(appContext, device, timedRequestTimeoutMs, interactionTimeoutMs, busyWaitMs, suppressResponse,
+ &testOnlyOverrides, batchCommandData, length);
+#else
+ return ToPyChipError(CHIP_ERROR_NOT_IMPLEMENTED);
+#endif
}
PyChipError pychip_CommandSender_TestOnlySendCommandTimedRequestNoTimedInvoke(
diff --git a/src/controller/python/chip/interaction_model/Delegate.h b/src/controller/python/chip/interaction_model/Delegate.h
index f11f4931fc4c1d..72832a7510f25e 100644
--- a/src/controller/python/chip/interaction_model/Delegate.h
+++ b/src/controller/python/chip/interaction_model/Delegate.h
@@ -60,6 +60,17 @@ struct PyWriteAttributeData
size_t tlvLength;
};
+struct TestOnlyPyBatchCommandsOverrides
+{
+ // When max paths per invoke override value is set to 0, we will not use
+ // it as an override. Otherwise, this value will be provided to the
+ // CommandSender as the remote node's maximum paths.
+ uint16_t overrideRemoteMaxPathsPerInvoke;
+ bool suppressTimedRequestMessage;
+ uint16_t * overrideCommandRefsList;
+ size_t overrideCommandRefsListLength;
+};
+
} // namespace python
namespace Controller {
diff --git a/src/controller/python/chip/interaction_model/__init__.py b/src/controller/python/chip/interaction_model/__init__.py
index 78568563a73475..f7239d778058eb 100644
--- a/src/controller/python/chip/interaction_model/__init__.py
+++ b/src/controller/python/chip/interaction_model/__init__.py
@@ -27,11 +27,12 @@
from chip.exceptions import ChipStackException
from .delegate import (AttributePath, AttributePathIBstruct, DataVersionFilterIBstruct, EventPath, EventPathIBstruct,
- PyInvokeRequestData, PyWriteAttributeData, SessionParameters, SessionParametersStruct)
+ PyInvokeRequestData, PyWriteAttributeData, SessionParameters, SessionParametersStruct,
+ TestOnlyPyBatchCommandsOverrides)
__all__ = ["AttributePath", "AttributePathIBstruct", "DataVersionFilterIBstruct",
"EventPath", "EventPathIBstruct", "InteractionModelError", "PyInvokeRequestData",
- "PyWriteAttributeData", "SessionParameters", "SessionParametersStruct", "Status"]
+ "PyWriteAttributeData", "SessionParameters", "SessionParametersStruct", "Status", "TestOnlyPyBatchCommandsOverrides"]
# defined src/controller/python/chip/interaction_model/Delegate.h
diff --git a/src/controller/python/chip/interaction_model/delegate.py b/src/controller/python/chip/interaction_model/delegate.py
index a9a9c04c4365a9..d0ed641fa2a75c 100644
--- a/src/controller/python/chip/interaction_model/delegate.py
+++ b/src/controller/python/chip/interaction_model/delegate.py
@@ -17,7 +17,7 @@
import ctypes
import threading
import typing
-from ctypes import CFUNCTYPE, c_uint8, c_uint32, c_uint64, c_void_p
+from ctypes import CFUNCTYPE, POINTER, c_uint8, c_uint32, c_uint64, c_void_p
from dataclasses import dataclass
import chip.exceptions
@@ -199,6 +199,25 @@ class PyWriteAttributeData(ctypes.Structure):
_fields_ = [('attributePath', PyAttributePath), ('tlvData', ctypes.c_void_p), ('tlvLength', ctypes.c_size_t)]
+class TestOnlyPyBatchCommandsOverrides(ctypes.Structure):
+ ''' TestOnly struct for overriding aspects of batch command to send invalid commands.
+
+ We are using the following struct for passing the information of TestOnlyPyBatchCommandsOverrides between Python and C++:
+
+ ```c
+ struct TestOnlyPyBatchCommandsOverrides
+ {
+ uint16_t overrideRemoteMaxPathsPerInvoke;
+ bool suppressTimedRequestMessage;
+ uint16_t * overrideCommandRefsList;
+ size_t overrideCommandRefsListLength;
+ };
+ ```
+ '''
+ _fields_ = [('overrideRemoteMaxPathsPerInvoke', ctypes.c_uint16), ('suppressTimedRequestMessage', ctypes.c_bool),
+ ('overrideCommandRefsList', POINTER(ctypes.c_uint16)), ('overrideCommandRefsListLength', ctypes.c_size_t)]
+
+
# typedef void (*PythonInteractionModelDelegate_OnCommandResponseStatusCodeReceivedFunct)(uint64_t commandSenderPtr,
# void * commandStatusBuf);
# typedef void (*PythonInteractionModelDelegate_OnCommandResponseProtocolErrorFunct)(uint64_t commandSenderPtr,
diff --git a/src/platform/silabs/efr32/wifi/ethernetif.cpp b/src/platform/silabs/efr32/wifi/ethernetif.cpp
index 2aeaf00fc14b95..3dbd1b85b3ef9a 100644
--- a/src/platform/silabs/efr32/wifi/ethernetif.cpp
+++ b/src/platform/silabs/efr32/wifi/ethernetif.cpp
@@ -36,7 +36,6 @@
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"
diff --git a/src/platform/silabs/rs911x/BLEManagerImpl.cpp b/src/platform/silabs/rs911x/BLEManagerImpl.cpp
index 749ff8614220ee..bc79b1429ff94a 100644
--- a/src/platform/silabs/rs911x/BLEManagerImpl.cpp
+++ b/src/platform/silabs/rs911x/BLEManagerImpl.cpp
@@ -107,16 +107,15 @@ void sl_ble_init()
NULL, NULL, NULL);
// registering the GATT call back functions
- rsi_ble_gatt_register_callbacks(NULL, NULL, NULL, NULL, NULL, NULL, NULL, rsi_ble_on_gatt_write_event, NULL, NULL, NULL,
- rsi_ble_on_mtu_event, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- rsi_ble_on_event_indication_confirmation, NULL);
+ rsi_ble_gatt_register_callbacks(NULL, NULL, NULL, NULL, NULL, NULL, NULL, rsi_ble_on_gatt_write_event, NULL, NULL,
+ rsi_ble_on_read_req_event, rsi_ble_on_mtu_event, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, rsi_ble_on_event_indication_confirmation, NULL);
// Exchange of GATT info with BLE stack
rsi_ble_add_matter_service();
// initializing the application events map
rsi_ble_app_init_events();
-
rsi_ble_set_random_address_with_value(randomAddrBLE);
chip::DeviceLayer::Internal::BLEMgrImpl().HandleBootEvent();
}
@@ -167,6 +166,17 @@ void sl_ble_event_handling_task(void)
rsi_ble_app_clear_event(RSI_BLE_MTU_EVENT);
}
break;
+ case RSI_BLE_EVENT_GATT_RD: {
+#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
+ if (event_msg.rsi_ble_read_req->type == 0)
+ {
+ BLEMgrImpl().HandleC3ReadRequest(event_msg.rsi_ble_read_req);
+ }
+#endif // CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
+ // clear the served event
+ rsi_ble_app_clear_event(RSI_BLE_EVENT_GATT_RD);
+ }
+ break;
case RSI_BLE_GATT_WRITE_EVENT: {
// event invokes when write/notification events received
BLEMgrImpl().HandleWriteEvent(event_msg.rsi_ble_write);
@@ -1011,8 +1021,16 @@ CHIP_ERROR BLEManagerImpl::EncodeAdditionalDataTlv()
return err;
}
-// TODO:: Need to do the correct implementation
-void BLEManagerImpl::HandleC3ReadRequest(void) {}
+void BLEManagerImpl::HandleC3ReadRequest(rsi_ble_read_req_t * rsi_ble_read_req)
+{
+ sl_status_t ret = rsi_ble_gatt_read_response(rsi_ble_read_req->dev_addr, GATT_READ_RESP, rsi_ble_read_req->handle,
+ GATT_READ_ZERO_OFFSET, sInstance.c3AdditionalDataBufferHandle->DataLength(),
+ sInstance.c3AdditionalDataBufferHandle->Start());
+ if (ret != SL_STATUS_OK)
+ {
+ ChipLogDetail(DeviceLayer, "Failed to send read response, err:%ld", ret);
+ }
+}
#endif // CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
diff --git a/src/platform/silabs/rs911x/rsi_ble_config.h b/src/platform/silabs/rs911x/rsi_ble_config.h
index e58cadcc77dd4c..bf40cad514dada 100644
--- a/src/platform/silabs/rs911x/rsi_ble_config.h
+++ b/src/platform/silabs/rs911x/rsi_ble_config.h
@@ -25,6 +25,7 @@
#else
#include
#endif
+
/******************************************************
* * Macros
* ******************************************************/
@@ -40,7 +41,10 @@
#define RSI_BLE_GATT_WRITE_EVENT (0x03)
#define RSI_BLE_MTU_EVENT (0x04)
#define RSI_BLE_GATT_INDICATION_CONFIRMATION (0x05)
+#define RSI_BLE_RESP_ATT_VALUE (0x06)
#define RSI_BLE_EVENT_GATT_RD (0x08)
+#define RSI_BLE_ADDR_LENGTH 6
+
#define RSI_SSID (0x0D)
#define RSI_SECTYPE (0x0E)
#define RSI_BLE_WLAN_DISCONN_NOTIFY (0x0F)
@@ -71,6 +75,8 @@
#define RSI_BLE_TX_TIME 2120 // microseconds
#define RSI_BLE_MATTER_CUSTOM_SERVICE_DATA_LENGTH 240
+#define GATT_READ_ZERO_OFFSET 0x00
+#define GATT_READ_RESP 0x00
#define ALL_PHYS (0x00)
#define RSI_BLE_DEV_ADDR_RESOLUTION_ENABLE (0)
@@ -133,7 +139,7 @@
#define RSI_BLE_ADV_TYPE UNDIR_CONN
#define RSI_BLE_ADV_FILTER_TYPE ALLOW_SCAN_REQ_ANY_CONN_REQ_ANY
-#define RSI_BLE_ADV_DIR_ADDR_TYPE LE_PUBLIC_ADDRESS
+#define RSI_BLE_ADV_DIR_ADDR_TYPE LE_RANDOM_ADDRESS
#define RSI_BLE_ADV_DIR_ADDR "00:15:83:6A:64:17"
//! Reduced the BLE adv interval time to match with EFR BLE
diff --git a/src/platform/silabs/rs911x/wfx_sl_ble_init.c b/src/platform/silabs/rs911x/wfx_sl_ble_init.c
index ef44d380d90740..7e7c165043a71a 100644
--- a/src/platform/silabs/rs911x/wfx_sl_ble_init.c
+++ b/src/platform/silabs/rs911x/wfx_sl_ble_init.c
@@ -150,6 +150,24 @@ void rsi_ble_on_event_indication_confirmation(uint16_t resp_status, rsi_ble_set_
/*==============================================*/
/**
+ * @fn rsi_ble_on_read_req_event
+ * @brief its invoked when read events are received.
+ * @param[in] event_id, it indicates write/notification event id.
+ * @param[in] rsi_ble_read, read event parameters.
+ * @return none.
+ * @section description
+ * This callback function is invoked when read events are received
+ */
+void rsi_ble_on_read_req_event(uint16_t event_id, rsi_ble_read_req_t * rsi_ble_read_req)
+{
+ SILABS_LOG("%s: starting", __func__);
+ event_msg.event_id = event_id;
+ memcpy(&event_msg.rsi_ble_read_req, rsi_ble_read_req, sizeof(rsi_ble_read_req_t));
+ rsi_ble_app_set_event(RSI_BLE_EVENT_GATT_RD);
+}
+
+/*==============================================*/
+/**s
* @fn rsi_ble_app_get_event
* @brief returns the first set event based on priority
* @param[in] none.
diff --git a/src/platform/silabs/rs911x/wfx_sl_ble_init.h b/src/platform/silabs/rs911x/wfx_sl_ble_init.h
index 2c124f4549caa1..26ee258300c5de 100644
--- a/src/platform/silabs/rs911x/wfx_sl_ble_init.h
+++ b/src/platform/silabs/rs911x/wfx_sl_ble_init.h
@@ -67,6 +67,7 @@ typedef struct sl_wfx_msg_s
rsi_ble_event_write_t rsi_ble_write;
rsi_ble_event_enhance_conn_status_t resp_enh_conn;
rsi_ble_event_disconnect_t * resp_disconnect;
+ rsi_ble_read_req_t * rsi_ble_read_req;
rsi_ble_set_att_resp_t rsi_ble_event_set_att_rsp;
uint32_t ble_app_event_map;
uint32_t ble_app_event_mask;
@@ -116,6 +117,7 @@ void rsi_ble_on_enhance_conn_status_event(rsi_ble_event_enhance_conn_status_t *
void rsi_ble_on_gatt_write_event(uint16_t event_id, rsi_ble_event_write_t * rsi_ble_write);
void rsi_ble_on_mtu_event(rsi_ble_event_mtu_t * rsi_ble_mtu);
void rsi_ble_on_event_indication_confirmation(uint16_t resp_status, rsi_ble_set_att_resp_t * rsi_ble_event_set_att_rsp);
+void rsi_ble_on_read_req_event(uint16_t event_id, rsi_ble_read_req_t * rsi_ble_read_req);
void rsi_gatt_add_attribute_to_list(rsi_ble_t * p_val, uint16_t handle, uint16_t data_len, uint8_t * data, uuid_t uuid,
uint8_t char_prop);
void rsi_ble_add_char_serv_att(void * serv_handler, uint16_t handle, uint8_t val_prop, uint16_t att_val_handle,
diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni
index 0741a06f9d3507..3a80deb7f99e33 100644
--- a/third_party/silabs/efr32_sdk.gni
+++ b/third_party/silabs/efr32_sdk.gni
@@ -130,6 +130,9 @@ template("efr32_sdk") {
# Treat these includes as system includes, so warnings in them are not fatal.
_include_dirs = [
"${efr32_sdk_root}",
+
+ #TODO: Added this as include files because of spi_multiplexing.h file. we will remove it after the cleanup.
+ "${examples_plat_dir}",
"${efr32_sdk_root}/util/plugin/security_manager/",
"${efr32_sdk_root}/hardware/kit/common/bsp",
"${efr32_sdk_root}/hardware/board/inc",
@@ -204,11 +207,22 @@ template("efr32_sdk") {
"${sl_ot_efr32_root}",
]
+ if (silabs_family == "efr32mg24") {
+ _include_dirs +=
+ [ "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG24/Include" ]
+ }
+
if (use_SiWx917) {
_include_dirs += [
- "${wifi_sdk_root}/components/si91x/inc",
+ # si91x component
"${wifi_sdk_root}/components/si91x/memory",
- "${wifi_sdk_root}/components/si91x/sl_net/inc",
+ "${wifi_sdk_root}/components/device/silabs/si91x/wireless/sl_net/inc",
+ "${wifi_sdk_root}/components/device/silabs/si91x/mcu/drivers/rom_driver/inc",
+ "${wifi_sdk_root}/components/device/silabs/si91x/mcu/core/chip/inc",
+ "${wifi_sdk_root}/components/common/inc",
+ "${wifi_sdk_root}/components/device/silabs/si91x/mcu/core/config",
+ "${wifi_sdk_root}/components/device/silabs/si91x/wireless/inc",
+ "${wifi_sdk_root}/components/device/silabs/si91x/wireless/ble/inc",
# wifi component
"${wifi_sdk_root}/components/protocol/wifi/inc",
@@ -223,9 +237,13 @@ template("efr32_sdk") {
# network_manager component
"${wifi_sdk_root}/components/service/network_manager/inc",
+
+ "${wifi_sdk_root}/components/protocol/wifi/si91x",
]
}
-
+ if (use_rs9116 || use_SiWx917) {
+ _include_dirs += [ "${chip_root}/src/platform/silabs/rs911x" ]
+ }
if (silabs_family != "mgm24") {
_include_dirs += [
"${efr32_sdk_root}/platform/radio/rail_lib/hal",
@@ -237,9 +255,10 @@ template("efr32_sdk") {
if (use_rs9116) {
_include_dirs += [ "${wiseconnect_sdk_root}/sapi/include" ]
} else {
- _include_dirs += [ "${wifi_sdk_root}/components/si91x/ble/inc" ]
+ _include_dirs += [
+ "${wifi_sdk_root}/components/device/silabs/si91x/wireless/ble/inc",
+ ]
}
- _include_dirs += [ "${chip_root}/src/platform/silabs/rs911x" ]
}
# Note that we're setting the mbedTLS and PSA configuration files through a
@@ -301,6 +320,8 @@ template("efr32_sdk") {
"RSI_BLE_ENABLE=1",
"BLE_ENABLE=1",
"RSI_LITTLE_ENDIAN=1",
+ "SLI_SI91X_ENABLE_BLE=1",
+ "SL_SI91X_ENABLE_LITTLE_ENDIAN=1",
]
}
@@ -331,6 +352,8 @@ template("efr32_sdk") {
defines += [
"EXP_BOARD=1",
"CHIP_917",
+ "SLI_SI917=1",
+ "SL_WFX_CONFIG_SCAN=1",
"CHIP_9117",
"SL_WIFI_COMPONENT_INCLUDED",
]
@@ -494,7 +517,6 @@ template("efr32_sdk") {
defines += [ "EFR32MG12" ]
} else if (silabs_family == "efr32mg24") {
_include_dirs += [
- "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG24/Include",
"${efr32_sdk_root}/platform/radio/rail_lib/chip/efr32/efr32xg2x",
"${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM33_NTZ/non_secure",
"${efr32_sdk_root}/platform/radio/rail_lib/plugin/pa-conversions/efr32xg24",
@@ -776,13 +798,13 @@ template("efr32_sdk") {
]
} else {
sources += [
- "${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",
+ "${wifi_sdk_root}/components/device/silabs/si91x/wireless/ble/src/rsi_ble_gap_apis.c",
+ "${wifi_sdk_root}/components/device/silabs/si91x/wireless/ble/src/rsi_ble_gatt_apis.c",
+ "${wifi_sdk_root}/components/device/silabs/si91x/wireless/ble/src/rsi_bt_ble.c",
+ "${wifi_sdk_root}/components/device/silabs/si91x/wireless/ble/src/rsi_bt_common_apis.c",
+ "${wifi_sdk_root}/components/device/silabs/si91x/wireless/ble/src/rsi_common_apis.c",
+ "${wifi_sdk_root}/components/device/silabs/si91x/wireless/ble/src/rsi_utils.c",
+ "${wifi_sdk_root}/components/device/silabs/si91x/wireless/ble/src/sl_si91x_ble.c",
]
}
} else {
diff --git a/third_party/silabs/matter_support b/third_party/silabs/matter_support
index 73fcd8b084355b..70800e2f6d5fbc 160000
--- a/third_party/silabs/matter_support
+++ b/third_party/silabs/matter_support
@@ -1 +1 @@
-Subproject commit 73fcd8b084355babbab333ebeaaa36323fdb4d8a
+Subproject commit 70800e2f6d5fbc972d22387fd4969a92568b455b