* serial.h ser-go32.c ser-go32-para.c ser-mac.c ser-tcp.c
ser-unix.c: Add SERIAL_SETSTOPBITS to set the number of stopbits (needed for IDP board?!?!?).
This commit is contained in:
parent
7baea94608
commit
85c8b135fe
7 changed files with 121 additions and 1 deletions
|
@ -1,5 +1,9 @@
|
||||||
Tue Mar 7 00:23:47 1995 Stu Grossman (grossman@cygnus.com)
|
Tue Mar 7 00:23:47 1995 Stu Grossman (grossman@cygnus.com)
|
||||||
|
|
||||||
|
* serial.h ser-go32.c ser-go32-para.c ser-mac.c ser-tcp.c
|
||||||
|
ser-unix.c: Add SERIAL_SETSTOPBITS to set the number of stopbits
|
||||||
|
(needed for IDP board?!?!?).
|
||||||
|
|
||||||
* defs.h utils.c remote-hms.c remote-pa.c remote.c: Fix defs and
|
* defs.h utils.c remote-hms.c remote-pa.c remote.c: Fix defs and
|
||||||
usage of fputc_unfiltered and putchar_unfiltered. Eliminate
|
usage of fputc_unfiltered and putchar_unfiltered. Eliminate
|
||||||
putc_unfiltered (it's superfluous).
|
putc_unfiltered (it's superfluous).
|
||||||
|
|
|
@ -230,6 +230,14 @@ go32_setbaudrate (scb, rate)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
go32_setstopbits (scb, num)
|
||||||
|
serial_t scb;
|
||||||
|
int num;
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
go32_close (scb)
|
go32_close (scb)
|
||||||
serial_t scb;
|
serial_t scb;
|
||||||
|
@ -253,6 +261,7 @@ static struct serial_ops go32_ops =
|
||||||
go32_print_tty_state,
|
go32_print_tty_state,
|
||||||
go32_noflush_set_tty_state,
|
go32_noflush_set_tty_state,
|
||||||
go32_setbaudrate,
|
go32_setbaudrate,
|
||||||
|
go32_setstopbits,
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -719,6 +719,7 @@ dos_setbaudrate (scb, rate)
|
||||||
if (port->baudrate != rate)
|
if (port->baudrate != rate)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
|
unsigned char cfcr;
|
||||||
|
|
||||||
x = dos_baudconv (rate);
|
x = dos_baudconv (rate);
|
||||||
if (x <= 0)
|
if (x <= 0)
|
||||||
|
@ -729,10 +730,12 @@ dos_setbaudrate (scb, rate)
|
||||||
}
|
}
|
||||||
|
|
||||||
disable ();
|
disable ();
|
||||||
|
cfcr = inb (port, com_cfcr);
|
||||||
|
|
||||||
outb(port, com_cfcr, CFCR_DLAB);
|
outb(port, com_cfcr, CFCR_DLAB);
|
||||||
outb(port, com_dlbl, x & 0xff);
|
outb(port, com_dlbl, x & 0xff);
|
||||||
outb(port, com_dlbh, x >> 8);
|
outb(port, com_dlbh, x >> 8);
|
||||||
outb(port, com_cfcr, CFCR_8BITS);
|
outb(port, com_cfcr, cfcr);
|
||||||
port->baudrate = rate;
|
port->baudrate = rate;
|
||||||
enable ();
|
enable ();
|
||||||
}
|
}
|
||||||
|
@ -740,6 +743,34 @@ dos_setbaudrate (scb, rate)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
dos_setstopbits (scb, num)
|
||||||
|
serial_t scb;
|
||||||
|
int num;
|
||||||
|
{
|
||||||
|
struct dos_ttystate *port = &ports[scb->fd];
|
||||||
|
unsigned char cfcr;
|
||||||
|
|
||||||
|
disable ();
|
||||||
|
cfcr = inb (port, com_cfcr);
|
||||||
|
|
||||||
|
switch (num)
|
||||||
|
{
|
||||||
|
case SERIAL_1_STOPBITS:
|
||||||
|
outb (port, com_cfcr, cfcr & ~CFCR_STOPB);
|
||||||
|
break;
|
||||||
|
case SERIAL_1_AND_A_HALF_STOPBITS:
|
||||||
|
case SERIAL_2_STOPBITS:
|
||||||
|
outb (port, com_cfcr, cfcr | CFCR_STOPB);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
enable ();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
enable ();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
dos_write (scb, str, len)
|
dos_write (scb, str, len)
|
||||||
|
@ -816,6 +847,7 @@ static struct serial_ops dos_ops =
|
||||||
dos_print_tty_state,
|
dos_print_tty_state,
|
||||||
dos_noflush_set_tty_state,
|
dos_noflush_set_tty_state,
|
||||||
dos_setbaudrate,
|
dos_setbaudrate,
|
||||||
|
dos_setstopbits,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -246,6 +246,14 @@ mac_set_baud_rate (scb, rate)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
mac_set_stop_bits (scb, num)
|
||||||
|
serial_t scb;
|
||||||
|
int num;
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int first_mac_write = 0;
|
int first_mac_write = 0;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -322,6 +330,7 @@ static struct serial_ops mac_ops =
|
||||||
mac_print_tty_state,
|
mac_print_tty_state,
|
||||||
mac_noflush_set_tty_state,
|
mac_noflush_set_tty_state,
|
||||||
mac_set_baud_rate,
|
mac_set_baud_rate,
|
||||||
|
mac_set_stop_bits,
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -38,6 +38,7 @@ static void tcp_raw PARAMS ((serial_t scb));
|
||||||
static int wait_for PARAMS ((serial_t scb, int timeout));
|
static int wait_for PARAMS ((serial_t scb, int timeout));
|
||||||
static int tcp_readchar PARAMS ((serial_t scb, int timeout));
|
static int tcp_readchar PARAMS ((serial_t scb, int timeout));
|
||||||
static int tcp_setbaudrate PARAMS ((serial_t scb, int rate));
|
static int tcp_setbaudrate PARAMS ((serial_t scb, int rate));
|
||||||
|
static int tcp_setstopbits PARAMS ((serial_t scb, int num));
|
||||||
static int tcp_write PARAMS ((serial_t scb, const char *str, int len));
|
static int tcp_write PARAMS ((serial_t scb, const char *str, int len));
|
||||||
/* FIXME: static void tcp_restore PARAMS ((serial_t scb)); */
|
/* FIXME: static void tcp_restore PARAMS ((serial_t scb)); */
|
||||||
static void tcp_close PARAMS ((serial_t scb));
|
static void tcp_close PARAMS ((serial_t scb));
|
||||||
|
@ -264,6 +265,14 @@ tcp_setbaudrate(scb, rate)
|
||||||
return 0; /* Never fails! */
|
return 0; /* Never fails! */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
tcp_setstopbits(scb, num)
|
||||||
|
serial_t scb;
|
||||||
|
int num;
|
||||||
|
{
|
||||||
|
return 0; /* Never fails! */
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tcp_write(scb, str, len)
|
tcp_write(scb, str, len)
|
||||||
serial_t scb;
|
serial_t scb;
|
||||||
|
@ -312,6 +321,7 @@ static struct serial_ops tcp_ops =
|
||||||
tcp_print_tty_state,
|
tcp_print_tty_state,
|
||||||
tcp_noflush_set_tty_state,
|
tcp_noflush_set_tty_state,
|
||||||
tcp_setbaudrate,
|
tcp_setbaudrate,
|
||||||
|
tcp_setstopbits,
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -627,6 +627,51 @@ hardwire_setbaudrate(scb, rate)
|
||||||
return set_tty_state (scb, &state);
|
return set_tty_state (scb, &state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
hardwire_setstopbits(scb, num)
|
||||||
|
serial_t scb;
|
||||||
|
int num;
|
||||||
|
{
|
||||||
|
struct hardwire_ttystate state;
|
||||||
|
int newbit;
|
||||||
|
|
||||||
|
if (get_tty_state(scb, &state))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
switch (num)
|
||||||
|
{
|
||||||
|
case SERIAL_1_STOPBITS:
|
||||||
|
newbit = 0;
|
||||||
|
break;
|
||||||
|
case SERIAL_1_AND_A_HALF_STOPBITS:
|
||||||
|
case SERIAL_2_STOPBITS:
|
||||||
|
newbit = 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_TERMIOS
|
||||||
|
if (!newbit)
|
||||||
|
state.termios.c_cflag &= ~CSTOPB;
|
||||||
|
else
|
||||||
|
state.termios.c_cflag |= CSTOPB; /* two bits */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_TERMIO
|
||||||
|
if (!newbit)
|
||||||
|
state.termio.c_cflag &= ~CSTOPB;
|
||||||
|
else
|
||||||
|
state.termio.c_cflag |= CSTOPB; /* two bits */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SGTTY
|
||||||
|
return 0; /* sgtty doesn't support this */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return set_tty_state (scb, &state);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
hardwire_write(scb, str, len)
|
hardwire_write(scb, str, len)
|
||||||
serial_t scb;
|
serial_t scb;
|
||||||
|
@ -675,6 +720,7 @@ static struct serial_ops hardwire_ops =
|
||||||
hardwire_print_tty_state,
|
hardwire_print_tty_state,
|
||||||
hardwire_noflush_set_tty_state,
|
hardwire_noflush_set_tty_state,
|
||||||
hardwire_setbaudrate,
|
hardwire_setbaudrate,
|
||||||
|
hardwire_setstopbits,
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
10
gdb/serial.h
10
gdb/serial.h
|
@ -57,6 +57,7 @@ struct serial_ops {
|
||||||
int (*noflush_set_tty_state)
|
int (*noflush_set_tty_state)
|
||||||
PARAMS ((serial_t, serial_ttystate, serial_ttystate));
|
PARAMS ((serial_t, serial_ttystate, serial_ttystate));
|
||||||
int (*setbaudrate) PARAMS ((serial_t, int rate));
|
int (*setbaudrate) PARAMS ((serial_t, int rate));
|
||||||
|
int (*setstopbits) PARAMS ((serial_t, int num));
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Add a new serial interface to the interface list */
|
/* Add a new serial interface to the interface list */
|
||||||
|
@ -139,6 +140,15 @@ serial_t serial_fdopen PARAMS ((const int fd));
|
||||||
|
|
||||||
#define SERIAL_SETBAUDRATE(SERIAL_T, RATE) ((SERIAL_T)->ops->setbaudrate((SERIAL_T), RATE))
|
#define SERIAL_SETBAUDRATE(SERIAL_T, RATE) ((SERIAL_T)->ops->setbaudrate((SERIAL_T), RATE))
|
||||||
|
|
||||||
|
/* Set the number of stop bits to the value specified. Returns 0 for success,
|
||||||
|
-1 for failure. */
|
||||||
|
|
||||||
|
#define SERIAL_1_STOPBITS 1
|
||||||
|
#define SERIAL_1_AND_A_HALF_STOPBITS 2 /* 1.5 bits, snicker... */
|
||||||
|
#define SERIAL_2_STOPBITS 3
|
||||||
|
|
||||||
|
#define SERIAL_SETSTOPBITS(SERIAL_T, NUM) ((SERIAL_T)->ops->setstopbits((SERIAL_T), NUM))
|
||||||
|
|
||||||
/* Write LEN chars from STRING to the port SERIAL_T. Returns 0 for
|
/* Write LEN chars from STRING to the port SERIAL_T. Returns 0 for
|
||||||
success, non-zero for failure. */
|
success, non-zero for failure. */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue