diff options
author | Paul Selkirk <paul@psgd.org> | 2017-10-17 00:27:11 -0400 |
---|---|---|
committer | Paul Selkirk <paul@psgd.org> | 2017-10-17 00:27:11 -0400 |
commit | 03b14b4cd4a214a92e3968ff33a13c2086896864 (patch) | |
tree | 4b391205211d55a0cba4750682784f5d1799fb44 /projects/hsm/mgmt-misc.c | |
parent | 5af4a915edf3e77705fa2625081200b61f8dda26 (diff) |
Overhaul UART API
MGMT is the default UART, and no one should have to explicitly refer to
the UART unless they need USER (hsm.c:hal_serial_send_char).
The default UART is now exposed in the header file, so that the
default-using functions can be macros, which saves a few bytes in code
space, and a few microseconds in function call overhead.
Diffstat (limited to 'projects/hsm/mgmt-misc.c')
-rw-r--r-- | projects/hsm/mgmt-misc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/projects/hsm/mgmt-misc.c b/projects/hsm/mgmt-misc.c index 65da7ff..b06003f 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; } @@ -91,12 +91,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), 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"); |