diff --git a/src/flash/nor/kinetis.c b/src/flash/nor/kinetis.c index ce5807ffe..179527905 100644 --- a/src/flash/nor/kinetis.c +++ b/src/flash/nor/kinetis.c @@ -316,7 +316,7 @@ COMMAND_HANDLER(kinetis_mdm_mass_erase) } int retval; - const uint8_t original_ap = dap->ap_current; + const uint8_t original_ap = dap_ap_get_select(dap); /* * ... Power on the processor, or if power has already been @@ -420,7 +420,7 @@ COMMAND_HANDLER(kinetis_check_flash_security_status) uint32_t val; int retval; - const uint8_t origninal_ap = dap->ap_current; + const uint8_t origninal_ap = dap_ap_get_select(dap); dap_ap_select(dap, 1); diff --git a/src/flash/nor/sim3x.c b/src/flash/nor/sim3x.c index 2a8700282..0a5906c12 100644 --- a/src/flash/nor/sim3x.c +++ b/src/flash/nor/sim3x.c @@ -959,7 +959,7 @@ COMMAND_HANDLER(sim3x_mass_erase) return ERROR_FAIL; } - const uint8_t origninal_ap = dap->ap_current >> 24; + const uint8_t origninal_ap = dap_ap_get_select(dap); dap_ap_select(dap, SIM3X_AP); ret = ap_read_register(dap, SIM3X_AP_ID, &val); @@ -1017,7 +1017,7 @@ COMMAND_HANDLER(sim3x_lock) return ERROR_FAIL; } } else { - const uint8_t origninal_ap = dap->ap_current >> 24; + const uint8_t origninal_ap = dap_ap_get_select(dap); dap_ap_select(dap, SIM3X_AP); /* check SIM3X_AP_ID */ diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index f7e58d08b..c2929ef7f 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -844,7 +844,7 @@ int dap_get_debugbase(struct adiv5_dap *dap, int ap, if (ap >= 256) return ERROR_COMMAND_SYNTAX_ERROR; - ap_old = dap->ap_current; + ap_old = dap_ap_get_select(dap); dap_ap_select(dap, ap); retval = dap_queue_ap_read(dap, AP_REG_BASE, dbgbase); @@ -873,7 +873,7 @@ int dap_lookup_cs_component(struct adiv5_dap *dap, int ap, return ERROR_COMMAND_SYNTAX_ERROR; *addr = 0; - ap_old = dap->ap_current; + ap_old = dap_ap_get_select(dap); dap_ap_select(dap, ap); do { @@ -1408,7 +1408,7 @@ static int dap_info_command(struct command_context *cmd_ctx, if (retval != ERROR_OK) return retval; - ap_old = dap->ap_current; + ap_old = dap_ap_get_select(dap); dap_ap_select(dap, ap); /* Now we read ROM table ID registers, ref. ARM IHI 0029B sec */