Commit | Line | Data |
---|---|---|
b52373a2 | 1 | /* Remote serial support interface definitions for GDB, the GNU Debugger. |
ae0ea72e SC |
2 | Copyright 1992 Free Software Foundation, Inc. |
3 | ||
4 | This file is part of GDB. | |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with this program; if not, write to the Free Software | |
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
19 | ||
20 | /* Return a sensible default name for a serial device, something which | |
b52373a2 | 21 | can be used as an argument to serial_open. */ |
ae0ea72e | 22 | |
b52373a2 | 23 | const char *serial_default_name PARAMS ((void)); |
ae0ea72e | 24 | |
b52373a2 | 25 | /* Try to open the serial device "name", return 1 if ok, 0 if not. */ |
ae0ea72e | 26 | |
b52373a2 | 27 | int serial_open PARAMS ((const char *name)); |
ae0ea72e | 28 | |
b52373a2 | 29 | /* Turn the port into raw mode. */ |
ae0ea72e | 30 | |
b52373a2 | 31 | void serial_raw PARAMS ((void)); |
ae0ea72e | 32 | |
b52373a2 | 33 | /* Turn the port into normal mode. */ |
ae0ea72e | 34 | |
b52373a2 | 35 | void serial_normal PARAMS ((void)); |
ae0ea72e | 36 | |
b52373a2 JG |
37 | /* Read one char from the serial device with <TO>-second timeout. |
38 | Return char, and set ok if ok. */ | |
ae0ea72e | 39 | |
b52373a2 | 40 | int serial_timedreadchar PARAMS ((int to, int *ok)); |
ae0ea72e | 41 | |
b52373a2 JG |
42 | /* Set the baudrate to the decimal value supplied, and return 1, or fail and |
43 | return 0. */ | |
ae0ea72e | 44 | |
a0f9783e | 45 | int serial_setbaudrate PARAMS ((int rate)); |
ae0ea72e | 46 | |
b52373a2 | 47 | /* Return the next rate in the sequence, or return 0 for failure. */ |
ae0ea72e | 48 | |
a0f9783e SG |
49 | /* Write some chars to the device, returns 0 for failure. See errno for |
50 | details. */ | |
ae0ea72e | 51 | |
a0f9783e | 52 | int serial_write PARAMS ((const char *str , int len)); |
ae0ea72e | 53 | |
a0f9783e | 54 | /* Close the serial port */ |
ae0ea72e | 55 | |
a0f9783e | 56 | void serial_close PARAMS ((void)); |
ae0ea72e | 57 | |
a0f9783e SG |
58 | #ifdef HAVE_TERMIO |
59 | ||
60 | #include <termios.h> | |
61 | #include <unistd.h> | |
62 | ||
63 | struct ttystate | |
64 | { | |
65 | int flags; /* Flags from fcntl F_GETFL */ | |
66 | struct termios termios; /* old tty driver settings */ | |
67 | }; | |
68 | ||
69 | #else /* not HAVE_TERMIO */ | |
70 | ||
71 | #include <sgtty.h> | |
72 | ||
73 | struct ttystate { | |
74 | int flags; /* Flags from fcntl F_GETFL */ | |
75 | struct sgttyb sgttyb; /* old tty driver settings */ | |
76 | }; | |
77 | ||
78 | #endif /* not HAVE_TERMIO */ |