26 #include <sys/types.h> 28 #include <sys/socket.h> 43 static int serial_hwflow;
45 show_serial_hwflow (
struct ui_file *file,
int from_tty,
87 if (tcgetattr (scb->
fd, &state->
termios) < 0)
96 if (tcsetattr (scb->
fd, TCSANOW, &state->
termios) < 0)
156 for (i = 0; i < NCCS; i += 1)
167 return tcdrain (scb->
fd);
173 return tcflush (scb->
fd, TCOFLUSH);
181 return tcflush (scb->
fd, TCIFLUSH);
187 return tcsendbreak (scb->
fd, 0);
202 state.
termios.c_cflag &= ~CSIZE;
203 state.
termios.c_cflag |= CLOCAL | CS8;
207 state.
termios.c_cflag |= CRTSCTS;
209 state.
termios.c_cflag &= ~CRTSCTS;
212 state.
termios.c_cflag |= CRTS_IFLOW;
214 state.
termios.c_cflag &= ~CRTS_IFLOW;
338 for (i = 0;
baudtab[i].rate != -1; i++)
351 "Closest values are %d and %d."),
356 warning (
_(
"Invalid baud rate %d. Minimum value is %d."),
365 warning (
_(
"Invalid baud rate %d. Maximum value is %d."),
387 cfsetospeed (&state.
termios, baud_code);
388 cfsetispeed (&state.
termios, baud_code);
416 state.
termios.c_cflag &= ~CSTOPB;
418 state.
termios.c_cflag |= CSTOPB;
440 newparity = PARENB | PARODD;
447 "Incorrect parity value: %d",
parity);
451 state.
termios.c_cflag &= ~(PARENB | PARODD);
452 state.
termios.c_cflag |= newparity;
505 Set use of hardware flow control for remote serial I/O."),
_(
"\ 506 Show use of hardware flow control for remote serial I/O."),
_(
"\ 507 Enable or disable hardware flow control (RTS/CTS) on the serial port\n\ 508 when debugging using remote targets."),
524 return write (scb->
fd, buf, len);
ssize_t read(int fd, void *buf, size_t count)
static void hardwire_close(struct serial *scb)
static int hardwire_setstopbits(struct serial *, int)
static int set_tty_state(struct serial *scb, struct hardwire_ttystate *state)
static int hardwire_drain_output(struct serial *)
void warning(const char *fmt,...)
int ser_unix_write_prim(struct serial *scb, const void *buf, size_t len)
static serial_ttystate hardwire_get_tty_state(struct serial *scb)
int ser_unix_read_prim(struct serial *scb, size_t count)
static serial_ttystate hardwire_copy_tty_state(struct serial *scb, serial_ttystate ttystate)
void ser_base_async(struct serial *scb, int async_p)
struct cmd_list_element * setlist
static int hardwire_setbaudrate(struct serial *scb, int rate)
static int hardwire_setparity(struct serial *scb, int parity)
void fprintf_filtered(struct ui_file *stream, const char *format,...)
static int hardwire_flush_output(struct serial *)
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
struct cmd_list_element * showlist
static int hardwire_send_break(struct serial *)
int(* write)(struct serial *, const void *buf, size_t count)
static const char * parity
static const struct serial_ops hardwire_ops
static int hardwire_set_tty_state(struct serial *scb, serial_ttystate state)
unsigned char buf[BUFSIZ]
static int hardwire_open(struct serial *scb, const char *name)
#define SERIAL_1_AND_A_HALF_STOPBITS
static int hardwire_flush_input(struct serial *)
#define SERIAL_1_STOPBITS
#define SERIAL_2_STOPBITS
void serial_add_interface(const struct serial_ops *optable)
int ser_base_flush_input(struct serial *scb)
int ser_base_readchar(struct serial *scb, int timeout)
char * safe_strerror(int)
void add_setshow_boolean_cmd(const char *name, enum command_class theclass, int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
int ser_base_write(struct serial *scb, const void *buf, size_t count)
int gdb_open_cloexec(const char *filename, int flags, unsigned long mode)
void _initialize_ser_hardwire(void)
static struct @162 baudtab[]
static void hardwire_print_tty_state(struct serial *, serial_ttystate, struct ui_file *)
void internal_warning(const char *file, int line, const char *fmt,...)
static void hardwire_raw(struct serial *scb)
static int get_tty_state(struct serial *scb, struct hardwire_ttystate *state)
static int rate_to_code(int rate)