TIOCTIMESTAMP capability. The port in question must be configured with
authorPoul-Henning Kamp <phk@FreeBSD.org>
Thu, 24 Feb 1994 16:39:48 +0000 (16:39 +0000)
committerPoul-Henning Kamp <phk@FreeBSD.org>
Thu, 24 Feb 1994 16:39:48 +0000 (16:39 +0000)
"vector siointrts".  Thus only a compare is added for the other ports.

sys/i386/isa/sio.c

index 31441f0..6bcee34 100644 (file)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *     from: @(#)com.c 7.5 (Berkeley) 5/16/91
  * SUCH DAMAGE.
  *
  *     from: @(#)com.c 7.5 (Berkeley) 5/16/91
- *     $Id: sio.c,v 1.27 1994/02/06 11:59:35 ache Exp $
+ *     $Id: sio.c,v 1.28 1994/02/07 18:37:21 ache Exp $
  */
 
 #include "sio.h"
  */
 
 #include "sio.h"
@@ -207,6 +207,8 @@ struct com_s {
 #define        CE_INPUT_OFFSET         RS_IBUFSIZE
        u_char  ibuf1[2 * RS_IBUFSIZE];
        u_char  ibuf2[2 * RS_IBUFSIZE];
 #define        CE_INPUT_OFFSET         RS_IBUFSIZE
        u_char  ibuf1[2 * RS_IBUFSIZE];
        u_char  ibuf2[2 * RS_IBUFSIZE];
+       int     do_timestamp;
+       struct timeval  timestamp;
 };
 
 /*
 };
 
 /*
@@ -253,6 +255,8 @@ static      struct com_s    *p_com_addr[NSIO];
 
 static struct com_s    com_structs[NSIO];
 
 
 static struct com_s    com_structs[NSIO];
 
+static  struct  timeval intr_timestamp;
+
 struct isa_driver      siodriver = {
        sioprobe, sioattach, "sio"
 };
 struct isa_driver      siodriver = {
        sioprobe, sioattach, "sio"
 };
@@ -778,6 +782,7 @@ comhardclose(com)
 
        s = spltty();
        iobase = com->iobase;
 
        s = spltty();
        iobase = com->iobase;
+       com->do_timestamp = 0;
        outb(iobase + com_cfcr, com->cfcr_image &= ~CFCR_SBREAK);
        unit = com - &com_structs[0];
 #ifdef KGDB
        outb(iobase + com_cfcr, com->cfcr_image &= ~CFCR_SBREAK);
        unit = com - &com_structs[0];
 #ifdef KGDB
@@ -844,6 +849,14 @@ siowrite(dev, uio, flag)
        return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
 }
 
        return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
 }
 
+/* Interrupt routine for timekeeping purposes */
+void
+siointrts(int unit)
+{
+       microtime(&intr_timestamp);
+       siointr(unit);
+}
+
 void
 siointr(unit)
        int     unit;
 void
 siointr(unit)
        int     unit;
@@ -892,6 +905,8 @@ comintr1(com)
        u_char          *ioptr;
        u_char          recv_data;
 
        u_char          *ioptr;
        u_char          recv_data;
 
+       if(com->do_timestamp)
+               com->timestamp = intr_timestamp;
        while (TRUE) {
                line_status = inb(com->line_status_port);
 
        while (TRUE) {
                line_status = inb(com->line_status_port);
 
@@ -1145,6 +1160,10 @@ sioioctl(dev, cmd, data, flag, p)
        case TIOCMGDTRWAIT:
                *(int *)data = com->dtr_wait;
                break;
        case TIOCMGDTRWAIT:
                *(int *)data = com->dtr_wait;
                break;
+       case TIOCTIMESTAMP:
+               com->do_timestamp = 1;
+               *(struct timeval *)data = com->timestamp;
+               break;
        default:
                splx(s);
                return (ENOTTY);
        default:
                splx(s);
                return (ENOTTY);