cortexa: Add timeout to reset spin.

This commit is contained in:
Gareth McMullin 2016-06-09 10:56:31 +12:00
parent 8b4342394f
commit 6b3c3d3473
1 changed files with 5 additions and 1 deletions

View File

@ -441,12 +441,16 @@ static void cortexa_reset(target *t)
platform_srst_set_val(false); platform_srst_set_val(false);
/* Spin until Xilinx reconnects us */ /* Spin until Xilinx reconnects us */
platform_timeout timeout;
platform_timeout_set(&timeout, 1000);
volatile struct exception e; volatile struct exception e;
do { do {
TRY_CATCH (e, EXCEPTION_ALL) { TRY_CATCH (e, EXCEPTION_ALL) {
apb_read(t, DBGDIDR); apb_read(t, DBGDIDR);
} }
} while (e.type == EXCEPTION_ERROR); } while (!platform_timeout_is_expired(&timeout) && e.type == EXCEPTION_ERROR);
if (e.type == EXCEPTION_ERROR)
raise_exception(e.type, e.msg);
platform_delay(100); platform_delay(100);