+// SPDX-License-Identifier: GPL-2.0-or-later
+
/***************************************************************************
* Copyright (C) 2005 by Dominic Rath *
* Dominic.Rath@gmx.de *
* hontor@126.com *
* *
* Copyright (C) 2009 by David Brownell *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#ifdef HAVE_CONFIG_H
{
if (!arm7_9->wp0_used) {
arm7_9->wp0_used = 1;
- breakpoint->set = 1;
+ breakpoint_hw_set(breakpoint, 0);
arm7_9->wp_available--;
} else if (!arm7_9->wp1_used) {
arm7_9->wp1_used = 1;
- breakpoint->set = 2;
+ breakpoint_hw_set(breakpoint, 1);
arm7_9->wp_available--;
- } else
+ } else {
LOG_ERROR("BUG: no hardware comparator available");
+ }
- LOG_DEBUG("BPID: %" PRIu32 " (0x%08" TARGET_PRIxADDR ") using hw wp: %d",
+ LOG_DEBUG("BPID: %" PRIu32 " (0x%08" TARGET_PRIxADDR ") using hw wp: %u",
breakpoint->unique_id,
breakpoint->address,
- breakpoint->set);
+ breakpoint->number);
}
/**
uint32_t mask = (breakpoint->length == 4) ? 0x3u : 0x1u;
/* reassign a hw breakpoint */
- if (breakpoint->set == 0)
+ if (!breakpoint->is_set)
arm7_9_assign_wp(arm7_9, breakpoint);
- if (breakpoint->set == 1) {
+ if (breakpoint->number == 0) {
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_ADDR_VALUE], breakpoint->address);
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_ADDR_MASK], mask);
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_DATA_MASK], 0xffffffffu);
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_MASK], ~EICE_W_CTRL_NOPC & 0xff);
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_VALUE], EICE_W_CTRL_ENABLE);
- } else if (breakpoint->set == 2) {
+ } else if (breakpoint->number == 1) {
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_ADDR_VALUE], breakpoint->address);
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_ADDR_MASK], mask);
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_DATA_MASK], 0xffffffffu);
retval = jtag_execute_queue();
} else if (breakpoint->type == BKPT_SOFT) {
/* did we already set this breakpoint? */
- if (breakpoint->set)
+ if (breakpoint->is_set)
return ERROR_OK;
if (breakpoint->length == 4) {
arm7_9->sw_breakpoint_count++;
- breakpoint->set = 1;
+ breakpoint->is_set = true;
}
return retval;
breakpoint->unique_id,
breakpoint->address);
- if (!breakpoint->set) {
+ if (!breakpoint->is_set) {
LOG_WARNING("breakpoint not set");
return ERROR_OK;
}
if (breakpoint->type == BKPT_HARD) {
LOG_DEBUG("BPID: %" PRIu32 " Releasing hw wp: %d",
breakpoint->unique_id,
- breakpoint->set);
- if (breakpoint->set == 1) {
+ breakpoint->is_set);
+ if (breakpoint->number == 0) {
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_VALUE], 0x0);
arm7_9->wp0_used = 0;
arm7_9->wp_available++;
- } else if (breakpoint->set == 2) {
+ } else if (breakpoint->number == 1) {
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_CONTROL_VALUE], 0x0);
arm7_9->wp1_used = 0;
arm7_9->wp_available++;
}
retval = jtag_execute_queue();
- breakpoint->set = 0;
+ breakpoint->is_set = false;
} else {
/* restore original instruction (kept in target endianness) */
if (breakpoint->length == 4) {
EICE_W1_CONTROL_VALUE], 0);
}
- breakpoint->set = 0;
+ breakpoint->is_set = false;
}
return retval;
retval = jtag_execute_queue();
if (retval != ERROR_OK)
return retval;
- watchpoint->set = 1;
+ watchpoint_set(watchpoint, 1);
arm7_9->wp0_used = 2;
} else if (!arm7_9->wp1_used) {
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_ADDR_VALUE],
retval = jtag_execute_queue();
if (retval != ERROR_OK)
return retval;
- watchpoint->set = 2;
+ watchpoint_set(watchpoint, 2);
arm7_9->wp1_used = 2;
} else {
LOG_ERROR("BUG: no hardware comparator available");
return ERROR_TARGET_NOT_HALTED;
}
- if (!watchpoint->set) {
+ if (!watchpoint->is_set) {
LOG_WARNING("breakpoint not set");
return ERROR_OK;
}
- if (watchpoint->set == 1) {
+ if (watchpoint->number == 1) {
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W0_CONTROL_VALUE], 0x0);
retval = jtag_execute_queue();
if (retval != ERROR_OK)
return retval;
arm7_9->wp0_used = 0;
- } else if (watchpoint->set == 2) {
+ } else if (watchpoint->number == 2) {
embeddedice_set_reg(&arm7_9->eice_cache->reg_list[EICE_W1_CONTROL_VALUE], 0x0);
retval = jtag_execute_queue();
if (retval != ERROR_OK)
return retval;
arm7_9->wp1_used = 0;
}
- watchpoint->set = 0;
+ watchpoint->is_set = false;
return ERROR_OK;
}
int retval = ERROR_OK;
struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
- if (watchpoint->set) {
+ if (watchpoint->is_set) {
retval = arm7_9_unset_watchpoint(target, watchpoint);
if (retval != ERROR_OK)
return retval;
struct watchpoint *watchpoint = target->watchpoints;
while (watchpoint) {
- if (watchpoint->set == 0)
+ if (!watchpoint->is_set)
arm7_9_set_watchpoint(target, watchpoint);
watchpoint = watchpoint->next;
}
struct breakpoint *breakpoint;
breakpoint = breakpoint_find(target,
buf_get_u32(arm->pc->value, 0, 32));
- if (breakpoint != NULL) {
+ if (breakpoint) {
LOG_DEBUG("unset breakpoint at 0x%8.8" TARGET_PRIxADDR " (id: %" PRIu32,
breakpoint->address,
breakpoint->unique_id);
/* the front-end may request us not to handle breakpoints */
if (handle_breakpoints)
breakpoint = breakpoint_find(target, current_pc);
- if (breakpoint != NULL) {
+ if (breakpoint) {
retval = arm7_9_unset_breakpoint(target, breakpoint);
if (retval != ERROR_OK)
return retval;
struct reg_cache *t, **cache_p;
t = embeddedice_build_reg_cache(target, arm7_9);
- if (t == NULL)
+ if (!t)
return ERROR_FAIL;
cache_p = register_get_last_cache_p(&target->reg_cache);