diff options
Diffstat (limited to 'projects/board-test')
-rw-r--r-- | projects/board-test/fmc-perf.c | 4 | ||||
-rw-r--r-- | projects/board-test/fmc-test.c | 60 | ||||
-rw-r--r-- | projects/board-test/keystore-perf.c | 43 | ||||
-rw-r--r-- | projects/board-test/rtc-test.c | 7 | ||||
-rw-r--r-- | projects/board-test/spiflash-perf.c | 41 |
5 files changed, 81 insertions, 74 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 c6a37e6..2002f57 100644 --- a/projects/board-test/fmc-test.c +++ b/projects/board-test/fmc-test.c @@ -4,8 +4,7 @@ /* This requires a special bitstream with a special test register. - See core/platform/novena/fmc/rtl/novena_fmc_top.v, sections marked - `ifdef test: + See core/platform/alpha/rtl/alpha_fmc_test.v: //---------------------------------------------------------------- // Dummy Register // @@ -76,6 +75,7 @@ int test_fpga_address_bus(void); // Defines //------------------------------------------------------------------------------ #define TEST_NUM_ROUNDS 100000 +#define VERBOSE 0 //------------------------------------------------------------------------------ @@ -117,11 +117,15 @@ int main(void) // test address bus addr_test_ok = test_fpga_address_bus(); - uart_send_string("Data: "); - uart_send_integer(data_test_ok, 6); - uart_send_string(", addr: "); - uart_send_integer(addr_test_ok, 6); - uart_send_string("\r\n"); + if (VERBOSE || + (data_test_ok != TEST_NUM_ROUNDS || + addr_test_ok != TEST_NUM_ROUNDS)) { + uart_send_string("Data: "); + uart_send_integer(data_test_ok, 6); + uart_send_string(", addr: "); + uart_send_integer(addr_test_ok, 6); + uart_send_string("\r\n"); + } if (data_test_ok == TEST_NUM_ROUNDS && addr_test_ok == TEST_NUM_ROUNDS) { @@ -137,11 +141,12 @@ 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_string("\r\n\r\n"); - + uart_send_integer(failed_runs, 1); + uart_send_string("\r\n"); + if (VERBOSE) + uart_send_string("\r\n"); HAL_Delay(sleep); } @@ -194,13 +199,16 @@ int test_fpga_data_bus(void) data_diff = buf; data_diff ^= rnd; - uart_send_string("Sample of data bus test data: expected "); - uart_send_binary(rnd, 32); - uart_send_string(", got "); - uart_send_binary(buf, 32); - uart_send_string(", diff "); - uart_send_binary(data_diff, 32); - uart_send_string("\r\n"); + if (VERBOSE || data_diff) { + uart_send_string("Sample of data bus test data: expected "); + uart_send_binary(rnd, 32); + uart_send_string(", got "); + uart_send_binary(buf, 32); + uart_send_string(", diff "); + uart_send_binary(data_diff, 32); + uart_send_string("\r\n"); + } + // return number of successful tests return c; } @@ -263,13 +271,15 @@ int test_fpga_address_bus(void) addr_diff = buf; addr_diff ^= rnd; - uart_send_string("Sample of addr bus test data: expected "); - uart_send_binary(rnd, 32); - uart_send_string(", got "); - uart_send_binary(buf, 32); - uart_send_string(", diff "); - uart_send_binary(addr_diff, 32); - uart_send_string("\r\n"); + if (VERBOSE || addr_diff) { + uart_send_string("Sample of addr bus test data: expected "); + uart_send_binary(rnd, 32); + uart_send_string(", got "); + uart_send_binary(buf, 32); + uart_send_string(", diff "); + uart_send_binary(addr_diff, 32); + uart_send_string("\r\n"); + } return c; } diff --git a/projects/board-test/keystore-perf.c b/projects/board-test/keystore-perf.c index 09528a2..c2aa4fb 100644 --- a/projects/board-test/keystore-perf.c +++ b/projects/board-test/keystore-perf.c @@ -16,13 +16,13 @@ static void test_read_data(void) { uint8_t read_buf[KEYSTORE_SUBSECTOR_SIZE]; uint32_t i; - int err; + HAL_StatusTypeDef err; for (i = 0; i < KEYSTORE_NUM_SUBSECTORS; ++i) { err = keystore_read_data(i * KEYSTORE_SUBSECTOR_SIZE, read_buf, KEYSTORE_SUBSECTOR_SIZE); - if (err != 1) { + 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; } @@ -36,19 +36,19 @@ static void _read_verify(uint8_t *vrfy_buf) { uint8_t read_buf[KEYSTORE_SUBSECTOR_SIZE]; uint32_t i; - int err; + HAL_StatusTypeDef err; for (i = 0; i < KEYSTORE_NUM_SUBSECTORS; ++i) { err = keystore_read_data(i * KEYSTORE_SUBSECTOR_SIZE, read_buf, KEYSTORE_SUBSECTOR_SIZE); - if (err != 1) { + 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; } @@ -61,13 +61,13 @@ static void _read_verify(uint8_t *vrfy_buf) static void test_erase_sector(void) { uint32_t i; - int err; + HAL_StatusTypeDef err; for (i = 0; i < KEYSTORE_NUM_SECTORS; ++i) { err = keystore_erase_sector(i); - if (err != 1) { + 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; } @@ -80,13 +80,13 @@ static void test_erase_sector(void) static void test_erase_subsector(void) { uint32_t i; - int err; + HAL_StatusTypeDef err; for (i = 0; i < KEYSTORE_NUM_SUBSECTORS; ++i) { err = keystore_erase_subsector(i); - if (err != 1) { + 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; } @@ -114,18 +114,18 @@ static void test_write_data(void) { uint8_t write_buf[KEYSTORE_SUBSECTOR_SIZE]; uint32_t i; - int err; + HAL_StatusTypeDef err; for (i = 0; i < sizeof(write_buf); ++i) write_buf[i] = i & 0xFF; for (i = 0; i < KEYSTORE_NUM_SUBSECTORS; ++i) { err = keystore_write_data(i * KEYSTORE_SUBSECTOR_SIZE, write_buf, KEYSTORE_SUBSECTOR_SIZE); - if (err != 1) { + 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,9 +177,8 @@ 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() != 1) { + if (keystore_check_id() != HAL_OK) { uart_send_string("ERROR: keystore_check_id failed\r\n"); return 0; } 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 53f29cb..36c6131 100644 --- a/projects/board-test/spiflash-perf.c +++ b/projects/board-test/spiflash-perf.c @@ -33,9 +33,9 @@ static void test_read_page(void) for (i = 0; i < N25Q128_NUM_PAGES; ++i) { err = n25q128_read_page(ctx, i, read_buf); - if (err != 1) { + 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; } @@ -53,9 +53,9 @@ static void test_read_subsector(void) for (i = 0; i < N25Q128_NUM_SUBSECTORS; ++i) { err = n25q128_read_subsector(ctx, i, read_buf); - if (err != 1) { + 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; } @@ -75,15 +75,15 @@ static void _read_verify(uint8_t *vrfy_buf) for (i = 0; i < N25Q128_NUM_PAGES; ++i) { err = n25q128_read_page(ctx, i, read_buf); - if (err != 1) { + 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; } @@ -100,9 +100,9 @@ static void test_erase_sector(void) for (i = 0; i < N25Q128_NUM_SECTORS; ++i) { err = n25q128_erase_sector(ctx, i); - if (err != 1) { + 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; } @@ -119,9 +119,9 @@ static void test_erase_subsector(void) for (i = 0; i < N25Q128_NUM_SUBSECTORS; ++i) { err = n25q128_erase_subsector(ctx, i); - if (err != 1) { + 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; } @@ -136,9 +136,9 @@ static void test_erase_bulk(void) int err; err = n25q128_erase_bulk(ctx); - if (err != 1) { + 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"); } } @@ -171,11 +171,11 @@ static void test_write_page(void) for (i = 0; i < N25Q128_NUM_PAGES; ++i) { err = n25q128_write_page(ctx, i, write_buf); - if (err != 1) { + 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,9 +227,8 @@ 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) != 1) { + if (n25q128_check_id(ctx) != HAL_OK) { uart_send_string("ERROR: n25q128_check_id failed\r\n"); return 0; } |