diff --git a/examples/platform/silabs/OTAConfig.h b/examples/platform/silabs/OTAConfig.h index 2b7ed9a45fa257..c97202e401f266 100644 --- a/examples/platform/silabs/OTAConfig.h +++ b/examples/platform/silabs/OTAConfig.h @@ -29,6 +29,10 @@ #include #endif +#if (SL_MATTER_GN_BUILD == 0) +#include "sl_matter_ota_config.h" +#endif + class OTAConfig { public: diff --git a/examples/platform/silabs/SiWx917/BUILD.gn b/examples/platform/silabs/SiWx917/BUILD.gn index 8acee7c3b9cfcd..1a4bc788637603 100644 --- a/examples/platform/silabs/SiWx917/BUILD.gn +++ b/examples/platform/silabs/SiWx917/BUILD.gn @@ -210,7 +210,7 @@ source_set("siwx917-common") { ] if (chip_enable_pw_rpc || chip_build_libshell || sl_uart_log_output) { - sources += [ "uart.cpp" ] + sources += [ "${silabs_common_plat_dir}/uart.cpp" ] } if (chip_enable_ota_requestor) { diff --git a/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.cpp b/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.cpp index 59bf52bbc0f30f..bfdedbfe82bb13 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.cpp +++ b/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.cpp @@ -19,6 +19,10 @@ #include #include +#if (SL_MATTER_GN_BUILD == 0) +#include "sl_matter_wifi_config.h" +#endif // SL_MATTER_GN_BUILD + #include "sl_status.h" #include #include @@ -52,9 +56,15 @@ extern "C" { #include "sl_si91x_m4_ps.h" } +namespace { // TODO: should be removed once we are getting the press interrupt for button 0 with sleep #define BUTTON_PRESSED 1 bool btn0_pressed = false; + +#ifdef ENABLE_CHIP_SHELL +bool ps_requirement_added = false; +#endif // ENABLE_CHIP_SHELL +} // namespace #endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI91X_MCU_INTERFACE #include "dhcp_client.h" @@ -288,6 +298,26 @@ void sl_si91x_invoke_btn_press_event() { btn0_pressed = false; } + +#ifdef ENABLE_CHIP_SHELL + // Checking the UULP PIN 1 status to reinit the UART and not allow the device to go to sleep + if (RSI_NPSSGPIO_GetPin(RTE_UULP_GPIO_1_PIN)) + { + if (!ps_requirement_added) + { + sl_si91x_power_manager_add_ps_requirement(SL_SI91X_POWER_MANAGER_PS4); + ps_requirement_added = true; + } + } + else + { + if (ps_requirement_added) + { + sl_si91x_power_manager_remove_ps_requirement(SL_SI91X_POWER_MANAGER_PS4); + ps_requirement_added = false; + } + } +#endif // ENABLE_CHIP_SHELL } /****************************************************************** @@ -426,6 +456,16 @@ static sl_status_t wfx_rsi_init(void) ChipLogError(DeviceLayer, "sl_si91x_m4_ta_secure_handshake failed: 0x%lx", static_cast(status)); return status; } +#ifdef ENABLE_CHIP_SHELL + // While using the matter shell with the ICD server, the GPIO 1 is used to check the UULP PIN 1 status + // since UART doesn't act as a wakeup source in the UULP mode + /*Configuring the NPS GPIO 1*/ + RSI_NPSSGPIO_SetPinMux(RTE_UULP_GPIO_1_PIN, 0); + /*Configure the NPSS GPIO direction to input */ + RSI_NPSSGPIO_SetDir(RTE_UULP_GPIO_1_PIN, 1); + /*Enable the REN*/ + RSI_NPSSGPIO_InputBufferEn(RTE_UULP_GPIO_1_PIN, 1); +#endif // ENABLE_CHIP_SHELL #endif /* CHIP_CONFIG_ENABLE_ICD_SERVER */ #endif /* SLI_SI91X_MCU_INTERFACE */ diff --git a/examples/platform/silabs/SiWx917/uart.cpp b/examples/platform/silabs/SiWx917/uart.cpp deleted file mode 100644 index 863beef67f7f04..00000000000000 --- a/examples/platform/silabs/SiWx917/uart.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/* - * - * Copyright (c) 2021 Project CHIP Authors - * All rights reserved. - * - * 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 "AppConfig.h" -#include "USART.h" -#include "matter_shell.h" -#include "rsi_rom_egpio.h" -#include "silabs_utils.h" -#include "sl_si91x_usart.h" -#ifdef __cplusplus -extern "C" { -#endif -#include "assert.h" -#include "rsi_board.h" -#include "rsi_debug.h" -#include "uart.h" -#include -#include - -#define USART_BAUDRATE 115200 // Baud rate <9600-7372800> -#define UART_CONSOLE_ERR -1 // Negative value in case of UART Console action failed. Triggers a failure for PW_RPC - -sl_usart_handle_t usart_handle; - -void callback_event(uint32_t event); - -/******************************************************************************* - * Callback function triggered on data Transfer and reception - ******************************************************************************/ -void callback_event(uint32_t event) -{ - switch (event) - { - case SL_USART_EVENT_SEND_COMPLETE: - break; - case SL_USART_EVENT_RECEIVE_COMPLETE: -#ifdef ENABLE_CHIP_SHELL - chip::NotifyShellProcess(); -#endif - case SL_USART_EVENT_TRANSFER_COMPLETE: - break; - } -} - -void uartConsoleInit(void) -{ - int32_t status = 0; - - sl_si91x_usart_control_config_t usart_config; - usart_config.baudrate = USART_BAUDRATE; - usart_config.mode = SL_USART_MODE_ASYNCHRONOUS; - usart_config.parity = SL_USART_NO_PARITY; - usart_config.stopbits = SL_USART_STOP_BITS_1; - usart_config.hwflowcontrol = SL_USART_FLOW_CONTROL_NONE; - usart_config.databits = SL_USART_DATA_BITS_8; - usart_config.misc_control = SL_USART_MISC_CONTROL_NONE; - usart_config.usart_module = USART_0; - usart_config.config_enable = ENABLE; - usart_config.synch_mode = DISABLE; - sl_si91x_usart_control_config_t get_config; - - // Initialize the UART - status = sl_si91x_usart_init((usart_peripheral_t) usart_config.usart_module, &usart_handle); - if (status != SL_STATUS_OK) - { - SILABS_LOG("sl_si91x_usart_initialize: Error Code : %lu \n", status); - } - - // Configure the USART configurations - status = sl_si91x_usart_set_configuration(usart_handle, &usart_config); - if (status != SL_STATUS_OK) - { - SILABS_LOG("sl_si91x_usart_set_configuration: Error Code : %lu \n", status); - } - - // Register user callback function - status = sl_si91x_usart_register_event_callback(callback_event); - if (status != SL_STATUS_OK) - { - SILABS_LOG("sl_si91x_usart_register_event_callback: Error Code : %lu \n", status); - } - - NVIC_EnableIRQ(USART0_IRQn); - NVIC_SetPriority(USART0_IRQn, 7); -} - -/* - * @brief Read the data available from the console Uart - * @param Buffer that contains the data to write, number bytes to write. - * @return Amount of bytes written or ERROR (-1) - */ -int16_t uartConsoleWrite(const char * Buf, uint16_t BufLength) -{ - int32_t status = 0; - if (Buf == NULL || BufLength < 1) - { - return UART_CONSOLE_ERR; - } - - status = sl_si91x_usart_send_data(usart_handle, Buf, BufLength); - if (status != SL_STATUS_OK) - { - return status; - } - return BufLength; -} - -/** - * @brief Write Logs to the Uart. Appends a return character - * - * @param log pointer to the logs - * @param length number of bytes to write - * @return int16_t Amount of bytes written or ERROR (-1) - */ -int16_t uartLogWrite(const char * log, uint16_t length) -{ - if (log == NULL || length == 0) - { - return UART_CONSOLE_ERR; - } - for (uint16_t i = 0; i < length; i++) - { - Board_UARTPutChar(log[i]); - } - // To print next log in new line with proper formatting - Board_UARTPutChar('\r'); - Board_UARTPutChar('\n'); - - return length + 2; -} - -/* - * @brief Read the data available from the console Uart - * @param Buffer for the data to be read, number bytes to read. - * @return Amount of bytes that was read from the rx fifo or ERROR (-1) - */ -int16_t uartConsoleRead(char * Buf, uint16_t NbBytesToRead) -{ - int32_t status = 0; - if (Buf == NULL || NbBytesToRead < 1) - { - return UART_CONSOLE_ERR; - } - - status = sl_si91x_usart_receive_data(usart_handle, Buf, NbBytesToRead); - if (status != SL_STATUS_OK) - { - return status; - } - return NbBytesToRead; -} - -#ifdef __cplusplus -} -#endif diff --git a/examples/platform/silabs/SoftwareFaultReports.cpp b/examples/platform/silabs/SoftwareFaultReports.cpp index fc7b6a9c5e3d76..8245b1bf454307 100644 --- a/examples/platform/silabs/SoftwareFaultReports.cpp +++ b/examples/platform/silabs/SoftwareFaultReports.cpp @@ -26,17 +26,18 @@ #include #include -#ifndef BRD4325A +#if !defined(SLI_SI91X_MCU_INTERFACE) || !defined(SLI_SI91X_ENABLE_BLE) #include "rail_types.h" #ifdef RAIL_ASSERT_DEBUG_STRING #include "rail_assert_error_codes.h" #endif -#endif // BRD4325A +#endif // !defined(SLI_SI91X_MCU_INTERFACE) || !defined(SLI_SI91X_ENABLE_BLE) + +#if defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE -#ifdef BRD4325A // For SiWx917 Platform only #include "core_cm4.h" -#endif +#endif // defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE // Technically FaultRecording is an octstr up to 1024 bytes. // We currently only report short strings. 100 char will more than enough for now. @@ -227,7 +228,7 @@ extern "C" void vApplicationGetTimerTaskMemory(StaticTask_t ** ppxTimerTaskTCBBu *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; } -#ifndef BRD4325A +#if !defined(SLI_SI91X_MCU_INTERFACE) || !defined(SLI_SI91X_ENABLE_BLE) extern "C" void RAILCb_AssertFailed(RAIL_Handle_t railHandle, uint32_t errorCode) { char faultMessage[kMaxFaultStringLen] = { 0 }; @@ -251,6 +252,5 @@ extern "C" void RAILCb_AssertFailed(RAIL_Handle_t railHandle, uint32_t errorCode chipAbort(); } -#endif // BRD4325A - +#endif // !defined(SLI_SI91X_MCU_INTERFACE) || !defined(SLI_SI91X_ENABLE_BLE) #endif // HARD_FAULT_LOG_ENABLE diff --git a/examples/platform/silabs/efr32/BUILD.gn b/examples/platform/silabs/efr32/BUILD.gn index 6cf43897f43b10..bff7d1e37be125 100644 --- a/examples/platform/silabs/efr32/BUILD.gn +++ b/examples/platform/silabs/efr32/BUILD.gn @@ -248,7 +248,7 @@ source_set("efr32-common") { ] if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli) { - sources += [ "uart.cpp" ] + sources += [ "${silabs_common_plat_dir}/uart.cpp" ] } if (chip_enable_ota_requestor) { diff --git a/examples/platform/silabs/efr32/uart.cpp b/examples/platform/silabs/uart.cpp similarity index 89% rename from examples/platform/silabs/efr32/uart.cpp rename to examples/platform/silabs/uart.cpp index 80d2dbba63b3a8..7d6dad912314db 100644 --- a/examples/platform/silabs/efr32/uart.cpp +++ b/examples/platform/silabs/uart.cpp @@ -18,14 +18,31 @@ #include "AppConfig.h" #include "matter_shell.h" #include +#include #include #ifdef __cplusplus extern "C" { #endif -#include "assert.h" + +#include "uart.h" +#include +#include + +#define UART_CONSOLE_ERR -1 // Negative value in case of UART Console action failed. Triggers a failure for PW_RPC +#define MAX_BUFFER_SIZE 256 +#define MAX_DMA_BUFFER_SIZE (MAX_BUFFER_SIZE / 2) + +#if SLI_SI91X_MCU_INTERFACE +#include "USART.h" +#include "rsi_board.h" +#include "rsi_debug.h" +#include "rsi_rom_egpio.h" +#include "sl_si91x_usart.h" +#else // For EFR32 #include "em_core.h" #include "em_usart.h" +#include "uartdrv.h" #ifdef SL_BOARD_NAME #include "sl_board_control.h" #endif @@ -38,11 +55,7 @@ extern "C" { #endif #ifdef SL_CATALOG_UARTDRV_USART_PRESENT #include "sl_uartdrv_usart_vcom_config.h" -#endif // EFR32MG24 -#include "uart.h" -#include "uartdrv.h" -#include -#include +#endif // SL_CATALOG_UARTDRV_USART_PRESENT #if defined(SL_CATALOG_POWER_MANAGER_PRESENT) #include "sl_power_manager.h" @@ -79,6 +92,16 @@ extern "C" { #define vcom_handle sl_uartdrv_usart_vcom_handle #endif // EFR32MG24 +namespace { +// In order to reduce the probability of data loss during the dmaFull callback handler we use +// two duplicate receive buffers so we can always have one "active" receive queue. +uint8_t sRxDmaBuffer[MAX_DMA_BUFFER_SIZE] = { 0 }; +uint8_t sRxDmaBuffer2[MAX_DMA_BUFFER_SIZE] = { 0 }; +uint16_t lastCount = 0; // Nb of bytes already processed from the active dmaBuffer +} // namespace + +#endif // SLI_SI91X_MCU_INTERFACE + typedef struct { // The data buffer @@ -91,15 +114,6 @@ typedef struct uint16_t MaxSize; } Fifo_t; -#define UART_CONSOLE_ERR -1 // Negative value in case of UART Console action failed. Triggers a failure for PW_RPC -#define MAX_BUFFER_SIZE 256 -#define MAX_DMA_BUFFER_SIZE (MAX_BUFFER_SIZE / 2) -// In order to reduce the probability of data loss during the dmaFull callback handler we use -// two duplicate receive buffers so we can always have one "active" receive queue. -static uint8_t sRxDmaBuffer[MAX_DMA_BUFFER_SIZE]; -static uint8_t sRxDmaBuffer2[MAX_DMA_BUFFER_SIZE]; -static uint16_t lastCount; // Nb of bytes already processed from the active dmaBuffer - // uart transmit #if SILABS_LOG_OUT_UART #define UART_MAX_QUEUE_SIZE 125 @@ -144,7 +158,9 @@ constexpr osMessageQueueAttr_t kUartTxQueueAttr = { .cb_mem = &sUartTxQueueStru static uint8_t sRxFifoBuffer[MAX_BUFFER_SIZE]; static Fifo_t sReceiveFifo; +#if SLI_SI91X_MCU_INTERFACE == 0 static void UART_rx_callback(UARTDRV_Handle_t handle, Ecode_t transferStatus, uint8_t * data, UARTDRV_Count_t transferCount); +#endif // SLI_SI91X_MCU_INTERFACE == 0 static void uartSendBytes(uint8_t * buffer, uint16_t nbOfBytes); static bool InitFifo(Fifo_t * fifo, uint8_t * pDataBuffer, uint16_t bufferSize) @@ -196,9 +212,9 @@ static uint16_t RemainingSpace(Fifo_t * fifo) */ static void WriteToFifo(Fifo_t * fifo, uint8_t * pDataToWrite, uint16_t SizeToWrite) { - assert(fifo); - assert(pDataToWrite); - assert(SizeToWrite <= fifo->MaxSize); + VerifyOrDie(fifo != nullptr); + VerifyOrDie(pDataToWrite != nullptr); + VerifyOrDie(SizeToWrite <= fifo->MaxSize); // Overwrite is not allowed if (RemainingSpace(fifo) >= SizeToWrite) @@ -227,9 +243,9 @@ static void WriteToFifo(Fifo_t * fifo, uint8_t * pDataToWrite, uint16_t SizeToWr */ static uint16_t RetrieveFromFifo(Fifo_t * fifo, uint8_t * pData, uint16_t SizeToRead) { - assert(fifo); - assert(pData); - assert(SizeToRead <= fifo->MaxSize); + VerifyOrDie(fifo != nullptr); + VerifyOrDie(pData != nullptr); + VerifyOrDie(SizeToRead <= fifo->MaxSize); uint16_t ReadSize = MIN(SizeToRead, AvailableDataCount(fifo)); uint16_t nBytesBeforWrap = (fifo->MaxSize - fifo->Head); @@ -263,22 +279,24 @@ void uartConsoleInit(void) return; } + sUartTxQueue = osMessageQueueNew(UART_MAX_QUEUE_SIZE, sizeof(UartTxStruct_t), &kUartTxQueueAttr); + sUartTaskHandle = osThreadNew(uartMainLoop, nullptr, &kUartTaskAttr); + + // Init a fifo for the data received on the uart + InitFifo(&sReceiveFifo, sRxFifoBuffer, MAX_BUFFER_SIZE); + + VerifyOrDie(sUartTaskHandle != nullptr); + VerifyOrDie(sUartTxQueue != nullptr); + +#if SLI_SI91X_MCU_INTERFACE == 0 #ifdef SL_BOARD_NAME sl_board_enable_vcom(); #endif - // Init a fifo for the data received on the uart - InitFifo(&sReceiveFifo, sRxFifoBuffer, MAX_BUFFER_SIZE); // Activate 2 dma queues to always have one active UARTDRV_Receive(vcom_handle, sRxDmaBuffer, MAX_DMA_BUFFER_SIZE, UART_rx_callback); UARTDRV_Receive(vcom_handle, sRxDmaBuffer2, MAX_DMA_BUFFER_SIZE, UART_rx_callback); - sUartTxQueue = osMessageQueueNew(UART_MAX_QUEUE_SIZE, sizeof(UartTxStruct_t), &kUartTxQueueAttr); - sUartTaskHandle = osThreadNew(uartMainLoop, nullptr, &kUartTaskAttr); - - assert(sUartTaskHandle); - assert(sUartTxQueue); - // Enable USART0/EUSART0 interrupt to wake OT task when data arrives NVIC_ClearPendingIRQ(USART_IRQ); NVIC_EnableIRQ(USART_IRQ); @@ -295,8 +313,24 @@ void uartConsoleInit(void) #else USART_IntEnable(SL_UARTDRV_USART_VCOM_PERIPHERAL, USART_IF_RXDATAV); #endif // EFR32MG24 +#endif // SLI_SI91X_MCU_INTERFACE == 0 +} + +#if SLI_SI91X_MCU_INTERFACE +void cache_uart_rx_data(char character) +{ + if (RemainingSpace(&sReceiveFifo) >= 1) + { + WriteToFifo(&sReceiveFifo, (uint8_t *) &character, 1); + } +#ifdef ENABLE_CHIP_SHELL + chip::NotifyShellProcess(); +#endif // ENABLE_CHIP_SHELL } +#endif // SLI_SI91X_MCU_INTERFACE +#if SLI_SI91X_MCU_INTERFACE == 0 +// For EFR32 void USART_IRQHandler(void) { #ifdef ENABLE_CHIP_SHELL @@ -346,6 +380,7 @@ static void UART_rx_callback(UARTDRV_Handle_t handle, Ecode_t transferStatus, ui otSysEventSignalPending(); #endif } +#endif // SLI_SI91X_MCU_INTERFACE == 0 /** * @brief Read the data available from the console Uart @@ -420,15 +455,15 @@ int16_t uartLogWrite(const char * log, uint16_t length) int16_t uartConsoleRead(char * Buf, uint16_t NbBytesToRead) { uint8_t * data; - UARTDRV_Count_t count, remaining; if (Buf == NULL || NbBytesToRead < 1) { return UART_CONSOLE_ERR; } - +#if SLI_SI91X_MCU_INTERFACE == 0 if (NbBytesToRead > AvailableDataCount(&sReceiveFifo)) { + UARTDRV_Count_t count, remaining; // Not enough data available in the fifo for the read size request // If there is data available in dma buffer, get it now. CORE_ATOMIC_SECTION(UARTDRV_GetReceiveStatus(vcom_handle, &data, &count, &remaining); if (count > lastCount) { @@ -436,6 +471,7 @@ int16_t uartConsoleRead(char * Buf, uint16_t NbBytesToRead) lastCount = count; }) } +#endif // SLI_SI91X_MCU_INTERFACE == 0 return (int16_t) RetrieveFromFifo(&sReceiveFifo, (uint8_t *) Buf, NbBytesToRead); } @@ -464,6 +500,14 @@ void uartMainLoop(void * args) */ void uartSendBytes(uint8_t * buffer, uint16_t nbOfBytes) { +#if SLI_SI91X_MCU_INTERFACE + // ensuring null termination of buffer + if (nbOfBytes != CHIP_SHELL_MAX_LINE_SIZE && buffer[nbOfBytes - 1] != '\0') + { + buffer[nbOfBytes] = '\0'; + } + Board_UARTPutSTR(reinterpret_cast(buffer)); +#else #if defined(SL_CATALOG_POWER_MANAGER_PRESENT) sl_power_manager_add_em_requirement(SL_POWER_MANAGER_EM1); #endif // SL_CATALOG_POWER_MANAGER_PRESENT @@ -489,6 +533,7 @@ void uartSendBytes(uint8_t * buffer, uint16_t nbOfBytes) #if defined(SL_CATALOG_POWER_MANAGER_PRESENT) sl_power_manager_remove_em_requirement(SL_POWER_MANAGER_EM1); #endif // SL_CATALOG_POWER_MANAGER_PRESENT +#endif // SLI_SI91X_MCU_INTERFACE } #ifdef __cplusplus diff --git a/examples/smoke-co-alarm-app/silabs/src/AppTask.cpp b/examples/smoke-co-alarm-app/silabs/src/AppTask.cpp index dc99728ccf90d5..105a3c9e5b6d9c 100644 --- a/examples/smoke-co-alarm-app/silabs/src/AppTask.cpp +++ b/examples/smoke-co-alarm-app/silabs/src/AppTask.cpp @@ -31,7 +31,7 @@ #include #include -#if (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(BRD4325B)) +#if (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT)) #define LIGHT_LED 1 #else #define LIGHT_LED 0 diff --git a/src/lib/shell/MainLoopSilabs.cpp b/src/lib/shell/MainLoopSilabs.cpp index 83ba4ea00ce619..8a8d60af2d6716 100644 --- a/src/lib/shell/MainLoopSilabs.cpp +++ b/src/lib/shell/MainLoopSilabs.cpp @@ -53,24 +53,12 @@ void ReadLine(char * buffer, size_t max) break; } -#ifdef BRD4325A - // for 917 SoC board, we need to create a rx event before we wait for the shell activity - // NotifyShellProcess() is called once the buffer is filled - while (streamer_read(streamer_get(), buffer + read, 1) == 1) - { - // Count how many characters were read; usually one but could be copy/paste - read++; - } -#endif chip::WaitForShellActivity(); -#ifndef BRD4325A - // for EFR32 boards while (streamer_read(streamer_get(), buffer + read, 1) == 1) { // Count how many characters were read; usually one but could be copy/paste read++; } -#endif // Process all characters that were read until we run out or exceed max char limit while (line_sz < read && line_sz < max) { @@ -218,10 +206,6 @@ void ProcessShellLine(intptr_t args) } } MemoryFree(line); -#ifdef BRD4325A - // small delay for uart print - vTaskDelay(1); -#endif streamer_printf(streamer_get(), kShellPrompt); } diff --git a/src/platform/silabs/CHIPPlatformConfig.h b/src/platform/silabs/CHIPPlatformConfig.h index 93faf6b791b697..20b4678c18b682 100644 --- a/src/platform/silabs/CHIPPlatformConfig.h +++ b/src/platform/silabs/CHIPPlatformConfig.h @@ -24,8 +24,15 @@ #pragma once +#include #include +#if (SL_MATTER_GN_BUILD == 0) +#if defined(CHIP_CONFIG_ENABLE_ICD_SERVER) && (CHIP_CONFIG_ENABLE_ICD_SERVER == 1) +#include "sl_matter_icd_config.h" +#endif // defined(CHIP_CONFIG_ENABLE_ICD_SERVER) && (CHIP_CONFIG_ENABLE_ICD_SERVER == 1) +#endif // SL_MATTER_GN_BUILD + // ==================== General Platform Adaptations ==================== #define CHIP_CONFIG_ABORT() abort() @@ -45,7 +52,8 @@ #if CHIP_HAVE_CONFIG_H #include #endif -#if (CHIP_CRYPTO_PLATFORM == 1) + +#if (CHIP_CRYPTO_PLATFORM == 1) && !defined(SL_MBEDTLS_USE_TINYCRYPT) #include "psa/crypto.h" #if !defined(CHIP_CONFIG_SHA256_CONTEXT_SIZE) @@ -56,7 +64,7 @@ #define CHIP_CONFIG_SHA256_CONTEXT_ALIGN psa_hash_operation_t #endif -#endif // CHIP_CRYPTO_PLATFORM +#endif // (CHIP_CRYPTO_PLATFORM == 1) && !defined(SL_MBEDTLS_USE_TINYCRYPT) // ==================== General Configuration Overrides ==================== @@ -92,7 +100,7 @@ #define CHIP_CONFIG_MAX_FABRICS 5 // 4 fabrics + 1 for rotation slack #endif -#ifdef SL_ICD_ENABLED +#if defined(CHIP_CONFIG_ENABLE_ICD_SERVER) && CHIP_CONFIG_ENABLE_ICD_SERVER #ifndef CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC #define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC SL_IDLE_MODE_DURATION_S @@ -110,7 +118,16 @@ #define CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC SL_ICD_SUPPORTED_CLIENTS_PER_FABRIC #endif // CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC -#endif // SL_ICD_ENABLED +#endif // defined(CHIP_CONFIG_ENABLE_ICD_SERVER) && CHIP_CONFIG_ENABLE_ICD_SERVER + +/** + * @brief CHIP_SHELL_MAX_LINE_SIZE + * + * @brief Platform maximum line for the Matter Shell + */ +#ifndef CHIP_SHELL_MAX_LINE_SIZE +#define CHIP_SHELL_MAX_LINE_SIZE 256 +#endif // CHIP_SHELL_MAX_LINE_SIZE // ==================== FreeRTOS Configuration Overrides ==================== #ifndef CHIP_CONFIG_FREERTOS_USE_STATIC_TASK diff --git a/src/platform/silabs/Logging.cpp b/src/platform/silabs/Logging.cpp index 3777c96148fb75..339bc8ae078cd6 100644 --- a/src/platform/silabs/Logging.cpp +++ b/src/platform/silabs/Logging.cpp @@ -15,13 +15,6 @@ #include #include -#ifndef BRD4325A - -#ifdef RAIL_ASSERT_DEBUG_STRING -#include "rail_assert_error_codes.h" -#endif -#endif // BRD4325A - #ifdef PW_RPC_ENABLED #include "PigweedLogger.h" #endif diff --git a/src/test_driver/efr32/BUILD.gn b/src/test_driver/efr32/BUILD.gn index 947ed482f4622e..b15b16864548c9 100644 --- a/src/test_driver/efr32/BUILD.gn +++ b/src/test_driver/efr32/BUILD.gn @@ -73,7 +73,7 @@ silabs_executable("efr32_device_tests") { "${examples_common_plat_dir}/provision/ProvisionStorageCustom.cpp", "${examples_common_plat_dir}/provision/ProvisionStorageDefault.cpp", "${examples_common_plat_dir}/syscalls_stubs.cpp", - "${examples_plat_dir}/uart.cpp", + "${examples_common_plat_dir}/uart.cpp", "src/main.cpp", ] diff --git a/third_party/silabs/SiWx917_sdk.gni b/third_party/silabs/SiWx917_sdk.gni index 5faba08acd3d3b..8c7635ad9235d3 100644 --- a/third_party/silabs/SiWx917_sdk.gni +++ b/third_party/silabs/SiWx917_sdk.gni @@ -215,7 +215,6 @@ template("siwx917_sdk") { "ROMDRIVER_PRESENT=1", "SL_CATALOG_FREERTOS_KERNEL_PRESENT=1", "SLI_SI91X_MCU_CONFIG_RADIO_BOARD_BASE_VER=1", - "BRD4325A", #TODO: should be removed after SoC macro clean-up "SLI_SI917B0=1", "SLI_SI91X_MCU_COMMON_FLASH_MODE=1", "SLI_SI91X_MCU_CONFIG_RADIO_BOARD_VER2=1", @@ -259,7 +258,10 @@ template("siwx917_sdk") { } if (chip_build_libshell) { - defines += [ "ENABLE_CHIP_SHELL" ] + defines += [ + "ENABLE_CHIP_SHELL", + "SLI_SI91X_MCU_INTR_BASED_RX_ON_UART=1", + ] } defines += [ "LWIP_NETIF_API=1" ] @@ -301,7 +303,6 @@ template("siwx917_sdk") { if (!disable_lcd) { defines += [ - "CONFIG_ENABLE_UART", "SYSCALLS_WRITE", "SPI_MULTI_SLAVE", "SL_ULP_TIMER", @@ -310,12 +311,7 @@ template("siwx917_sdk") { # Enabling led interface if (use_wstk_leds) { - defines += [ - "ENABLE_WSTK_LEDS", - - # TODO: remove this when it is added to the board config from wifi sdk - "SL_CATALOG_SIMPLE_LED_LED1_PRESENT", - ] + defines += [ "ENABLE_WSTK_LEDS" ] } if (chip_enable_icd_server) { diff --git a/third_party/silabs/matter_support b/third_party/silabs/matter_support index 9084b6fa2f9407..8f476b30f9c604 160000 --- a/third_party/silabs/matter_support +++ b/third_party/silabs/matter_support @@ -1 +1 @@ -Subproject commit 9084b6fa2f9407396a7f2db12975e6e89fe07a8c +Subproject commit 8f476b30f9c6041de334abadcdb6852ade77790e