Skip to content

Commit

Permalink
Add diag clusters (#10279)
Browse files Browse the repository at this point in the history
* Modify GN to build FreeRTOS from third party source repo

* Remove lowercase "portable" folder

* Add implementation for software diagnostics cluster

* Restyled by clang-format

* Update qpg_sdk repo

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Oct 13, 2021
1 parent 0c38f5a commit 3546106
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 9 deletions.
33 changes: 33 additions & 0 deletions src/platform/qpg/PlatformManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,38 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void)
return err;
}

CHIP_ERROR PlatformManagerImpl::_GetCurrentHeapFree(uint64_t & currentHeapFree)
{
size_t freeHeapSize;
size_t usedHeapSize;
size_t highWatermarkHeapSize;

qvCHIP_GetHeapStats(&freeHeapSize, &usedHeapSize, &highWatermarkHeapSize);
currentHeapFree = static_cast<uint64_t>(freeHeapSize);
return CHIP_NO_ERROR;
}

CHIP_ERROR PlatformManagerImpl::_GetCurrentHeapUsed(uint64_t & currentHeapUsed)
{
size_t freeHeapSize;
size_t usedHeapSize;
size_t highWatermarkHeapSize;

qvCHIP_GetHeapStats(&freeHeapSize, &usedHeapSize, &highWatermarkHeapSize);
currentHeapUsed = static_cast<uint64_t>(usedHeapSize);
return CHIP_NO_ERROR;
}

CHIP_ERROR PlatformManagerImpl::_GetCurrentHeapHighWatermark(uint64_t & currentHeapHighWatermark)
{
size_t freeHeapSize;
size_t usedHeapSize;
size_t highWatermarkHeapSize;

qvCHIP_GetHeapStats(&freeHeapSize, &usedHeapSize, &highWatermarkHeapSize);
currentHeapHighWatermark = static_cast<uint64_t>(highWatermarkHeapSize);
return CHIP_NO_ERROR;
}

} // namespace DeviceLayer
} // namespace chip
3 changes: 3 additions & 0 deletions src/platform/qpg/PlatformManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ class PlatformManagerImpl final : public PlatformManager, public Internal::Gener
// ===== Methods that implement the PlatformManager abstract interface.

CHIP_ERROR _InitChipStack(void);
CHIP_ERROR _GetCurrentHeapFree(uint64_t & currentHeapFree);
CHIP_ERROR _GetCurrentHeapUsed(uint64_t & currentHeapUsed);
CHIP_ERROR _GetCurrentHeapHighWatermark(uint64_t & currentHeapHighWatermark);

// ===== Members for internal use by the following friends.

Expand Down
7 changes: 0 additions & 7 deletions src/platform/qpg/qpgConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,6 @@ CHIP_ERROR QPGConfig::Init()
return CHIP_NO_ERROR;
}

uint16_t QPGConfig::GetSettingsMaxValueLength(Key key)
{
uint16_t keyLen;

return (qvCHIP_Nvm_GetMaxKeyLen(key, &keyLen) == QV_STATUS_NO_ERROR) ? keyLen : 0;
}

CHIP_ERROR QPGConfig::ReadConfigValue(Key key, bool & val)
{
uint16_t length;
Expand Down
1 change: 0 additions & 1 deletion src/platform/qpg/qpgConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ class QPGConfig
static CHIP_ERROR Init(void);

// Configuration methods used by the GenericConfigurationManagerImpl<> template.
static uint16_t GetSettingsMaxValueLength(uint16_t Key);
static CHIP_ERROR ReadConfigValue(Key key, bool & val);
static CHIP_ERROR ReadConfigValue(Key key, uint32_t & val);
static CHIP_ERROR ReadConfigValue(Key key, uint64_t & val);
Expand Down
2 changes: 1 addition & 1 deletion third_party/qpg_sdk/repo
Submodule repo updated from 197eba to ca8b06

0 comments on commit 3546106

Please sign in to comment.