+/**
+ * Assign a watchpoint to one of the two available hardware comparators in an
+ * ARM7 or ARM9 target.
+ *
+ * @param arm7_9 Pointer to the common struct for an ARM7/9 target
+ * @param breakpoint Pointer to the breakpoint to be used as a watchpoint
+ */
+static void arm7_9_assign_wp(arm7_9_common_t *arm7_9, breakpoint_t *breakpoint)
+{
+ if (!arm7_9->wp0_used)
+ {
+ arm7_9->wp0_used = 1;
+ breakpoint->set = 1;
+ arm7_9->wp_available--;
+ }
+ else if (!arm7_9->wp1_used)
+ {
+ arm7_9->wp1_used = 1;
+ breakpoint->set = 2;
+ arm7_9->wp_available--;
+ }
+ else
+ {
+ LOG_ERROR("BUG: no hardware comparator available");
+ }
+ LOG_DEBUG("BPID: %d (0x%08" PRIx32 ") using hw wp: %d",
+ breakpoint->unique_id,
+ breakpoint->address,
+ breakpoint->set );
+}
+
+/**
+ * Setup an ARM7/9 target's embedded ICE registers for software breakpoints.
+ *
+ * @param arm7_9 Pointer to common struct for ARM7/9 targets
+ * @return Error codes if there is a problem finding a watchpoint or the result
+ * of executing the JTAG queue
+ */