28#include <sys/socket.h>
29#include "gdbsupport/gdb_sys_time.h"
31#include "gdbsupport/gdb_select.h"
33#include "gdbsupport/filestuff.h"
35#include "gdbsupport/scoped_ignore_sigttou.h"
44static bool serial_hwflow;
46show_serial_hwflow (
struct ui_file *file,
int from_tty,
78 scb->
fd = gdb_open_cloexec (
name, O_RDWR, 0).release ();
88 if (tcgetattr (scb->
fd, &state->
termios) < 0)
97 if (tcsetattr (scb->
fd, TCSANOW, &state->
termios) < 0)
145 gdb_printf (stream,
"c_iflag = 0x%x, c_oflag = 0x%x,\n",
148 gdb_printf (stream,
"c_cflag = 0x%x, c_lflag = 0x%x\n",
157 for (i = 0; i < NCCS; i += 1)
169 scoped_ignore_sigttou ignore_sigttou;
171 return tcdrain (scb->
fd);
177 return tcflush (scb->
fd, TCOFLUSH);
185 return tcflush (scb->
fd, TCIFLUSH);
191 return tcsendbreak (scb->
fd, 0);
201 safe_strerror (errno));
206 state.
termios.c_cflag &= ~CSIZE;
207 state.
termios.c_cflag |= CLOCAL | CS8;
211 state.
termios.c_cflag |= CRTSCTS;
213 state.
termios.c_cflag &= ~CRTSCTS;
216 state.
termios.c_cflag |= CRTS_IFLOW;
218 state.
termios.c_cflag &= ~CRTS_IFLOW;
226 safe_strerror (errno));
408 for (i = 0;
baudtab[i].rate != -1; i++)
420 warning (_(
"Invalid baud rate %d. "
421 "Closest values are %d and %d."),
426 warning (_(
"Invalid baud rate %d. Minimum value is %d."),
435 warning (_(
"Invalid baud rate %d. Maximum value is %d."),
457 cfsetospeed (&state.
termios, baud_code);
458 cfsetispeed (&state.
termios, baud_code);
486 state.
termios.c_cflag &= ~CSTOPB;
488 state.
termios.c_cflag |= CSTOPB;
510 newparity = PARENB | PARODD;
516 internal_warning (
"Incorrect parity value: %d",
parity);
520 state.
termios.c_cflag &= ~(PARENB | PARODD);
521 state.
termios.c_cflag |= newparity;
575Set use of hardware flow control for remote serial I/O."), _(
"\
576Show use of hardware flow control for remote serial I/O."), _(
"\
577Enable or disable hardware flow control (RTS/CTS) on the serial port\n\
578when debugging using remote targets."),
594 return write (scb->
fd, buf, len);
struct cmd_list_element * showlist
struct cmd_list_element * setlist
set_show_commands add_setshow_boolean_cmd(const char *name, enum command_class theclass, bool *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
ssize_t read(int fd, void *buf, size_t count)
void ser_base_async(struct serial *scb, int async_p)
int ser_base_write(struct serial *scb, const void *buf, size_t count)
int ser_base_flush_input(struct serial *scb)
int ser_base_readchar(struct serial *scb, int timeout)
static int hardwire_flush_output(struct serial *)
static void hardwire_print_tty_state(struct serial *, serial_ttystate, struct ui_file *)
static int rate_to_code(int rate)
static struct @175 baudtab[]
static int hardwire_setstopbits(struct serial *, int)
static const struct serial_ops hardwire_ops
static int hardwire_open(struct serial *scb, const char *name)
static int get_tty_state(struct serial *scb, struct hardwire_ttystate *state)
void _initialize_ser_hardwire()
static int hardwire_drain_output(struct serial *)
int ser_unix_write_prim(struct serial *scb, const void *buf, size_t len)
static serial_ttystate hardwire_copy_tty_state(struct serial *scb, serial_ttystate ttystate)
static int hardwire_flush_input(struct serial *)
static void hardwire_close(struct serial *scb)
static serial_ttystate hardwire_get_tty_state(struct serial *scb)
static int hardwire_setparity(struct serial *scb, int parity)
int ser_unix_read_prim(struct serial *scb, size_t count)
static int hardwire_send_break(struct serial *)
static int hardwire_set_tty_state(struct serial *scb, serial_ttystate state)
static int set_tty_state(struct serial *scb, struct hardwire_ttystate *state)
static int hardwire_setbaudrate(struct serial *scb, int rate)
static void hardwire_raw(struct serial *scb)
static const char * parity
void serial_add_interface(const struct serial_ops *optable)
#define SERIAL_2_STOPBITS
#define SERIAL_1_AND_A_HALF_STOPBITS
#define SERIAL_1_STOPBITS
int(* write)(struct serial *, const void *buf, size_t count)
unsigned char buf[BUFSIZ]
void gdb_printf(struct ui_file *stream, const char *format,...)