diff --git a/examples/lighting-app/silabs/src/AppTask.cpp b/examples/lighting-app/silabs/src/AppTask.cpp index bce7b06cb5cb07..7430bd2828d233 100644 --- a/examples/lighting-app/silabs/src/AppTask.cpp +++ b/examples/lighting-app/silabs/src/AppTask.cpp @@ -40,7 +40,7 @@ #include -#if (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917)) +#ifdef SL_CATALOG_SIMPLE_LED_LED1_PRESENT #define LIGHT_LED 1 #else #define LIGHT_LED 0 diff --git a/examples/platform/silabs/BaseApplication.cpp b/examples/platform/silabs/BaseApplication.cpp index c98882f30aba96..abd2c207da0b06 100644 --- a/examples/platform/silabs/BaseApplication.cpp +++ b/examples/platform/silabs/BaseApplication.cpp @@ -82,7 +82,7 @@ #define APP_EVENT_QUEUE_SIZE 10 #define EXAMPLE_VENDOR_ID 0xcafe -#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917))) +#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT))) #define SYSTEM_STATE_LED 0 #endif // ENABLE_WSTK_LEDS #define APP_FUNCTION_BUTTON 0 @@ -104,7 +104,7 @@ TimerHandle_t sLightTimer; TaskHandle_t sAppTaskHandle; QueueHandle_t sAppEventQueue; -#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917))) +#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT))) LEDWidget sStatusLED; #endif // ENABLE_WSTK_LEDS @@ -270,7 +270,7 @@ CHIP_ERROR BaseApplication::Init() ConfigurationMgr().LogDeviceConfig(); OutputQrCode(true /*refreshLCD at init*/); -#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917))) +#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT))) LEDWidget::InitGpio(); sStatusLED.Init(SYSTEM_STATE_LED); #endif // ENABLE_WSTK_LEDS @@ -321,7 +321,7 @@ void BaseApplication::FunctionEventHandler(AppEvent * aEvent) bool BaseApplication::ActivateStatusLedPatterns() { bool isPatternSet = false; -#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917))) +#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT))) #ifdef MATTER_DM_PLUGIN_IDENTIFY_SERVER if (gIdentify.mActive) { @@ -427,7 +427,7 @@ void BaseApplication::LightEventHandler() #endif // CHIP_CONFIG_ENABLE_ICD_SERVER #if defined(ENABLE_WSTK_LEDS) -#if (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917)) +#ifdef SL_CATALOG_SIMPLE_LED_LED1_PRESENT // Update the status LED if factory reset has not been initiated. // // If system has "full connectivity", keep the LED On constantly. @@ -563,7 +563,7 @@ void BaseApplication::StartFactoryResetSequence() StartStatusLEDTimer(); #endif // CHIP_CONFIG_ENABLE_ICD_SERVER -#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917))) +#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT))) // Turn off all LEDs before starting blink to make sure blink is // co-ordinated. sStatusLED.Set(false); @@ -596,7 +596,7 @@ void BaseApplication::StartStatusLEDTimer() void BaseApplication::StopStatusLEDTimer() { -#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917))) +#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT))) sStatusLED.Set(false); #endif // ENABLE_WSTK_LEDS diff --git a/examples/platform/silabs/FreeRTOSConfig.h b/examples/platform/silabs/FreeRTOSConfig.h index 478dfa10be547f..fd6658c7af35e2 100644 --- a/examples/platform/silabs/FreeRTOSConfig.h +++ b/examples/platform/silabs/FreeRTOSConfig.h @@ -107,7 +107,7 @@ extern "C" { #include -#ifdef SIWX_917 +#ifdef SLI_SI91X_MCU_INTERFACE #include "si91x_device.h" extern uint32_t SystemCoreClock; #else // For EFR32 @@ -169,23 +169,23 @@ extern uint32_t SystemCoreClock; #define configTIMER_QUEUE_LENGTH (10) #define configTIMER_TASK_STACK_DEPTH (1024) -#ifdef SIWX_917 +#ifdef SLI_SI91X_MCU_INTERFACE #ifdef __NVIC_PRIO_BITS #undef __NVIC_PRIO_BITS #endif #define configPRIO_BITS 6 /* 6 priority levels. */ -#endif // SIWX_917 +#endif // SLI_SI91X_MCU_INTERFACE /* Interrupt priorities used by the kernel port layer itself. These are generic to all Cortex-M ports, and do not rely on any particular library functions. */ #define configKERNEL_INTERRUPT_PRIORITY (255) /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!! See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ -#ifdef SIWX_917 +#ifdef SLI_SI91X_MCU_INTERFACE #define configMAX_SYSCALL_INTERRUPT_PRIORITY 20 #else #define configMAX_SYSCALL_INTERRUPT_PRIORITY 48 -#endif // SIWX_917 +#endif // SLI_SI91X_MCU_INTERFACE #define configENABLE_FPU 0 #define configENABLE_MPU 0 @@ -232,11 +232,11 @@ See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ #ifndef configTOTAL_HEAP_SIZE #ifdef SL_WIFI #ifdef DIC_ENABLE -#ifdef SIWX_917 +#ifdef SLI_SI91X_MCU_INTERFACE #define configTOTAL_HEAP_SIZE ((size_t) ((75 + EXTRA_HEAP_k) * 1024)) #else #define configTOTAL_HEAP_SIZE ((size_t) ((68 + EXTRA_HEAP_k) * 1024)) -#endif // SIWX_917 +#endif // SLI_SI91X_MCU_INTERFACE #else #define configTOTAL_HEAP_SIZE ((size_t) ((42 + EXTRA_HEAP_k) * 1024)) #endif // DIC diff --git a/examples/platform/silabs/MatterConfig.cpp b/examples/platform/silabs/MatterConfig.cpp index 32bf04cf0e0f7b..1c148a5a1f0d1c 100644 --- a/examples/platform/silabs/MatterConfig.cpp +++ b/examples/platform/silabs/MatterConfig.cpp @@ -42,9 +42,9 @@ #include "MemMonitoring.h" #endif -#ifdef SIWX_917 +#ifdef SLI_SI91X_MCU_INTERFACE #include "wfx_rsi.h" -#endif /* SIWX_917 */ +#endif /* SLI_SI91X_MCU_INTERFACE */ using namespace ::chip; using namespace ::chip::Inet; @@ -53,7 +53,7 @@ using namespace ::chip::DeviceLayer; #include // If building with the EFR32-provided crypto backend, we can use the // opaque keystore -#if CHIP_CRYPTO_PLATFORM && !(defined(SIWX_917)) +#if CHIP_CRYPTO_PLATFORM && !(defined(SLI_SI91X_MCU_INTERFACE)) #include static chip::DeviceLayer::Internal::Efr32PsaOperationalKeystore gOperationalKeystore; #endif @@ -229,7 +229,7 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName) initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; #endif // SILABS_TEST_EVENT_TRIGGER_ENABLED -#if CHIP_CRYPTO_PLATFORM && !(defined(SIWX_917)) +#if CHIP_CRYPTO_PLATFORM && !(defined(SLI_SI91X_MCU_INTERFACE)) // When building with EFR32 crypto, use the opaque key store // instead of the default (insecure) one. gOperationalKeystore.Init(); @@ -289,13 +289,13 @@ CHIP_ERROR SilabsMatterConfig::InitWiFi(void) #endif // SL_WFX_USE_SECURE_LINK #endif /* WF200_WIFI */ -#ifdef SIWX_917 +#ifdef SLI_SI91X_MCU_INTERFACE sl_status_t status; if ((status = wfx_wifi_rsi_init()) != SL_STATUS_OK) { ReturnErrorOnFailure((CHIP_ERROR) status); } -#endif // SIWX_917 +#endif // SLI_SI91X_MCU_INTERFACE return CHIP_NO_ERROR; } @@ -306,7 +306,7 @@ CHIP_ERROR SilabsMatterConfig::InitWiFi(void) // ================================================================================ extern "C" void vApplicationIdleHook(void) { -#if SIWX_917 && CHIP_CONFIG_ENABLE_ICD_SERVER +#if SLI_SI91X_MCU_INTERFACE && CHIP_CONFIG_ENABLE_ICD_SERVER sl_wfx_host_si91x_sleep_wakeup(); #endif } diff --git a/examples/platform/silabs/OTAConfig.cpp b/examples/platform/silabs/OTAConfig.cpp index 6305af08e628b5..f35c9770a6aab7 100644 --- a/examples/platform/silabs/OTAConfig.cpp +++ b/examples/platform/silabs/OTAConfig.cpp @@ -20,7 +20,7 @@ #include "silabs_utils.h" #include -#ifndef SIWX_917 +#ifndef SLI_SI91X_MCU_INTERFACE #include "application_properties.h" @@ -75,7 +75,7 @@ __attribute__((used)) ApplicationProperties_t sl_app_properties = { .longTokenSectionAddress = NULL, }; #endif // SL_CATALOG_GECKO_BOOTLOADER_INTERFACE_PRESENT -#endif // SIWX_917 +#endif // SLI_SI91X_MCU_INTERFACE // Global OTA objects chip::DefaultOTARequestor gRequestorCore; diff --git a/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.c b/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.c index c5044fcf255a8e..60489cd9b2ba30 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.c +++ b/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.c @@ -41,7 +41,7 @@ #include "ble_config.h" -#if SL_ICD_ENABLED && SIWX_917 +#if SL_ICD_ENABLED && SLI_SI91X_MCU_INTERFACE #include "rsi_rom_power_save.h" #include "sl_si91x_button_pin_config.h" #include "sl_si91x_driver.h" @@ -50,7 +50,7 @@ // TODO: should be removed once we are getting the press interrupt for button 0 with sleep #define BUTTON_PRESSED 1 bool btn0_pressed = false; -#endif // SL_ICD_ENABLED && SIWX_917 +#endif // SL_ICD_ENABLED && SLI_SI91X_MCU_INTERFACE #include "dhcp_client.h" #include "sl_wifi.h" @@ -63,10 +63,10 @@ bool btn0_pressed = false; #define ADV_MULTIPROBE 1 #define ADV_SCAN_PERIODICITY 10 -#ifdef SIWX_917 +#if SLI_SI91X_MCU_INTERFACE #include "sl_si91x_trng.h" #define TRNGKEY_SIZE 4 -#endif // SIWX_917 +#endif // SLI_SI91X_MCU_INTERFACE struct wfx_rsi wfx_rsi; @@ -215,7 +215,7 @@ sl_status_t join_callback_handler(sl_wifi_event_t event, char * result, uint32_t #if SL_ICD_ENABLED -#if SIWX_917 +#if SLI_SI91X_MCU_INTERFACE /****************************************************************** * @fn sl_wfx_host_si91x_sleep_wakeup() * @brief @@ -250,7 +250,7 @@ void sl_wfx_host_si91x_sleep_wakeup() } } } -#endif /* SIWX_917 */ +#endif // SLI_SI91X_MCU_INTERFACE /****************************************************************** * @fn wfx_rsi_power_save() @@ -373,7 +373,7 @@ static sl_status_t wfx_rsi_init(void) SILABS_LOG("sl_wifi_get_mac_address failed: %x", status); return status; } -#ifdef SIWX_917 + const uint32_t trngKey[TRNGKEY_SIZE] = { 0x16157E2B, 0xA6D2AE28, 0x8815F7AB, 0x3C4FCF09 }; // To check the Entropy of TRNG and verify TRNG functioning. @@ -391,7 +391,7 @@ static sl_status_t wfx_rsi_init(void) SILABS_LOG("TRNG Key Programming Failed"); return status; } -#endif // SIWX_917 + wfx_rsi.events = xEventGroupCreateStatic(&rsiDriverEventGroup); wfx_rsi.dev_state |= WFX_RSI_ST_DEV_READY; osSemaphoreRelease(sl_rs_ble_init_sem); @@ -697,7 +697,7 @@ void wfx_rsi_task(void * arg) #ifdef SL_WFX_CONFIG_SCAN | WFX_EVT_SCAN #endif /* SL_WFX_CONFIG_SCAN */ - | 0, + , pdTRUE, /* Clear the bits */ pdFALSE, /* Wait for any bit */ pdMS_TO_TICKS(250)); /* 250 mSec */ diff --git a/examples/platform/silabs/SiWx917/SiWx917/sl_wlan_config.h b/examples/platform/silabs/SiWx917/SiWx917/sl_wlan_config.h index d73989617fe6e3..813ab399af5ab8 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/sl_wlan_config.h +++ b/examples/platform/silabs/SiWx917/SiWx917/sl_wlan_config.h @@ -48,21 +48,11 @@ static const sl_wifi_device_configuration_t config = { #endif | SL_SI91X_TCP_IP_FEAT_ICMP | SL_SI91X_TCP_IP_FEAT_EXTENSION_VALID), .custom_feature_bit_map = (SL_SI91X_CUSTOM_FEAT_EXTENTION_VALID | RSI_CUSTOM_FEATURE_BIT_MAP), - .ext_custom_feature_bit_map = ( -#ifdef SLI_SI917 - (RSI_EXT_CUSTOM_FEATURE_BIT_MAP) -#else // defaults -#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) -#endif -#endif // SLI_SI917 - | (SL_SI91X_EXT_FEAT_BT_CUSTOM_FEAT_ENABLE) + .ext_custom_feature_bit_map = (RSI_EXT_CUSTOM_FEATURE_BIT_MAP | (SL_SI91X_EXT_FEAT_BT_CUSTOM_FEAT_ENABLE) #if (defined A2DP_POWER_SAVE_ENABLE) - | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(2) + | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(2) #endif - ), + ), .bt_feature_bit_map = (RSI_BT_FEATURE_BITMAP #if (RSI_BT_GATT_ON_CLASSIC) | SL_SI91X_BT_ATT_OVER_CLASSIC_ACL /* to support att over classic acl link */ diff --git a/examples/platform/silabs/SilabsDeviceAttestationCreds.cpp b/examples/platform/silabs/SilabsDeviceAttestationCreds.cpp index d442f520debcbc..bc69573c13286b 100644 --- a/examples/platform/silabs/SilabsDeviceAttestationCreds.cpp +++ b/examples/platform/silabs/SilabsDeviceAttestationCreds.cpp @@ -101,7 +101,7 @@ class DeviceAttestationCredsSilabs : public DeviceAttestationCredentialsProvider if (SilabsConfig::ConfigValueExists(SilabsConfig::kConfigKey_Creds_KeyId)) { // Provisioned DAC key -#ifdef SIWX_917 +#ifdef SLI_SI91X_MCU_INTERFACE return CHIP_ERROR_NOT_IMPLEMENTED; #else uint32_t key_id = SILABS_CREDENTIALS_DAC_KEY_ID; diff --git a/examples/platform/silabs/display/demo-ui.c b/examples/platform/silabs/display/demo-ui.c index bccde3e3eaa449..479af92fd5bb90 100644 --- a/examples/platform/silabs/display/demo-ui.c +++ b/examples/platform/silabs/display/demo-ui.c @@ -25,9 +25,9 @@ #include "glib.h" #include "sl_component_catalog.h" #include "sl_memlcd.h" -#if SL_WIFI && !SIWX_917 +#if SL_WIFI && !SLI_SI91X_MCU_INTERFACE #include "spi_multiplex.h" -#endif // SL_WIFI && !SIWX_917 +#endif // SL_WIFI && !SLI_SI91X_MCU_INTERFACE #include #include @@ -106,9 +106,9 @@ void demoUIInit(GLIB_Context_t * context) sl_status_t updateDisplay(void) { sl_status_t status = SL_STATUS_OK; -#if SIWX_917 && SL_ICD_ENABLED && DISPLAY_ENABLED +#if SLI_SI91X_MCU_INTERFACE && SL_ICD_ENABLED && DISPLAY_ENABLED sl_memlcd_post_wakeup_init(); -#endif // SIWX_917 && SL_ICD_ENABLED && DISPLAY_ENABLED +#endif // SLI_SI91X_MCU_INTERFACE && SL_ICD_ENABLED && DISPLAY_ENABLED #if SL_LCDCTRL_MUX status = sl_wfx_host_pre_lcd_spi_transfer(); if (status != SL_STATUS_OK) diff --git a/examples/platform/silabs/display/lcd.cpp b/examples/platform/silabs/display/lcd.cpp index 43a134f923e24c..bf40cd0f6d543b 100644 --- a/examples/platform/silabs/display/lcd.cpp +++ b/examples/platform/silabs/display/lcd.cpp @@ -25,7 +25,7 @@ #include "dmd.h" #include "glib.h" -#if (SIWX_917) +#if (SLI_SI91X_MCU_INTERFACE) #include "rsi_chip.h" #endif @@ -66,7 +66,7 @@ CHIP_ERROR SilabsLCD::Init(uint8_t * name, bool initialState) } /* Enable the memory lcd */ -#if (SIWX_917) +#if (SLI_SI91X_MCU_INTERFACE) RSI_NPSSGPIO_InputBufferEn(SL_BOARD_ENABLE_DISPLAY_PIN, 1U); RSI_NPSSGPIO_SetPinMux(SL_BOARD_ENABLE_DISPLAY_PIN, 0); RSI_NPSSGPIO_SetDir(SL_BOARD_ENABLE_DISPLAY_PIN, 0); 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 f7a40551fdc5b5..079a5e0c9c32f4 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 @@ -38,7 +38,7 @@ #include "wfx_host_events.h" #include "wfx_rsi.h" -#if (SIWX_917 | EXP_BOARD) +#if (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) #include "sl_board_configuration.h" #include "sl_rsi_utility.h" @@ -61,7 +61,7 @@ void rsi_gpio_irq_cb(uint8_t irqnum) { if (irqnum != SL_WFX_HOST_PINOUT_SPI_IRQ) return; -#if (SIWX_917 | EXP_BOARD) +#if (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) sl_si91x_host_set_bus_event(NCP_HOST_BUS_RX_EVENT); #else GPIO_IntClear(1 << SL_WFX_HOST_PINOUT_SPI_IRQ); diff --git a/examples/platform/silabs/efr32/rs911x/sl_wlan_config.h b/examples/platform/silabs/efr32/rs911x/sl_wlan_config.h index c8eef5c60e830e..2ce2060cd7deeb 100644 --- a/examples/platform/silabs/efr32/rs911x/sl_wlan_config.h +++ b/examples/platform/silabs/efr32/rs911x/sl_wlan_config.h @@ -1,109 +1,109 @@ -/* - * - * Copyright (c) 2022 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef RSI_CONFIG_H -#define RSI_CONFIG_H - -#include "ble_config.h" -#include "sl_wifi_device.h" - -//! Enable feature -#define RSI_ENABLE 1 -//! Disable feature -#define RSI_DISABLE 0 - -static const sl_wifi_device_configuration_t config = { - .boot_option = LOAD_NWP_FW, - .mac_address = NULL, - .band = SL_SI91X_WIFI_BAND_2_4GHZ, - .region_code = US, - .boot_config = { .oper_mode = SL_SI91X_CLIENT_MODE, - .coex_mode = SL_SI91X_WLAN_BLE_MODE, - .feature_bit_map = -#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), -#endif - .tcp_ip_feature_bit_map = (SL_SI91X_TCP_IP_FEAT_DHCPV4_CLIENT | SL_SI91X_TCP_IP_FEAT_DNS_CLIENT | - SL_SI91X_TCP_IP_FEAT_SSL | SL_SI91X_TCP_IP_FEAT_BYPASS -#ifdef ipv6_FEATURE_REQUIRED - | 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_CUSTOM_FEAT_EXTENTION_VALID | RSI_CUSTOM_FEATURE_BIT_MAP), - .ext_custom_feature_bit_map = ( -#ifdef SLI_SI917 - (RSI_EXT_CUSTOM_FEATURE_BIT_MAP) -#else // defaults -#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) -#endif -#endif - | (SL_SI91X_EXT_FEAT_BT_CUSTOM_FEAT_ENABLE) -#if (defined A2DP_POWER_SAVE_ENABLE) - | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(2) -#endif - ), - .bt_feature_bit_map = (RSI_BT_FEATURE_BITMAP -#if (RSI_BT_GATT_ON_CLASSIC) - | SL_SI91X_BT_ATT_OVER_CLASSIC_ACL /* to support att over classic acl link */ -#endif - ), -#ifdef RSI_PROCESS_MAX_RX_DATA - .ext_tcp_ip_feature_bit_map = - (RSI_EXT_TCPIP_FEATURE_BITMAP | SL_SI91X_CONFIG_FEAT_EXTENTION_VALID | SL_SI91X_EXT_TCP_MAX_RECV_LENGTH), -#else - .ext_tcp_ip_feature_bit_map = (RSI_EXT_TCPIP_FEATURE_BITMAP | SL_SI91X_CONFIG_FEAT_EXTENTION_VALID), -#endif - //! ENABLE_BLE_PROTOCOL in bt_feature_bit_map - .ble_feature_bit_map = - ((SL_SI91X_BLE_MAX_NBR_PERIPHERALS(RSI_BLE_MAX_NBR_PERIPHERALS) | - SL_SI91X_BLE_MAX_NBR_CENTRALS(RSI_BLE_MAX_NBR_CENTRALS) | - SL_SI91X_BLE_MAX_NBR_ATT_SERV(RSI_BLE_MAX_NBR_ATT_SERV) | - SL_SI91X_BLE_MAX_NBR_ATT_REC(RSI_BLE_MAX_NBR_ATT_REC)) | - SL_SI91X_FEAT_BLE_CUSTOM_FEAT_EXTENTION_VALID | SL_SI91X_BLE_PWR_INX(RSI_BLE_PWR_INX) | - SL_SI91X_BLE_PWR_SAVE_OPTIONS(RSI_BLE_PWR_SAVE_OPTIONS) | SL_SI91X_916_BLE_COMPATIBLE_FEAT_ENABLE -#if RSI_BLE_GATT_ASYNC_ENABLE - | SL_SI91X_BLE_GATT_ASYNC_ENABLE -#endif - ), - - .ble_ext_feature_bit_map = ((SL_SI91X_BLE_NUM_CONN_EVENTS(RSI_BLE_NUM_CONN_EVENTS) | - SL_SI91X_BLE_NUM_REC_BYTES(RSI_BLE_NUM_REC_BYTES)) -#if RSI_BLE_INDICATE_CONFIRMATION_FROM_HOST - | SL_SI91X_BLE_INDICATE_CONFIRMATION_FROM_HOST // indication response from app -#endif -#if RSI_BLE_MTU_EXCHANGE_FROM_HOST - | SL_SI91X_BLE_MTU_EXCHANGE_FROM_HOST // MTU Exchange request initiation from app -#endif -#if RSI_BLE_SET_SCAN_RESP_DATA_FROM_HOST - | (SL_SI91X_BLE_SET_SCAN_RESP_DATA_FROM_HOST) // Set SCAN Resp Data from app -#endif -#if RSI_BLE_DISABLE_CODED_PHY_FROM_HOST - | (SL_SI91X_BLE_DISABLE_CODED_PHY_FROM_HOST) // Disable Coded PHY from app -#endif -#if BLE_SIMPLE_GATT - | SL_SI91X_BLE_GATT_INIT -#endif - ), - .config_feature_bit_map = (SL_SI91X_FEAT_SLEEP_GPIO_SEL_BITMAP | RSI_CONFIG_FEATURE_BITMAP) } -}; - -#endif \ No newline at end of file +/* + * + * Copyright (c) 2022 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef RSI_CONFIG_H +#define RSI_CONFIG_H + +#include "ble_config.h" +#include "sl_wifi_device.h" + +//! Enable feature +#define RSI_ENABLE 1 +//! Disable feature +#define RSI_DISABLE 0 + +static const sl_wifi_device_configuration_t config = { + .boot_option = LOAD_NWP_FW, + .mac_address = NULL, + .band = SL_SI91X_WIFI_BAND_2_4GHZ, + .region_code = US, + .boot_config = { .oper_mode = SL_SI91X_CLIENT_MODE, + .coex_mode = SL_SI91X_WLAN_BLE_MODE, + .feature_bit_map = +#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), +#endif + .tcp_ip_feature_bit_map = (SL_SI91X_TCP_IP_FEAT_DHCPV4_CLIENT | SL_SI91X_TCP_IP_FEAT_DNS_CLIENT | + SL_SI91X_TCP_IP_FEAT_SSL | SL_SI91X_TCP_IP_FEAT_BYPASS +#ifdef ipv6_FEATURE_REQUIRED + | 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_CUSTOM_FEAT_EXTENTION_VALID | RSI_CUSTOM_FEATURE_BIT_MAP), + .ext_custom_feature_bit_map = ( +#ifdef SLI_SI917 + (RSI_EXT_CUSTOM_FEATURE_BIT_MAP) +#else // defaults +#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) +#endif +#endif + | (SL_SI91X_EXT_FEAT_BT_CUSTOM_FEAT_ENABLE) +#if (defined A2DP_POWER_SAVE_ENABLE) + | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(2) +#endif + ), + .bt_feature_bit_map = (RSI_BT_FEATURE_BITMAP +#if (RSI_BT_GATT_ON_CLASSIC) + | SL_SI91X_BT_ATT_OVER_CLASSIC_ACL /* to support att over classic acl link */ +#endif + ), +#ifdef RSI_PROCESS_MAX_RX_DATA + .ext_tcp_ip_feature_bit_map = + (RSI_EXT_TCPIP_FEATURE_BITMAP | SL_SI91X_CONFIG_FEAT_EXTENTION_VALID | SL_SI91X_EXT_TCP_MAX_RECV_LENGTH), +#else + .ext_tcp_ip_feature_bit_map = (RSI_EXT_TCPIP_FEATURE_BITMAP | SL_SI91X_CONFIG_FEAT_EXTENTION_VALID), +#endif + //! ENABLE_BLE_PROTOCOL in bt_feature_bit_map + .ble_feature_bit_map = + ((SL_SI91X_BLE_MAX_NBR_PERIPHERALS(RSI_BLE_MAX_NBR_PERIPHERALS) | + SL_SI91X_BLE_MAX_NBR_CENTRALS(RSI_BLE_MAX_NBR_CENTRALS) | + SL_SI91X_BLE_MAX_NBR_ATT_SERV(RSI_BLE_MAX_NBR_ATT_SERV) | + SL_SI91X_BLE_MAX_NBR_ATT_REC(RSI_BLE_MAX_NBR_ATT_REC)) | + SL_SI91X_FEAT_BLE_CUSTOM_FEAT_EXTENTION_VALID | SL_SI91X_BLE_PWR_INX(RSI_BLE_PWR_INX) | + SL_SI91X_BLE_PWR_SAVE_OPTIONS(RSI_BLE_PWR_SAVE_OPTIONS) | SL_SI91X_916_BLE_COMPATIBLE_FEAT_ENABLE +#if RSI_BLE_GATT_ASYNC_ENABLE + | SL_SI91X_BLE_GATT_ASYNC_ENABLE +#endif + ), + + .ble_ext_feature_bit_map = ((SL_SI91X_BLE_NUM_CONN_EVENTS(RSI_BLE_NUM_CONN_EVENTS) | + SL_SI91X_BLE_NUM_REC_BYTES(RSI_BLE_NUM_REC_BYTES)) +#if RSI_BLE_INDICATE_CONFIRMATION_FROM_HOST + | SL_SI91X_BLE_INDICATE_CONFIRMATION_FROM_HOST // indication response from app +#endif +#if RSI_BLE_MTU_EXCHANGE_FROM_HOST + | SL_SI91X_BLE_MTU_EXCHANGE_FROM_HOST // MTU Exchange request initiation from app +#endif +#if RSI_BLE_SET_SCAN_RESP_DATA_FROM_HOST + | (SL_SI91X_BLE_SET_SCAN_RESP_DATA_FROM_HOST) // Set SCAN Resp Data from app +#endif +#if RSI_BLE_DISABLE_CODED_PHY_FROM_HOST + | (SL_SI91X_BLE_DISABLE_CODED_PHY_FROM_HOST) // Disable Coded PHY from app +#endif +#if BLE_SIMPLE_GATT + | SL_SI91X_BLE_GATT_INIT +#endif + ), + .config_feature_bit_map = (SL_SI91X_FEAT_SLEEP_GPIO_SEL_BITMAP | RSI_CONFIG_FEATURE_BITMAP) } +}; + +#endif diff --git a/examples/thermostat/silabs/src/ThermostatUI.cpp b/examples/thermostat/silabs/src/ThermostatUI.cpp index 77184151e1d1d3..f82ee36387e99a 100644 --- a/examples/thermostat/silabs/src/ThermostatUI.cpp +++ b/examples/thermostat/silabs/src/ThermostatUI.cpp @@ -25,7 +25,7 @@ #include "glib.h" #include "lcd.h" -#if SL_WIFI && !defined(SIWX_917) +#if SL_WIFI && !defined(SLI_SI91X_MCU_INTERFACE) // Only needed for wifi NCP devices #include "spi_multiplex.h" #endif // SL_WIFI diff --git a/src/platform/silabs/KeyValueStoreManagerImpl.cpp b/src/platform/silabs/KeyValueStoreManagerImpl.cpp index 5dbeba3e35edcd..8f886dba84ba67 100644 --- a/src/platform/silabs/KeyValueStoreManagerImpl.cpp +++ b/src/platform/silabs/KeyValueStoreManagerImpl.cpp @@ -164,7 +164,7 @@ void KeyValueStoreManagerImpl::ScheduleKeyMapSave(void) During commissioning, the key map will be modified multiples times subsequently. Commit the key map in nvm once it as stabilized. */ -#if SIWX_917 && CHIP_CONFIG_ENABLE_ICD_SERVER +#if SLI_SI91X_MCU_INTERFACE && CHIP_CONFIG_ENABLE_ICD_SERVER // TODO: Remove this when RTC timer is added MATTER-2705 SilabsConfig::WriteConfigValueBin(SilabsConfig::kConfigKey_KvsStringKeyMap, reinterpret_cast(mKvsKeyMap), sizeof(mKvsKeyMap)); @@ -172,7 +172,7 @@ void KeyValueStoreManagerImpl::ScheduleKeyMapSave(void) SystemLayer().StartTimer( std::chrono::duration_cast(System::Clock::Seconds32(SILABS_KVS_SAVE_DELAY_SECONDS)), KeyValueStoreManagerImpl::OnScheduledKeyMapSave, NULL); -#endif // defined(SIWX_917) && CHIP_CONFIG_ENABLE_ICD_SERVER +#endif // defined(SLI_SI91X_MCU_INTERFACE) && CHIP_CONFIG_ENABLE_ICD_SERVER } CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t value_size, size_t * read_bytes_size, diff --git a/src/platform/silabs/SilabsConfig.cpp b/src/platform/silabs/SilabsConfig.cpp index f98ced75a3e1d8..6c362d41c2c330 100644 --- a/src/platform/silabs/SilabsConfig.cpp +++ b/src/platform/silabs/SilabsConfig.cpp @@ -33,7 +33,7 @@ #include #include -#ifndef SIWX_917 // 917soc/wifi-sdk implements the same nvm3 lock/unlock mechanism and it currently can't be overide. +#ifndef SLI_SI91X_MCU_INTERFACE // 917soc/wifi-sdk implements the same nvm3 lock/unlock mechanism and it currently can't be overide. #include #include // Substitute the GSDK weak nvm3_lockBegin and nvm3_lockEnd @@ -58,7 +58,7 @@ void nvm3_lockEnd(void) VerifyOrDie(nvm3_Sem != NULL); xSemaphoreGive(nvm3_Sem); } -#endif // !SIWX_917 +#endif // !SLI_SI91X_MCU_INTERFACE namespace chip { namespace DeviceLayer { @@ -78,9 +78,9 @@ CHIP_ERROR SilabsConfig::Init() void SilabsConfig::DeInit() { -#ifndef SIWX_917 +#ifndef SLI_SI91X_MCU_INTERFACE vSemaphoreDelete(nvm3_Sem); -#endif // !SIWX_917 +#endif // !SLI_SI91X_MCU_INTERFACE nvm3_close(nvm3_defaultHandle); } diff --git a/src/platform/silabs/efr32/wifi/ethernetif.cpp b/src/platform/silabs/efr32/wifi/ethernetif.cpp index 3dbd1b85b3ef9a..32d7ee1d079d0d 100644 --- a/src/platform/silabs/efr32/wifi/ethernetif.cpp +++ b/src/platform/silabs/efr32/wifi/ethernetif.cpp @@ -31,7 +31,7 @@ #include "FreeRTOS.h" #include "event_groups.h" #include "task.h" -#if (SIWX_917 | EXP_BOARD) +#if (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) #ifdef __cplusplus extern "C" { #endif @@ -46,7 +46,7 @@ extern "C" { #ifdef __cplusplus } #endif -#endif // (SIWX_917 | EXP_BOARD) +#endif // (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) #endif // WF200_WIFI #include "wfx_host_events.h" @@ -349,7 +349,7 @@ static SemaphoreHandle_t ethout_sem; ******************************************************************************/ static err_t low_level_output(struct netif * netif, struct pbuf * p) { -#if (SIWX_917 | EXP_BOARD) +#if (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) sl_wifi_buffer_t * buffer; sl_si91x_packet_t * packet; sl_status_t status = SL_STATUS_OK; @@ -385,7 +385,7 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) return ERR_IF; } /* Confirm if packet is allocated */ -#if (SIWX_917 | EXP_BOARD) +#if (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) status = sl_si91x_allocate_command_buffer(&buffer, (void **) &packet, sizeof(sl_si91x_packet_t) + framelength, SL_WIFI_ALLOCATE_COMMAND_BUFFER_WAIT_TIME_MS); VERIFY_STATUS_AND_RETURN(status); @@ -393,18 +393,18 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) #else // RS9116 packet = wfx_rsi_alloc_pkt(); if (!packet) -#endif // SIWX_917 +#endif // SLI_SI91X_MCU_INTERFACE { SILABS_LOG("EN-RSI:No buf"); xSemaphoreGive(ethout_sem); -#if (SIWX_917 | EXP_BOARD) +#if (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) return SL_STATUS_ALLOCATION_FAILED; } memset(packet->desc, 0, sizeof(packet->desc)); #else // RS9116 return ERR_IF; } -#endif // SIWX_917 +#endif // SLI_SI91X_MCU_INTERFACE #ifdef WIFI_DEBUG_ENABLED uint8_t * b = (uint8_t *) p->payload; SILABS_LOG("EN-RSI: Out [%02x:%02x:%02x:%02x:%02x:%02x][%02x:%02x:%02x:%02x:%02x:%02x]type=%02x%02x", b[0], b[1], b[2], b[3], @@ -428,7 +428,7 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) /* forward the generated packet to RSI to * send the data over wifi network */ -#if (SIWX_917 | EXP_BOARD) +#if (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) packet->length = framelength & 0xFFF; packet->command = RSI_SEND_RAW_DATA; if (sl_si91x_driver_send_data_packet(SI91X_WLAN_CMD_QUEUE, buffer, 1000)) @@ -452,7 +452,7 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) return ERR_OK; } -#if (SIWX_917 | EXP_BOARD) +#if (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) /***************************************************************************** * @fn void sl_si91x_host_process_data_frame(uint8_t *buf, int len) * @brief diff --git a/src/platform/silabs/efr32/wifi/wfx_host_events.h b/src/platform/silabs/efr32/wifi/wfx_host_events.h index c9f451f8ac063a..b7a7c936b8d6de 100644 --- a/src/platform/silabs/efr32/wifi/wfx_host_events.h +++ b/src/platform/silabs/efr32/wifi/wfx_host_events.h @@ -98,7 +98,7 @@ typedef struct __attribute__((__packed__)) sl_wfx_mib_req_s #include "wfx_msgs.h" -#if (SIWX_917 | EXP_BOARD) +#if (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) #include "sl_si91x_types.h" #include "sl_status.h" #include "sl_wifi_constants.h" @@ -361,7 +361,7 @@ void wfx_ip_changed_notify(int got_ip); #endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ void wfx_ipv6_notify(int got_ip); -#if !(SIWX_917 | EXP_BOARD) +#if !(SLI_SI91X_MCU_INTERFACE | EXP_BOARD) void * wfx_rsi_alloc_pkt(void); #endif @@ -386,7 +386,7 @@ void sl_wfx_host_gpio_init(void); sl_status_t sl_wfx_host_process_event(sl_wfx_generic_message_t * event_payload); #endif -#if (SIWX_917 | EXP_BOARD) +#if (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retryJoin); sl_status_t sl_si91x_driver_send_data_packet(sl_si91x_queue_type_t queue_type, sl_wifi_buffer_t * buffer, uint32_t wait_time); sl_status_t sl_si91x_allocate_command_buffer(sl_wifi_buffer_t ** host_buffer, void ** buffer, uint32_t requested_buffer_size, diff --git a/src/platform/silabs/rs911x/BLEManagerImpl.cpp b/src/platform/silabs/rs911x/BLEManagerImpl.cpp index d7e79f59dc8318..7c6f5a58ffe717 100644 --- a/src/platform/silabs/rs911x/BLEManagerImpl.cpp +++ b/src/platform/silabs/rs911x/BLEManagerImpl.cpp @@ -28,7 +28,7 @@ #include "cmsis_os2.h" #include -#ifndef SIWX_917 +#ifndef SLI_SI91X_MCU_INTERFACE #include "rail.h" #endif #include @@ -42,7 +42,7 @@ extern "C" { #include "wfx_host_events.h" #include "wfx_rsi.h" #include "wfx_sl_ble_init.h" -#if !(SIWX_917 | EXP_BOARD) +#if !(SLI_SI91X_MCU_INTERFACE | EXP_BOARD) #include #endif #include @@ -58,11 +58,11 @@ extern "C" { #include #include -#ifdef SIWX_917 +#ifdef SLI_SI91X_MCU_INTERFACE extern "C" { #include "sl_si91x_trng.h" } -#endif // SIWX_917 +#endif // SLI_SI91X_MCU_INTERFACE #if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING #include @@ -85,7 +85,7 @@ using namespace ::chip::DeviceLayer::Internal; void sl_ble_init() { uint8_t randomAddrBLE[RSI_BLE_ADDR_LENGTH] = { 0 }; -#if SIWX_917 +#if SLI_SI91X_MCU_INTERFACE 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); @@ -100,7 +100,7 @@ void sl_ble_init() #else uint64_t randomAddr = chip::Crypto::GetRandU64(); memcpy(randomAddrBLE, &randomAddr, RSI_BLE_ADDR_LENGTH); -#endif // SIWX_917 +#endif // SLI_SI91X_MCU_INTERFACE // 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, diff --git a/src/platform/silabs/rs911x/rsi_ble_config.h b/src/platform/silabs/rs911x/rsi_ble_config.h index 72f830b423ef9d..c5a07e25ed12d2 100644 --- a/src/platform/silabs/rs911x/rsi_ble_config.h +++ b/src/platform/silabs/rs911x/rsi_ble_config.h @@ -1,316 +1,316 @@ -/******************************************************************************* - * @file rsi_ble_config.h - * @brief - ******************************************************************************* - * # License - * Copyright 2020 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. - * - ******************************************************************************/ -#pragma once - -#include "rsi_ble_apis.h" -#if (SIWX_917 | EXP_BOARD) -#include "rsi_bt_common_apis.h" -#include "rsi_user.h" -#else -#include -#endif - -/****************************************************** - * * Macros - * ******************************************************/ -//! application event list -// TODO: remove this define after integration of the new wifi sdk -#ifndef RSI_FAILURE -// failure return value -#define RSI_FAILURE -1 -#endif - -#define RSI_BLE_CONN_EVENT (0x01) -#define RSI_BLE_DISCONN_EVENT (0x02) -#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) -#define RSI_WLAN_ALREADY (0x10) -#define RSI_WLAN_NOT_ALREADY (0x11) -#define RSI_BLE_WLAN_TIMEOUT_NOTIFY (0x12) -#define RSI_BLE_WLAN_JOIN_STATUS (0x15) -#define RSI_APP_FW_VERSION (0x13) -#define RSI_BLE_WLAN_DISCONNECT_STATUS (0x14) - -#define RSI_REM_DEV_ADDR_LEN (18) -#define RSI_REM_DEV_NAME_LEN (31) - -#define RSI_BLE_DEV_NAME "CCP_DEVICE" -#define RSI_BLE_SET_RAND_ADDR "00:23:A7:12:34:56" -#define RSI_BLE_EVENT_GATT_RD (0x08) -#define RSI_BLE_ADDR_LENGTH 6 - -#define CLEAR_WHITELIST (0x00) -#define ADD_DEVICE_TO_WHITELIST (0x01) -#define DELETE_DEVICE_FROM_WHITELIST (0x02) - -#define CLEAR_ACCEPTLIST (0x00) -#define ADD_DEVICE_TO_ACCEPTLIST (0x01) -#define DELETE_DEVICE_FROM_ACCEPTLIST (0x02) - -#define RSI_BLE_TX_OCTETS 251 -#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) - -#define RSI_OPERMODE_WLAN_BLE (13) - -/***********************************************************************************************************************************************/ -//! Characteristic Presenatation Format Fields -/***********************************************************************************************************************************************/ -#define RSI_BLE_UINT8_FORMAT (0x04) -#define RSI_BLE_EXPONENT (0x00) -#define RSI_BLE_PERCENTAGE_UNITS_UUID (0x27AD) -#define RSI_BLE_NAME_SPACE (0x01) -#define RSI_BLE_DESCRIPTION (0x010B) - -//! BLE characteristic custom service uuid -#define RSI_BLE_CUSTOM_SERVICE_UUID (0xFFF6) -#define RSI_BLE_CUSTOM_LEVEL_UUID (0x1FF1) - -#if (defined(RSI_M4_INTERFACE) || defined(SLI_SI91X_MCU_INTERFACE)) -#define RSI_BLE_MAX_NBR_ATT_REC (20) - -#if (SIWX_917 | EXP_BOARD) -#define RSI_BLE_MAX_NBR_PERIPHERALS (1) -#else -#define RSI_BLE_MAX_NBR_SLAVES (1) -#endif // (SIWX_917 | EXP_BOARD) - -#define RSI_BLE_NUM_CONN_EVENTS (2) -#else -#define RSI_BLE_MAX_NBR_ATT_REC (80) - -#if (SIWX_917 | EXP_BOARD) -#define RSI_BLE_MAX_NBR_PERIPHERALS (3) -#else -#define RSI_BLE_MAX_NBR_SLAVES (3) -#endif // (SIWX_917 | EXP_BOARD) - -#define RSI_BLE_NUM_CONN_EVENTS (20) -#endif // (defined(RSI_M4_INTERFACE) || defined(SLI_SI91X_MCU_INTERFACE)) - -#define RSI_BLE_MAX_NBR_ATT_SERV (10) - -#define RSI_BLE_GATT_ASYNC_ENABLE (1) -#define RSI_BLE_GATT_INIT (0) - -#define RSI_BLE_START_SCAN (0x01) -#define RSI_BLE_STOP_SCAN (0x00) - -#define RSI_BLE_SCAN_TYPE SCAN_TYPE_ACTIVE -#define RSI_BLE_SCAN_FILTER_TYPE SCAN_FILTER_TYPE_ALL -/* Number of BLE GATT RECORD SIZE IN (n*16 BYTES), eg:(0x40*16)=1024 bytes */ -#define RSI_BLE_NUM_REC_BYTES (0x40) - -#define RSI_BLE_INDICATE_CONFIRMATION_FROM_HOST (0) - -/*=======================================================================*/ -//! Advertising command parameters -/*=======================================================================*/ - -#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_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 -#define RSI_BLE_ADV_INT_MIN (0x20) -#define RSI_BLE_ADV_INT_MAX (0x20) - -#define RSI_BLE_ADV_CHANNEL_MAP (0x07) - -//! Advertise status -//! Start the advertising process -#define RSI_BLE_START_ADV (0x01) -//! Stop the advertising process -#define RSI_BLE_STOP_ADV (0x00) - -//! BLE Tx Power Index On Air -#define RSI_BLE_PWR_INX (30) - -//! BLE Active H/w Pwr Features -#define BLE_DISABLE_DUTY_CYCLING (0) -#define BLE_DUTY_CYCLING (1) -#define BLR_DUTY_CYCLING (2) -#define BLE_4X_PWR_SAVE_MODE (4) -#define RSI_BLE_PWR_SAVE_OPTIONS BLE_DISABLE_DUTY_CYCLING - -//! Advertise types - -/* Advertising will be visible(discoverable) to all the devices. - * Scanning/Connection is also accepted from all devices - * */ -#define UNDIR_CONN (0x80) - -/* Advertising will be visible(discoverable) to the particular device - * mentioned in RSI_BLE_ADV_DIR_ADDR only. - * Scanning and Connection will be accepted from that device only. - * */ -#define DIR_CONN (0x81) - -/* Advertising will be visible(discoverable) to all the devices. - * Scanning will be accepted from all the devices. - * Connection will be not be accepted from any device. - * */ -#define UNDIR_SCAN (0x82) - -/* Advertising will be visible(discoverable) to all the devices. - * Scanning and Connection will not be accepted from any device - * */ -#define UNDIR_NON_CONN (0x83) - -/* Advertising will be visible(discoverable) to the particular device - * mentioned in RSI_BLE_ADV_DIR_ADDR only. - * Scanning and Connection will be accepted from that device only. - * */ -#define DIR_CONN_LOW_DUTY_CYCLE (0x84) - -//! Advertising flags -#define LE_LIMITED_DISCOVERABLE (0x01) -#define LE_GENERAL_DISCOVERABLE (0x02) -#define LE_BR_EDR_NOT_SUPPORTED (0x04) - -//! Advertise filters -#define ALLOW_SCAN_REQ_ANY_CONN_REQ_ANY (0x00) -#define ALLOW_SCAN_REQ_WHITE_LIST_CONN_REQ_ANY (0x01) -#define ALLOW_SCAN_REQ_ANY_CONN_REQ_WHITE_LIST (0x02) -#define ALLOW_SCAN_REQ_WHITE_LIST_CONN_REQ_WHITE_LIST (0x03) - -//! Address types -#define LE_PUBLIC_ADDRESS (0x00) -#define LE_RANDOM_ADDRESS (0x01) -#define LE_RESOLVABLE_PUBLIC_ADDRESS (0x02) -#define LE_RESOLVABLE_RANDOM_ADDRESS (0x03) - -/*=======================================================================*/ - -/*=======================================================================*/ -//! Connection parameters -/*=======================================================================*/ -#define LE_SCAN_INTERVAL (0x0100) -#define LE_SCAN_WINDOW (0x0050) - -#define CONNECTION_INTERVAL_MIN (0x00A0) -#define CONNECTION_INTERVAL_MAX (0x00A0) - -#define CONNECTION_LATENCY (0x0000) -#define SUPERVISION_TIMEOUT (0x07D0) // 2000 - -/*=======================================================================*/ - -/*=======================================================================*/ -//! Scan command parameters -/*=======================================================================*/ - -#define SL_WFX_BLE_SCAN_TYPE SCAN_TYPE_ACTIVE -#define SL_WFX_BLE_SCAN_FILTER_TYPE SCAN_FILTER_TYPE_ALL - -//! Scan status -#define SL_WFX_BLE_START_SCAN (0x01) -#define SL_WFX_BLE_STOP_SCAN (0x00) - -//! Scan types -#define SCAN_TYPE_ACTIVE (0x01) -#define SCAN_TYPE_PASSIVE (0x00) - -//! Scan filters -#define SCAN_FILTER_TYPE_ALL (0x00) -#define SCAN_FILTER_TYPE_ONLY_WHITE_LIST (0x01) - -#define SL_WFX_SEL_INTERNAL_ANTENNA (0x00) -#define SL_WFX_SEL_EXTERNAL_ANTENNA (0x01) - -#define SL_WFX_BT_CTRL_REMOTE_USER_TERMINATED (0x4E13) -#define SL_WFX_BT_CTRL_REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_LOW_RESOURCES (0x4E14) -#define SL_WFX_BT_CTRL_REMOTE_POWERING_OFF (0x4E15) -#define SL_WFX_BT_CTRL_TERMINATED_MIC_FAILURE (0x4E3D) -#define SL_WFX_BT_FAILED_TO_ESTABLISH_CONN (0x4E3E) -#define SL_WFX_BT_INVALID_RANGE (0x4E60) - -/***********************************************************************************************************************************************/ -//! RS9116 Firmware Configurations -/***********************************************************************************************************************************************/ -/*=======================================================================*/ -//! Power save command parameters -/*=======================================================================*/ - -#define BLE_ATT_REC_SIZE (500) -#define NO_OF_VAL_ATT (5) //! Attribute value count - -#if (SIWX_917 | EXP_BOARD) -#define RSI_BLE_MAX_NBR_CENTRALS (1) -#define FRONT_END_SWITCH_SEL2 BIT(30) -#define RSI_FEATURE_BIT_MAP \ - (SL_SI91X_FEAT_ULP_GPIO_BASED_HANDSHAKE | SL_SI91X_FEAT_DEV_TO_HOST_ULP_GPIO_1) //! To set wlan feature select bit map -#define RSI_TCP_IP_FEATURE_BIT_MAP \ - (SL_SI91X_TCP_IP_FEAT_DHCPV4_CLIENT) //! TCP/IP feature select bitmap for selecting TCP/IP features -#define RSI_CUSTOM_FEATURE_BIT_MAP SL_SI91X_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) | 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) | 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 -#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP (SL_SI91X_EXT_FEAT_LOW_POWER_MODE | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(2)) -#endif /* CHIP_9117 */ - -#define RSI_EXT_TCPIP_FEATURE_BITMAP 0 -#define RSI_BT_FEATURE_BITMAP (SL_SI91X_BT_RF_TYPE | SL_SI91X_ENABLE_BLE_PROTOCOL) -#define RSI_CONFIG_FEATURE_BITMAP 0 -#define RSI_TCP_IP_BYPASS RSI_ENABLE //! TCP IP BYPASS feature checks -#else -#define RSI_BLE_MAX_NBR_MASTERS (1) -#define RSI_HAND_SHAKE_TYPE GPIO_BASED -#endif -/***********************************************************************************************************************************************/ -//! user defined structure -/***********************************************************************************************************************************************/ -typedef struct rsi_ble_att_list_s -{ - uuid_t char_uuid; - uint16_t handle; - uint16_t value_len; - uint16_t max_value_len; - uint8_t char_val_prop; - void * value; -} rsi_ble_att_list_t; -typedef struct rsi_ble_s -{ - uint8_t DATA[BLE_ATT_REC_SIZE]; - uint16_t DATA_ix; - uint16_t att_rec_list_count; - rsi_ble_att_list_t att_rec_list[NO_OF_VAL_ATT]; -} rsi_ble_t; \ No newline at end of file +/******************************************************************************* + * @file rsi_ble_config.h + * @brief + ******************************************************************************* + * # License + * Copyright 2020 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. + * + ******************************************************************************/ +#pragma once + +#include "rsi_ble_apis.h" +#if (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) +#include "rsi_bt_common_apis.h" +#include "rsi_user.h" +#else +#include +#endif + +/****************************************************** + * * Macros + * ******************************************************/ +//! application event list +// TODO: remove this define after integration of the new wifi sdk +#ifndef RSI_FAILURE +// failure return value +#define RSI_FAILURE -1 +#endif + +#define RSI_BLE_CONN_EVENT (0x01) +#define RSI_BLE_DISCONN_EVENT (0x02) +#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) +#define RSI_WLAN_ALREADY (0x10) +#define RSI_WLAN_NOT_ALREADY (0x11) +#define RSI_BLE_WLAN_TIMEOUT_NOTIFY (0x12) +#define RSI_BLE_WLAN_JOIN_STATUS (0x15) +#define RSI_APP_FW_VERSION (0x13) +#define RSI_BLE_WLAN_DISCONNECT_STATUS (0x14) + +#define RSI_REM_DEV_ADDR_LEN (18) +#define RSI_REM_DEV_NAME_LEN (31) + +#define RSI_BLE_DEV_NAME "CCP_DEVICE" +#define RSI_BLE_SET_RAND_ADDR "00:23:A7:12:34:56" +#define RSI_BLE_EVENT_GATT_RD (0x08) +#define RSI_BLE_ADDR_LENGTH 6 + +#define CLEAR_WHITELIST (0x00) +#define ADD_DEVICE_TO_WHITELIST (0x01) +#define DELETE_DEVICE_FROM_WHITELIST (0x02) + +#define CLEAR_ACCEPTLIST (0x00) +#define ADD_DEVICE_TO_ACCEPTLIST (0x01) +#define DELETE_DEVICE_FROM_ACCEPTLIST (0x02) + +#define RSI_BLE_TX_OCTETS 251 +#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) + +#define RSI_OPERMODE_WLAN_BLE (13) + +/***********************************************************************************************************************************************/ +//! Characteristic Presenatation Format Fields +/***********************************************************************************************************************************************/ +#define RSI_BLE_UINT8_FORMAT (0x04) +#define RSI_BLE_EXPONENT (0x00) +#define RSI_BLE_PERCENTAGE_UNITS_UUID (0x27AD) +#define RSI_BLE_NAME_SPACE (0x01) +#define RSI_BLE_DESCRIPTION (0x010B) + +//! BLE characteristic custom service uuid +#define RSI_BLE_CUSTOM_SERVICE_UUID (0xFFF6) +#define RSI_BLE_CUSTOM_LEVEL_UUID (0x1FF1) + +#if (defined(RSI_M4_INTERFACE) || defined(SLI_SI91X_MCU_INTERFACE)) +#define RSI_BLE_MAX_NBR_ATT_REC (20) + +#if (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) +#define RSI_BLE_MAX_NBR_PERIPHERALS (1) +#else +#define RSI_BLE_MAX_NBR_SLAVES (1) +#endif // (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) + +#define RSI_BLE_NUM_CONN_EVENTS (2) +#else +#define RSI_BLE_MAX_NBR_ATT_REC (80) + +#if (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) +#define RSI_BLE_MAX_NBR_PERIPHERALS (3) +#else +#define RSI_BLE_MAX_NBR_SLAVES (3) +#endif // (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) + +#define RSI_BLE_NUM_CONN_EVENTS (20) +#endif // (defined(RSI_M4_INTERFACE) || defined(SLI_SI91X_MCU_INTERFACE)) + +#define RSI_BLE_MAX_NBR_ATT_SERV (10) + +#define RSI_BLE_GATT_ASYNC_ENABLE (1) +#define RSI_BLE_GATT_INIT (0) + +#define RSI_BLE_START_SCAN (0x01) +#define RSI_BLE_STOP_SCAN (0x00) + +#define RSI_BLE_SCAN_TYPE SCAN_TYPE_ACTIVE +#define RSI_BLE_SCAN_FILTER_TYPE SCAN_FILTER_TYPE_ALL +/* Number of BLE GATT RECORD SIZE IN (n*16 BYTES), eg:(0x40*16)=1024 bytes */ +#define RSI_BLE_NUM_REC_BYTES (0x40) + +#define RSI_BLE_INDICATE_CONFIRMATION_FROM_HOST (0) + +/*=======================================================================*/ +//! Advertising command parameters +/*=======================================================================*/ + +#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_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 +#define RSI_BLE_ADV_INT_MIN (0x20) +#define RSI_BLE_ADV_INT_MAX (0x20) + +#define RSI_BLE_ADV_CHANNEL_MAP (0x07) + +//! Advertise status +//! Start the advertising process +#define RSI_BLE_START_ADV (0x01) +//! Stop the advertising process +#define RSI_BLE_STOP_ADV (0x00) + +//! BLE Tx Power Index On Air +#define RSI_BLE_PWR_INX (30) + +//! BLE Active H/w Pwr Features +#define BLE_DISABLE_DUTY_CYCLING (0) +#define BLE_DUTY_CYCLING (1) +#define BLR_DUTY_CYCLING (2) +#define BLE_4X_PWR_SAVE_MODE (4) +#define RSI_BLE_PWR_SAVE_OPTIONS BLE_DISABLE_DUTY_CYCLING + +//! Advertise types + +/* Advertising will be visible(discoverable) to all the devices. + * Scanning/Connection is also accepted from all devices + * */ +#define UNDIR_CONN (0x80) + +/* Advertising will be visible(discoverable) to the particular device + * mentioned in RSI_BLE_ADV_DIR_ADDR only. + * Scanning and Connection will be accepted from that device only. + * */ +#define DIR_CONN (0x81) + +/* Advertising will be visible(discoverable) to all the devices. + * Scanning will be accepted from all the devices. + * Connection will be not be accepted from any device. + * */ +#define UNDIR_SCAN (0x82) + +/* Advertising will be visible(discoverable) to all the devices. + * Scanning and Connection will not be accepted from any device + * */ +#define UNDIR_NON_CONN (0x83) + +/* Advertising will be visible(discoverable) to the particular device + * mentioned in RSI_BLE_ADV_DIR_ADDR only. + * Scanning and Connection will be accepted from that device only. + * */ +#define DIR_CONN_LOW_DUTY_CYCLE (0x84) + +//! Advertising flags +#define LE_LIMITED_DISCOVERABLE (0x01) +#define LE_GENERAL_DISCOVERABLE (0x02) +#define LE_BR_EDR_NOT_SUPPORTED (0x04) + +//! Advertise filters +#define ALLOW_SCAN_REQ_ANY_CONN_REQ_ANY (0x00) +#define ALLOW_SCAN_REQ_WHITE_LIST_CONN_REQ_ANY (0x01) +#define ALLOW_SCAN_REQ_ANY_CONN_REQ_WHITE_LIST (0x02) +#define ALLOW_SCAN_REQ_WHITE_LIST_CONN_REQ_WHITE_LIST (0x03) + +//! Address types +#define LE_PUBLIC_ADDRESS (0x00) +#define LE_RANDOM_ADDRESS (0x01) +#define LE_RESOLVABLE_PUBLIC_ADDRESS (0x02) +#define LE_RESOLVABLE_RANDOM_ADDRESS (0x03) + +/*=======================================================================*/ + +/*=======================================================================*/ +//! Connection parameters +/*=======================================================================*/ +#define LE_SCAN_INTERVAL (0x0100) +#define LE_SCAN_WINDOW (0x0050) + +#define CONNECTION_INTERVAL_MIN (0x00A0) +#define CONNECTION_INTERVAL_MAX (0x00A0) + +#define CONNECTION_LATENCY (0x0000) +#define SUPERVISION_TIMEOUT (0x07D0) // 2000 + +/*=======================================================================*/ + +/*=======================================================================*/ +//! Scan command parameters +/*=======================================================================*/ + +#define SL_WFX_BLE_SCAN_TYPE SCAN_TYPE_ACTIVE +#define SL_WFX_BLE_SCAN_FILTER_TYPE SCAN_FILTER_TYPE_ALL + +//! Scan status +#define SL_WFX_BLE_START_SCAN (0x01) +#define SL_WFX_BLE_STOP_SCAN (0x00) + +//! Scan types +#define SCAN_TYPE_ACTIVE (0x01) +#define SCAN_TYPE_PASSIVE (0x00) + +//! Scan filters +#define SCAN_FILTER_TYPE_ALL (0x00) +#define SCAN_FILTER_TYPE_ONLY_WHITE_LIST (0x01) + +#define SL_WFX_SEL_INTERNAL_ANTENNA (0x00) +#define SL_WFX_SEL_EXTERNAL_ANTENNA (0x01) + +#define SL_WFX_BT_CTRL_REMOTE_USER_TERMINATED (0x4E13) +#define SL_WFX_BT_CTRL_REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_LOW_RESOURCES (0x4E14) +#define SL_WFX_BT_CTRL_REMOTE_POWERING_OFF (0x4E15) +#define SL_WFX_BT_CTRL_TERMINATED_MIC_FAILURE (0x4E3D) +#define SL_WFX_BT_FAILED_TO_ESTABLISH_CONN (0x4E3E) +#define SL_WFX_BT_INVALID_RANGE (0x4E60) + +/***********************************************************************************************************************************************/ +//! RS9116 Firmware Configurations +/***********************************************************************************************************************************************/ +/*=======================================================================*/ +//! Power save command parameters +/*=======================================================================*/ + +#define BLE_ATT_REC_SIZE (500) +#define NO_OF_VAL_ATT (5) //! Attribute value count + +#if (SLI_SI91X_MCU_INTERFACE | EXP_BOARD) +#define RSI_BLE_MAX_NBR_CENTRALS (1) +#define FRONT_END_SWITCH_SEL2 BIT(30) +#define RSI_FEATURE_BIT_MAP \ + (SL_SI91X_FEAT_ULP_GPIO_BASED_HANDSHAKE | SL_SI91X_FEAT_DEV_TO_HOST_ULP_GPIO_1) //! To set wlan feature select bit map +#define RSI_TCP_IP_FEATURE_BIT_MAP \ + (SL_SI91X_TCP_IP_FEAT_DHCPV4_CLIENT) //! TCP/IP feature select bitmap for selecting TCP/IP features +#define RSI_CUSTOM_FEATURE_BIT_MAP SL_SI91X_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) | 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) | 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 +#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP (SL_SI91X_EXT_FEAT_LOW_POWER_MODE | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(2)) +#endif /* CHIP_9117 */ + +#define RSI_EXT_TCPIP_FEATURE_BITMAP 0 +#define RSI_BT_FEATURE_BITMAP (SL_SI91X_BT_RF_TYPE | SL_SI91X_ENABLE_BLE_PROTOCOL) +#define RSI_CONFIG_FEATURE_BITMAP 0 +#define RSI_TCP_IP_BYPASS RSI_ENABLE //! TCP IP BYPASS feature checks +#else +#define RSI_BLE_MAX_NBR_MASTERS (1) +#define RSI_HAND_SHAKE_TYPE GPIO_BASED +#endif +/***********************************************************************************************************************************************/ +//! user defined structure +/***********************************************************************************************************************************************/ +typedef struct rsi_ble_att_list_s +{ + uuid_t char_uuid; + uint16_t handle; + uint16_t value_len; + uint16_t max_value_len; + uint8_t char_val_prop; + void * value; +} rsi_ble_att_list_t; +typedef struct rsi_ble_s +{ + uint8_t DATA[BLE_ATT_REC_SIZE]; + uint16_t DATA_ix; + uint16_t att_rec_list_count; + rsi_ble_att_list_t att_rec_list[NO_OF_VAL_ATT]; +} rsi_ble_t; diff --git a/src/platform/silabs/rs911x/wfx_sl_ble_init.h b/src/platform/silabs/rs911x/wfx_sl_ble_init.h index 26ee258300c5de..19a28888f1864d 100644 --- a/src/platform/silabs/rs911x/wfx_sl_ble_init.h +++ b/src/platform/silabs/rs911x/wfx_sl_ble_init.h @@ -1,134 +1,134 @@ -/******************************************************************************* - * @file wfx_sl_ble_init.h - * @brief - ******************************************************************************* - * # License - * Copyright 2021 Silicon Laboratories Inc. www.silabs.com - ******************************************************************************* - * - * Copyright (c) 2022 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Include files - * */ - -#ifndef WFX_SL_BLE_INIT -#define WFX_SL_BLE_INIT -#ifndef RSI_BLE_ENABLE -#define RSI_BLE_ENABLE (1) -#endif // RSI_BLE_ENABLE - -// BLE include file to refer BLE APIs -#include "FreeRTOS.h" -#include "ble_config.h" -#include "event_groups.h" -#include "task.h" -#include "timers.h" -#include "wfx_host_events.h" -#include "wfx_rsi.h" -#include -#include -#include -#if !(SIWX_917 | EXP_BOARD) -#include -#include -#include -#include -#include -#endif -#include -#include -#include -#include -#include - -typedef struct sl_wfx_msg_s -{ - uint8_t connectionHandle; - uint8_t bondingHandle; - uint32_t event_num; - uint16_t reason; - uint16_t event_id; - uint16_t resp_status; - rsi_ble_event_mtu_t rsi_ble_mtu; - 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; - uint16_t rsi_ble_measurement_hndl; - uint16_t rsi_ble_gatt_server_client_config_hndl; - uint16_t subscribed; - -} sl_wfx_msg_t; - -#define ATT_REC_IN_HOST (0) - -#define RSI_BT_CTRL_REMOTE_USER_TERMINATED (0x4E13) -#define RSI_BT_CTRL_REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_LOW_RESOURCES (0x4E14) -#define RSI_BT_CTRL_REMOTE_POWERING_OFF (0x4E15) -#define RSI_BT_CTRL_TERMINATED_MIC_FAILURE (0x4E3D) -#define RSI_BT_FAILED_TO_ESTABLISH_CONN (0x4E3E) -#define RSI_BT_INVALID_RANGE (0x4E60) - -#define RSI_BLE_MATTER_CUSTOM_SERVICE_UUID (0) -#define RSI_BLE_MATTER_CUSTOM_SERVICE_SIZE (2) -#define RSI_BLE_MATTER_CUSTOM_SERVICE_VALUE_16 (0xFFF6) -#define RSI_BLE_MATTER_CUSTOM_SERVICE_DATA (0x00) - -#define RSI_BLE_CUSTOM_CHARACTERISTIC_RX_SIZE (16) -#define RSI_BLE_CUSTOM_CHARACTERISTIC_RX_RESERVED 0x00, 0x00, 0x00 -#define RSI_BLE_CUSTOM_CHARACTERISTIC_RX_VALUE_128_DATA_1 0x18EE2EF5 -#define RSI_BLE_CUSTOM_CHARACTERISTIC_RX_VALUE_128_DATA_2 0x263D -#define RSI_BLE_CUSTOM_CHARACTERISTIC_RX_VALUE_128_DATA_3 0x4559 -#define RSI_BLE_CUSTOM_CHARACTERISTIC_RX_VALUE_128_DATA_4 0x9F, 0x95, 0x9C, 0x4F, 0x11, 0x9D, 0x9F, 0x42 -#define RSI_BLE_CHARACTERISTIC_RX_ATTRIBUTE_HANDLE_LOCATION (1) -#define RSI_BLE_CHARACTERISTIC_RX_VALUE_HANDLE_LOCATION (2) - -#define RSI_BLE_CUSTOM_CHARACTERISTIC_TX_SIZE (16) -#define RSI_BLE_CUSTOM_CHARACTERISTIC_TX_RESERVED 0x00, 0x00, 0x00 -#define RSI_BLE_CUSTOM_CHARACTERISTIC_TX_VALUE_128_DATA_1 0x18EE2EF5 -#define RSI_BLE_CUSTOM_CHARACTERISTIC_TX_VALUE_128_DATA_2 0x263D -#define RSI_BLE_CUSTOM_CHARACTERISTIC_TX_VALUE_128_DATA_3 0x4559 -#define RSI_BLE_CUSTOM_CHARACTERISTIC_TX_VALUE_128_DATA_4 0x9F, 0x95, 0x9C, 0x4F, 0x12, 0x9D, 0x9F, 0x42 -#define RSI_BLE_CHARACTERISTIC_TX_ATTRIBUTE_HANDLE_LOCATION (3) -#define RSI_BLE_CHARACTERISTIC_TX_MEASUREMENT_HANDLE_LOCATION (4) -#define RSI_BLE_CHARACTERISTIC_TX_GATT_SERVER_CLIENT_HANDLE_LOCATION (5) - -// ALL Ble functions -void rsi_ble_on_connect_event(rsi_ble_event_conn_status_t * resp_conn); -void rsi_ble_on_disconnect_event(rsi_ble_event_disconnect_t * resp_disconnect, uint16_t reason); -void rsi_ble_on_enhance_conn_status_event(rsi_ble_event_enhance_conn_status_t * resp_enh_conn); -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, - uuid_t att_val_uuid); -void rsi_ble_add_char_val_att(void * serv_handler, uint16_t handle, uuid_t att_type_uuid, uint8_t val_prop, uint8_t * data, - uint8_t data_len, uint8_t auth_read); -uint32_t rsi_ble_add_matter_service(void); -void rsi_ble_app_set_event(uint32_t event_num); -int32_t rsi_ble_app_get_event(void); -void rsi_ble_app_clear_event(uint32_t event_num); -void rsi_ble_app_init_events(); -void rsi_ble_event_handling_task(void); - -#endif +/******************************************************************************* + * @file wfx_sl_ble_init.h + * @brief + ******************************************************************************* + * # License + * Copyright 2021 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * Copyright (c) 2022 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Include files + * */ + +#ifndef WFX_SL_BLE_INIT +#define WFX_SL_BLE_INIT +#ifndef RSI_BLE_ENABLE +#define RSI_BLE_ENABLE (1) +#endif // RSI_BLE_ENABLE + +// BLE include file to refer BLE APIs +#include "FreeRTOS.h" +#include "ble_config.h" +#include "event_groups.h" +#include "task.h" +#include "timers.h" +#include "wfx_host_events.h" +#include "wfx_rsi.h" +#include +#include +#include +#if !(SLI_SI91X_MCU_INTERFACE | EXP_BOARD) +#include +#include +#include +#include +#include +#endif +#include +#include +#include +#include +#include + +typedef struct sl_wfx_msg_s +{ + uint8_t connectionHandle; + uint8_t bondingHandle; + uint32_t event_num; + uint16_t reason; + uint16_t event_id; + uint16_t resp_status; + rsi_ble_event_mtu_t rsi_ble_mtu; + 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; + uint16_t rsi_ble_measurement_hndl; + uint16_t rsi_ble_gatt_server_client_config_hndl; + uint16_t subscribed; + +} sl_wfx_msg_t; + +#define ATT_REC_IN_HOST (0) + +#define RSI_BT_CTRL_REMOTE_USER_TERMINATED (0x4E13) +#define RSI_BT_CTRL_REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_LOW_RESOURCES (0x4E14) +#define RSI_BT_CTRL_REMOTE_POWERING_OFF (0x4E15) +#define RSI_BT_CTRL_TERMINATED_MIC_FAILURE (0x4E3D) +#define RSI_BT_FAILED_TO_ESTABLISH_CONN (0x4E3E) +#define RSI_BT_INVALID_RANGE (0x4E60) + +#define RSI_BLE_MATTER_CUSTOM_SERVICE_UUID (0) +#define RSI_BLE_MATTER_CUSTOM_SERVICE_SIZE (2) +#define RSI_BLE_MATTER_CUSTOM_SERVICE_VALUE_16 (0xFFF6) +#define RSI_BLE_MATTER_CUSTOM_SERVICE_DATA (0x00) + +#define RSI_BLE_CUSTOM_CHARACTERISTIC_RX_SIZE (16) +#define RSI_BLE_CUSTOM_CHARACTERISTIC_RX_RESERVED 0x00, 0x00, 0x00 +#define RSI_BLE_CUSTOM_CHARACTERISTIC_RX_VALUE_128_DATA_1 0x18EE2EF5 +#define RSI_BLE_CUSTOM_CHARACTERISTIC_RX_VALUE_128_DATA_2 0x263D +#define RSI_BLE_CUSTOM_CHARACTERISTIC_RX_VALUE_128_DATA_3 0x4559 +#define RSI_BLE_CUSTOM_CHARACTERISTIC_RX_VALUE_128_DATA_4 0x9F, 0x95, 0x9C, 0x4F, 0x11, 0x9D, 0x9F, 0x42 +#define RSI_BLE_CHARACTERISTIC_RX_ATTRIBUTE_HANDLE_LOCATION (1) +#define RSI_BLE_CHARACTERISTIC_RX_VALUE_HANDLE_LOCATION (2) + +#define RSI_BLE_CUSTOM_CHARACTERISTIC_TX_SIZE (16) +#define RSI_BLE_CUSTOM_CHARACTERISTIC_TX_RESERVED 0x00, 0x00, 0x00 +#define RSI_BLE_CUSTOM_CHARACTERISTIC_TX_VALUE_128_DATA_1 0x18EE2EF5 +#define RSI_BLE_CUSTOM_CHARACTERISTIC_TX_VALUE_128_DATA_2 0x263D +#define RSI_BLE_CUSTOM_CHARACTERISTIC_TX_VALUE_128_DATA_3 0x4559 +#define RSI_BLE_CUSTOM_CHARACTERISTIC_TX_VALUE_128_DATA_4 0x9F, 0x95, 0x9C, 0x4F, 0x12, 0x9D, 0x9F, 0x42 +#define RSI_BLE_CHARACTERISTIC_TX_ATTRIBUTE_HANDLE_LOCATION (3) +#define RSI_BLE_CHARACTERISTIC_TX_MEASUREMENT_HANDLE_LOCATION (4) +#define RSI_BLE_CHARACTERISTIC_TX_GATT_SERVER_CLIENT_HANDLE_LOCATION (5) + +// ALL Ble functions +void rsi_ble_on_connect_event(rsi_ble_event_conn_status_t * resp_conn); +void rsi_ble_on_disconnect_event(rsi_ble_event_disconnect_t * resp_disconnect, uint16_t reason); +void rsi_ble_on_enhance_conn_status_event(rsi_ble_event_enhance_conn_status_t * resp_enh_conn); +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, + uuid_t att_val_uuid); +void rsi_ble_add_char_val_att(void * serv_handler, uint16_t handle, uuid_t att_type_uuid, uint8_t val_prop, uint8_t * data, + uint8_t data_len, uint8_t auth_read); +uint32_t rsi_ble_add_matter_service(void); +void rsi_ble_app_set_event(uint32_t event_num); +int32_t rsi_ble_app_get_event(void); +void rsi_ble_app_clear_event(uint32_t event_num); +void rsi_ble_app_init_events(); +void rsi_ble_event_handling_task(void); + +#endif diff --git a/third_party/silabs/SiWx917_sdk.gni b/third_party/silabs/SiWx917_sdk.gni index 0853c0304a8b61..f2d501ef6aa462 100644 --- a/third_party/silabs/SiWx917_sdk.gni +++ b/third_party/silabs/SiWx917_sdk.gni @@ -160,7 +160,8 @@ template("siwx917_sdk") { "RS911X_WIFI=1", "RSI_WLAN_ENABLE", "SLI_SI91X_ENABLE_OS=1", - "SLI_SI91X_MCU_INTERFACE=1", #Enable CCP bus Interface + "SLI_SI91X_MCU_INTERFACE=1", #Enable CCP bus Interface, Differentiation: + # 1->SOC and 0->NCP "RSI_WLAN_API_ENABLE", "NVM3_DEFAULT_NVM_SIZE=40960", "NVM3_DEFAULT_MAX_OBJECT_SIZE=4092", @@ -171,8 +172,6 @@ template("siwx917_sdk") { "__HEAP_SIZE=0", "PLATFORM_HEADER=\"platform-header.h\"", "USE_NVM3=1", - "SIWX_917=1", - "CHIP_9117=1", "SLI_SI91X_ENABLE_BLE=1", "SL_SI91X_ENABLE_LITTLE_ENDIAN=1", "TINYCRYPT_PRIMITIVES", @@ -183,7 +182,6 @@ template("siwx917_sdk") { "SLI_SI91X_MCU_ENABLE_FLASH_BASED_EXECUTION=1", "SL_WIFI_COMPONENT_INCLUDED=1", "SLI_SI917=1", - "SI917=1", "ROMDRIVER_PRESENT=1", "SL_CATALOG_FREERTOS_KERNEL_PRESENT=1", "SLI_SI91X_MCU_CONFIG_RADIO_BOARD_BASE_VER=1", @@ -203,7 +201,6 @@ template("siwx917_sdk") { "ENABLE_DEBUG_MODULE=1", "SI91X_SYSRTC_PRESENT=1", "TA_DEEP_SLEEP_COMMON_FLASH=1", - "SI917_SOC=1", "SI91X_PLATFORM=1", "SL_NET_COMPONENT_INCLUDED=1", "SRAM_BASE=0x0cUL",