rp: Increase spinner timeout to 500ms

Increasing spinner timeout to 500 means `tc_printf` is not called during
the `_flash_range_erase`. This is important as `_flash_range_erase` is
used when loading. This fixes the issue:
https://github.com/blacksphere/blackmagic/issues/875
Also adding spinner timeout counter to reduce bus traffic.
This commit is contained in:
James Turton 2021-05-11 12:17:59 +02:00 committed by UweBonnes
parent 67c9003522
commit e453740aca
1 changed files with 10 additions and 2 deletions

View File

@ -112,7 +112,7 @@ static bool rp2040_fill_table(struct rp_priv_s *priv, uint16_t *table, int max)
/* RP ROM functions calls /* RP ROM functions calls
* *
* timout == 0: Do not wait for poll, use for reset_usb_boot() * timout == 0: Do not wait for poll, use for reset_usb_boot()
* timeout > 400 (ms) : display spinner * timeout > 500 (ms) : display spinner
*/ */
static bool rp_rom_call(target *t, uint32_t *regs, uint32_t cmd, static bool rp_rom_call(target *t, uint32_t *regs, uint32_t cmd,
uint32_t timeout) uint32_t timeout)
@ -134,9 +134,17 @@ static bool rp_rom_call(target *t, uint32_t *regs, uint32_t cmd,
DEBUG_INFO("Call cmd %04" PRIx32 "\n", cmd); DEBUG_INFO("Call cmd %04" PRIx32 "\n", cmd);
platform_timeout to; platform_timeout to;
platform_timeout_set(&to, timeout); platform_timeout_set(&to, timeout);
platform_timeout to_spinner;
if (timeout > 500)
platform_timeout_set(&to_spinner, 500);
else
/* never trigger if timeout is short */
platform_timeout_set(&to_spinner, timeout + 1);
do { do {
if (timeout > 400) if (platform_timeout_is_expired(&to_spinner)) {
tc_printf(t, "\b%c", spinner[spinindex++ % 4]); tc_printf(t, "\b%c", spinner[spinindex++ % 4]);
platform_timeout_set(&to_spinner, 500);
}
if (platform_timeout_is_expired(&to)) { if (platform_timeout_is_expired(&to)) {
DEBUG_WARN("RP Run timout %d ms reached: ", (int)timeout); DEBUG_WARN("RP Run timout %d ms reached: ", (int)timeout);
break; break;