aboutsummaryrefslogtreecommitdiff
path: root/projects/hsm
diff options
context:
space:
mode:
Diffstat (limited to 'projects/hsm')
-rw-r--r--projects/hsm/hsm.c12
-rw-r--r--projects/hsm/mgmt-task.c6
2 files changed, 17 insertions, 1 deletions
diff --git a/projects/hsm/hsm.c b/projects/hsm/hsm.c
index a34b1f7..52157c9 100644
--- a/projects/hsm/hsm.c
+++ b/projects/hsm/hsm.c
@@ -341,7 +341,6 @@ static void busy_task(void)
}
#include "stm-fpgacfg.h"
-#include "hashsig.h"
static void hashsig_restart_task(void)
{
@@ -395,6 +394,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;
}