Skip to content

Commit

Permalink
Pull request project-chip#1647: MATTER-3297: Bugfix/add fixes for tic…
Browse files Browse the repository at this point in the history
…kless 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
  • Loading branch information
bhmanda-silabs authored and rerasool committed Mar 17, 2024
1 parent eae4864 commit 2a78824
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
26 changes: 22 additions & 4 deletions examples/platform/silabs/MatterConfig.cpp
Expand Up @@ -21,11 +21,14 @@
#include "BaseApplication.h"
#include "OTAConfig.h"
#include <MatterConfig.h>

#include <FreeRTOS.h>

#include <mbedtls/platform.h>

#if CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED
#include "rsi_m4.h"
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED

#ifdef SL_WIFI
#include "wfx_host_events.h"
#endif /* SL_WIFI */
Expand Down Expand Up @@ -309,13 +312,28 @@ CHIP_ERROR SilabsMatterConfig::InitWiFi(void)
static bool is_sleep_ready = false;
void vTaskPreSuppressTicksAndSleepProcessing(uint16_t * xExpectedIdleTime)
{
if (!is_sleep_ready)
{
if (!is_sleep_ready) {
*xExpectedIdleTime = 0;
} else {
// Indicate M4 is Inactive
P2P_STATUS_REG &= ~M4_is_active;
P2P_STATUS_REG;

/* Delay is added to sync between M4 and TA */
for (uint8_t delay = 0; delay < 10; delay++) {
__ASM("NOP");
}

// Checking if TA has already triggered a packet to M4
// RX_BUFFER_VALID will be cleared by TA if any packet is triggered
if ((P2P_STATUS_REG & TA_wakeup_M4) || (P2P_STATUS_REG & M4_wakeup_TA)
|| (!(M4SS_P2P_INTR_SET_REG & RX_BUFFER_VALID))) {
P2P_STATUS_REG |= M4_is_active;
*xExpectedIdleTime = 0;
}
}
}
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED

extern "C" void vApplicationIdleHook(void)
{
#if CHIP_CONFIG_ENABLE_ICD_SERVER && SI917_M4_SLEEP_ENABLED
Expand Down

0 comments on commit 2a78824

Please sign in to comment.