1 /* Generic serial interface routines
2 Copyright 1992, 1993 Free Software Foundation, Inc.
4 This file is part of GDB.
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.
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.
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. */
23 /* Open up a device or a network socket, depending upon the syntax of NAME. */
25 static struct serial_ops
*serial_ops_list
= NULL
;
27 static struct serial_ops
*
28 serial_interface_lookup (name
)
31 struct serial_ops
*ops
;
33 for (ops
= serial_ops_list
; ops
; ops
= ops
->next
)
34 if (strcmp (name
, ops
->name
) == 0)
41 serial_add_interface(optable
)
42 struct serial_ops
*optable
;
44 optable
->next
= serial_ops_list
;
45 serial_ops_list
= optable
;
53 struct serial_ops
*ops
;
55 ops
= serial_interface_lookup ("hardwire");
60 scb
= (serial_t
)xmalloc (sizeof (struct _serial_t
));
67 if (scb
->ops
->open(scb
, name
))
86 /* Connect the user directly to the remote system. This command acts just like
87 the 'cu' or 'tip' command. Use <CR>~. or <CR>~^D to break out. */
91 struct ttystate ttystate
;
93 printf("\r\n[Exiting connect mode]\r\n");
94 serial_restore(0, &ttystate
);
98 connect_command (args
, fromtty
)
106 static struct ttystate ttystate
;
111 error("target not open.");
114 fprintf("This command takes no args. They have been ignored.\n");
116 printf("[Entering connect mode. Use ~. or ~^D to escape]\n");
118 serial_raw(0, &ttystate
);
120 make_cleanup(cleanup_tty
, &ttystate
);
129 FD_SET(desc
, &readfds
);
130 numfds
= select(sizeof(readfds
)*8, &readfds
, 0, 0, 0);
135 perror_with_name("select");
137 if (FD_ISSET(0, &readfds
))
138 { /* tty input, send to stdebug */
141 c
= serial_readchar(-1);
143 perror_with_name("connect");
146 serial_write(&cx
, 1);
160 if (c
== '.' || c
== '\004')
167 if (FD_ISSET(desc
, &readfds
))
171 c
= serial_readchar(-1);
184 _initialize_serial ()
186 add_com ("connect", class_obscure
, connect_command
,
187 "Connect the terminal directly up to the command monitor.\n\
188 Use <CR>~. or <CR>~^D to break out.");
This page took 0.032274 seconds and 4 git commands to generate.