diff options
Diffstat (limited to 'projects/cli-test')
-rw-r--r-- | projects/cli-test/cli-test.c | 1 | ||||
-rw-r--r-- | projects/cli-test/mgmt-cli.c | 7 | ||||
-rw-r--r-- | projects/cli-test/mgmt-dfu.c | 4 | ||||
-rw-r--r-- | projects/cli-test/mgmt-keystore.c | 4 | ||||
-rw-r--r-- | projects/cli-test/mgmt-masterkey.c | 8 | ||||
-rw-r--r-- | projects/cli-test/mgmt-misc.c | 8 | ||||
-rw-r--r-- | projects/cli-test/mgmt-show.c | 4 | ||||
-rw-r--r-- | projects/cli-test/test-fmc.c | 12 |
8 files changed, 23 insertions, 25 deletions
diff --git a/projects/cli-test/cli-test.c b/projects/cli-test/cli-test.c index c288257..82946fa 100644 --- a/projects/cli-test/cli-test.c +++ b/projects/cli-test/cli-test.c @@ -57,7 +57,6 @@ int main() { stm_init(); - uart_set_default(STM_UART_MGMT); led_on(LED_GREEN); diff --git a/projects/cli-test/mgmt-cli.c b/projects/cli-test/mgmt-cli.c index 6910c4d..d7f7383 100644 --- a/projects/cli-test/mgmt-cli.c +++ b/projects/cli-test/mgmt-cli.c @@ -104,9 +104,8 @@ void HAL_UART1_RxCpltCallback(UART_HandleTypeDef *huart) static void uart_cli_print(struct cli_def *cli __attribute__ ((unused)), const char *buf) { - char crlf[] = "\r\n"; - uart_send_string2(STM_UART_MGMT, buf); - uart_send_string2(STM_UART_MGMT, crlf); + uart_send_string(buf); + uart_send_string("\r\n"); } static ssize_t uart_cli_read(struct cli_def *cli __attribute__ ((unused)), void *buf, size_t count) @@ -120,7 +119,7 @@ static ssize_t uart_cli_read(struct cli_def *cli __attribute__ ((unused)), void static ssize_t uart_cli_write(struct cli_def *cli __attribute__ ((unused)), const void *buf, size_t count) { - uart_send_bytes(STM_UART_MGMT, (uint8_t *) buf, count); + uart_send_bytes((uint8_t *) buf, count); return (ssize_t)count; } diff --git a/projects/cli-test/mgmt-dfu.c b/projects/cli-test/mgmt-dfu.c index 7b78d38..c7273f4 100644 --- a/projects/cli-test/mgmt-dfu.c +++ b/projects/cli-test/mgmt-dfu.c @@ -64,8 +64,8 @@ static int cmd_dfu_dump(struct cli_def *cli, const char *command, char *argv[], cli_print(cli, "First 256 bytes from DFU application address %p:\r\n", dfu_firmware); - uart_send_hexdump(STM_UART_MGMT, (uint8_t *) dfu_firmware, 0, 0xff); - uart_send_string2(STM_UART_MGMT, (char *) "\r\n\r\n"); + uart_send_hexdump((uint8_t *) dfu_firmware, 0, 0xff); + cli_print(cli, "\n"); return CLI_OK; } diff --git a/projects/cli-test/mgmt-keystore.c b/projects/cli-test/mgmt-keystore.c index 8c16f35..6d0d38d 100644 --- a/projects/cli-test/mgmt-keystore.c +++ b/projects/cli-test/mgmt-keystore.c @@ -239,8 +239,8 @@ static int cmd_keystore_show_data(struct cli_def *cli, const char *command, char } cli_print(cli, "First page from keystore memory:\r\n"); - uart_send_hexdump(STM_UART_MGMT, buf, 0, sizeof(buf) - 1); - uart_send_string2(STM_UART_MGMT, (char *) "\r\n\r\n"); + uart_send_hexdump(buf, 0, sizeof(buf) - 1); + cli_print(cli, "\n"); return CLI_OK; } diff --git a/projects/cli-test/mgmt-masterkey.c b/projects/cli-test/mgmt-masterkey.c index 0f6e352..811e15b 100644 --- a/projects/cli-test/mgmt-masterkey.c +++ b/projects/cli-test/mgmt-masterkey.c @@ -102,7 +102,7 @@ static int cmd_masterkey_status(struct cli_def *cli, const char *command, char * status = hal_mkm_volatile_read(&buf[0], sizeof(buf)); if (status == LIBHAL_OK || status == HAL_ERROR_MASTERKEY_NOT_SET) { cli_print(cli, "\nVolatile read-out:\n"); - uart_send_hexdump(STM_UART_MGMT, buf, 0, sizeof(buf) - 1); + uart_send_hexdump(buf, 0, sizeof(buf) - 1); cli_print(cli, "\n"); } else { cli_print(cli, "Failed reading from volatile memory: %s", hal_error_string(status)); @@ -111,7 +111,7 @@ static int cmd_masterkey_status(struct cli_def *cli, const char *command, char * status = hal_mkm_flash_read(&buf[0], sizeof(buf)); if (status == LIBHAL_OK || status == HAL_ERROR_MASTERKEY_NOT_SET) { cli_print(cli, "\nFlash read-out:\n"); - uart_send_hexdump(STM_UART_MGMT, buf, 0, sizeof(buf) - 1); + uart_send_hexdump(buf, 0, sizeof(buf) - 1); cli_print(cli, "\n"); } else { cli_print(cli, "Failed reading from flash: %s", hal_error_string(status)); @@ -134,7 +134,7 @@ static int cmd_masterkey_set(struct cli_def *cli, const char *command, char *arg } cli_print(cli, "Parsed key:\n"); - uart_send_hexdump(STM_UART_MGMT, buf, 0, sizeof(buf) - 1); + uart_send_hexdump(buf, 0, sizeof(buf) - 1); cli_print(cli, "\n"); if ((err = hal_mkm_volatile_write(buf, sizeof(buf))) == LIBHAL_OK) { @@ -175,7 +175,7 @@ static int cmd_masterkey_unsecure_set(struct cli_def *cli, const char *command, } cli_print(cli, "Parsed key:\n"); - uart_send_hexdump(STM_UART_MGMT, buf, 0, sizeof(buf) - 1); + uart_send_hexdump(buf, 0, sizeof(buf) - 1); cli_print(cli, "\n"); if ((err = hal_mkm_flash_write(buf, sizeof(buf))) == LIBHAL_OK) { diff --git a/projects/cli-test/mgmt-misc.c b/projects/cli-test/mgmt-misc.c index 1216bd5..db8dbd2 100644 --- a/projects/cli-test/mgmt-misc.c +++ b/projects/cli-test/mgmt-misc.c @@ -67,7 +67,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), 1000) != CMSIS_HAL_OK) { + if (uart_receive_bytes((void *) &filesize, sizeof(filesize), 1000) != CMSIS_HAL_OK) { cli_print(cli, "Receive timed out"); goto fail; } @@ -82,7 +82,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, 1000) != CMSIS_HAL_OK) { + if (uart_receive_bytes((void *) buf, n, 1000) != CMSIS_HAL_OK) { cli_print(cli, "Receive timed out"); goto fail; } @@ -98,12 +98,12 @@ int cli_receive_data(struct cli_def *cli, uint8_t *buf, size_t len, cli_data_cal } 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), 1000); + uart_receive_bytes((void *) &crc, sizeof(crc), 1000); 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"); diff --git a/projects/cli-test/mgmt-show.c b/projects/cli-test/mgmt-show.c index e276b15..4338dcd 100644 --- a/projects/cli-test/mgmt-show.c +++ b/projects/cli-test/mgmt-show.c @@ -130,8 +130,8 @@ static int cmd_show_keystore_data(struct cli_def *cli, const char *command, char } cli_print(cli, "First page from keystore memory:\r\n"); - uart_send_hexdump(STM_UART_MGMT, buf, 0, sizeof(buf) - 1); - uart_send_string2(STM_UART_MGMT, (char *) "\r\n\r\n"); + uart_send_hexdump(buf, 0, sizeof(buf) - 1); + cli_print(cli, "\n"); for (i = 0; i < 8; i++) { if (buf[i] == 0xff) break; /* never written */ diff --git a/projects/cli-test/test-fmc.c b/projects/cli-test/test-fmc.c index a1d6eea..87f80ce 100644 --- a/projects/cli-test/test-fmc.c +++ b/projects/cli-test/test-fmc.c @@ -121,9 +121,9 @@ int test_fpga_data_bus(struct cli_def *cli, uint32_t test_rounds) data_diff = buf ^ rnd; if (data_diff) { cli_print(cli, "Data bus FAIL: expected %lx got %lx", rnd, buf); - uart_send_string2(STM_UART_MGMT, (char *) "Binary diff: "); - uart_send_number2(STM_UART_MGMT, data_diff, 32, 2); - uart_send_string2(STM_UART_MGMT, "\r\n"); + uart_send_string((char *) "Binary diff: "); + uart_send_binary(data_diff, 32); + uart_send_string("\r\n"); break; } @@ -192,9 +192,9 @@ int test_fpga_address_bus(struct cli_def *cli, uint32_t test_rounds) addr_diff = buf ^ addr; if (addr_diff) { cli_print(cli, "Address bus FAIL: expected 0x%lx got 0x%lx", addr, buf); - uart_send_string2(STM_UART_MGMT, (char *) "Binary diff: "); - uart_send_number2(STM_UART_MGMT, addr_diff, 32, 2); - uart_send_string2(STM_UART_MGMT, "\r\n"); + uart_send_string((char *) "Binary diff: "); + uart_send_binary(addr_diff, 32); + uart_send_string("\r\n"); break; } |