Skip to content

Commit 2a78824

Browse files
bhmanda-silabsrerasool
authored andcommitted
Pull request project-chip#1647: MATTER-3297: Bugfix/add fixes for tickless idle m4 sleep
Merge in WMN_TOOLS/matter from bugfix/add_fixes_for_tickless_idle_m4_sleep to RC_2.3.0-1.3-alpha.3 Squashed commit of the following: commit 00d25d7907acae15009184eb7ab1a7b1622efba3 Author: Rehan Rasool <Rehan.Rasool@silabs.com> Date: Sun Mar 17 18:15:26 2024 -0400 Move variable declaration in the else statement where it is used commit 5a50a4c86d36ff9f8414a56daa8622d82f85909a Author: Rehan Rasool <Rehan.Rasool@silabs.com> Date: Sun Mar 17 18:08:01 2024 -0400 Fix indentation commit c94664e24be97acaffeaabf7f1a118a7ace8b40d Author: Junior Martinez <Junior.Martinez@silabs.com> Date: Sun Mar 17 22:05:27 2024 +0000 Applied suggestion: update comment ... and 6 more commits
1 parent eae4864 commit 2a78824

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

examples/platform/silabs/MatterConfig.cpp

+22-4
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,14 @@
2121
#include "BaseApplication.h"
2222
#include "OTAConfig.h"
2323
#include <MatterConfig.h>
24-
2524
#include <FreeRTOS.h>
2625

2726
#include <mbedtls/platform.h>
2827

28+
#if CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED
29+
#include "rsi_m4.h"
30+
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED
31+
2932
#ifdef SL_WIFI
3033
#include "wfx_host_events.h"
3134
#endif /* SL_WIFI */
@@ -309,13 +312,28 @@ CHIP_ERROR SilabsMatterConfig::InitWiFi(void)
309312
static bool is_sleep_ready = false;
310313
void vTaskPreSuppressTicksAndSleepProcessing(uint16_t * xExpectedIdleTime)
311314
{
312-
if (!is_sleep_ready)
313-
{
315+
if (!is_sleep_ready) {
314316
*xExpectedIdleTime = 0;
317+
} else {
318+
// Indicate M4 is Inactive
319+
P2P_STATUS_REG &= ~M4_is_active;
320+
P2P_STATUS_REG;
321+
322+
/* Delay is added to sync between M4 and TA */
323+
for (uint8_t delay = 0; delay < 10; delay++) {
324+
__ASM("NOP");
325+
}
326+
327+
// Checking if TA has already triggered a packet to M4
328+
// RX_BUFFER_VALID will be cleared by TA if any packet is triggered
329+
if ((P2P_STATUS_REG & TA_wakeup_M4) || (P2P_STATUS_REG & M4_wakeup_TA)
330+
|| (!(M4SS_P2P_INTR_SET_REG & RX_BUFFER_VALID))) {
331+
P2P_STATUS_REG |= M4_is_active;
332+
*xExpectedIdleTime = 0;
333+
}
315334
}
316335
}
317336
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED
318-
319337
extern "C" void vApplicationIdleHook(void)
320338
{
321339
#if CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED

0 commit comments

Comments
 (0)