diff --git a/sw/sf2-test/main.c b/sw/sf2-test/main.c index 914ecd04ad6d54dd256888e61eaa41ec70aba747..86d031e130a178ca46bd6a4c653f8457f3c1eb59 100644 --- a/sw/sf2-test/main.c +++ b/sw/sf2-test/main.c @@ -18,7 +18,9 @@ extern void clear_bss(void); static enum t_test { - TEST_ECC_DE, + TEST_IRAM_DE, + TEST_IRAM_SE, + TEST_IRAM_SCRUB, TEST_WD, TEST_CPU1_RECOVER, TEST_CPU2_RECOVER, @@ -153,16 +155,42 @@ main (void) v = SUPERVISOR->reset_cause; uart_put_hex_digit (v & 0x0f); uart_puts (", tst: "); - uart_put_hex_digit (next_test); + uart_put_hex_digit (next_test & 0x0f); uart_putc('\n'); switch (next_test) { - case TEST_ECC_DE: - next_test = TEST_WD; + case TEST_IRAM_DE: + next_test = TEST_IRAM_SE; v = *(volatile unsigned *)0xfffc; unreachable(); break; + case TEST_IRAM_SE: + /* Must have been corrected. */ + v = *(volatile unsigned *)0xfffc; + if (SUPERVISOR->iram_ecc_se != 0) + unreachable(); + v = *(volatile unsigned *)0xfff8; + if (SUPERVISOR->iram_ecc_se != 1) + unreachable(); + next_test = TEST_IRAM_SCRUB; + /* Fallthrough */ + + case TEST_IRAM_SCRUB: + if (SUPERVISOR->iram_scrub_se != 0 + || SUPERVISOR->iram_scrub_de != 0) + unreachable(); + uart_puts("Start IRAM scrubber"); + SUPERVISOR->scrub_cfg = HYDRA_SUPERVISOR_REGS_SCRUB_CFG_IRAM_EN; + while (SUPERVISOR->iram_scrub_de == 0) + uart_putc('.'); + uart_putc('\n'); + if (SUPERVISOR->iram_scrub_se != 1 + || SUPERVISOR->iram_scrub_de != 1) + unreachable(); + next_test = TEST_WD; + /* Fallthrough */ + case TEST_WD: /* Test watchdog - infinite loop */ next_test = TEST_CPU1_RECOVER; @@ -214,6 +242,8 @@ main (void) /* Fallthrough */ case TEST_DONE: + default: + next_test++; SUPERVISOR->wd_key = WD_KEY; SUPERVISOR->wd_period = 100000000; uart_puts ("Hello diot.\n");