delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/04/14/05:25:01

Date: Thu, 14 Apr 94 02:40:25 -0600
From: jan kok <kok AT CS DOT ColoState DOT EDU>
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: aeasy102 hanging

Summary: I'm trying to send and receive data through a serial port using
the aeasy102 package.  I'm getting hangups using the atest demo program.

Could someone who understands PC assembly language programming look at
the following code from the beginning of asynctsr.asm and tell me if
it looks ok?

isr_handler:
        pusha
        mov     al,20h    ; End Of Interrupt command.
        out     20h,al    ; Send to 8259 interrupt controller.
	...

I'm suspicious of issuing the end of interrupt at the *beginning* of the
ISR.  Wouldn't this allow another interrupt from the UART to occur in
the middle of servicing an earlier interrupt from the UART?  Especially
if the UART has a buffer of several characters, then it could issue
interrupts pretty fast, I would think.

(I'd change the code and try it, but I don't have an Intel-format assembler
handy.)

Here's a simple way to cause the hangup:  Just put a loopback connector
on the serial port.  Modify atest as follows:

...
    if (kb_ready())
    {
      char ch = kb_rx();
      if (ch == '~')
        exit(0);
      for (x=1; x<25; x++)          <= add this line
      async_tx(port,ch);
      exit (0);                     <= add this line
    }
...

Now do

asynctsr 2
mode com2:9600,n,8,1
atest 2 0
q
atest 2 0
    (atest prints out 24 q's)
w
atest 2 0
    (atest prints out 24 w's)
y
atest 2 0
    (atest prints out *23* y's)
u
atest 2 0
    (atest prints nothing!)

Try different keys.  It seems to get "poisoned" by certain letters.  For
example, it seems to be especially prone to hanging after "y"!

Thanks...
- Jan

P.S. to Michael Snoswell: Thanks for the suggestion, but I don't see much
evidence for accusing the mode command.  I've tried both MS-DOS and DRDOS
mode commands and both produce the same results.  The failure doesn't seem
to be correlated with using the mode command; on the contrary, mode can get
the serial port unhung.

- Raw text -


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