Lines Matching refs:tty
28 #include <linux/tty.h>
33 #include "tty.h"
91 struct ipw_tty *tty = get_tty(linux_tty->index);
93 if (!tty)
96 mutex_lock(&tty->ipw_tty_mutex);
97 if (tty->port.count == 0)
98 tty->tx_bytes_queued = 0;
100 tty->port.count++;
102 tty->port.tty = linux_tty;
103 linux_tty->driver_data = tty;
104 tty->port.low_latency = 1;
106 if (tty->tty_type == TTYTYPE_MODEM)
107 ipwireless_ppp_open(tty->network);
109 mutex_unlock(&tty->ipw_tty_mutex);
114 static void do_ipw_close(struct ipw_tty *tty)
116 tty->port.count--;
118 if (tty->port.count == 0) {
119 struct tty_struct *linux_tty = tty->port.tty;
122 tty->port.tty = NULL;
125 if (tty->tty_type == TTYTYPE_MODEM)
126 ipwireless_ppp_close(tty->network);
133 struct ipw_tty *tty = linux_tty->driver_data;
135 if (!tty)
138 mutex_lock(&tty->ipw_tty_mutex);
139 if (tty->port.count == 0) {
140 mutex_unlock(&tty->ipw_tty_mutex);
144 do_ipw_close(tty);
146 mutex_unlock(&tty->ipw_tty_mutex);
154 /* Take data received from hardware, and send it out the tty */
155 void ipwireless_tty_received(struct ipw_tty *tty, unsigned char *data,
160 mutex_lock(&tty->ipw_tty_mutex);
162 if (!tty->port.count) {
163 mutex_unlock(&tty->ipw_tty_mutex);
166 mutex_unlock(&tty->ipw_tty_mutex);
168 work = tty_insert_flip_string(&tty->port, data, length);
176 tty_flip_buffer_push(&tty->port);
182 struct ipw_tty *tty = callback_data;
188 tty->tx_bytes_queued -= packet_length;
194 struct ipw_tty *tty = linux_tty->driver_data;
197 if (!tty)
200 mutex_lock(&tty->ipw_tty_mutex);
201 if (!tty->port.count) {
202 mutex_unlock(&tty->ipw_tty_mutex);
206 room = IPWIRELESS_TX_QUEUE_SIZE - tty->tx_bytes_queued;
214 mutex_unlock(&tty->ipw_tty_mutex);
218 ret = ipwireless_send_packet(tty->hardware, IPW_CHANNEL_RAS,
220 ipw_write_packet_sent_callback, tty);
222 mutex_unlock(&tty->ipw_tty_mutex);
226 tty->tx_bytes_queued += count;
227 mutex_unlock(&tty->ipw_tty_mutex);
234 struct ipw_tty *tty = linux_tty->driver_data;
237 /* FIXME: Exactly how is the tty object locked here .. */
238 if (!tty)
241 if (!tty->port.count)
244 room = IPWIRELESS_TX_QUEUE_SIZE - tty->tx_bytes_queued;
254 struct ipw_tty *tty = linux_tty->driver_data;
256 if (!tty)
259 if (!tty->port.count)
263 ss->line = tty->index;
276 struct ipw_tty *tty = linux_tty->driver_data;
278 if (!tty)
281 if (!tty->port.count)
284 return tty->tx_bytes_queued;
287 static int get_control_lines(struct ipw_tty *tty)
289 unsigned int my = tty->control_lines;
306 static int set_control_lines(struct ipw_tty *tty, unsigned int set,
312 ret = ipwireless_set_RTS(tty->hardware, tty->channel_idx, 1);
315 if (tty->secondary_channel_idx != -1) {
316 ret = ipwireless_set_RTS(tty->hardware,
317 tty->secondary_channel_idx, 1);
323 ret = ipwireless_set_DTR(tty->hardware, tty->channel_idx, 1);
326 if (tty->secondary_channel_idx != -1) {
327 ret = ipwireless_set_DTR(tty->hardware,
328 tty->secondary_channel_idx, 1);
334 ret = ipwireless_set_RTS(tty->hardware, tty->channel_idx, 0);
335 if (tty->secondary_channel_idx != -1) {
336 ret = ipwireless_set_RTS(tty->hardware,
337 tty->secondary_channel_idx, 0);
343 ret = ipwireless_set_DTR(tty->hardware, tty->channel_idx, 0);
344 if (tty->secondary_channel_idx != -1) {
345 ret = ipwireless_set_DTR(tty->hardware,
346 tty->secondary_channel_idx, 0);
356 struct ipw_tty *tty = linux_tty->driver_data;
357 /* FIXME: Exactly how is the tty object locked here .. */
359 if (!tty)
362 if (!tty->port.count)
365 return get_control_lines(tty);
372 struct ipw_tty *tty = linux_tty->driver_data;
373 /* FIXME: Exactly how is the tty object locked here .. */
375 if (!tty)
378 if (!tty->port.count)
381 return set_control_lines(tty, set, clear);
387 struct ipw_tty *tty = linux_tty->driver_data;
389 if (!tty)
392 if (!tty->port.count)
395 /* FIXME: Exactly how is the tty object locked here .. */
396 if (tty->tty_type == TTYTYPE_MODEM) {
401 tty->network);
413 tty->network);
514 void ipwireless_tty_free(struct ipw_tty *tty)
517 struct ipw_network *network = ttys[tty->index]->network;
519 for (j = tty->index; j < IPWIRELESS_PCMCIA_MINORS;
530 if (ttyj->port.tty != NULL) {
532 tty_vhangup(ttyj->port.tty);
533 /* FIXME: Exactly how is the tty object locked here
590 ": failed to register tty driver\n");
609 int ipwireless_tty_is_modem(struct ipw_tty *tty)
611 return tty->tty_type == TTYTYPE_MODEM;
615 ipwireless_tty_notify_control_line_change(struct ipw_tty *tty,
620 unsigned int old_control_lines = tty->control_lines;
622 tty->control_lines = (tty->control_lines & ~changed_mask)
626 * If DCD is de-asserted, we close the tty so pppd can tell that we
630 && !(tty->control_lines & IPW_CONTROL_LINE_DCD)
631 && tty->port.tty) {
632 tty_hangup(tty->port.tty);