Lines Matching refs:port

169 /* Main interrupt controller port addresses.  */
183 struct dos_ttystate *port;
247 dos_getc (volatile struct dos_ttystate *port)
251 if (port->count == 0)
254 c = port->cbuf[port->first];
256 port->first = (port->first + 1) & (CBSIZE - 1);
257 port->count--;
264 dos_putc (int c, struct dos_ttystate *port)
266 if (port->count >= CBSIZE - 1)
268 port->cbuf[(port->first + port->count) & (CBSIZE - 1)] = c;
269 port->count++;
279 struct dos_ttystate *port;
288 port = intrupts[irq].port;
289 if (!port)
297 iir = inb (port, com_iir) & IIR_IMASK;
302 lsr = inb (port, com_lsr);
312 c = inb (port, com_data);
316 port->ferr++;
318 port->perr++;
320 port->oflo++;
323 if (dos_putc (c, port) < 0)
332 while ((lsr = inb (port, com_lsr)) & LSR_RXRDY);
337 port->msr = inb (port, com_msr);
341 port->txbusy = 0;
460 struct dos_ttystate *port;
485 port = &ports[fd];
486 if (port->refcnt++ > 0)
494 outb (port, com_cfcr, 0);
495 outb (port, com_iir, 0);
498 if ((inb (port, com_iir) & 0x38) == 0)
500 (void) inb (port, com_data); /* clear recv */
507 outb (port, com_ier, 0);
510 outb (port, com_fifo,
513 port->fifo = ((inb (port, com_iir) & IIR_FIFO_MASK) == IIR_FIFO_MASK);
516 (void) inb (port, com_lsr);
517 (void) inb (port, com_msr);
520 outb (port, com_mcr, MCR_IENABLE);
523 port->intrupt = dos_hookirq (port->irq);
524 if (!port->intrupt)
526 outb (port, com_mcr, 0);
527 outb (port, com_fifo, 0);
534 /* record port */
535 port->intrupt->port = port;
539 port->first = port->count = 0;
540 port->txbusy = 0;
541 port->oflo = 0;
544 i = dos_baudconv (port->baudrate = 9600);
545 outb (port, com_cfcr, CFCR_DLAB);
546 outb (port, com_dlbl, i & 0xff);
547 outb (port, com_dlbh, i >> 8);
548 outb (port, com_cfcr, CFCR_8BITS);
551 outb (port, com_ier, IER_ETXRDY | IER_ERXRDY | IER_ERLS | IER_EMSC);
554 outb (port, com_mcr, MCR_DTR | MCR_RTS | MCR_IENABLE);
565 struct dos_ttystate *port;
571 port = &ports[scb->fd];
573 if (port->refcnt-- > 1)
576 if (!(intrupt = port->intrupt))
581 port->intrupt = 0;
582 intrupt->port = 0;
583 outb (port, com_fifo, 0);
584 outb (port, com_ier, 0);
589 outb (port, com_mcr, 0);
592 if (port->oflo)
597 port->fifo ? "cannot" : "needs a 16550 to",
598 port->baudrate);
620 struct dos_ttystate *port = &ports[scb->fd];
625 while ((c = dos_getc (port)) < 0)
638 struct dos_ttystate *port = &ports[scb->fd];
641 /* Are they asking about a port we opened? */
642 if (port->refcnt <= 0)
644 /* We've never heard about this port. We should fail this call,
655 *state = *port;
694 struct dos_ttystate *port = &ports[scb->fd];
697 port->first = port->count = 0;
698 if (port->fifo)
699 outb (port, com_fifo, FIFO_ENABLE | FIFO_RCV_RST | FIFO_TRIGGER);
738 struct dos_ttystate *port = &ports[scb->fd];
740 if (port->baudrate != rate)
754 cfcr = inb (port, com_cfcr);
756 outb (port, com_cfcr, CFCR_DLAB);
757 outb (port, com_dlbl, x & 0xff);
758 outb (port, com_dlbh, x >> 8);
759 outb (port, com_cfcr, cfcr);
760 port->baudrate = rate;
770 struct dos_ttystate *port = &ports[scb->fd];
774 cfcr = inb (port, com_cfcr);
779 outb (port, com_cfcr, cfcr & ~CFCR_STOPB);
783 outb (port, com_cfcr, cfcr | CFCR_STOPB);
797 volatile struct dos_ttystate *port = &ports[scb->fd];
798 int fifosize = port->fifo ? 16 : 1;
806 port->txbusy = 1;
810 outportsb (port->base + com_data, str, cnt);
815 outportb (port->base + com_data, *str++);
822 while (port->txbusy)
838 volatile struct dos_ttystate *port = &ports[scb->fd];
842 cfcr = inb (port, com_cfcr);
843 outb (port, com_cfcr, cfcr | CFCR_SBREAK);
850 outb (port, com_cfcr, cfcr);
890 struct dos_ttystate *port;
895 for (port = ports; port < &ports[4]; port++)
897 if (port->baudrate == 0)
899 printf_filtered ("Port:\tCOM%ld (%sactive)\n", (long)(port - ports) + 1,
900 port->intrupt ? "" : "not ");
901 printf_filtered ("Addr:\t0x%03x (irq %d)\n", port->base, port->irq);
902 printf_filtered ("16550:\t%s\n", port->fifo ? "yes" : "no");
903 printf_filtered ("Speed:\t%d baud\n", port->baudrate);
905 port->ferr, port->perr, port->oflo);
931 Set COM1 base i/o port address."), _("\
932 Show COM1 base i/o port address."), NULL,
945 Set COM2 base i/o port address."), _("\
946 Show COM2 base i/o port address."), NULL,
959 Set COM3 base i/o port address."), _("\
960 Show COM3 base i/o port address."), NULL,
973 Set COM4 base i/o port address."), _("\
974 Show COM4 base i/o port address."), NULL,
987 _("Print DOS serial port status."));