return ERROR_OK;
}
+
+int mips32_enable_interrupts(struct target_s *target, int enable)
+{
+ int retval;
+ int update = 0;
+ u32 dcr;
+
+ /* read debug control register */
+ if ((retval = target_read_u32(target, EJTAG_DCR, &dcr)) != ERROR_OK)
+ return retval;
+
+ if (enable)
+ {
+ if (!(dcr & (1<<4)))
+ {
+ /* enable interrupts */
+ dcr |= (1<<4);
+ update = 1;
+ }
+ }
+ else
+ {
+ if (dcr & (1<<4))
+ {
+ /* disable interrupts */
+ dcr &= ~(1<<4);
+ update = 1;
+ }
+ }
+
+ if (update)
+ {
+ if ((retval = target_write_u32(target, EJTAG_DCR, dcr)) != ERROR_OK)
+ return retval;
+ }
+
+ return ERROR_OK;
+}
extern reg_cache_t *mips32_build_reg_cache(target_t *target);
extern int mips32_run_algorithm(struct target_s *target, int num_mem_params, mem_param_t *mem_params, int num_reg_params, reg_param_t *reg_params, u32 entry_point, u32 exit_point, int timeout_ms, void *arch_info);
extern int mips32_configure_break_unit(struct target_s *target);
+extern int mips32_enable_interrupts(struct target_s *target, int enable);
extern int mips32_examine(struct target_s *target);
extern int mips32_register_commands(struct command_context_s *cmd_ctx);
return ERROR_OK;
}
-int mips_ejtag_exit_debug(mips_ejtag_t *ejtag_info, int enable_interrupts)
+int mips_ejtag_exit_debug(mips_ejtag_t *ejtag_info)
{
u32 inst;
inst = MIPS32_DRET;
-
- /* TODO : enable/disable interrrupts */
-
+
/* execute our dret instruction */
mips32_pracc_exec(ejtag_info, 1, &inst, 0, NULL, 0, NULL, 0);
extern int mips_ejtag_set_instr(mips_ejtag_t *ejtag_info, int new_instr, void *delete_me_and_submit_patch);
extern int mips_ejtag_enter_debug(mips_ejtag_t *ejtag_info);
-extern int mips_ejtag_exit_debug(mips_ejtag_t *ejtag_info, int enable_interrupts);
+extern int mips_ejtag_exit_debug(mips_ejtag_t *ejtag_info);
extern int mips_ejtag_get_impcode(mips_ejtag_t *ejtag_info, u32 *impcode, in_handler_t handler);
extern int mips_ejtag_get_idcode(mips_ejtag_t *ejtag_info, u32 *idcode, in_handler_t handler);
extern int mips_ejtag_drscan_32(mips_ejtag_t *ejtag_info, u32 *data);
/* configure single step mode */
mips_ejtag_config_step(ejtag_info, 1);
+ /* disable interrupts while stepping */
+ mips32_enable_interrupts(target, 0);
+
/* exit debug mode */
- mips_ejtag_exit_debug(ejtag_info, 1);
+ mips_ejtag_exit_debug(ejtag_info);
mips_m4k_debug_entry(target);
}
}
- /* exit debug mode - enable interrupts if required */
- mips_ejtag_exit_debug(ejtag_info, !debug_execution);
+ /* enable interrupts if we are running */
+ mips32_enable_interrupts(target, !debug_execution);
+
+ /* exit debug mode */
+ mips_ejtag_exit_debug(ejtag_info);
target->debug_reason = DBG_REASON_NOTHALTED;
/* registers are now invalid */
target_call_event_callbacks(target, TARGET_EVENT_RESUMED);
+ /* disable interrupts while stepping */
+ mips32_enable_interrupts(target, 0);
+
/* exit debug mode */
- mips_ejtag_exit_debug(ejtag_info, 1);
+ mips_ejtag_exit_debug(ejtag_info);
/* registers are now invalid */
mips32_invalidate_core_regs(target);