aboutsummaryrefslogtreecommitdiff
path: root/projects/hsm/mgmt-misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'projects/hsm/mgmt-misc.c')
-rw-r--r--projects/hsm/mgmt-misc.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/projects/hsm/mgmt-misc.c b/projects/hsm/mgmt-misc.c
index 016d7cb..86f1be8 100644
--- a/projects/hsm/mgmt-misc.c
+++ b/projects/hsm/mgmt-misc.c
@@ -60,7 +60,7 @@ int cli_receive_data(struct cli_def *cli, uint8_t *buf, size_t len, cli_data_cal
cli_print(cli, "OK, write size (4 bytes), data in %li byte chunks, CRC-32 (4 bytes)", (uint32_t) n);
- if (uart_receive_bytes(STM_UART_MGMT, (void *) &filesize, sizeof(filesize), 2000) != CMSIS_HAL_OK) {
+ if (uart_receive_bytes((void *) &filesize, sizeof(filesize), 2000) != CMSIS_HAL_OK) {
cli_print(cli, "Receive timed out");
goto fail;
}
@@ -75,7 +75,7 @@ int cli_receive_data(struct cli_def *cli, uint8_t *buf, size_t len, cli_data_cal
if (filesize < n) n = filesize;
- if (uart_receive_bytes(STM_UART_MGMT, (void *) buf, n, 2000) != CMSIS_HAL_OK) {
+ if (uart_receive_bytes((void *) buf, n, 2000) != CMSIS_HAL_OK) {
cli_print(cli, "Receive timed out");
goto fail;
}
@@ -85,18 +85,18 @@ int cli_receive_data(struct cli_def *cli, uint8_t *buf, size_t len, cli_data_cal
/* After reception of a chunk but before ACKing we have "all" the time in the world to
* calculate CRC and invoke the data_callback.
*/
- if (data_callback != NULL && ! data_callback(buf, (size_t) n)) {
+ if (data_callback != NULL && data_callback(buf, n) != CMSIS_HAL_OK) {
cli_print(cli, "Data processing failed");
goto okay;
}
counter++;
- uart_send_bytes(STM_UART_MGMT, (void *) &counter, 4);
+ uart_send_bytes((void *) &counter, 4);
}
my_crc = hal_crc32_finalize(my_crc);
cli_print(cli, "Send CRC-32");
- uart_receive_bytes(STM_UART_MGMT, (void *) &crc, sizeof(crc), 2000);
+ uart_receive_bytes((void *) &crc, sizeof(crc), 2000);
cli_print(cli, "CRC-32 0x%x, calculated CRC 0x%x", (unsigned int) crc, (unsigned int) my_crc);
if (crc == my_crc) {
cli_print(cli, "CRC checksum MATCHED");
@@ -116,6 +116,11 @@ int cli_receive_data(struct cli_def *cli, uint8_t *buf, size_t len, cli_data_cal
#ifdef DO_PROFILING
static int cmd_profile_start(struct cli_def *cli, const char *command, char *argv[], int argc)
{
+ cli = cli;
+ command = command;
+ argv = argv;
+ argc = argc;
+
extern uint32_t CRYPTECH_FIRMWARE_START;
extern char __etext; /* end of text/code symbol, defined by linker */
extern void monstartup (size_t lowpc, size_t highpc);
@@ -125,6 +130,11 @@ static int cmd_profile_start(struct cli_def *cli, const char *command, char *arg
static int cmd_profile_stop(struct cli_def *cli, const char *command, char *argv[], int argc)
{
+ cli = cli;
+ command = command;
+ argv = argv;
+ argc = argc;
+
extern void _mcleanup(void);
_mcleanup();
return CLI_OK;
@@ -134,6 +144,10 @@ static int cmd_profile_stop(struct cli_def *cli, const char *command, char *argv
static int cmd_reboot(struct cli_def *cli, const char *command, char *argv[], int argc)
{
+ command = command;
+ argv = argv;
+ argc = argc;
+
cli_print(cli, "\n\n\nRebooting\n\n\n");
HAL_NVIC_SystemReset();