OLD | NEW |
1 /* Remote serial support interface definitions for GDB, the GNU Debugger. | 1 /* Remote serial support interface definitions for GDB, the GNU Debugger. |
2 Copyright (C) 1992-1996, 1998-2001, 2004-2012 Free Software | 2 Copyright (C) 1992-2013 Free Software Foundation, Inc. |
3 Foundation, Inc. | |
4 | 3 |
5 This file is part of GDB. | 4 This file is part of GDB. |
6 | 5 |
7 This program is free software; you can redistribute it and/or modify | 6 This program is free software; you can redistribute it and/or modify |
8 it under the terms of the GNU General Public License as published by | 7 it under the terms of the GNU General Public License as published by |
9 the Free Software Foundation; either version 3 of the License, or | 8 the Free Software Foundation; either version 3 of the License, or |
10 (at your option) any later version. | 9 (at your option) any later version. |
11 | 10 |
12 This program is distributed in the hope that it will be useful, | 11 This program is distributed in the hope that it will be useful, |
13 but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 Unfortunately, through | 97 Unfortunately, through |
99 deprecated_ui_loop_hook (), this can also | 98 deprecated_ui_loop_hook (), this can also |
100 be a QUIT indication. */ | 99 be a QUIT indication. */ |
101 SERIAL_EOF = -3 /* General end-of-file or remote target | 100 SERIAL_EOF = -3 /* General end-of-file or remote target |
102 connection closed, indication. Includes | 101 connection closed, indication. Includes |
103 things like the line dropping dead. */ | 102 things like the line dropping dead. */ |
104 }; | 103 }; |
105 | 104 |
106 extern int serial_readchar (struct serial *scb, int timeout); | 105 extern int serial_readchar (struct serial *scb, int timeout); |
107 | 106 |
108 /* Write LEN chars from STRING to the port SCB. Returns 0 for | 107 /* Write COUNT bytes from BUF to the port SCB. Returns 0 for |
109 success, non-zero for failure. */ | 108 success, non-zero for failure. */ |
110 | 109 |
111 extern int serial_write (struct serial *scb, const char *str, int len); | 110 extern int serial_write (struct serial *scb, const void *buf, size_t count); |
112 | 111 |
113 /* Write a printf style string onto the serial port. */ | 112 /* Write a printf style string onto the serial port. */ |
114 | 113 |
115 extern void serial_printf (struct serial *desc, | 114 extern void serial_printf (struct serial *desc, |
116 const char *,...) ATTRIBUTE_PRINTF (2, 3); | 115 const char *,...) ATTRIBUTE_PRINTF (2, 3); |
117 | 116 |
118 /* Allow pending output to drain. */ | 117 /* Allow pending output to drain. */ |
119 | 118 |
120 extern int serial_drain_output (struct serial *); | 119 extern int serial_drain_output (struct serial *); |
121 | 120 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 extern int serial_is_async_p (struct serial *scb); | 197 extern int serial_is_async_p (struct serial *scb); |
199 | 198 |
200 /* For ASYNC enabled devices, register a callback and enable | 199 /* For ASYNC enabled devices, register a callback and enable |
201 asynchronous mode. To disable asynchronous mode, register a NULL | 200 asynchronous mode. To disable asynchronous mode, register a NULL |
202 callback. */ | 201 callback. */ |
203 | 202 |
204 typedef void (serial_event_ftype) (struct serial *scb, void *context); | 203 typedef void (serial_event_ftype) (struct serial *scb, void *context); |
205 extern void serial_async (struct serial *scb, | 204 extern void serial_async (struct serial *scb, |
206 serial_event_ftype *handler, void *context); | 205 serial_event_ftype *handler, void *context); |
207 | 206 |
208 /* Provide direct access to the underlying FD (if any) used to | |
209 implement the serial device. This interface is clearly | |
210 deprecated. Will call internal_error() if the operation isn't | |
211 applicable to the current serial device. */ | |
212 | |
213 extern int deprecated_serial_fd (struct serial *scb); | |
214 | |
215 /* Trace/debug mechanism. | 207 /* Trace/debug mechanism. |
216 | 208 |
217 serial_debug() enables/disables internal debugging. | 209 serial_debug() enables/disables internal debugging. |
218 serial_debug_p() indicates the current debug state. */ | 210 serial_debug_p() indicates the current debug state. */ |
219 | 211 |
220 extern void serial_debug (struct serial *scb, int debug_p); | 212 extern void serial_debug (struct serial *scb, int debug_p); |
221 | 213 |
222 extern int serial_debug_p (struct serial *scb); | 214 extern int serial_debug_p (struct serial *scb); |
223 | 215 |
224 | 216 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 }; | 249 }; |
258 | 250 |
259 struct serial_ops | 251 struct serial_ops |
260 { | 252 { |
261 char *name; | 253 char *name; |
262 struct serial_ops *next; | 254 struct serial_ops *next; |
263 int (*open) (struct serial *, const char *name); | 255 int (*open) (struct serial *, const char *name); |
264 void (*close) (struct serial *); | 256 void (*close) (struct serial *); |
265 int (*fdopen) (struct serial *, int fd); | 257 int (*fdopen) (struct serial *, int fd); |
266 int (*readchar) (struct serial *, int timeout); | 258 int (*readchar) (struct serial *, int timeout); |
267 int (*write) (struct serial *, const char *str, int len); | 259 int (*write) (struct serial *, const void *buf, size_t count); |
268 /* Discard pending output */ | 260 /* Discard pending output */ |
269 int (*flush_output) (struct serial *); | 261 int (*flush_output) (struct serial *); |
270 /* Discard pending input */ | 262 /* Discard pending input */ |
271 int (*flush_input) (struct serial *); | 263 int (*flush_input) (struct serial *); |
272 int (*send_break) (struct serial *); | 264 int (*send_break) (struct serial *); |
273 void (*go_raw) (struct serial *); | 265 void (*go_raw) (struct serial *); |
274 serial_ttystate (*get_tty_state) (struct serial *); | 266 serial_ttystate (*get_tty_state) (struct serial *); |
275 serial_ttystate (*copy_tty_state) (struct serial *, serial_ttystate); | 267 serial_ttystate (*copy_tty_state) (struct serial *, serial_ttystate); |
276 int (*set_tty_state) (struct serial *, serial_ttystate); | 268 int (*set_tty_state) (struct serial *, serial_ttystate); |
277 void (*print_tty_state) (struct serial *, serial_ttystate, | 269 void (*print_tty_state) (struct serial *, serial_ttystate, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 /* Windows-only: find or create handles that we can wait on for this | 312 /* Windows-only: find or create handles that we can wait on for this |
321 serial device. */ | 313 serial device. */ |
322 extern void serial_wait_handle (struct serial *, HANDLE *, HANDLE *); | 314 extern void serial_wait_handle (struct serial *, HANDLE *, HANDLE *); |
323 | 315 |
324 /* Windows-only: signal that we are done with the wait handles. */ | 316 /* Windows-only: signal that we are done with the wait handles. */ |
325 extern void serial_done_wait_handle (struct serial *); | 317 extern void serial_done_wait_handle (struct serial *); |
326 | 318 |
327 #endif /* USE_WIN32API */ | 319 #endif /* USE_WIN32API */ |
328 | 320 |
329 #endif /* SERIAL_H */ | 321 #endif /* SERIAL_H */ |
OLD | NEW |