Browse Source

target/arm_adi_v5: power off chip debug hardware on shutdown

Change-Id: I759442371439ec54597f75964115776bfaa67949
cc2538-riot
Jim Paris 5 years ago
parent
commit
f92d7174cc
3 changed files with 25 additions and 0 deletions
  1. +20
    -0
      src/target/arm_adi_v5.c
  2. +3
    -0
      src/target/arm_adi_v5.h
  3. +2
    -0
      src/target/cortex_m.c

+ 20
- 0
src/target/arm_adi_v5.c View File

@@ -731,6 +731,26 @@ int dap_dp_init(struct adiv5_dap *dap)
return retval;
}

/**
* Deinitialize a DAP. This turns off power to the debug domain.
*
* @param dap The DAP being initialized.
*/
int dap_dp_uninit(struct adiv5_dap *dap)
{
int retval;

LOG_DEBUG("%s", adiv5_dap_name(dap));

/* Deassert CDBGPWRUPREQ and CSYSPWRUPREQ */
dap->dp_ctrl_stat = 0;
retval = dap_queue_dp_write(dap, DP_CTRL_STAT, dap->dp_ctrl_stat);
if (retval != ERROR_OK)
return retval;

return dap_run(dap);
}

/**
* Initialize a DAP. This sets up the power domains, prepares the DP
* for further use, and arranges to use AP #0 for all AP operations


+ 3
- 0
src/target/arm_adi_v5.h View File

@@ -552,6 +552,9 @@ int mem_ap_write_buf_noincr(struct adiv5_ap *ap,
int dap_dp_init(struct adiv5_dap *dap);
int mem_ap_init(struct adiv5_ap *ap);

/* Deinitialisation of the debug system and power domains */
int dap_dp_uninit(struct adiv5_dap *dap);

/* Invalidate cached DP select and cached TAR and CSW of all APs */
void dap_invalidate_cache(struct adiv5_dap *dap);



+ 2
- 0
src/target/cortex_m.c View File

@@ -1800,6 +1800,8 @@ void cortex_m_deinit_target(struct target *target)
{
struct cortex_m_common *cortex_m = target_to_cm(target);

dap_dp_uninit(cortex_m->armv7m.debug_ap->dap);

free(cortex_m->fp_comparator_list);

cortex_m_dwt_free(target);


Loading…
Cancel
Save