Lines Matching refs:ch
152 static inline void globalwinon(struct channel *ch);
153 static inline void rxwinon(struct channel *ch);
154 static inline void txwinon(struct channel *ch);
155 static inline void memoff(struct channel *ch);
156 static inline void assertgwinon(struct channel *ch);
157 static inline void assertmemoff(struct channel *ch);
163 static inline void pcxem_globalwinon(struct channel *ch);
164 static inline void pcxem_rxwinon(struct channel *ch);
165 static inline void pcxem_txwinon(struct channel *ch);
166 static inline void pcxem_memoff(struct channel *ch);
172 static inline void pcxe_globalwinon(struct channel *ch);
173 static inline void pcxe_rxwinon(struct channel *ch);
174 static inline void pcxe_txwinon(struct channel *ch);
175 static inline void pcxe_memoff(struct channel *ch);
182 static inline void pcxi_globalwinon(struct channel *ch);
183 static inline void pcxi_rxwinon(struct channel *ch);
184 static inline void pcxi_txwinon(struct channel *ch);
185 static inline void pcxi_memoff(struct channel *ch);
191 static inline void dummy_globalwinon(struct channel *ch);
192 static inline void dummy_rxwinon(struct channel *ch);
193 static inline void dummy_txwinon(struct channel *ch);
194 static inline void dummy_memoff(struct channel *ch);
195 static inline void dummy_assertgwinon(struct channel *ch);
196 static inline void dummy_assertmemoff(struct channel *ch);
218 static unsigned termios2digi_h(struct channel *ch, unsigned);
219 static unsigned termios2digi_i(struct channel *ch, unsigned);
220 static unsigned termios2digi_c(struct channel *ch, unsigned);
231 static void digi_send_break(struct channel *ch, int msec);
232 static void setup_empty_event(struct tty_struct *tty, struct channel *ch);
266 static inline void globalwinon(struct channel *ch) in globalwinon() argument
268 (ch->board->globalwinon)(ch); in globalwinon()
271 static inline void rxwinon(struct channel *ch) in rxwinon() argument
273 (ch->board->rxwinon)(ch); in rxwinon()
276 static inline void txwinon(struct channel *ch) in txwinon() argument
278 (ch->board->txwinon)(ch); in txwinon()
281 static inline void memoff(struct channel *ch) in memoff() argument
283 (ch->board->memoff)(ch); in memoff()
285 static inline void assertgwinon(struct channel *ch) in assertgwinon() argument
287 (ch->board->assertgwinon)(ch); in assertgwinon()
290 static inline void assertmemoff(struct channel *ch) in assertmemoff() argument
292 (ch->board->assertmemoff)(ch); in assertmemoff()
310 static inline void pcxem_globalwinon(struct channel *ch) in pcxem_globalwinon() argument
312 outb_p( FEPWIN, (int)ch->board->port + 1); in pcxem_globalwinon()
315 static inline void pcxem_rxwinon(struct channel *ch) in pcxem_rxwinon() argument
317 outb_p(ch->rxwin, (int)ch->board->port + 1); in pcxem_rxwinon()
320 static inline void pcxem_txwinon(struct channel *ch) in pcxem_txwinon() argument
322 outb_p(ch->txwin, (int)ch->board->port + 1); in pcxem_txwinon()
325 static inline void pcxem_memoff(struct channel *ch) in pcxem_memoff() argument
327 outb_p(0, (int)ch->board->port + 1); in pcxem_memoff()
344 static inline void pcxe_globalwinon(struct channel *ch) in pcxe_globalwinon() argument
346 outb_p( FEPWIN, (int)ch->board->port + 1); in pcxe_globalwinon()
349 static inline void pcxe_rxwinon(struct channel *ch) in pcxe_rxwinon() argument
351 outb_p(ch->rxwin, (int)ch->board->port + 1); in pcxe_rxwinon()
354 static inline void pcxe_txwinon(struct channel *ch) in pcxe_txwinon() argument
356 outb_p(ch->txwin, (int)ch->board->port + 1); in pcxe_txwinon()
359 static inline void pcxe_memoff(struct channel *ch) in pcxe_memoff() argument
361 outb_p(0, (int)ch->board->port); in pcxe_memoff()
362 outb_p(0, (int)ch->board->port + 1); in pcxe_memoff()
377 static inline void pcxi_globalwinon(struct channel *ch) in pcxi_globalwinon() argument
379 outb_p(FEPMEM, (int)ch->board->port); in pcxi_globalwinon()
382 static inline void pcxi_rxwinon(struct channel *ch) in pcxi_rxwinon() argument
384 outb_p(FEPMEM, (int)ch->board->port); in pcxi_rxwinon()
387 static inline void pcxi_txwinon(struct channel *ch) in pcxi_txwinon() argument
389 outb_p(FEPMEM, (int)ch->board->port); in pcxi_txwinon()
392 static inline void pcxi_memoff(struct channel *ch) in pcxi_memoff() argument
394 outb_p(0, (int)ch->board->port); in pcxi_memoff()
397 static inline void pcxi_assertgwinon(struct channel *ch) in pcxi_assertgwinon() argument
399 epcaassert(inb((int)ch->board->port) & FEPMEM, "Global memory off"); in pcxi_assertgwinon()
402 static inline void pcxi_assertmemoff(struct channel *ch) in pcxi_assertmemoff() argument
404 epcaassert(!(inb((int)ch->board->port) & FEPMEM), "Memory on"); in pcxi_assertmemoff()
425 static inline void dummy_globalwinon(struct channel *ch) in dummy_globalwinon() argument
429 static inline void dummy_rxwinon(struct channel *ch) in dummy_rxwinon() argument
433 static inline void dummy_txwinon(struct channel *ch) in dummy_txwinon() argument
437 static inline void dummy_memoff(struct channel *ch) in dummy_memoff() argument
441 static inline void dummy_assertgwinon(struct channel *ch) in dummy_assertgwinon() argument
445 static inline void dummy_assertmemoff(struct channel *ch) in dummy_assertmemoff() argument
463 register struct channel *ch = (struct channel *)tty->driver_data; in verifyChannel() local
465 if ((ch >= &digi_channels[0]) && (ch < &digi_channels[nbdevs])) in verifyChannel()
467 if (ch->magic == EPCA_MAGIC) in verifyChannel()
468 return ch; in verifyChannel()
480 static inline void pc_sched_event(struct channel *ch, int event) in pc_sched_event() argument
489 ch->event |= 1 << event; in pc_sched_event()
491 if (schedule_task(&ch->tqueue) == 0) in pc_sched_event()
511 struct channel *ch; in pc_close() local
525 if ((ch = verifyChannel(tty)) != NULL) in pc_close()
538 if (ch->count-- > 1) in pc_close()
552 if (ch->count < 0) in pc_close()
554 ch->count = 0; in pc_close()
563 ch->asyncflags |= ASYNC_CLOSING; in pc_close()
570 if (ch->asyncflags & ASYNC_NORMAL_ACTIVE) in pc_close()
571 ch->normal_termios = *tty->termios; in pc_close()
573 if (ch->asyncflags & ASYNC_CALLOUT_ACTIVE) in pc_close()
574 ch->callout_termios = *tty->termios; in pc_close()
578 if (ch->asyncflags & ASYNC_INITIALIZED) in pc_close()
581 setup_empty_event(tty, ch); in pc_close()
589 shutdown(ch); in pc_close()
591 ch->event = 0; in pc_close()
592 ch->tty = NULL; in pc_close()
594 if (ch->blocked_open) in pc_close()
597 if (ch->close_delay) in pc_close()
600 schedule_timeout(ch->close_delay); in pc_close()
603 wake_up_interruptible(&ch->open_wait); in pc_close()
607 ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_INITIALIZED | in pc_close()
609 wake_up_interruptible(&ch->close_wait); in pc_close()
621 static void shutdown(struct channel *ch) in shutdown() argument
628 if (!(ch->asyncflags & ASYNC_INITIALIZED)) in shutdown()
633 globalwinon(ch); in shutdown()
635 bc = ch->brdchan; in shutdown()
646 tty = ch->tty; in shutdown()
654 ch->omodem &= ~(ch->m_rts | ch->m_dtr); in shutdown()
655 fepcmd(ch, SETMODEM, 0, ch->m_dtr | ch->m_rts, 10, 1); in shutdown()
658 memoff(ch); in shutdown()
667 ch->asyncflags &= ~ASYNC_INITIALIZED; in shutdown()
677 struct channel *ch; in pc_hangup() local
684 if ((ch = verifyChannel(tty)) != NULL) in pc_hangup()
696 shutdown(ch); in pc_hangup()
698 if (ch->count) in pc_hangup()
701 ch->tty = NULL; in pc_hangup()
702 ch->event = 0; in pc_hangup()
703 ch->count = 0; in pc_hangup()
705 ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_INITIALIZED | ASYNC_CALLOUT_ACTIVE); in pc_hangup()
706 wake_up_interruptible(&ch->open_wait); in pc_hangup()
724 struct channel *ch; in pc_write() local
751 if ((ch = verifyChannel(tty)) == NULL) in pc_write()
756 bc = ch->brdchan; in pc_write()
757 size = ch->txbufsize; in pc_write()
765 globalwinon(ch); in pc_write()
875 memoff(ch); in pc_write()
907 if (copy_from_user(ch->tmp_buf, buf, in pc_write()
919 buf = ch->tmp_buf; in pc_write()
929 globalwinon(ch); in pc_write()
969 txwinon(ch); in pc_write()
979 memcpy(ch->txptr + head, buf, dataLen); in pc_write()
993 ch->statusflags |= TXBUSY; in pc_write()
994 globalwinon(ch); in pc_write()
997 if ((ch->statusflags & LOWWAIT) == 0) in pc_write()
999 ch->statusflags |= LOWWAIT; in pc_write()
1002 memoff(ch); in pc_write()
1026 struct channel *ch; in pc_write_room() local
1038 if ((ch = verifyChannel(tty)) != NULL) in pc_write_room()
1042 globalwinon(ch); in pc_write_room()
1044 bc = ch->brdchan; in pc_write_room()
1045 head = bc->tin & (ch->txbufsize - 1); in pc_write_room()
1051 tail &= (ch->txbufsize - 1); in pc_write_room()
1054 remain += ch->txbufsize; in pc_write_room()
1056 if (remain && (ch->statusflags & LOWWAIT) == 0) in pc_write_room()
1058 ch->statusflags |= LOWWAIT; in pc_write_room()
1061 memoff(ch); in pc_write_room()
1079 struct channel *ch; in pc_chars_in_buffer() local
1088 if ((ch = verifyChannel(tty)) == NULL) in pc_chars_in_buffer()
1093 globalwinon(ch); in pc_chars_in_buffer()
1095 bc = ch->brdchan; in pc_chars_in_buffer()
1098 ctail = ch->mailbox->cout; in pc_chars_in_buffer()
1100 if (tail == head && ch->mailbox->cin == ctail && bc->tbusy == 0) in pc_chars_in_buffer()
1105 head = bc->tin & (ch->txbufsize - 1); in pc_chars_in_buffer()
1106 tail &= (ch->txbufsize - 1); in pc_chars_in_buffer()
1115 remain += ch->txbufsize; in pc_chars_in_buffer()
1117 chars = (int)(ch->txbufsize - remain); in pc_chars_in_buffer()
1127 if (!(ch->statusflags & EMPTYWAIT)) in pc_chars_in_buffer()
1128 setup_empty_event(tty,ch); in pc_chars_in_buffer()
1132 memoff(ch); in pc_chars_in_buffer()
1147 struct channel *ch; in pc_flush_buffer() local
1156 if ((ch = verifyChannel(tty)) == NULL) in pc_flush_buffer()
1162 globalwinon(ch); in pc_flush_buffer()
1164 bc = ch->brdchan; in pc_flush_buffer()
1169 fepcmd(ch, STOUT, (unsigned) tail, 0, 0, 0); in pc_flush_buffer()
1171 memoff(ch); in pc_flush_buffer()
1183 struct channel * ch; in pc_flush_chars() local
1190 if ((ch = verifyChannel(tty)) != NULL) in pc_flush_chars()
1202 if ((ch->statusflags & TXBUSY) && !(ch->statusflags & EMPTYWAIT)) in pc_flush_chars()
1203 setup_empty_event(tty,ch); in pc_flush_chars()
1213 struct file *filp, struct channel *ch) in block_til_ready() argument
1223 if (ch->asyncflags & ASYNC_HUP_NOTIFY) in block_til_ready()
1234 if (ch->asyncflags & ASYNC_CLOSING) in block_til_ready()
1236 interruptible_sleep_on(&ch->close_wait); in block_til_ready()
1238 if (ch->asyncflags & ASYNC_HUP_NOTIFY) in block_til_ready()
1251 if (ch->asyncflags & ASYNC_NORMAL_ACTIVE) in block_til_ready()
1254 if ((ch->asyncflags & ASYNC_CALLOUT_ACTIVE) && in block_til_ready()
1255 (ch->asyncflags & ASYNC_SESSION_LOCKOUT) && in block_til_ready()
1256 (ch->session != current->session)) in block_til_ready()
1259 if ((ch->asyncflags & ASYNC_CALLOUT_ACTIVE) && in block_til_ready()
1260 (ch->asyncflags & ASYNC_PGRP_LOCKOUT) && in block_til_ready()
1261 (ch->pgrp != current->pgrp)) in block_til_ready()
1264 ch->asyncflags |= ASYNC_CALLOUT_ACTIVE; in block_til_ready()
1276 if (ch->asyncflags & ASYNC_CALLOUT_ACTIVE) in block_til_ready()
1279 ch->asyncflags |= ASYNC_NORMAL_ACTIVE; in block_til_ready()
1285 if (ch->asyncflags & ASYNC_CALLOUT_ACTIVE) in block_til_ready()
1287 if (ch->normal_termios.c_cflag & CLOCAL) in block_til_ready()
1299 add_wait_queue(&ch->open_wait, &wait); in block_til_ready()
1306 ch->count--; in block_til_ready()
1310 ch->blocked_open++; in block_til_ready()
1318 !(ch->asyncflags & ASYNC_INITIALIZED)) in block_til_ready()
1320 if (ch->asyncflags & ASYNC_HUP_NOTIFY) in block_til_ready()
1327 if (!(ch->asyncflags & ASYNC_CLOSING) && in block_til_ready()
1328 !(ch->asyncflags & ASYNC_CALLOUT_ACTIVE) && in block_til_ready()
1329 (do_clocal || (ch->imodem & ch->dcd))) in block_til_ready()
1349 remove_wait_queue(&ch->open_wait, &wait); in block_til_ready()
1352 ch->count++; in block_til_ready()
1355 ch->blocked_open--; in block_til_ready()
1360 ch->asyncflags |= ASYNC_NORMAL_ACTIVE; in block_til_ready()
1371 struct channel *ch; in pc_open() local
1395 ch = &digi_channels[line]; in pc_open()
1396 boardnum = ch->boardnum; in pc_open()
1436 if (( bc = ch->brdchan) == 0) in pc_open()
1448 ch->count++; in pc_open()
1456 tty->driver_data = ch; in pc_open()
1464 if (ch->count == 1) in pc_open()
1467 *tty->termios = ch->normal_termios; in pc_open()
1469 *tty->termios = ch->callout_termios; in pc_open()
1472 ch->session = current->session; in pc_open()
1473 ch->pgrp = current->pgrp; in pc_open()
1478 globalwinon(ch); in pc_open()
1479 ch->statusflags = 0; in pc_open()
1482 ch->imodem = bc->mstat; in pc_open()
1492 ch->tty = tty; in pc_open()
1498 epcaparam(tty,ch); in pc_open()
1500 ch->asyncflags |= ASYNC_INITIALIZED; in pc_open()
1501 memoff(ch); in pc_open()
1505 retval = block_til_ready(tty, filp, ch); in pc_open()
1515 ch->tty = tty; in pc_open()
1519 globalwinon(ch); in pc_open()
1524 memoff(ch); in pc_open()
1562 struct channel *ch; in cleanup_module() local
1590 ch = card_ptr[crd]; in cleanup_module()
1592 for (count = 0; count < bd->numports; count++, ch++) in cleanup_module()
1595 if (ch) in cleanup_module()
1597 if (ch->tty) in cleanup_module()
1598 tty_hangup(ch->tty); in cleanup_module()
1599 kfree(ch->tmp_buf); in cleanup_module()
1930 struct channel *ch; in post_fep_init() local
1979 ch = card_ptr[crd]; in post_fep_init()
1982 epcaassert(ch <= &digi_channels[nbdevs - 1], "ch out of range"); in post_fep_init()
2032 for (i = 0; i < bd->numports; i++, ch++, bc++) in post_fep_init()
2035 ch->brdchan = bc; in post_fep_init()
2036 ch->mailbox = gd; in post_fep_init()
2037 ch->tqueue.routine = do_softint; in post_fep_init()
2038 ch->tqueue.data = ch; in post_fep_init()
2039 ch->board = &boards[crd]; in post_fep_init()
2054 ch->m_rts = 0x02 ; in post_fep_init()
2055 ch->m_dcd = 0x80 ; in post_fep_init()
2056 ch->m_dsr = 0x20 ; in post_fep_init()
2057 ch->m_cts = 0x10 ; in post_fep_init()
2058 ch->m_ri = 0x40 ; in post_fep_init()
2059 ch->m_dtr = 0x01 ; in post_fep_init()
2066 ch->m_rts = 0x02 ; in post_fep_init()
2067 ch->m_dcd = 0x08 ; in post_fep_init()
2068 ch->m_dsr = 0x10 ; in post_fep_init()
2069 ch->m_cts = 0x20 ; in post_fep_init()
2070 ch->m_ri = 0x40 ; in post_fep_init()
2071 ch->m_dtr = 0x80 ; in post_fep_init()
2078 ch->dsr = ch->m_dcd; in post_fep_init()
2079 ch->dcd = ch->m_dsr; in post_fep_init()
2080 ch->digiext.digi_flags |= DIGI_ALTPIN; in post_fep_init()
2084 ch->dcd = ch->m_dcd; in post_fep_init()
2085 ch->dsr = ch->m_dsr; in post_fep_init()
2088 ch->boardnum = crd; in post_fep_init()
2089 ch->channelnum = i; in post_fep_init()
2090 ch->magic = EPCA_MAGIC; in post_fep_init()
2091 ch->tty = 0; in post_fep_init()
2095 fepcmd(ch, SETBUFFER, 32, 0, 0, 0); in post_fep_init()
2106 ch->txptr = memaddr + (((bc->tseg) << 4) & 0x1fffff); in post_fep_init()
2107 ch->rxptr = memaddr + (((bc->rseg) << 4) & 0x1fffff); in post_fep_init()
2108 ch->txwin = FEPWIN | ((bc->tseg) >> 11); in post_fep_init()
2109 ch->rxwin = FEPWIN | ((bc->rseg) >> 11); in post_fep_init()
2116 ch->txptr = memaddr + (((bc->tseg) << 4) & 0x7fff); in post_fep_init()
2117 ch->rxptr = memaddr + (((bc->rseg) << 4) & 0x7fff); in post_fep_init()
2118 ch->txwin = FEPWIN | ((bc->tseg) >> 11); in post_fep_init()
2119 ch->rxwin = FEPWIN | ((bc->rseg) >> 11); in post_fep_init()
2124 ch->txptr = memaddr + (((bc->tseg - bd->memory_seg) << 4) & 0x1fff); in post_fep_init()
2125 ch->txwin = FEPWIN | ((bc->tseg - bd->memory_seg) >> 9); in post_fep_init()
2126 ch->rxptr = memaddr + (((bc->rseg - bd->memory_seg) << 4) & 0x1fff); in post_fep_init()
2127 ch->rxwin = FEPWIN | ((bc->rseg - bd->memory_seg) >>9 ); in post_fep_init()
2132 ch->txptr = memaddr + ((bc->tseg - bd->memory_seg) << 4); in post_fep_init()
2133 ch->rxptr = memaddr + ((bc->rseg - bd->memory_seg) << 4); in post_fep_init()
2134 ch->txwin = ch->rxwin = 0; in post_fep_init()
2139 ch->txbufhead = 0; in post_fep_init()
2140 ch->txbufsize = bc->tmax + 1; in post_fep_init()
2142 ch->rxbufhead = 0; in post_fep_init()
2143 ch->rxbufsize = bc->rmax + 1; in post_fep_init()
2145 lowwater = ch->txbufsize >= 2000 ? 1024 : (ch->txbufsize / 2); in post_fep_init()
2148 fepcmd(ch, STXLWATER, lowwater, 0, 10, 0); in post_fep_init()
2152 fepcmd(ch, SRXLWATER, (ch->rxbufsize / 4), 0, 10, 0); in post_fep_init()
2156 fepcmd(ch, SRXHWATER, (3 * ch->rxbufsize / 4), 0, 10, 0); in post_fep_init()
2161 ch->startc = bc->startc; in post_fep_init()
2162 ch->stopc = bc->stopc; in post_fep_init()
2163 ch->startca = bc->startca; in post_fep_init()
2164 ch->stopca = bc->stopca; in post_fep_init()
2166 ch->fepcflag = 0; in post_fep_init()
2167 ch->fepiflag = 0; in post_fep_init()
2168 ch->fepoflag = 0; in post_fep_init()
2169 ch->fepstartc = 0; in post_fep_init()
2170 ch->fepstopc = 0; in post_fep_init()
2171 ch->fepstartca = 0; in post_fep_init()
2172 ch->fepstopca = 0; in post_fep_init()
2174 ch->close_delay = 50; in post_fep_init()
2175 ch->count = 0; in post_fep_init()
2176 ch->blocked_open = 0; in post_fep_init()
2177 ch->callout_termios = pc_callout.init_termios; in post_fep_init()
2178 ch->normal_termios = pc_driver.init_termios; in post_fep_init()
2179 init_waitqueue_head(&ch->open_wait); in post_fep_init()
2180 init_waitqueue_head(&ch->close_wait); in post_fep_init()
2181 ch->tmp_buf = kmalloc(ch->txbufsize,GFP_KERNEL); in post_fep_init()
2182 if (!(ch->tmp_buf)) in post_fep_init()
2187 kfree((ch--)->tmp_buf); in post_fep_init()
2191 memset((void *)ch->tmp_buf,0,ch->txbufsize); in post_fep_init()
2214 struct channel *ch; in epcapoll() local
2232 ch = card_ptr[crd]; in epcapoll()
2243 assertmemoff(ch); in epcapoll()
2245 globalwinon(ch); in epcapoll()
2252 head = ch->mailbox->ein; in epcapoll()
2253 tail = ch->mailbox->eout; in epcapoll()
2260 memoff(ch); in epcapoll()
2275 struct channel *ch, *chan0; in doevent() local
2317 ch = chan0 + channel; in doevent()
2319 if ((unsigned)channel >= bd->numports || !ch) in doevent()
2322 ch = chan0; in doevent()
2323 bc = ch->brdchan; in doevent()
2327 if ((bc = ch->brdchan) == NULL) in doevent()
2333 receive_data(ch); in doevent()
2334 assertgwinon(ch); in doevent()
2343 ch->imodem = mstat; in doevent()
2345 if (ch->asyncflags & ASYNC_CHECK_CD) in doevent()
2347 if (mstat & ch->dcd) /* We are now receiving dcd */ in doevent()
2348 wake_up_interruptible(&ch->open_wait); in doevent()
2350 pc_sched_event(ch, EPCA_EVENT_HANGUP); /* No dcd; hangup */ in doevent()
2355 tty = ch->tty; in doevent()
2376 if (ch->statusflags & LOWWAIT) in doevent()
2379 ch->statusflags &= ~LOWWAIT; in doevent()
2391 ch->statusflags &= ~TXBUSY; in doevent()
2392 if (ch->statusflags & EMPTYWAIT) in doevent()
2395 ch->statusflags &= ~EMPTYWAIT; in doevent()
2406 globalwinon(ch); in doevent()
2422 static void fepcmd(struct channel *ch, int cmd, int word_or_byte, in fepcmd() argument
2433 if (ch->board->status == DISABLED) in fepcmd()
2438 assertgwinon(ch); in fepcmd()
2441 head = ch->mailbox->cin; in fepcmd()
2444 cmdStart = ch->mailbox->cstart; in fepcmd()
2452 cmdMax = (cmdStart + 4 + (ch->mailbox->cmax)); in fepcmd()
2454 memaddr = ch->board->re_map_membase; in fepcmd()
2477 *(volatile unchar *)(memaddr + head + cmdStart + 1) = (unchar)ch->channelnum; in fepcmd()
2487 *(volatile unchar *)(memaddr + head + cmdStart + 1) = (unchar)ch->channelnum; in fepcmd()
2492 ch->mailbox->cin = head; in fepcmd()
2506 head = ch->mailbox->cin; in fepcmd()
2507 cmdTail = ch->mailbox->cout; in fepcmd()
2532 static unsigned termios2digi_h(struct channel *ch, unsigned cflag) in termios2digi_h() argument
2539 ch->digiext.digi_flags |= (RTSPACE | CTSPACE); in termios2digi_h()
2540 res |= ((ch->m_cts) | (ch->m_rts)); in termios2digi_h()
2543 if (ch->digiext.digi_flags & RTSPACE) in termios2digi_h()
2544 res |= ch->m_rts; in termios2digi_h()
2546 if (ch->digiext.digi_flags & DTRPACE) in termios2digi_h()
2547 res |= ch->m_dtr; in termios2digi_h()
2549 if (ch->digiext.digi_flags & CTSPACE) in termios2digi_h()
2550 res |= ch->m_cts; in termios2digi_h()
2552 if (ch->digiext.digi_flags & DSRPACE) in termios2digi_h()
2553 res |= ch->dsr; in termios2digi_h()
2555 if (ch->digiext.digi_flags & DCDPACE) in termios2digi_h()
2556 res |= ch->dcd; in termios2digi_h()
2558 if (res & (ch->m_rts)) in termios2digi_h()
2559 ch->digiext.digi_flags |= RTSPACE; in termios2digi_h()
2561 if (res & (ch->m_cts)) in termios2digi_h()
2562 ch->digiext.digi_flags |= CTSPACE; in termios2digi_h()
2569 static unsigned termios2digi_i(struct channel *ch, unsigned iflag) in termios2digi_i() argument
2575 if (ch->digiext.digi_flags & DIGI_AIXON) in termios2digi_i()
2583 static unsigned termios2digi_c(struct channel *ch, unsigned cflag) in termios2digi_c() argument
2597 ch->digiext.digi_flags |= DIGI_FAST; in termios2digi_c()
2607 else ch->digiext.digi_flags &= ~DIGI_FAST; in termios2digi_c()
2661 static void epcaparam(struct tty_struct *tty, struct channel *ch) in epcaparam() argument
2669 bc = ch->brdchan; in epcaparam()
2672 assertgwinon(ch); in epcaparam()
2689 fepcmd(ch, STOUT, (unsigned) cmdHead, 0, 0, 0); in epcaparam()
2701 cflag = termios2digi_c(ch, ts->c_cflag); in epcaparam()
2703 if (cflag != ch->fepcflag) in epcaparam()
2705 ch->fepcflag = cflag; in epcaparam()
2707 fepcmd(ch, SETCTRLFLAGS, (unsigned) cflag, 0, 0, 0); in epcaparam()
2719 ch->asyncflags &= ~ASYNC_CHECK_CD; in epcaparam()
2723 ch->asyncflags |= ASYNC_CHECK_CD; in epcaparam()
2726 mval = ch->m_dtr | ch->m_rts; in epcaparam()
2730 iflag = termios2digi_i(ch, ts->c_iflag); in epcaparam()
2734 if (iflag != ch->fepiflag) in epcaparam()
2736 ch->fepiflag = iflag; in epcaparam()
2745 fepcmd(ch, SETIFLAGS, (unsigned int) ch->fepiflag, 0, 0, 0); in epcaparam()
2753 bc->mint = ch->dcd; in epcaparam()
2755 if ((ts->c_cflag & CLOCAL) || (ch->digiext.digi_flags & DIGI_FORCEDCD)) in epcaparam()
2756 if (ch->digiext.digi_flags & DIGI_FORCEDCD) in epcaparam()
2759 ch->imodem = bc->mstat; in epcaparam()
2761 hflow = termios2digi_h(ch, ts->c_cflag); in epcaparam()
2763 if (hflow != ch->hflow) in epcaparam()
2765 ch->hflow = hflow; in epcaparam()
2772 fepcmd(ch, SETHFLOW, hflow, 0xff, 0, 1); in epcaparam()
2776 mval ^= ch->modemfake & (mval ^ ch->modem); in epcaparam()
2778 if (ch->omodem ^ mval) in epcaparam()
2780 ch->omodem = mval; in epcaparam()
2791 fepcmd(ch, SETMODEM, 0, ((ch->m_dtr)|(ch->m_rts)), 0, 1); in epcaparam()
2792 fepcmd(ch, SETMODEM, mval, 0, 0, 1); in epcaparam()
2796 if (ch->startc != ch->fepstartc || ch->stopc != ch->fepstopc) in epcaparam()
2798 ch->fepstartc = ch->startc; in epcaparam()
2799 ch->fepstopc = ch->stopc; in epcaparam()
2806 fepcmd(ch, SONOFFC, ch->fepstartc, ch->fepstopc, 0, 1); in epcaparam()
2809 if (ch->startca != ch->fepstartca || ch->stopca != ch->fepstopca) in epcaparam()
2811 ch->fepstartca = ch->startca; in epcaparam()
2812 ch->fepstopca = ch->stopca; in epcaparam()
2819 fepcmd(ch, SAUXONOFFC, ch->fepstartca, ch->fepstopca, 0, 1); in epcaparam()
2826 static void receive_data(struct channel *ch) in receive_data() argument
2844 globalwinon(ch); in receive_data()
2846 if (ch->statusflags & RXSTOPPED) in receive_data()
2849 tty = ch->tty; in receive_data()
2853 bc = ch->brdchan; in receive_data()
2861 wrapmask = ch->rxbufsize - 1; in receive_data()
2896 rxwinon(ch); in receive_data()
2903 wrapgap = (head >= tail) ? head - tail : ch->rxbufsize - tail; in receive_data()
2928 if ((memcpy(rptr, ch->rxptr + tail, dataToRead)) != rptr) in receive_data()
2941 globalwinon(ch); in receive_data()
2945 tty_schedule_flip(ch->tty); in receive_data()
2962 struct channel *ch = (struct channel *) tty->driver_data; in pc_ioctl() local
3047 if (ch) in pc_ioctl()
3048 bc = ch->brdchan; in pc_ioctl()
3083 setup_empty_event(tty,ch); in pc_ioctl()
3086 digi_send_break(ch, HZ/4); /* 1/4 second */ in pc_ioctl()
3097 setup_empty_event(tty,ch); in pc_ioctl()
3099 digi_send_break(ch, arg ? arg*(HZ/10) : HZ/4); in pc_ioctl()
3130 globalwinon(ch); in pc_ioctl()
3132 memoff(ch); in pc_ioctl()
3135 if (mstat & ch->m_dtr) in pc_ioctl()
3138 if (mstat & ch->m_rts) in pc_ioctl()
3141 if (mstat & ch->m_cts) in pc_ioctl()
3144 if (mstat & ch->dsr) in pc_ioctl()
3147 if (mstat & ch->m_ri) in pc_ioctl()
3150 if (mstat & ch->dcd) in pc_ioctl()
3171 mflag |= ch->m_dtr; in pc_ioctl()
3174 mflag |= ch->m_rts; in pc_ioctl()
3181 ch->modemfake = ch->m_dtr|ch->m_rts; in pc_ioctl()
3182 ch->modem = mflag; in pc_ioctl()
3186 ch->modemfake |= mflag; in pc_ioctl()
3187 ch->modem |= mflag; in pc_ioctl()
3191 ch->modemfake |= mflag; in pc_ioctl()
3192 ch->modem &= ~mflag; in pc_ioctl()
3198 globalwinon(ch); in pc_ioctl()
3205 epcaparam(tty,ch); in pc_ioctl()
3206 memoff(ch); in pc_ioctl()
3211 ch->omodem |= ch->m_dtr; in pc_ioctl()
3213 globalwinon(ch); in pc_ioctl()
3214 fepcmd(ch, SETMODEM, ch->m_dtr, 0, 10, 1); in pc_ioctl()
3215 memoff(ch); in pc_ioctl()
3220 ch->omodem &= ~ch->m_dtr; in pc_ioctl()
3222 globalwinon(ch); in pc_ioctl()
3223 fepcmd(ch, SETMODEM, 0, ch->m_dtr, 10, 1); in pc_ioctl()
3224 memoff(ch); in pc_ioctl()
3229 if (copy_to_user((char*)arg, &ch->digiext, in pc_ioctl()
3240 setup_empty_event(tty,ch); in pc_ioctl()
3252 if (copy_from_user(&ch->digiext, (char*)arg, in pc_ioctl()
3256 if (ch->digiext.digi_flags & DIGI_ALTPIN) in pc_ioctl()
3258 ch->dcd = ch->m_dsr; in pc_ioctl()
3259 ch->dsr = ch->m_dcd; in pc_ioctl()
3263 ch->dcd = ch->m_dcd; in pc_ioctl()
3264 ch->dsr = ch->m_dsr; in pc_ioctl()
3268 globalwinon(ch); in pc_ioctl()
3275 epcaparam(tty,ch); in pc_ioctl()
3276 memoff(ch); in pc_ioctl()
3283 globalwinon(ch); in pc_ioctl()
3294 memoff(ch); in pc_ioctl()
3305 startc = ch->startc; in pc_ioctl()
3306 stopc = ch->stopc; in pc_ioctl()
3310 startc = ch->startca; in pc_ioctl()
3311 stopc = ch->stopca; in pc_ioctl()
3320 globalwinon(ch); in pc_ioctl()
3324 ch->fepstartc = ch->startc = dflow.startc; in pc_ioctl()
3325 ch->fepstopc = ch->stopc = dflow.stopc; in pc_ioctl()
3326 fepcmd(ch, SONOFFC, ch->fepstartc, ch->fepstopc, 0, 1); in pc_ioctl()
3330 ch->fepstartca = ch->startca = dflow.startc; in pc_ioctl()
3331 ch->fepstopca = ch->stopca = dflow.stopc; in pc_ioctl()
3332 fepcmd(ch, SAUXONOFFC, ch->fepstartca, ch->fepstopca, 0, 1); in pc_ioctl()
3335 if (ch->statusflags & TXSTOPPED) in pc_ioctl()
3338 memoff(ch); in pc_ioctl()
3358 struct channel *ch; in pc_set_termios() local
3366 if ((ch = verifyChannel(tty)) != NULL) in pc_set_termios()
3371 globalwinon(ch); in pc_set_termios()
3372 epcaparam(tty, ch); in pc_set_termios()
3373 memoff(ch); in pc_set_termios()
3381 wake_up_interruptible(&ch->open_wait); in pc_set_termios()
3394 struct channel *ch = (struct channel *) private_; in do_softint() local
3399 if (ch && ch->magic == EPCA_MAGIC) in do_softint()
3402 struct tty_struct *tty = ch->tty; in do_softint()
3406 if (test_and_clear_bit(EPCA_EVENT_HANGUP, &ch->event)) in do_softint()
3410 wake_up_interruptible(&ch->open_wait); in do_softint()
3411 ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CALLOUT_ACTIVE); in do_softint()
3430 struct channel *ch; in pc_stop() local
3438 if ((ch = verifyChannel(tty)) != NULL) in pc_stop()
3444 if ((ch->statusflags & TXSTOPPED) == 0) in pc_stop()
3447 globalwinon(ch); in pc_stop()
3451 fepcmd(ch, PAUSETX, 0, 0, 0, 0); in pc_stop()
3453 ch->statusflags |= TXSTOPPED; in pc_stop()
3454 memoff(ch); in pc_stop()
3469 struct channel *ch; in pc_start() local
3476 if ((ch = verifyChannel(tty)) != NULL) in pc_start()
3485 if (ch->statusflags & TXSTOPPED) in pc_start()
3490 globalwinon(ch); in pc_start()
3491 bc = ch->brdchan; in pc_start()
3492 if (ch->statusflags & LOWWAIT) in pc_start()
3497 fepcmd(ch, RESUMETX, 0, 0, 0, 0); in pc_start()
3499 ch->statusflags &= ~TXSTOPPED; in pc_start()
3500 memoff(ch); in pc_start()
3523 struct channel *ch; in pc_throttle() local
3531 if ((ch = verifyChannel(tty)) != NULL) in pc_throttle()
3538 if ((ch->statusflags & RXSTOPPED) == 0) in pc_throttle()
3540 globalwinon(ch); in pc_throttle()
3541 fepcmd(ch, PAUSERX, 0, 0, 0, 0); in pc_throttle()
3543 ch->statusflags |= RXSTOPPED; in pc_throttle()
3544 memoff(ch); in pc_throttle()
3557 struct channel *ch; in pc_unthrottle() local
3567 if ((ch = verifyChannel(tty)) != NULL) in pc_unthrottle()
3575 if (ch->statusflags & RXSTOPPED) in pc_unthrottle()
3578 globalwinon(ch); in pc_unthrottle()
3579 bc = ch->brdchan; in pc_unthrottle()
3580 fepcmd(ch, RESUMERX, 0, 0, 0, 0); in pc_unthrottle()
3582 ch->statusflags &= ~RXSTOPPED; in pc_unthrottle()
3583 memoff(ch); in pc_unthrottle()
3593 void digi_send_break(struct channel *ch, int msec) in digi_send_break() argument
3600 globalwinon(ch); in digi_send_break()
3610 fepcmd(ch, SENDBREAK, msec, 0, 10, 0); in digi_send_break()
3611 memoff(ch); in digi_send_break()
3619 static void setup_empty_event(struct tty_struct *tty, struct channel *ch) in setup_empty_event() argument
3622 volatile struct board_chan *bc = ch->brdchan; in setup_empty_event()
3627 globalwinon(ch); in setup_empty_event()
3628 ch->statusflags |= EMPTYWAIT; in setup_empty_event()
3636 memoff(ch); in setup_empty_event()