Skip to content

Commit

Permalink
[Silabs] Update platform source files (#34865)
Browse files Browse the repository at this point in the history
* Update matter support submodule

* Add missing define guards

* Merge SiWx917 and EFR32 uart source file

* Remove references to BRD4325A

* restyle

* Add uart define

* Fix uart define usage

* Update uart.cpp

---------

Co-authored-by: Chirag Bansal <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Sep 5, 2024
1 parent f5ee1e8 commit ac8eabd
Show file tree
Hide file tree
Showing 14 changed files with 158 additions and 248 deletions.
4 changes: 4 additions & 0 deletions examples/platform/silabs/OTAConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
#include <platform/silabs/OTAImageProcessorImpl.h>
#endif

#if (SL_MATTER_GN_BUILD == 0)
#include "sl_matter_ota_config.h"
#endif

class OTAConfig
{
public:
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
40 changes: 40 additions & 0 deletions examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#include <stdlib.h>
#include <string.h>

#if (SL_MATTER_GN_BUILD == 0)
#include "sl_matter_wifi_config.h"
#endif // SL_MATTER_GN_BUILD

#include "sl_status.h"
#include <app/icd/server/ICDServerConfig.h>
#include <inet/IPAddress.h>
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
}

/******************************************************************
Expand Down Expand Up @@ -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<uint32_t>(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 */

Expand Down
169 changes: 0 additions & 169 deletions examples/platform/silabs/SiWx917/uart.cpp

This file was deleted.

14 changes: 7 additions & 7 deletions examples/platform/silabs/SoftwareFaultReports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,18 @@
#include <platform/CHIPDeviceLayer.h>
#include <platform/DiagnosticDataProvider.h>

#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.
Expand Down Expand Up @@ -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 };
Expand All @@ -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
2 changes: 1 addition & 1 deletion examples/platform/silabs/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading

0 comments on commit ac8eabd

Please sign in to comment.