Skip to content

Commit

Permalink
Revert "[nxp fromtree] [NXP][common][mcxw71_k32w1] Add MML support to…
Browse files Browse the repository at this point in the history
… DiagnosticDataProviderImpl (project-chip#35990)"

This reverts commit 27e5cae.

Signed-off-by: Andrei Menzopol <andrei.menzopol@nxp.com>
  • Loading branch information
andrei-menzopol committed Oct 17, 2024
1 parent 01413c8 commit 1aa5337
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 37 deletions.
5 changes: 0 additions & 5 deletions src/platform/nxp/common/CHIPNXPPlatformDefaultConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,3 @@
*/
#define CHIP_CONFIG_RMP_DEFAULT_MAX_RETRANS 10
#endif

#ifndef NXP_USE_MML
/* Do not use Memory Manager Light for dynamic memory allocation by default. */
#define NXP_USE_MML 0
#endif // NXP_USE_MML
28 changes: 6 additions & 22 deletions src/platform/nxp/common/DiagnosticDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,6 @@ extern "C" {
}
#endif

#if NXP_USE_MML
#include "fsl_component_mem_manager.h"
#define GetFreeHeapSize MEM_GetFreeHeapSize
#define HEAP_SIZE MinimalHeapSize_c
#define GetMinimumEverFreeHeapSize MEM_GetFreeHeapSizeLowWaterMark
#else
#define GetFreeHeapSize xPortGetFreeHeapSize
#define HEAP_SIZE configTOTAL_HEAP_SIZE
#define GetMinimumEverFreeHeapSize xPortGetMinimumEverFreeHeapSize
#endif // NXP_USE_MML

// Not implement into the SDK
// extern "C" void xPortResetHeapMinimumEverFreeHeapSize(void);

Expand All @@ -68,8 +57,8 @@ DiagnosticDataProviderImpl & DiagnosticDataProviderImpl::GetDefaultInstance()
CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapFree(uint64_t & currentHeapFree)
{
size_t freeHeapSize;
freeHeapSize = GetFreeHeapSize();

freeHeapSize = xPortGetFreeHeapSize();
currentHeapFree = static_cast<uint64_t>(freeHeapSize);
return CHIP_NO_ERROR;
}
Expand All @@ -79,8 +68,8 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapUsed(uint64_t & currentHeap
size_t freeHeapSize;
size_t usedHeapSize;

freeHeapSize = GetFreeHeapSize();
usedHeapSize = HEAP_SIZE - freeHeapSize;
freeHeapSize = xPortGetFreeHeapSize();
usedHeapSize = configTOTAL_HEAP_SIZE - freeHeapSize;

currentHeapUsed = static_cast<uint64_t>(usedHeapSize);
return CHIP_NO_ERROR;
Expand All @@ -90,8 +79,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapHighWatermark(uint64_t & cu
{
size_t highWatermarkHeapSize;

highWatermarkHeapSize = HEAP_SIZE - GetMinimumEverFreeHeapSize();

highWatermarkHeapSize = configTOTAL_HEAP_SIZE - xPortGetMinimumEverFreeHeapSize();
currentHeapHighWatermark = static_cast<uint64_t>(highWatermarkHeapSize);
return CHIP_NO_ERROR;
}
Expand All @@ -101,16 +89,12 @@ CHIP_ERROR DiagnosticDataProviderImpl::ResetWatermarks()
// If implemented, the server SHALL set the value of the CurrentHeapHighWatermark attribute to the
// value of the CurrentHeapUsed.

#if NXP_USE_MML
MEM_ResetFreeHeapSizeLowWaterMark();

return CHIP_NO_ERROR;
#else
// Not implement into the SDK
// xPortResetHeapMinimumEverFreeHeapSize();

// return CHIP_NO_ERROR;

return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
#endif
}

CHIP_ERROR DiagnosticDataProviderImpl::GetThreadMetrics(ThreadMetrics ** threadMetricsOut)
Expand Down
4 changes: 0 additions & 4 deletions src/platform/nxp/common/DiagnosticDataProviderImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider
static DiagnosticDataProviderImpl & GetDefaultInstance();

// ===== Methods that implement the PlatformManager abstract interface.

#if NXP_USE_MML
bool SupportsWatermarks() override { return true; }
#endif
CHIP_ERROR GetCurrentHeapFree(uint64_t & currentHeapFree) override;
CHIP_ERROR GetCurrentHeapUsed(uint64_t & currentHeapUsed) override;
CHIP_ERROR GetCurrentHeapHighWatermark(uint64_t & currentHeapHighWatermark) override;
Expand Down
9 changes: 3 additions & 6 deletions src/platform/nxp/mcxw71_k32w1/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,10 @@ config("nxp_platform_config") {

static_library("nxp_platform") {
deps = []
defines = [
"CHIP_DEVICE_K32W1=1",
"NXP_USE_MML=1",
]
defines = [ "CHIP_DEVICE_K32W1=1" ]

sources = [
"../../SingletonConfigurationManager.cpp",
"../common/DiagnosticDataProviderImpl.cpp",
"../common/DiagnosticDataProviderImpl.h",
"../common/ble/BLEManagerCommon.cpp",
"../common/ble/BLEManagerCommon.h",
"../common/ble/BLEManagerImpl.cpp",
Expand All @@ -109,6 +104,8 @@ static_library("nxp_platform") {
"ConfigurationManagerImpl.h",
"ConnectivityManagerImpl.cpp",
"ConnectivityManagerImpl.h",
"DiagnosticDataProviderImpl.cpp",
"DiagnosticDataProviderImpl.h",
"PlatformManagerImpl.cpp",
"PlatformManagerImpl.h",
"SystemTimeSupport.cpp",
Expand Down

0 comments on commit 1aa5337

Please sign in to comment.