diff options
author | Nicholas Piggin <npiggin@gmail.com> | 2019-03-08 12:25:35 +1000 |
---|---|---|
committer | Alistair Popple <alistair@popple.id.au> | 2019-03-08 15:28:21 +1100 |
commit | 7f55d463c7cc44d7a48818b10774f5c86f6df8dc (patch) | |
tree | 32ff49196b027e663d48807130f0265f90d64d05 | |
parent | db358eb46363b50cd83035c6f501af2ac37cc9ac (diff) | |
download | pdbg-7f55d463c7cc44d7a48818b10774f5c86f6df8dc.tar.gz pdbg-7f55d463c7cc44d7a48818b10774f5c86f6df8dc.zip |
libpdbg/p8chip.c: Only write the SP_STOP bit once
The workbook recipe is to write SP_STOP once, then poll for status.
Also add a small delay between polling to give a reasonable timeout
and avoid hitting the scom bus hard for no good reason.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
-rw-r--r-- | libpdbg/p8chip.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libpdbg/p8chip.c b/libpdbg/p8chip.c index 61b1e25..b93e953 100644 --- a/libpdbg/p8chip.c +++ b/libpdbg/p8chip.c @@ -286,9 +286,11 @@ static int p8_thread_stop(struct thread *thread) struct core *chip = target_to_core( pdbg_target_require_parent("core", &thread->target)); + /* Quiese active thread */ + CHECK_ERR(pib_write(&thread->target, DIRECT_CONTROLS_REG, DIRECT_CONTROL_SP_STOP)); + do { - /* Quiese active thread */ - CHECK_ERR(pib_write(&thread->target, DIRECT_CONTROLS_REG, DIRECT_CONTROL_SP_STOP)); + usleep(1); /* Wait for thread to quiese */ CHECK_ERR(pib_read(&thread->target, RAS_STATUS_REG, &val)); |