diff options
-rw-r--r-- | projects/hsm/hsm.c | 12 | ||||
-rw-r--r-- | projects/hsm/mgmt-task.c | 6 | ||||
-rw-r--r-- | stm-fmc.h | 17 |
3 files changed, 19 insertions, 16 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; } @@ -52,22 +52,9 @@ extern void fmc_init(void); -static inline void fmc_write_32(const uint32_t addr, const uint32_t data) +static inline void *fmc_fpga_addr(off_t addr) { - // calculate target fpga address - uint32_t *ptr = (uint32_t *) (FMC_FPGA_BASE_ADDR + (addr & FMC_FPGA_ADDR_MASK)); - - // write data to fpga - *ptr = data; -} - -static inline void fmc_read_32(const uint32_t addr, uint32_t * const data) -{ - // calculate target fpga address - uint32_t *ptr = (uint32_t *) (FMC_FPGA_BASE_ADDR + (addr & FMC_FPGA_ADDR_MASK)); - - // read data from fpga - *data = *ptr; + return (void *)(FMC_FPGA_BASE_ADDR + (addr & FMC_FPGA_ADDR_MASK)); } #endif /* __STM_FMC_H */ |