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/board-test/spiflash-perf.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/board-test/spiflash-perf.c')
-rw-r--r-- | projects/board-test/spiflash-perf.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/projects/board-test/spiflash-perf.c b/projects/board-test/spiflash-perf.c index 2691504..36c6131 100644 --- a/projects/board-test/spiflash-perf.c +++ b/projects/board-test/spiflash-perf.c @@ -35,7 +35,7 @@ static void test_read_page(void) err = n25q128_read_page(ctx, i, read_buf); if (err != HAL_OK) { uart_send_string("ERROR: n25q128_read_page returned "); - uart_send_integer(err, 0); + uart_send_integer(err, 1); uart_send_string("\r\n"); break; } @@ -55,7 +55,7 @@ static void test_read_subsector(void) err = n25q128_read_subsector(ctx, i, read_buf); if (err != HAL_OK) { uart_send_string("ERROR: n25q128_read_subsector returned "); - uart_send_integer(err, 0); + uart_send_integer(err, 1); uart_send_string("\r\n"); break; } @@ -77,13 +77,13 @@ static void _read_verify(uint8_t *vrfy_buf) err = n25q128_read_page(ctx, i, read_buf); if (err != HAL_OK) { uart_send_string("ERROR: n25q128_read_page returned "); - uart_send_integer(err, 0); + uart_send_integer(err, 1); uart_send_string("\r\n"); break; } if (memcmp(read_buf, vrfy_buf, N25Q128_PAGE_SIZE) != 0) { uart_send_string("ERROR: verify failed in page "); - uart_send_integer(i, 0); + uart_send_integer(i, 1); uart_send_string("\r\n"); break; } @@ -102,7 +102,7 @@ static void test_erase_sector(void) err = n25q128_erase_sector(ctx, i); if (err != HAL_OK) { uart_send_string("ERROR: n25q128_erase_sector returned "); - uart_send_integer(err, 0); + uart_send_integer(err, 1); uart_send_string("\r\n"); break; } @@ -121,7 +121,7 @@ static void test_erase_subsector(void) err = n25q128_erase_subsector(ctx, i); if (err != HAL_OK) { uart_send_string("ERROR: n25q128_erase_subsector returned "); - uart_send_integer(err, 0); + uart_send_integer(err, 1); uart_send_string("\r\n"); break; } @@ -138,7 +138,7 @@ static void test_erase_bulk(void) err = n25q128_erase_bulk(ctx); if (err != HAL_OK) { uart_send_string("ERROR: n25q128_erase_bulk returned "); - uart_send_integer(err, 0); + uart_send_integer(err, 1); uart_send_string("\r\n"); } } @@ -173,9 +173,9 @@ static void test_write_page(void) err = n25q128_write_page(ctx, i, write_buf); if (err != HAL_OK) { uart_send_string("ERROR: n25q128_write_page returned "); - uart_send_integer(err, 0); + uart_send_integer(err, 1); uart_send_string(" for page "); - uart_send_integer(i, 0); + uart_send_integer(i, 1); uart_send_string("\r\n"); break; } @@ -201,15 +201,15 @@ static void _time_check(char *label, const uint32_t t0, uint32_t n_rounds) uint32_t t = HAL_GetTick() - t0; uart_send_string(label); - uart_send_integer(t / 1000, 0); + uart_send_integer(t / 1000, 1); uart_send_char('.'); uart_send_integer(t % 1000, 3); uart_send_string(" sec"); if (n_rounds > 1) { uart_send_string(" for "); - uart_send_integer(n_rounds, 0); + uart_send_integer(n_rounds, 1); uart_send_string(" rounds, "); - uart_send_integer(t / n_rounds, 0); + uart_send_integer(t / n_rounds, 1); uart_send_char('.'); uart_send_integer(((t % n_rounds) * 100) / n_rounds, 2); uart_send_string(" ms each"); @@ -227,7 +227,6 @@ static void _time_check(char *label, const uint32_t t0, uint32_t n_rounds) int main(void) { stm_init(); - uart_set_default(STM_UART_MGMT); if (n25q128_check_id(ctx) != HAL_OK) { uart_send_string("ERROR: n25q128_check_id failed\r\n"); |