diff options
author | Paul Selkirk <paul@psgd.org> | 2019-02-28 15:01:12 -0500 |
---|---|---|
committer | Paul Selkirk <paul@psgd.org> | 2019-02-28 15:02:01 -0500 |
commit | 73c911dfe407027c1822ac4745405ff22d446c66 (patch) | |
tree | 497866a8ca014620e63f1f5cfe9d575de783bd8e /projects/hsm | |
parent | a89dcb22ca549ae17742a8ee3c08f2d7fd606771 (diff) |
Report SDRAM usage in `task show`
Diffstat (limited to 'projects/hsm')
-rw-r--r-- | projects/hsm/hsm.c | 11 | ||||
-rw-r--r-- | projects/hsm/mgmt-task.c | 6 |
2 files changed, 17 insertions, 0 deletions
diff --git a/projects/hsm/hsm.c b/projects/hsm/hsm.c index a34b1f7..c1ab691 100644 --- a/projects/hsm/hsm.c +++ b/projects/hsm/hsm.c @@ -395,6 +395,17 @@ static hal_error_t sdram_free(uint8_t *ptr) return HAL_ERROR_FORBIDDEN; } +hal_error_t sdram_stats(size_t *used, size_t *available) +{ + if (used == NULL || available == NULL) + return HAL_ERROR_BAD_ARGUMENTS; + + *used = sdram_heap - &_esdram1; + *available = &__end_sdram1 - sdram_heap; + + return LIBHAL_OK; +} + /* Implement static memory allocation for libhal over sdram_malloc(). */ void *hal_allocate_static_memory(const size_t size) diff --git a/projects/hsm/mgmt-task.c b/projects/hsm/mgmt-task.c index c2a3d3f..180c6d9 100644 --- a/projects/hsm/mgmt-task.c +++ b/projects/hsm/mgmt-task.c @@ -74,6 +74,12 @@ static int cmd_task_show(struct cli_def *cli, const char *command, char *argv[], cli_print(cli, " "); cli_print(cli, "UART receive queue maximum length: %u", uart_rx_max); + size_t used, available; + extern void sdram_stats(size_t *used, size_t *available); + sdram_stats(&used, &available); + cli_print(cli, " "); + cli_print(cli, "SDRAM used: %u, available: %u", used, available); + return CLI_OK; } |