delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2009/05/21/10:00:24

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: =?ISO-2022-JP?B?GyRCPi44UUBnGyhC?= <foxapple AT gmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: An interrupt drived uart program dead
Date: Thu, 21 May 2009 06:49:07 -0700 (PDT)
Organization: http://groups.google.com
Lines: 26
Message-ID: <83605232-a7c9-4de6-98db-1f3122c14584@y33g2000prg.googlegroups.com>
References: <dcff139d-32b8-4f22-ab4a-6f7e78f81324 AT c18g2000prh DOT googlegroups DOT com>
NNTP-Posting-Host: 58.38.4.123
Mime-Version: 1.0
X-Trace: posting.google.com 1242913747 26214 127.0.0.1 (21 May 2009 13:49:07 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: Thu, 21 May 2009 13:49:07 +0000 (UTC)
Complaints-To: groups-abuse AT google DOT com
Injection-Info: y33g2000prg.googlegroups.com; posting-host=58.38.4.123;
posting-account=qc6pEAoAAACyFixjIDHUvf8HsKSt31ce
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)
AppleWebKit/530.9 (KHTML, like Gecko) Chrome/2.0.180.0 Safari/530.9,gzip(gfe),gzip(gfe)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

The bug is found. Rod Pemberton is right. The do-while loop in the
commISR never exits. I miss a "break" statement after "txIdle = true;"
in the do-while loop. the correct code block is follow:
-------------------------------------------------------------------------------------------------------------------------------
     do {
         if (queueSize > 0)
         {
            byte data = writeQueue[queueHead];
            queueHead = (queueHead + 1) % QUEUE_CAPABILITY;
            queueSize --;
            outportb(baseAddress + OFFSET_THR, data);
            txIdle = false;
         }
         else
         {
            txIdle = true;
            break;             // this statement missed so can't exit
the do-while loop.
         }
         lsr = inportb(baseAddress + OFFSET_LSR);
      } while((lsr & (LSR_THRE | LSR_TEMT)) != 0);
-------------------------------------------------------------------------------------------------------------------------------

Very thanks for everybody's help. All suggestion give me the good idea
for the future develop in DOS.
God bless you all ! :-D

- Raw text -


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