aboutsummaryrefslogtreecommitdiff
path: root/projects/board-test
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2017-10-17 00:27:11 -0400
committerPaul Selkirk <paul@psgd.org>2017-10-17 00:27:11 -0400
commit03b14b4cd4a214a92e3968ff33a13c2086896864 (patch)
tree4b391205211d55a0cba4750682784f5d1799fb44 /projects/board-test
parent5af4a915edf3e77705fa2625081200b61f8dda26 (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')
-rw-r--r--projects/board-test/fmc-perf.c4
-rw-r--r--projects/board-test/fmc-test.c5
-rw-r--r--projects/board-test/keystore-perf.c21
-rw-r--r--projects/board-test/rtc-test.c7
-rw-r--r--projects/board-test/spiflash-perf.c25
5 files changed, 29 insertions, 33 deletions
diff --git a/projects/board-test/fmc-perf.c b/projects/board-test/fmc-perf.c
index 5ed47ec..e87f282 100644
--- a/projects/board-test/fmc-perf.c
+++ b/projects/board-test/fmc-perf.c
@@ -56,11 +56,11 @@ static void _time_check(char *label, const uint32_t t0)
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(" seconds, ");
- uart_send_integer(((1000 * TEST_NUM_ROUNDS) / t), 0);
+ uart_send_integer(((1000 * TEST_NUM_ROUNDS) / t), 1);
uart_send_string("/sec\r\n");
}
diff --git a/projects/board-test/fmc-test.c b/projects/board-test/fmc-test.c
index ed5891a..2002f57 100644
--- a/projects/board-test/fmc-test.c
+++ b/projects/board-test/fmc-test.c
@@ -85,7 +85,6 @@ int main(void)
int i;
stm_init();
- uart_set_default(STM_UART_MGMT);
uart_send_string("Keep calm for FPGA bitstream loading...\r\n");
@@ -142,9 +141,9 @@ int main(void)
}
uart_send_string("Success ");
- uart_send_integer(successful_runs, 0);
+ uart_send_integer(successful_runs, 1);
uart_send_string(", fail ");
- uart_send_integer(failed_runs, 0);
+ uart_send_integer(failed_runs, 1);
uart_send_string("\r\n");
if (VERBOSE)
uart_send_string("\r\n");
diff --git a/projects/board-test/keystore-perf.c b/projects/board-test/keystore-perf.c
index 3552d30..c2aa4fb 100644
--- a/projects/board-test/keystore-perf.c
+++ b/projects/board-test/keystore-perf.c
@@ -22,7 +22,7 @@ static void test_read_data(void)
err = keystore_read_data(i * KEYSTORE_SUBSECTOR_SIZE, read_buf, KEYSTORE_SUBSECTOR_SIZE);
if (err != HAL_OK) {
uart_send_string("ERROR: keystore_read_data returned ");
- uart_send_integer(err, 0);
+ uart_send_integer(err, 1);
uart_send_string("\r\n");
break;
}
@@ -42,13 +42,13 @@ static void _read_verify(uint8_t *vrfy_buf)
err = keystore_read_data(i * KEYSTORE_SUBSECTOR_SIZE, read_buf, KEYSTORE_SUBSECTOR_SIZE);
if (err != HAL_OK) {
uart_send_string("ERROR: keystore_read_data returned ");
- uart_send_integer(err, 0);
+ uart_send_integer(err, 1);
uart_send_string("\r\n");
break;
}
if (memcmp(read_buf, vrfy_buf, KEYSTORE_SUBSECTOR_SIZE) != 0) {
uart_send_string("ERROR: verify failed in subsector ");
- uart_send_integer(i, 0);
+ uart_send_integer(i, 1);
uart_send_string("\r\n");
break;
}
@@ -67,7 +67,7 @@ static void test_erase_sector(void)
err = keystore_erase_sector(i);
if (err != HAL_OK) {
uart_send_string("ERROR: keystore_erase_sector returned ");
- uart_send_integer(err, 0);
+ uart_send_integer(err, 1);
uart_send_string("\r\n");
break;
}
@@ -86,7 +86,7 @@ static void test_erase_subsector(void)
err = keystore_erase_subsector(i);
if (err != HAL_OK) {
uart_send_string("ERROR: keystore_erase_subsector returned ");
- uart_send_integer(err, 0);
+ uart_send_integer(err, 1);
uart_send_string("\r\n");
break;
}
@@ -123,9 +123,9 @@ static void test_write_data(void)
err = keystore_write_data(i * KEYSTORE_SUBSECTOR_SIZE, write_buf, KEYSTORE_SUBSECTOR_SIZE);
if (err != HAL_OK) {
uart_send_string("ERROR: keystore_write_data returned ");
- uart_send_integer(err, 0);
+ uart_send_integer(err, 1);
uart_send_string(" for subsector ");
- uart_send_integer(i, 0);
+ uart_send_integer(i, 1);
uart_send_string("\r\n");
break;
}
@@ -151,15 +151,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");
@@ -177,7 +177,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 (keystore_check_id() != HAL_OK) {
uart_send_string("ERROR: keystore_check_id failed\r\n");
diff --git a/projects/board-test/rtc-test.c b/projects/board-test/rtc-test.c
index f1c2db1..bbb297a 100644
--- a/projects/board-test/rtc-test.c
+++ b/projects/board-test/rtc-test.c
@@ -94,7 +94,7 @@ void dump_sram()
request_data(buf, RTC_RTC_ADDR, 0x0, RTC_SRAM_TOTAL_BYTES);
uart_send_string("SRAM contents:\r\n");
- uart_send_hexdump(STM_UART_MGMT, buf, 0, RTC_SRAM_TOTAL_BYTES);
+ uart_send_hexdump(buf, 0, RTC_SRAM_TOTAL_BYTES);
uart_send_string("\r\n");
}
@@ -104,12 +104,12 @@ void dump_eeprom()
request_data(buf, RTC_EEPROM_ADDR, 0x0, RTC_EEPROM_TOTAL_BYTES);
uart_send_string("EEPROM contents:\r\n");
- uart_send_hexdump(STM_UART_MGMT, buf, 0, RTC_EEPROM_TOTAL_BYTES);
+ uart_send_hexdump(buf, 0, RTC_EEPROM_TOTAL_BYTES);
uart_send_string("\r\n");
request_data(buf, RTC_EEPROM_ADDR, RTC_EEPROM_EUI48_OFFSET, RTC_EEPROM_EUI48_BYTES);
uart_send_string("EEPROM EUI-48:\r\n");
- uart_send_hexdump(STM_UART_MGMT, buf, RTC_EEPROM_EUI48_OFFSET, RTC_EEPROM_EUI48_BYTES);
+ uart_send_hexdump(buf, RTC_EEPROM_EUI48_OFFSET, RTC_EEPROM_EUI48_BYTES);
uart_send_string("\r\n");
}
@@ -131,7 +131,6 @@ int
main()
{
stm_init();
- uart_set_default(STM_UART_MGMT);
uart_send_string("\r\n\r\n*** Init done\r\n");
dump_sram();
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");