to monitor config structure for supported baud rates for a target
and variable stop bits.
* monitor.c (monitor_fetch_register): Store register values in big
endian format on any host.
+Thu Dec 29 18:18:31 1994 Rob Savoye <rob@darkstar.cygnus.com>
+
+ * monitor.[ch], op50-rom.c, rom68k-rom.c, w89k-rom.c: Add support
+ to monitor config structure for supported baud rates for a target
+ and variable stop bits.
+ * monitor.c (monitor_fetch_register): Store register values in big
+ endian format on any host.
+
Wed Dec 28 19:27:22 1994 Jeff Law (law@snake.cs.utah.edu)
* hppa-tdep.c (hppa_fix_call_dummy): Prefer import stubs over
Wed Dec 28 19:27:22 1994 Jeff Law (law@snake.cs.utah.edu)
* hppa-tdep.c (hppa_fix_call_dummy): Prefer import stubs over
#include "monitor.h"
#include "remote-utils.h"
#include "monitor.h"
#include "remote-utils.h"
+#if !defined (HAVE_TERMIOS) && !defined (HAVE_TERMIO) && !defined (HAVE_SGTTY)
+#define HAVE_SGTTY
+#endif
+
+#ifdef HAVE_TERMIOS
+#include <termio.h>
+#include <termios.h>
# define TERMINAL struct termios
#else
# define TERMINAL struct termios
#else
# define TERMINAL struct sgttyb
#endif
# define TERMINAL struct sgttyb
#endif
+#include "terminal.h"
+#ifndef CSTOPB
+#define CSTOPB 0x00000040
+#endif
+
+#define SWAP_TARGET_AND_HOST(buffer,len) \
+ do \
+ { \
+ if (TARGET_BYTE_ORDER != HOST_BYTE_ORDER) \
+ { \
+ char tmp; \
+ char *p = (char *)(buffer); \
+ char *q = ((char *)(buffer)) + len - 1; \
+ for (; p < q; p++, q--) \
+ { \
+ tmp = *q; \
+ *q = *p; \
+ *p = tmp; \
+ } \
+ } \
+ } \
+ while (0)
+
extern void make_xmodem_packet();
extern void print_xmodem_packet();
extern void make_xmodem_packet();
extern void print_xmodem_packet();
* Descriptor for I/O to remote machine. Initialize it to NULL so that
* monitor_open knows that we don't have a file open when the program starts.
*/
* Descriptor for I/O to remote machine. Initialize it to NULL so that
* monitor_open knows that we don't have a file open when the program starts.
*/
-static serial_t monitor_desc = NULL;
+serial_t monitor_desc = NULL;
/* sets the download protocol, choices are srec, generic, boot */
char *loadtype;
/* sets the download protocol, choices are srec, generic, boot */
char *loadtype;
* the sr_get_debug() value, the second arg is a printf buffer and args
* to be formatted and printed. A CR is added after each string is printed.
*/
* the sr_get_debug() value, the second arg is a printf buffer and args
* to be formatted and printed. A CR is added after each string is printed.
*/
debuglogs(va_alist)
va_dcl
{
debuglogs(va_alist)
va_dcl
{
ch = readchar(timeout);
if (junk(ch))
continue;
ch = readchar(timeout);
if (junk(ch))
continue;
- if (sr_get_debug() > 4)
+ if (sr_get_debug() > 4) {
debuglogs (4, "get_hex_digit() got a 0x%x(%c)", ch, ch);
debuglogs (4, "get_hex_digit() got a 0x%x(%c)", ch, ch);
+ } else {
+#ifdef LOG_FILE /* write to the monitor log */
+ if (log_file != 0x0) {
+ fputs ("get_hex_digit() got a 0x", log_file);
+ fputc (ch, log_file);
+ fputc ('\n', log_file);
+ fflush (log_file);
+ }
+#endif
+ }
if (ch >= '0' && ch <= '9')
return ch - '0';
if (ch >= '0' && ch <= '9')
return ch - '0';
;
else {
expect_prompt(1);
;
else {
expect_prompt(1);
+ debuglogs (4, "Invalid hex digit from remote system. (0x%x)", ch);
error("Invalid hex digit from remote system. (0x%x)", ch);
}
}
error("Invalid hex digit from remote system. (0x%x)", ch);
}
}
int val;
val = get_hex_digit (1) << 4;
int val;
val = get_hex_digit (1) << 4;
- debuglogs (4, "get_hex_digit() -- Read first nibble 0x%x", val);
+ debuglogs (4, "get_hex_byte() -- Read first nibble 0x%x", val);
val |= get_hex_digit (0);
val |= get_hex_digit (0);
- debuglogs (4, "get_hex_digit() -- Read second nibble 0x%x", val);
+ debuglogs (4, "get_hex_byte() -- Read second nibble 0x%x", val);
- debuglogs (4, "get_hex_digit() -- Read a 0x%x", val);
+ debuglogs (4, "get_hex_byte() -- Read a 0x%x", val);
static int
get_hex_word ()
{
static int
get_hex_word ()
{
- for (i = 0; i < 8; i++)
- val = (val << 4) + get_hex_digit (i == 0);
-
- debuglogs (4, "get_hex_word() got a 0x%x.", val);
+
+#if 0
+ if (HOST_BYTE_ORDER == BIG_ENDIAN) {
+#endif
+ for (i = 0; i < 8; i++)
+ val = (val << 4) + get_hex_digit (i == 0);
+#if 0
+ } else {
+ for (i = 7; i >= 0; i--)
+ val = (val << 4) + get_hex_digit (i == 0);
+ }
+#endif
+
+ debuglogs (4, "get_hex_word() got a 0x%x for a %s host.", val, (HOST_BYTE_ORDER == BIG_ENDIAN) ? "big endian" : "little endian");
entry_pt = (int) bfd_get_start_address (exec_bfd);
entry_pt = (int) bfd_get_start_address (exec_bfd);
- debuglogs (1, "create_inferior(exexfile=%s, args=%s, env=%s)", execfile, args, env);
+ debuglogs (3, "create_inferior(exexfile=%s, args=%s, env=%s)", execfile, args, env);
/* The "process" (board) is already stopped awaiting our commands, and
the program is already downloaded. We just set its PC and go. */
/* The "process" (board) is already stopped awaiting our commands, and
the program is already downloaded. We just set its PC and go. */
char *name;
int from_tty;
{
char *name;
int from_tty;
{
if (args == NULL)
error ("Use `target %s DEVICE-NAME' to use a serial port, or \n\
if (args == NULL)
error ("Use `target %s DEVICE-NAME' to use a serial port, or \n\
SERIAL_RAW(monitor_desc);
SERIAL_RAW(monitor_desc);
+#ifndef __GO32__
+ /* some systems only work with 2 stop bits */
+ if (STOPBITS == 2) {
+ temptempio = (TERMINAL *)SERIAL_GET_TTY_STATE(monitor_desc);
+#ifdef HAVE_SGTTY
+ temptempio->sg_cflag |= baud_rate | CSTOPB;
+#else
+ temptempio->c_cflag |= baud_rate | CSTOPB;
+#endif
+ SERIAL_SET_TTY_STATE(monitor_desc, temptempio);
+ debuglogs (4, "Set serial port to 2 stop bits");
+ }
+#endif /* __GO32__ */
+
#if defined (LOG_FILE)
log_file = fopen (LOG_FILE, "w");
if (log_file == NULL)
#if defined (LOG_FILE)
log_file = fopen (LOG_FILE, "w");
if (log_file == NULL)
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
status->kind = TARGET_WAITKIND_STOPPED;
status->value.sig = TARGET_SIGNAL_TRAP;
timeout = old_timeout;
return 0;
timeout = old_timeout;
return 0;
monitor_fetch_register (regno)
int regno;
{
monitor_fetch_register (regno)
int regno;
{
debuglogs (1, "monitor_fetch_register (reg=%s)", get_reg_name (regno));
debuglogs (1, "monitor_fetch_register (reg=%s)", get_reg_name (regno));
}
val = get_hex_word(); /* get the value, ignore junk */
}
val = get_hex_word(); /* get the value, ignore junk */
+
+
+ /* supply register stores in target byte order, so swap here */
+ SWAP_TARGET_AND_HOST (&val, 4);
supply_register (regno, (char *) &val);
if (*ROMDELIM(GET_REG) != 0) {
supply_register (regno, (char *) &val);
if (*ROMDELIM(GET_REG) != 0) {
/* Starting address of this pass. */
unsigned long startaddr;
/* Starting address of this pass. */
unsigned long startaddr;
+ /* Starting address of this pass. */
+ unsigned long endaddr;
+
/* Number of bytes to read in this pass. */
int len_this_pass;
/* Number of bytes to read in this pass. */
int len_this_pass;
len_this_pass -= startaddr % 16;
if (len_this_pass > (len - count))
len_this_pass = (len - count);
len_this_pass -= startaddr % 16;
if (len_this_pass > (len - count))
len_this_pass = (len - count);
-
- debuglogs (3, "Display %d bytes at %x", len_this_pass, startaddr);
+
+ debuglogs (3, "Display %d bytes at %x for Big Endian host", len_this_pass, startaddr);
for (i = 0; i < len_this_pass; i++) {
printf_monitor (ROMCMD(GET_MEM), startaddr, startaddr);
for (i = 0; i < len_this_pass; i++) {
printf_monitor (ROMCMD(GET_MEM), startaddr, startaddr);
get_hex_word(1); /* strip away the address */
}
get_hex_byte (&myaddr[count++]); /* get the value at this address */
get_hex_word(1); /* strip away the address */
}
get_hex_byte (&myaddr[count++]); /* get the value at this address */
if (*ROMDELIM(GET_MEM) != 0) {
printf_monitor (CMD_END);
}
expect_prompt (1);
startaddr += 1;
}
if (*ROMDELIM(GET_MEM) != 0) {
printf_monitor (CMD_END);
}
expect_prompt (1);
startaddr += 1;
}
type = 3; /* switch to a 4 byte address record */
fflush (stdout);
}
type = 3; /* switch to a 4 byte address record */
fflush (stdout);
}
- printf_filtered ("\n");
free (buffer);
} else {
debuglogs (3, "%s doesn't need to be loaded", s->name);
}
s = s->next;
}
free (buffer);
} else {
debuglogs (3, "%s doesn't need to be loaded", s->name);
}
s = s->next;
}
+ printf_filtered ("\n");
/*
write a type 7 terminator record. no data for a type 7,
/*
write a type 7 terminator record. no data for a type 7,
struct target_ops *target; /* target operations */
char *loadtypes; /* the load types that are supported */
char *loadprotos; /* the load protocols that are supported */
struct target_ops *target; /* target operations */
char *loadtypes; /* the load types that are supported */
char *loadprotos; /* the load protocols that are supported */
+ char *baudrates; /* supported baud rates */
+ int stopbits; /* number of stop bits */
char **regnames; /* array of register names in ascii */
};
char **regnames; /* array of register names in ascii */
};
#define PROMPT (current_monitor->prompt)
#define TARGET_OPS (current_monitor->target)
#define TARGET_NAME (current_monitor->target->to_shortname)
#define PROMPT (current_monitor->prompt)
#define TARGET_OPS (current_monitor->target)
#define TARGET_NAME (current_monitor->target->to_shortname)
+#define BAUDRATES (current_monitor->baudrates)
+#define STOPBITS (current_monitor->stopbits)
#define REGNAMES(x) (current_monitor->regnames[x])
#define ROMCMD(x) (x.cmd)
#define ROMDELIM(x) (x.delim)
#define REGNAMES(x) (current_monitor->regnames[x])
#define ROMCMD(x) (x.cmd)
#define ROMDELIM(x) (x.delim)
&op50n_ops, /* target operations */
"none,srec,default", /* load types */
"none", /* load types */
&op50n_ops, /* target operations */
"none,srec,default", /* load types */
"none", /* load types */
+ "2400,4800,9600,19200,exta,38400,extb", /* supported baud rates */
+ 1, /* number of stop bits */
&rom68k_ops, /* target operations */
"none,srec,default", /* load types */
"none", /* load protocols */
&rom68k_ops, /* target operations */
"none,srec,default", /* load types */
"none", /* load protocols */
+ "9600", /* supported baud rates */
+ 1, /* number of stop bits */
rom68k_regnames /* registers names */
};
rom68k_regnames /* registers names */
};
&w89k_ops, /* target operations */
"none,srec,default", /* load types */
"none,xmodem", /* load protocols */
&w89k_ops, /* target operations */
"none,srec,default", /* load types */
"none,xmodem", /* load protocols */
+ "9600", /* supported baud rates */
+ 1, /* number of stop bits */
w89k_regnames /* registers names */
};
w89k_regnames /* registers names */
};