Lines Matching refs:tty

28 #include <linux/tty.h>
33 #include "tty.h"
90 struct ipw_tty *tty = get_tty(linux_tty->index);
92 if (!tty)
95 mutex_lock(&tty->ipw_tty_mutex);
96 if (tty->port.count == 0)
97 tty->tx_bytes_queued = 0;
99 tty->port.count++;
101 tty->port.tty = linux_tty;
102 linux_tty->driver_data = tty;
104 if (tty->tty_type == TTYTYPE_MODEM)
105 ipwireless_ppp_open(tty->network);
107 mutex_unlock(&tty->ipw_tty_mutex);
112 static void do_ipw_close(struct ipw_tty *tty)
114 tty->port.count--;
116 if (tty->port.count == 0) {
117 struct tty_struct *linux_tty = tty->port.tty;
120 tty->port.tty = NULL;
123 if (tty->tty_type == TTYTYPE_MODEM)
124 ipwireless_ppp_close(tty->network);
131 struct ipw_tty *tty = linux_tty->driver_data;
133 if (!tty)
136 mutex_lock(&tty->ipw_tty_mutex);
137 if (tty->port.count == 0) {
138 mutex_unlock(&tty->ipw_tty_mutex);
142 do_ipw_close(tty);
144 mutex_unlock(&tty->ipw_tty_mutex);
152 /* Take data received from hardware, and send it out the tty */
153 void ipwireless_tty_received(struct ipw_tty *tty, unsigned char *data,
158 mutex_lock(&tty->ipw_tty_mutex);
160 if (!tty->port.count) {
161 mutex_unlock(&tty->ipw_tty_mutex);
164 mutex_unlock(&tty->ipw_tty_mutex);
166 work = tty_insert_flip_string(&tty->port, data, length);
174 tty_flip_buffer_push(&tty->port);
180 struct ipw_tty *tty = callback_data;
186 tty->tx_bytes_queued -= packet_length;
192 struct ipw_tty *tty = linux_tty->driver_data;
195 if (!tty)
198 mutex_lock(&tty->ipw_tty_mutex);
199 if (!tty->port.count) {
200 mutex_unlock(&tty->ipw_tty_mutex);
204 room = IPWIRELESS_TX_QUEUE_SIZE - tty->tx_bytes_queued;
212 mutex_unlock(&tty->ipw_tty_mutex);
216 ret = ipwireless_send_packet(tty->hardware, IPW_CHANNEL_RAS,
218 ipw_write_packet_sent_callback, tty);
220 mutex_unlock(&tty->ipw_tty_mutex);
224 tty->tx_bytes_queued += count;
225 mutex_unlock(&tty->ipw_tty_mutex);
232 struct ipw_tty *tty = linux_tty->driver_data;
235 /* FIXME: Exactly how is the tty object locked here .. */
236 if (!tty)
239 if (!tty->port.count)
242 room = IPWIRELESS_TX_QUEUE_SIZE - tty->tx_bytes_queued;
252 struct ipw_tty *tty = linux_tty->driver_data;
254 if (!tty)
257 if (!tty->port.count)
261 ss->line = tty->index;
274 struct ipw_tty *tty = linux_tty->driver_data;
276 if (!tty)
279 if (!tty->port.count)
282 return tty->tx_bytes_queued;
285 static int get_control_lines(struct ipw_tty *tty)
287 unsigned int my = tty->control_lines;
304 static int set_control_lines(struct ipw_tty *tty, unsigned int set,
310 ret = ipwireless_set_RTS(tty->hardware, tty->channel_idx, 1);
313 if (tty->secondary_channel_idx != -1) {
314 ret = ipwireless_set_RTS(tty->hardware,
315 tty->secondary_channel_idx, 1);
321 ret = ipwireless_set_DTR(tty->hardware, tty->channel_idx, 1);
324 if (tty->secondary_channel_idx != -1) {
325 ret = ipwireless_set_DTR(tty->hardware,
326 tty->secondary_channel_idx, 1);
332 ret = ipwireless_set_RTS(tty->hardware, tty->channel_idx, 0);
333 if (tty->secondary_channel_idx != -1) {
334 ret = ipwireless_set_RTS(tty->hardware,
335 tty->secondary_channel_idx, 0);
341 ret = ipwireless_set_DTR(tty->hardware, tty->channel_idx, 0);
342 if (tty->secondary_channel_idx != -1) {
343 ret = ipwireless_set_DTR(tty->hardware,
344 tty->secondary_channel_idx, 0);
354 struct ipw_tty *tty = linux_tty->driver_data;
355 /* FIXME: Exactly how is the tty object locked here .. */
357 if (!tty)
360 if (!tty->port.count)
363 return get_control_lines(tty);
370 struct ipw_tty *tty = linux_tty->driver_data;
371 /* FIXME: Exactly how is the tty object locked here .. */
373 if (!tty)
376 if (!tty->port.count)
379 return set_control_lines(tty, set, clear);
385 struct ipw_tty *tty = linux_tty->driver_data;
387 if (!tty)
390 if (!tty->port.count)
393 /* FIXME: Exactly how is the tty object locked here .. */
394 if (tty->tty_type == TTYTYPE_MODEM) {
399 tty->network);
411 tty->network);
512 void ipwireless_tty_free(struct ipw_tty *tty)
515 struct ipw_network *network = ttys[tty->index]->network;
517 for (j = tty->index; j < IPWIRELESS_PCMCIA_MINORS;
527 if (ttyj->port.tty != NULL) {
529 tty_vhangup(ttyj->port.tty);
530 /* FIXME: Exactly how is the tty object locked here
587 ": failed to register tty driver\n");
601 int ipwireless_tty_is_modem(struct ipw_tty *tty)
603 return tty->tty_type == TTYTYPE_MODEM;
607 ipwireless_tty_notify_control_line_change(struct ipw_tty *tty,
612 unsigned int old_control_lines = tty->control_lines;
614 tty->control_lines = (tty->control_lines & ~changed_mask)
618 * If DCD is de-asserted, we close the tty so pppd can tell that we
622 && !(tty->control_lines & IPW_CONTROL_LINE_DCD)
623 && tty->port.tty) {
624 tty_hangup(tty->port.tty);