cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/27/12:43:29

Date: Thu, 27 Aug 1998 20:15:55 +0400 (MSD)
From: "Alexander S. Aganichev" <asa AT lan DOT eed DOT miee DOT ru>
To: djgpp AT delorie DOT com
Subject: uclock ()
Message-ID: <Pine.BSF.3.96.980827201415.6189B-100000@lan.eed.miee.ru>
MIME-Version: 1.0

Greencity'ngs, dear all!

During debugging my program i found that in rare conditions return value
of second call to uclock is lesser than first. I made patch, that works on
all my boards, but I'm still unsure if *ALL* PC with i386 or higher
contains RTC8254. Could anyone comment my patch, so i could rebuild all my
applications with patched library?

*** uclock.c	Thu Jan 25 21:39:06 1996
--- uclock.new	Mon Aug  3 14:13:12 1998
***************
*** 20,26 ****
  {
    static uclock_t base = 0;
    static unsigned long last_tics = 0;
!   unsigned char lsb, msb;
    unsigned long tics, otics;
    uclock_t rv;
  
--- 20,26 ----
  {
    static uclock_t base = 0;
    static unsigned long last_tics = 0;
!   unsigned char lsb, msb, status;
    unsigned long tics, otics;
    uclock_t rv;
  
***************
*** 41,51 ****
    /* Make sure the numbers we get are consistent */
    do {
      otics = _farpeekl(_dos_ds, 0x46c);
!     outportb(0x43, 0x00);
      lsb = inportb(0x40);
      msb = inportb(0x40);
      tics = _farpeekl(_dos_ds, 0x46c);
!   } while (otics != tics);
  
    /* calculate absolute time */
    msb ^= 0xff;
--- 41,52 ----
    /* Make sure the numbers we get are consistent */
    do {
      otics = _farpeekl(_dos_ds, 0x46c);
!     outportb(0x43, 0xd0);
!     status = inportb(0x40);
      lsb = inportb(0x40);
      msb = inportb(0x40);
      tics = _farpeekl(_dos_ds, 0x46c);
!   } while ((otics != tics) && (status & 0x40));
  
    /* calculate absolute time */
    msb ^= 0xff;

Signed
Alex. S. Aganichev

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019