#include "defs.h"
#include "gdbcore.h"
#include "target.h"
#include "monitor.h"
#include "serial.h"
static void est_open (char *args, int from_tty);
static void
est_supply_register (char *regname, int regnamelen, char *val, int vallen)
{
int regno;
if (regnamelen != 2)
return;
switch (regname[0])
{
case 'S':
if (regname[1] != 'R')
return;
regno = PS_REGNUM;
break;
case 'P':
if (regname[1] != 'C')
return;
regno = PC_REGNUM;
break;
case 'D':
if (regname[1] < '0' || regname[1] > '7')
return;
regno = regname[1] - '0' + D0_REGNUM;
break;
case 'A':
if (regname[1] < '0' || regname[1] > '7')
return;
regno = regname[1] - '0' + A0_REGNUM;
break;
default:
return;
}
monitor_supply_register (regno, val);
}
static char *est_regnames[NUM_REGS] =
{
"D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
"A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
"SR", "PC",
};
static struct target_ops est_ops;
static char *est_inits[] =
{"he\r",
NULL};
static struct monitor_ops est_cmds;
static void
init_est_cmds (void)
{
est_cmds.flags = MO_CLR_BREAK_USES_ADDR | MO_FILL_USES_ADDR | MO_NEED_REGDUMP_AFTER_CONT |
MO_SREC_ACK | MO_SREC_ACK_PLUS;
est_cmds.init = est_inits;
est_cmds.cont = "go\r";
est_cmds.step = "sidr\r";
est_cmds.stop = "\003";
est_cmds.set_break = "sb %x\r";
est_cmds.clr_break = "rb %x\r";
est_cmds.clr_all_break = "rb\r";
est_cmds.fill = "bfb %x %x %x\r";
est_cmds.setmem.cmdb = "smb %x %x\r";
est_cmds.setmem.cmdw = "smw %x %x\r";
est_cmds.setmem.cmdl = "sml %x %x\r";
est_cmds.setmem.cmdll = NULL;
est_cmds.setmem.resp_delim = NULL;
est_cmds.setmem.term = NULL;
est_cmds.setmem.term_cmd = NULL;
est_cmds.getmem.cmdb = "dmb %x %x\r";
est_cmds.getmem.cmdw = "dmw %x %x\r";
est_cmds.getmem.cmdl = "dml %x %x\r";
est_cmds.getmem.cmdll = NULL;
est_cmds.getmem.resp_delim = ": ";
est_cmds.getmem.term = NULL;
est_cmds.getmem.term_cmd = NULL;
est_cmds.setreg.cmd = "sr %s %x\r";
est_cmds.setreg.resp_delim = NULL;
est_cmds.setreg.term = NULL;
est_cmds.setreg.term_cmd = NULL;
est_cmds.getreg.cmd = "dr %s\r";
est_cmds.getreg.resp_delim = " = ";
est_cmds.getreg.term = NULL;
est_cmds.getreg.term_cmd = NULL;
est_cmds.dump_registers = "dr\r";
est_cmds.register_pattern = "\\(\\w+\\) = \\([0-9a-fA-F]+\\)";
est_cmds.supply_register = est_supply_register;
est_cmds.load_routine = NULL;
est_cmds.load = "dl\r";
est_cmds.loadresp = "+";
est_cmds.prompt = ">BKM>";
est_cmds.line_term = "\r";
est_cmds.cmd_end = NULL;
est_cmds.target = &est_ops;
est_cmds.stopbits = SERIAL_1_STOPBITS;
est_cmds.regnames = est_regnames;
est_cmds.magic = MONITOR_OPS_MAGIC;
}
static void
est_open (char *args, int from_tty)
{
monitor_open (args, &est_cmds, from_tty);
}
void
_initialize_est (void)
{
init_est_cmds ();
init_monitor_ops (&est_ops);
est_ops.to_shortname = "est";
est_ops.to_longname = "EST background debug monitor";
est_ops.to_doc = "Debug via the EST BDM.\n\
Specify the serial device it is connected to (e.g. /dev/ttya).";
est_ops.to_open = est_open;
add_target (&est_ops);
}