riscv: Implement the assert/deassert reset functions for v13

This commit is contained in:
Megan Wachs 2017-03-30 19:28:44 -07:00 committed by Palmer Dabbelt
parent 7203102c25
commit b04c6cb3ed
2 changed files with 11 additions and 2 deletions

View File

@ -1817,12 +1817,18 @@ static int riscv013_resume(struct target *target, int current, uint32_t address,
static int assert_reset(struct target *target) static int assert_reset(struct target *target)
{ {
return ERROR_FAIL; select_dmi(target);
dmi_write(target, DMI_DMCONTROL,
DMI_DMCONTROL_DMACTIVE | DMI_DMCONTROL_NDMRESET);
return ERROR_OK;
} }
static int deassert_reset(struct target *target) static int deassert_reset(struct target *target)
{ {
return ERROR_FAIL; select_dmi(target);
dmi_write(target, DMI_DMCONTROL,
DMI_DMCONTROL_DMACTIVE);
return ERROR_OK;
} }
static int read_memory(struct target *target, uint32_t address, static int read_memory(struct target *target, uint32_t address,

View File

@ -310,6 +310,7 @@ static int riscv_examine(struct target *target)
{ {
LOG_DEBUG("riscv_examine()"); LOG_DEBUG("riscv_examine()");
if (target_was_examined(target)) { if (target_was_examined(target)) {
LOG_DEBUG("Target was already examined.\n");
return ERROR_OK; return ERROR_OK;
} }
@ -348,12 +349,14 @@ static int riscv_resume(struct target *target, int current, uint32_t address,
static int riscv_assert_reset(struct target *target) static int riscv_assert_reset(struct target *target)
{ {
LOG_DEBUG("RISCV ASSERT RESET");
struct target_type *tt = get_target_type(target); struct target_type *tt = get_target_type(target);
return tt->assert_reset(target); return tt->assert_reset(target);
} }
static int riscv_deassert_reset(struct target *target) static int riscv_deassert_reset(struct target *target)
{ {
LOG_DEBUG("RISCV DEASSERT RESET");
struct target_type *tt = get_target_type(target); struct target_type *tt = get_target_type(target);
return tt->deassert_reset(target); return tt->deassert_reset(target);
} }