2 ** -----------------------------------------------------------------------------
4 ** Perle Specialix driver for Linux
5 ** Ported from existing RIO Driver for SCO sources.
7 * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 ** Last Modified : 11/6/98 10:33:44
26 ** Retrieved : 11/6/98 10:33:49
28 ** ident @(#)riointr.c 1.2
30 ** -----------------------------------------------------------------------------
33 static char *_riointr_c_sccs_ = "@(#)riointr.c 1.2";
37 #include <linux/module.h>
38 #include <linux/slab.h>
39 #include <linux/errno.h>
40 #include <linux/tty.h>
41 #include <linux/tty_flip.h>
43 #include <asm/system.h>
44 #include <asm/string.h>
45 #include <asm/semaphore.h>
46 #include <asm/uaccess.h>
48 #include <linux/termios.h>
49 #include <linux/serial.h>
51 #include <linux/generic_serial.h>
53 #include <linux/delay.h>
55 #include "linux_compat.h"
56 #include "rio_linux.h"
88 static void RIOReceive(struct rio_info *, struct Port *);
91 static char *firstchars(char *p, int nch)
93 static char buf[2][128];
96 memcpy(buf[t], p, nch);
102 #define INCR( P, I ) ((P) = (((P)+(I)) & p->RIOBufferMask))
103 /* Enable and start the transmission of packets */
109 struct tty_struct *tty;
114 PortP = (struct Port *) en;
115 p = (struct rio_info *) PortP->p;
119 rio_dprintk(RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", PortP->PortNum, PortP->gs.xmit_cnt);
121 if (!PortP->gs.xmit_cnt)
125 /* This routine is an order of magnitude simpler than the specialix
126 version. One of the disadvantages is that this version will send
127 an incomplete packet (usually 64 bytes instead of 72) once for
128 every 4k worth of data. Let's just say that this won't influence
129 performance significantly..... */
131 rio_spin_lock_irqsave(&PortP->portSem, flags);
133 while (can_add_transmit(&PacketP, PortP)) {
134 c = PortP->gs.xmit_cnt;
135 if (c > PKT_MAX_DATA_LEN)
136 c = PKT_MAX_DATA_LEN;
138 /* Don't copy past the end of the source buffer */
139 if (c > SERIAL_XMIT_SIZE - PortP->gs.xmit_tail)
140 c = SERIAL_XMIT_SIZE - PortP->gs.xmit_tail;
144 t = (c > 10) ? 10 : c;
146 rio_dprintk(RIO_DEBUG_INTR, "rio: tx port %d: copying %d chars: %s - %s\n", PortP->PortNum, c, firstchars(PortP->gs.xmit_buf + PortP->gs.xmit_tail, t), firstchars(PortP->gs.xmit_buf + PortP->gs.xmit_tail + c - t, t));
148 /* If for one reason or another, we can't copy more data,
153 rio_memcpy_toio(PortP->HostP->Caddr, (caddr_t) PacketP->data, PortP->gs.xmit_buf + PortP->gs.xmit_tail, c);
156 writeb(c, &(PacketP->len));
157 if (!(PortP->State & RIO_DELETED)) {
160 ** Count chars tx'd for port statistics reporting
162 if (PortP->statsGather)
165 PortP->gs.xmit_tail = (PortP->gs.xmit_tail + c) & (SERIAL_XMIT_SIZE - 1);
166 PortP->gs.xmit_cnt -= c;
169 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
171 if (PortP->gs.xmit_cnt <= (PortP->gs.wakeup_chars + 2 * PKT_MAX_DATA_LEN)) {
172 rio_dprintk(RIO_DEBUG_INTR, "Waking up.... ldisc:%d (%d/%d)....", (int) (PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)), PortP->gs.wakeup_chars, PortP->gs.xmit_cnt);
173 if ((PortP->gs.tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && PortP->gs.tty->ldisc.write_wakeup)
174 (PortP->gs.tty->ldisc.write_wakeup) (PortP->gs.tty);
175 rio_dprintk(RIO_DEBUG_INTR, "(%d/%d)\n", PortP->gs.wakeup_chars, PortP->gs.xmit_cnt);
176 wake_up_interruptible(&PortP->gs.tty->write_wait);
183 ** RIO Host Service routine. Does all the work traditionally associated with an
189 void RIOServiceHost(p, HostP, From)
194 rio_spin_lock(&HostP->HostLock);
195 if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
197 rio_spin_unlock(&HostP->HostLock);
198 if ((t++ % 200) == 0)
199 rio_dprintk(RIO_DEBUG_INTR, "Interrupt but host not running. flags=%x.\n", (int) HostP->Flags);
202 rio_spin_unlock(&HostP->HostLock);
204 if (RWORD(HostP->ParmMapP->rup_intr)) {
205 WWORD(HostP->ParmMapP->rup_intr, 0);
208 rio_dprintk(RIO_DEBUG_INTR, "rio: RUP interrupt on host %d\n", HostP - p->RIOHosts);
209 RIOPollHostCommands(p, HostP);
212 if (RWORD(HostP->ParmMapP->rx_intr)) {
215 WWORD(HostP->ParmMapP->rx_intr, 0);
219 rio_dprintk(RIO_DEBUG_INTR, "rio: RX interrupt on host %d\n", HostP - p->RIOHosts);
221 ** Loop through every port. If the port is mapped into
222 ** the system ( i.e. has /dev/ttyXXXX associated ) then it is
223 ** worth checking. If the port isn't open, grab any packets
224 ** hanging on its receive queue and stuff them on the free
225 ** list; check for commands on the way.
227 for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) {
228 struct Port *PortP = p->RIOPortp[port];
229 struct tty_struct *ttyP;
233 ** not mapped in - most of the RIOPortp[] information
234 ** has not been set up!
235 ** Optimise: ports come in bundles of eight.
237 if (!PortP->Mapped) {
239 continue; /* with the next port */
243 ** If the host board isn't THIS host board, check the next one.
244 ** optimise: ports come in bundles of eight.
246 if (PortP->HostP != HostP) {
252 ** Let us see - is the port open? If not, then don't service it.
254 if (!(PortP->PortState & PORT_ISOPEN)) {
259 ** find corresponding tty structure. The process of mapping
260 ** the ports puts these here.
262 ttyP = PortP->gs.tty;
265 ** Lock the port before we begin working on it.
267 rio_spin_lock(&PortP->portSem);
270 ** Process received data if there is any.
272 if (can_remove_receive(&PacketP, PortP))
273 RIOReceive(p, PortP);
276 ** If there is no data left to be read from the port, and
277 ** it's handshake bit is set, then we must clear the handshake,
278 ** so that that downstream RTA is re-enabled.
280 if (!can_remove_receive(&PacketP, PortP) && (RWORD(PortP->PhbP->handshake) == PHB_HANDSHAKE_SET)) {
282 ** MAGIC! ( Basically, handshake the RX buffer, so that
283 ** the RTAs upstream can be re-enabled. )
285 rio_dprintk(RIO_DEBUG_INTR, "Set RX handshake bit\n");
286 WWORD(PortP->PhbP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET);
288 rio_spin_unlock(&PortP->portSem);
292 if (RWORD(HostP->ParmMapP->tx_intr)) {
295 WWORD(HostP->ParmMapP->tx_intr, 0);
299 rio_dprintk(RIO_DEBUG_INTR, "rio: TX interrupt on host %d\n", HostP - p->RIOHosts);
302 ** Loop through every port.
303 ** If the port is mapped into the system ( i.e. has /dev/ttyXXXX
304 ** associated ) then it is worth checking.
306 for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) {
307 struct Port *PortP = p->RIOPortp[port];
308 struct tty_struct *ttyP;
312 ** not mapped in - most of the RIOPortp[] information
313 ** has not been set up!
315 if (!PortP->Mapped) {
317 continue; /* with the next port */
321 ** If the host board isn't running, then its data structures
322 ** are no use to us - continue quietly.
324 if (PortP->HostP != HostP) {
326 continue; /* with the next port */
330 ** Let us see - is the port open? If not, then don't service it.
332 if (!(PortP->PortState & PORT_ISOPEN)) {
336 rio_dprintk(RIO_DEBUG_INTR, "rio: Looking into port %d.\n", port);
338 ** Lock the port before we begin working on it.
340 rio_spin_lock(&PortP->portSem);
343 ** If we can't add anything to the transmit queue, then
344 ** we need do none of this processing.
346 if (!can_add_transmit(&PacketP, PortP)) {
347 rio_dprintk(RIO_DEBUG_INTR, "Can't add to port, so skipping.\n");
348 rio_spin_unlock(&PortP->portSem);
353 ** find corresponding tty structure. The process of mapping
354 ** the ports puts these here.
356 ttyP = PortP->gs.tty;
357 /* If ttyP is NULL, the port is getting closed. Forget about it. */
359 rio_dprintk(RIO_DEBUG_INTR, "no tty, so skipping.\n");
360 rio_spin_unlock(&PortP->portSem);
364 ** If there is more room available we start up the transmit
365 ** data process again. This can be direct I/O, if the cookmode
366 ** is set to COOK_RAW or COOK_MEDIUM, or will be a call to the
367 ** riotproc( T_OUTPUT ) if we are in COOK_WELL mode, to fetch
368 ** characters via the line discipline. We must always call
369 ** the line discipline,
370 ** so that user input characters can be echoed correctly.
373 ** With the advent of double buffering, we now see if
374 ** TxBufferOut-In is non-zero. If so, then we copy a packet
375 ** to the output place, and set it going. If this empties
376 ** the buffer, then we must issue a wakeup( ) on OUT.
377 ** If it frees space in the buffer then we must issue
378 ** a wakeup( ) on IN.
380 ** ++++ Extra! Extra! If PortP->WflushFlag is set, then we
381 ** have to send a WFLUSH command down the PHB, to mark the
382 ** end point of a WFLUSH. We also need to clear out any
383 ** data from the double buffer! ( note that WflushFlag is a
384 ** *count* of the number of WFLUSH commands outstanding! )
386 ** ++++ And there's more!
387 ** If an RTA is powered off, then on again, and rebooted,
388 ** whilst it has ports open, then we need to re-open the ports.
389 ** ( reasonable enough ). We can't do this when we spot the
390 ** re-boot, in interrupt time, because the queue is probably
391 ** full. So, when we come in here, we need to test if any
392 ** ports are in this condition, and re-open the port before
393 ** we try to send any more data to it. Now, the re-booted
394 ** RTA will be discarding packets from the PHB until it
395 ** receives this open packet, but don't worry tooo much
396 ** about that. The one thing that is interesting is the
397 ** combination of this effect and the WFLUSH effect!
399 /* For now don't handle RTA reboots. -- REW.
400 Reenabled. Otherwise RTA reboots didn't work. Duh. -- REW */
401 if (PortP->MagicFlags) {
403 if (PortP->MagicFlags & MAGIC_REBOOT) {
405 ** well, the RTA has been rebooted, and there is room
406 ** on its queue to add the open packet that is required.
408 ** The messy part of this line is trying to decide if
409 ** we need to call the Param function as a tty or as
411 ** DONT USE CLOCAL AS A TEST FOR THIS!
413 ** If we can't param the port, then move on to the
416 PortP->InUse = NOT_INUSE;
418 rio_spin_unlock(&PortP->portSem);
419 if (RIOParam(PortP, OPEN, ((PortP->Cor2Copy & (COR2_RTSFLOW | COR2_CTSFLOW)) == (COR2_RTSFLOW | COR2_CTSFLOW)) ? TRUE : FALSE, DONT_SLEEP) == RIO_FAIL) {
420 continue; /* with next port */
422 rio_spin_lock(&PortP->portSem);
423 PortP->MagicFlags &= ~MAGIC_REBOOT;
428 ** As mentioned above, this is a tacky hack to cope
431 if (PortP->WflushFlag) {
432 rio_dprintk(RIO_DEBUG_INTR, "Want to WFLUSH mark this port\n");
435 rio_dprintk(RIO_DEBUG_INTR, "FAILS - PORT IS IN USE\n");
438 while (PortP->WflushFlag && can_add_transmit(&PacketP, PortP) && (PortP->InUse == NOT_INUSE)) {
440 struct PktCmd *PktCmdP;
442 rio_dprintk(RIO_DEBUG_INTR, "Add WFLUSH marker to data queue\n");
444 ** make it look just like a WFLUSH command
446 PktCmdP = (struct PktCmd *) &PacketP->data[0];
448 WBYTE(PktCmdP->Command, WFLUSH);
450 p = PortP->HostPort % (ushort) PORTS_PER_RTA;
453 ** If second block of ports for 16 port RTA, add 8
456 if (PortP->SecondBlock)
459 WBYTE(PktCmdP->PhbNum, p);
462 ** to make debuggery easier
464 WBYTE(PacketP->data[2], 'W');
465 WBYTE(PacketP->data[3], 'F');
466 WBYTE(PacketP->data[4], 'L');
467 WBYTE(PacketP->data[5], 'U');
468 WBYTE(PacketP->data[6], 'S');
469 WBYTE(PacketP->data[7], 'H');
470 WBYTE(PacketP->data[8], ' ');
471 WBYTE(PacketP->data[9], '0' + PortP->WflushFlag);
472 WBYTE(PacketP->data[10], ' ');
473 WBYTE(PacketP->data[11], ' ');
474 WBYTE(PacketP->data[12], '\0');
477 ** its two bytes long!
479 WBYTE(PacketP->len, PKT_CMD_BIT | 2);
484 if (!(PortP->State & RIO_DELETED)) {
487 ** Count chars tx'd for port statistics reporting
489 if (PortP->statsGather)
493 if (--(PortP->WflushFlag) == 0) {
494 PortP->MagicFlags &= ~MAGIC_FLUSH;
497 rio_dprintk(RIO_DEBUG_INTR, "Wflush count now stands at %d\n", PortP->WflushFlag);
499 if (PortP->MagicFlags & MORE_OUTPUT_EYGOR) {
500 if (PortP->MagicFlags & MAGIC_FLUSH) {
501 PortP->MagicFlags |= MORE_OUTPUT_EYGOR;
503 if (!can_add_transmit(&PacketP, PortP)) {
504 rio_spin_unlock(&PortP->portSem);
507 rio_spin_unlock(&PortP->portSem);
508 RIOTxEnable((char *) PortP);
509 rio_spin_lock(&PortP->portSem);
510 PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR;
517 ** If we can't add anything to the transmit queue, then
518 ** we need do none of the remaining processing.
520 if (!can_add_transmit(&PacketP, PortP)) {
521 rio_spin_unlock(&PortP->portSem);
525 rio_spin_unlock(&PortP->portSem);
526 RIOTxEnable((char *) PortP);
532 ** Routine for handling received data for clist drivers.
533 ** NB: Called with the tty locked. The spl from the lockb( ) is passed.
534 ** we return the ttySpl level that we re-locked at.
536 static void RIOReceive(p, PortP)
540 struct tty_struct *TtyP;
541 register ushort transCount;
543 register uint DataCnt;
548 static int intCount, RxIntCnt;
551 ** The receive data process is to remove packets from the
552 ** PHB until there aren't any more or the current cblock
553 ** is full. When this occurs, there will be some left over
554 ** data in the packet, that we must do something with.
555 ** As we haven't unhooked the packet from the read list
556 ** yet, we can just leave the packet there, having first
557 ** made a note of how far we got. This means that we need
558 ** a pointer per port saying where we start taking the
559 ** data from - this will normally be zero, but when we
560 ** run out of space it will be set to the offset of the
561 ** next byte to copy from the packet data area. The packet
562 ** length field is decremented by the number of bytes that
563 ** we succesfully removed from the packet. When this reaches
564 ** zero, we reset the offset pointer to be zero, and free
565 ** the packet from the front of the queue.
570 TtyP = PortP->gs.tty;
572 rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: tty is null. \n");
576 if (PortP->State & RIO_THROTTLE_RX) {
577 rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: Throttled. Can't handle more input.\n");
581 if (PortP->State & RIO_DELETED) {
582 while (can_remove_receive(&PacketP, PortP)) {
583 remove_receive(PortP);
584 put_free_end(PortP->HostP, PacketP);
588 ** loop, just so long as:
589 ** i ) there's some data ( i.e. can_remove_receive )
590 ** ii ) we haven't been blocked
591 ** iii ) there's somewhere to put the data
592 ** iv ) we haven't outstayed our welcome
595 while (can_remove_receive(&PacketP, PortP)
598 PortP->Stat.RxIntCnt++;
603 ** check that it is not a command!
605 if (PacketP->len & PKT_CMD_BIT) {
606 rio_dprintk(RIO_DEBUG_INTR, "RIO: unexpected command packet received on PHB\n");
607 /* rio_dprint(RIO_DEBUG_INTR, (" sysport = %d\n", p->RIOPortp->PortNum)); */
608 rio_dprintk(RIO_DEBUG_INTR, " dest_unit = %d\n", PacketP->dest_unit);
609 rio_dprintk(RIO_DEBUG_INTR, " dest_port = %d\n", PacketP->dest_port);
610 rio_dprintk(RIO_DEBUG_INTR, " src_unit = %d\n", PacketP->src_unit);
611 rio_dprintk(RIO_DEBUG_INTR, " src_port = %d\n", PacketP->src_port);
612 rio_dprintk(RIO_DEBUG_INTR, " len = %d\n", PacketP->len);
613 rio_dprintk(RIO_DEBUG_INTR, " control = %d\n", PacketP->control);
614 rio_dprintk(RIO_DEBUG_INTR, " csum = %d\n", PacketP->csum);
615 rio_dprintk(RIO_DEBUG_INTR, " data bytes: ");
616 for (DataCnt = 0; DataCnt < PKT_MAX_DATA_LEN; DataCnt++)
617 rio_dprintk(RIO_DEBUG_INTR, "%d\n", PacketP->data[DataCnt]);
618 remove_receive(PortP);
619 put_free_end(PortP->HostP, PacketP);
620 continue; /* with next packet */
624 ** How many characters can we move 'upstream' ?
626 ** Determine the minimum of the amount of data
627 ** available and the amount of space in which to
630 ** 1. Get the packet length by masking 'len'
631 ** for only the length bits.
632 ** 2. Available space is [buffer size] - [space used]
634 ** Transfer count is the minimum of packet length
635 ** and available space.
638 transCount = tty_buffer_request_room(TtyP, PacketP->len & PKT_LEN_MASK);
639 rio_dprintk(RIO_DEBUG_REC, "port %d: Copy %d bytes\n", PortP->PortNum, transCount);
641 ** To use the following 'kkprintfs' for debugging - change the '#undef'
642 ** to '#define', (this is the only place ___DEBUG_IT___ occurs in the
645 #undef ___DEBUG_IT___
646 #ifdef ___DEBUG_IT___
647 kkprintf("I:%d R:%d P:%d Q:%d C:%d F:%x ", intCount, RxIntCnt, PortP->PortNum, TtyP->rxqueue.count, transCount, TtyP->flags);
649 ptr = (uchar *) PacketP->data + PortP->RxDataStart;
651 tty_prepare_flip_string(TtyP, &buf, transCount);
652 rio_memcpy_fromio(buf, ptr, transCount);
655 ** keep a count for statistical purposes
657 PortP->Stat.RxCharCnt += transCount;
659 PortP->RxDataStart += transCount;
660 PacketP->len -= transCount;
661 copied += transCount;
664 #ifdef ___DEBUG_IT___
665 kkprintf("T:%d L:%d\n", DataCnt, PacketP->len);
668 if (PacketP->len == 0) {
670 ** If we have emptied the packet, then we can
671 ** free it, and reset the start pointer for
674 remove_receive(PortP);
675 put_free_end(PortP->HostP, PacketP);
676 PortP->RxDataStart = 0;
679 ** more lies ( oops, I mean statistics )
681 PortP->Stat.RxPktCnt++;
687 rio_dprintk(RIO_DEBUG_REC, "port %d: pushing tty flip buffer: %d total bytes copied.\n", PortP->PortNum, copied);
688 tty_flip_buffer_push(TtyP);
694 #ifdef FUTURE_RELEASE
696 ** The proc routine called by the line discipline to do the work for it.
697 ** The proc routine works hand in hand with the interrupt routine.
699 int riotproc(p, tp, cmd, port)
701 register struct ttystatics *tp;
705 register struct Port *PortP;
709 SysPort = port; /* Believe me, it works. */
711 if (SysPort < 0 || SysPort >= RIO_PORTS) {
712 rio_dprintk(RIO_DEBUG_INTR, "Illegal port %d derived from TTY in riotproc()\n", SysPort);
715 PortP = p->RIOPortp[SysPort];
717 if ((uint) PortP->PhbP < (uint) PortP->Caddr || (uint) PortP->PhbP >= (uint) PortP->Caddr + SIXTY_FOUR_K) {
718 rio_dprintk(RIO_DEBUG_INTR, "RIO: NULL or BAD PhbP on sys port %d in proc routine\n", SysPort);
719 rio_dprintk(RIO_DEBUG_INTR, " PortP = 0x%x\n", PortP);
720 rio_dprintk(RIO_DEBUG_INTR, " PortP->PhbP = 0x%x\n", PortP->PhbP);
721 rio_dprintk(RIO_DEBUG_INTR, " PortP->Caddr = 0x%x\n", PortP->PhbP);
722 rio_dprintk(RIO_DEBUG_INTR, " PortP->HostPort = 0x%x\n", PortP->HostPort);
728 rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH\n");
730 ** Because of the spooky way the RIO works, we don't need
731 ** to issue a flush command on any of the SET*F commands,
732 ** as that causes trouble with getty and login, which issue
733 ** these commands to incur a READ flush, and rely on the fact
734 ** that the line discipline does a wait for drain for them.
735 ** As the rio doesn't wait for drain, the write flush would
736 ** destroy the Password: prompt. This isn't very friendly, so
737 ** here we only issue a WFLUSH command if we are in the interrupt
738 ** routine, or we aren't executing a SET*F command.
740 if (PortP->HostP->InIntr || !PortP->FlushCmdBodge) {
742 ** form a wflush packet - 1 byte long, no data
744 if (PortP->State & RIO_DELETED) {
745 rio_dprintk(RIO_DEBUG_INTR, "WFLUSH on deleted RTA\n");
747 if (RIOPreemptiveCmd(p, PortP, WFLUSH) == RIO_FAIL) {
748 rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command failed\n");
750 rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command\n");
753 ** WFLUSH operation - flush the data!
755 PortP->TxBufferIn = PortP->TxBufferOut = 0;
757 rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command ignored\n");
760 ** sort out the line discipline
762 if (PortP->CookMode == COOK_WELL)
767 rio_dprintk(RIO_DEBUG_INTR, "T_RESUME\n");
769 ** send pre-emptive resume packet
771 if (PortP->State & RIO_DELETED) {
772 rio_dprintk(RIO_DEBUG_INTR, "RESUME on deleted RTA\n");
774 if (RIOPreemptiveCmd(p, PortP, RESUME) == RIO_FAIL) {
775 rio_dprintk(RIO_DEBUG_INTR, "T_RESUME Command failed\n");
779 ** and re-start the sender software!
781 if (PortP->CookMode == COOK_WELL)
786 rio_dprintk(RIO_DEBUG_INTR, "T_TIME\n");
788 ** T_TIME is called when xDLY is set in oflags and
789 ** the line discipline timeout has expired. It's
790 ** function in life is to clear the TIMEOUT flag
791 ** and to re-start output to the port.
794 ** Fall through and re-start output
798 if (PortP->MagicFlags & MAGIC_FLUSH) {
799 PortP->MagicFlags |= MORE_OUTPUT_EYGOR;
802 RIOTxEnable((char *) PortP);
803 PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR;
804 /*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"T_OUTPUT finished\n"); */
808 rio_dprintk(RIO_DEBUG_INTR, "T_SUSPEND\n");
810 ** send a suspend pre-emptive packet.
812 if (PortP->State & RIO_DELETED) {
813 rio_dprintk(RIO_DEBUG_INTR, "SUSPEND deleted RTA\n");
815 if (RIOPreemptiveCmd(p, PortP, SUSPEND) == RIO_FAIL) {
816 rio_dprintk(RIO_DEBUG_INTR, "T_SUSPEND Command failed\n");
825 rio_dprintk(RIO_DEBUG_INTR, "T_BLOCK\n");
829 rio_dprintk(RIO_DEBUG_INTR, "T_RFLUSH\n");
830 if (PortP->State & RIO_DELETED) {
831 rio_dprintk(RIO_DEBUG_INTR, "RFLUSH on deleted RTA\n");
832 PortP->RxDataStart = 0;
834 if (RIOPreemptiveCmd(p, PortP, RFLUSH) == RIO_FAIL) {
835 rio_dprintk(RIO_DEBUG_INTR, "T_RFLUSH Command failed\n");
838 PortP->RxDataStart = 0;
839 while (can_remove_receive(&PacketP, PortP)) {
840 remove_receive(PortP);
841 ShowPacket(DBG_PROC, PacketP);
842 put_free_end(PortP->HostP, PacketP);
844 if (PortP->PhbP->handshake == PHB_HANDSHAKE_SET) {
848 rio_dprintk(RIO_DEBUG_INTR, "Set receive handshake bit\n");
849 PortP->PhbP->handshake |= PHB_HANDSHAKE_RESET;
855 rio_dprintk(RIO_DEBUG_INTR, "T_UNBLOCK\n");
857 ** If there is any data to receive set a timeout to service it.
859 RIOReceive(p, PortP);
863 rio_dprintk(RIO_DEBUG_INTR, "T_BREAK\n");
865 ** Send a break command. For Sys V
866 ** this is a timed break, so we
867 ** send a SBREAK[time] packet
870 ** Build a BREAK command
872 if (PortP->State & RIO_DELETED) {
873 rio_dprintk(RIO_DEBUG_INTR, "BREAK on deleted RTA\n");
875 if (RIOShortCommand(PortP, SBREAK, 2, p->RIOConf.BreakInterval) == RIO_FAIL) {
876 rio_dprintk(RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n");
886 rio_dprintk(RIO_DEBUG_INTR, "Proc T_INPUT called - I don't know what to do!\n");
889 rio_dprintk(RIO_DEBUG_INTR, "Proc T_PARM called - I don't know what to do!\n");
893 rio_dprintk(RIO_DEBUG_INTR, "Proc T_SWTCH called - I don't know what to do!\n");
897 rio_dprintk(RIO_DEBUG_INTR, "Proc UNKNOWN command %d\n", cmd);
900 ** T_OUTPUT returns without passing through this point!
902 /*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"riotproc done\n"); */