diff --git a/examples/platform/silabs/efr32/BUILD.gn b/examples/platform/silabs/efr32/BUILD.gn index a4fb8f1ac684dc..fa42fef3958b60 100644 --- a/examples/platform/silabs/efr32/BUILD.gn +++ b/examples/platform/silabs/efr32/BUILD.gn @@ -281,7 +281,9 @@ 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 +292,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/efx_spi.c b/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c index 1e30b8bdf2f9c6..02f43e0cdae3d2 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/rs9117.gni b/examples/platform/silabs/efr32/rs911x/rs9117.gni index a753a66153bec4..05b1ed5af5b071 100644 --- a/examples/platform/silabs/efr32/rs911x/rs9117.gni +++ b/examples/platform/silabs/efr32/rs911x/rs9117.gni @@ -10,15 +10,17 @@ rs911x_src_plat = [ "${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", + # si91x component + "${wifi_sdk_root}/components/device/silabs/si91x/wireless/ble/inc", + "${wifi_sdk_root}/components/device/silabs/si91x/wireless/inc", + "${wifi_sdk_root}/components/common/inc", "${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 component "${wifi_sdk_root}/components/protocol/wifi/inc", @@ -38,15 +40,18 @@ rs911x_inc_plat = [ ] 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_sdk_root}/components/si91x/sl_net/src/sl_net_si91x.c", # wifi component "${wifi_sdk_root}/components/protocol/wifi/src/sl_wifi_callback_framework.c", @@ -57,13 +62,13 @@ 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", + #"${wifi_sdk_root}/components/device/silabs/si91x/wireless/host_mcu/efx32/efx32_ncp_host.c", ] diff --git a/examples/platform/silabs/efr32/rs911x/rsi_if.c b/examples/platform/silabs/efr32/rs911x/rsi_if.c index c43389761dcdfc..643fa7db0df68a 100644 --- a/examples/platform/silabs/efr32/rs911x/rsi_if.c +++ b/examples/platform/silabs/efr32/rs911x/rsi_if.c @@ -54,6 +54,9 @@ #include "wfx_host_events.h" #include "wfx_rsi.h" +// SLC-FIX +#include "sl_matter_wifi_config.h" + // TODO convert this file to cpp and use CodeUtils.h #ifndef MIN #define MIN(a, b) ((a) < (b) ? (a) : (b)) @@ -123,6 +126,10 @@ int32_t wfx_rsi_get_ap_info(wfx_wifi_scan_result_t * ap) *********************************************************************/ int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info) { +// TODO: Need to remove this condition once wisemcu SDK supports RSI_WLAN_EXT_STATS +#if CHIP_9117 + return 0; +#else int32_t status; uint8_t buff[RSI_RESPONSE_MAX_SIZE] = { 0 }; status = rsi_wlan_get(RSI_WLAN_EXT_STATS, buff, sizeof(buff)); @@ -142,6 +149,7 @@ int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info) extra_info->overrun_count = test->overrun_count - temp_reset->overrun_count; } return status; +#endif } /****************************************************************** @@ -154,6 +162,10 @@ int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info) *********************************************************************/ int32_t wfx_rsi_reset_count() { +// TODO: Need to remove this condition once wisemcu SDK supports RSI_WLAN_EXT_STATS +#if CHIP_9117 + return 0; +#else int32_t status; uint8_t buff[RSI_RESPONSE_MAX_SIZE] = { 0 }; status = rsi_wlan_get(RSI_WLAN_EXT_STATS, buff, sizeof(buff)); @@ -173,6 +185,7 @@ int32_t wfx_rsi_reset_count() temp_reset->overrun_count = test->overrun_count; } return status; +#endif } /****************************************************************** diff --git a/examples/platform/silabs/efr32/rs911x/rsi_wlan_config.h b/examples/platform/silabs/efr32/rs911x/rsi_wlan_config.h index 96bd71bb80539a..75488fdeb03fda 100644 --- a/examples/platform/silabs/efr32/rs911x/rsi_wlan_config.h +++ b/examples/platform/silabs/efr32/rs911x/rsi_wlan_config.h @@ -20,6 +20,9 @@ #include "rsi_wlan_defines.h" +// SLC-FIX +#include "sl_matter_wifi_config.h" + //! Enable feature #define RSI_ENABLE 1 //! Disable feature 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_host.c b/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c index 3482f222b3bc35..8ff93e2e75d9fc 100644 --- a/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c +++ b/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c @@ -31,10 +31,10 @@ #include "FreeRTOS.h" #include "event_groups.h" #include "task.h" - #include "wfx_host_events.h" #include "wfx_rsi.h" + /* wfxRsi Task will use as its stack */ StackType_t wfxRsiTaskStack[WFX_RSI_TASK_SZ] = { 0 }; diff --git a/src/platform/silabs/efr32/BLEManagerImpl.cpp b/src/platform/silabs/efr32/BLEManagerImpl.cpp index f8130df8b89fdf..fe8acb3ad02fcb 100644 --- a/src/platform/silabs/efr32/BLEManagerImpl.cpp +++ b/src/platform/silabs/efr32/BLEManagerImpl.cpp @@ -1053,7 +1053,7 @@ extern "C" void sl_bt_on_event(sl_bt_msg_t * evt) evt->data.evt_gatt_server_characteristic_status.connection); } else if ((evt->data.evt_gatt_server_characteristic_status.characteristic == gattdb_CHIPoBLEChar_Tx) && - (evt->data.evt_gatt_server_characteristic_status.status_flags == gatt_server_client_config)) + (evt->data.evt_gatt_server_characteristic_status.status_flags == sl_bt_gatt_server_client_config)) { chip::DeviceLayer::Internal::BLEMgrImpl().HandleTXCharCCCDWrite(evt); } 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/efr32/wifi/wfx_host_events.h b/src/platform/silabs/efr32/wifi/wfx_host_events.h index 4070cf4ea93700..5f26edf793940c 100644 --- a/src/platform/silabs/efr32/wifi/wfx_host_events.h +++ b/src/platform/silabs/efr32/wifi/wfx_host_events.h @@ -122,6 +122,8 @@ typedef struct __attribute__((__packed__)) sl_wfx_mib_req_s #include "lwip/netifapi.h" #include "lwip/tcpip.h" +// SLC-FIX +#include "sl_matter_wifi_config.h" /* Wi-Fi bitmask events - for the task */ #define SL_WFX_CONNECT (1 << 1) #define SL_WFX_DISCONNECT (1 << 2) diff --git a/src/platform/silabs/efr32/wifi/wfx_notify.cpp b/src/platform/silabs/efr32/wifi/wfx_notify.cpp index f888a1a4c5c0ab..7f75324c22d461 100644 --- a/src/platform/silabs/efr32/wifi/wfx_notify.cpp +++ b/src/platform/silabs/efr32/wifi/wfx_notify.cpp @@ -43,6 +43,9 @@ #include #include +// SLC-FIX +#include "sl_matter_wifi_config.h" + using namespace ::chip; using namespace ::chip::DeviceLayer; diff --git a/src/platform/silabs/rs911x/BLEManagerImpl.cpp b/src/platform/silabs/rs911x/BLEManagerImpl.cpp index 717f0798c2068d..3ad0211b946f00 100644 --- a/src/platform/silabs/rs911x/BLEManagerImpl.cpp +++ b/src/platform/silabs/rs911x/BLEManagerImpl.cpp @@ -58,6 +58,12 @@ extern "C" { #include #include +#ifdef SIWX_917 +extern "C" { +#include "sl_si91x_trng.h" +} +#endif + #if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING #include #endif @@ -78,15 +84,26 @@ using namespace ::chip::DeviceLayer::Internal; void sl_ble_init() { - uint8_t randomAddrBLE[6] = { 0 }; + uint8_t randomAddrBLE[RSI_BLE_ADDR_LENGTH] = { 0 }; +#if SIWX_917 + sl_status_t sl_status; + //! Get Random number of desired length + sl_status = sl_si91x_trng_get_random_num((uint32_t *)randomAddrBLE, RSI_BLE_ADDR_LENGTH); + if (sl_status != SL_STATUS_OK) { + ChipLogError(DeviceLayer," TRNG Random number generation Failed "); + return ; + } +#else uint64_t randomAddr = chip::Crypto::GetRandU64(); + memcpy(randomAddrBLE, &randomAddr, RSI_BLE_ADDR_LENGTH); +#endif // registering the GAP callback functions rsi_ble_gap_register_callbacks(NULL, NULL, rsi_ble_on_disconnect_event, NULL, NULL, NULL, rsi_ble_on_enhance_conn_status_event, 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_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); @@ -96,7 +113,6 @@ void sl_ble_init() // initializing the application events map rsi_ble_app_init_events(); - memcpy(randomAddrBLE, &randomAddr, 6); rsi_ble_set_random_address_with_value(randomAddrBLE); chip::DeviceLayer::Internal::BLEMgrImpl().HandleBootEvent(); } @@ -147,6 +163,16 @@ 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); @@ -162,6 +188,12 @@ void sl_ble_event_handling_task(void) default: break; } + + if (chip::DeviceLayer::ConnectivityMgr().IsWiFiStationConnected()) { + // Once DUT is connected adding a 500ms delay + // TODO: Fix this with a better event handling + vTaskDelay(pdMS_TO_TICKS(500)); + } } } @@ -983,8 +1015,18 @@ 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 64be3e24d386e6..1188e5c6b57b39 100644 --- a/src/platform/silabs/rs911x/rsi_ble_config.h +++ b/src/platform/silabs/rs911x/rsi_ble_config.h @@ -25,6 +25,9 @@ #else #include #endif + +// SLC-FIX +#include "sl_matter_wifi_config.h" /****************************************************** * * Macros * ******************************************************/ @@ -40,7 +43,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) @@ -70,6 +76,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) @@ -89,7 +97,7 @@ #define RSI_BLE_CUSTOM_SERVICE_UUID (0xFFF6) #define RSI_BLE_CUSTOM_LEVEL_UUID (0x1FF1) -#ifdef RSI_M4_INTERFACE +#if (defined(RSI_M4_INTERFACE) || defined(SLI_SI91X_MCU_INTERFACE)) #define RSI_BLE_MAX_NBR_ATT_REC (20) #if (SIWX_917 | EXP_BOARD) @@ -132,7 +140,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 @@ -266,16 +274,16 @@ (SL_SI91X_FEAT_ULP_GPIO_BASED_HANDSHAKE | SL_SI91X_FEAT_DEV_TO_HOST_ULP_GPIO_1) //! To set wlan feature select bit map #define RSI_TCP_IP_FEATURE_BIT_MAP \ (SL_SI91X_TCP_IP_FEAT_DHCPV4_CLIENT) //! TCP/IP feature select bitmap for selecting TCP/IP features -#define RSI_CUSTOM_FEATURE_BIT_MAP SL_SI91X_FEAT_CUSTOM_FEAT_EXTENTION_VALID //! To set custom feature select bit map +#define RSI_CUSTOM_FEATURE_BIT_MAP SL_SI91X_CUSTOM_FEAT_EXTENTION_VALID //! To set custom feature select bit map #ifdef CHIP_9117 #if WIFI_ENABLE_SECURITY_WPA3_TRANSITION // Adding Support for WPA3 transition #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP \ - (SL_SI91X_EXT_FEAT_LOW_POWER_MODE | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(1) | RAM_LEVEL_NWP_BASIC_MCU_ADV | \ + (SL_SI91X_EXT_FEAT_LOW_POWER_MODE | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(1) | SL_SI91X_RAM_LEVEL_NWP_BASIC_MCU_ADV | \ SL_SI91X_EXT_FEAT_FRONT_END_SWITCH_PINS_ULP_GPIO_4_5_0 | SL_SI91X_EXT_FEAT_IEEE_80211W) #else #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP \ - (SL_SI91X_EXT_FEAT_LOW_POWER_MODE | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(1) | RAM_LEVEL_NWP_BASIC_MCU_ADV | \ + (SL_SI91X_EXT_FEAT_LOW_POWER_MODE | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(1) | SL_SI91X_RAM_LEVEL_NWP_BASIC_MCU_ADV | \ SL_SI91X_EXT_FEAT_FRONT_END_SWITCH_PINS_ULP_GPIO_4_5_0) #endif /* WIFI_ENABLE_SECURITY_WPA3_TRANSITION */ #else // EXP_BOARD diff --git a/src/platform/silabs/rs911x/wfx_sl_ble_init.c b/src/platform/silabs/rs911x/wfx_sl_ble_init.c index ef44d380d90740..df426de4c7126f 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..4dccda545b72ab 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 789b9723ccbd48..55ec03dc519f47 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -206,9 +206,14 @@ template("efr32_sdk") { if (use_SiWx917) { _include_dirs += [ - "${wifi_sdk_root}/components/si91x/inc", "${wifi_sdk_root}/components/si91x/memory", - "${wifi_sdk_root}/components/si91x/sl_net/inc", + "${wifi_sdk_root}/components/device/silabs/si91x/wireless/inc", + "${wifi_sdk_root}/components/device/silabs/si91x/wireless/sl_net/inc", + "${wifi_sdk_root}/components/device/silabs/si91x/wireless/ahb_interface/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 component "${wifi_sdk_root}/components/protocol/wifi/inc", @@ -237,7 +242,7 @@ 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" ] } @@ -331,6 +336,7 @@ template("efr32_sdk") { defines += [ "EXP_BOARD=1", "CHIP_917", + "SLI_SI917=1", "CHIP_9117", "SL_WIFI_COMPONENT_INCLUDED", ] @@ -697,7 +703,7 @@ template("efr32_sdk") { "${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_aead.c", "${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_cipher.c", "${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_client.c", - "${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_driver_wrappers.c", + "${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_driver_wrappers_no_static.c", "${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_ecp.c", "${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_hash.c", "${efr32_sdk_root}/util/third_party/mbedtls/library/psa_crypto_mac.c", @@ -764,13 +770,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/gecko_sdk b/third_party/silabs/gecko_sdk index 1228a95262ee09..8e1bf373c3229c 160000 --- a/third_party/silabs/gecko_sdk +++ b/third_party/silabs/gecko_sdk @@ -1 +1 @@ -Subproject commit 1228a95262ee099a21c6be4d35224479c8e4dde2 +Subproject commit 8e1bf373c3229c31b16b8b85e4a908fedad89020 diff --git a/third_party/silabs/wifi_sdk b/third_party/silabs/wifi_sdk index 58a240448abd15..b2c1cd0750baef 160000 --- a/third_party/silabs/wifi_sdk +++ b/third_party/silabs/wifi_sdk @@ -1 +1 @@ -Subproject commit 58a240448abd15f7a4604b3f1a19ff398c341863 +Subproject commit b2c1cd0750baef2cd5e9a12321b54b018b807cb1