home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / linux / 21443 < prev    next >
Encoding:
Text File  |  1992-12-22  |  7.0 KB  |  130 lines

  1. Newsgroups: comp.os.linux
  2. Path: sparky!uunet!mcsun!Germany.EU.net!horga!agsc!veeble.han.sub.org!gkminix!gero
  3. From: gero@gkminix.han.de (Gero Kuhlmann)
  4. Subject: Re: internal modem and serial device driver
  5. References: <1992Dec16.230026.9878@sfu.ca>
  6. Organization: gkminix, Hannover, Germany
  7. Date: Tue, 22 Dec 92 02:09:50 GMT
  8. Message-ID: <1992Dec22.020950.3470@gkminix.han.de>
  9. Lines: 119
  10.  
  11. rchen@fraser.sfu.ca (Robert Chen) writes:
  12. > Now for the problem.  I have a 9600bps mouse on /dev/ttys0.  While
  13. > getty_ps is running (and hence accessing ttys2), my X cursor is jumpy
  14. > when I move the mouse.  Since ttys0 and ttys2 share IRQ3, I assume
  15. > that this has something to do with the serial driver (and the fact
  16. > that my modem on ttys2 is not recognised at bootup).
  17. > What I would like to be able to do is access all three com ports
  18. > simultaneously.  I would rather not move the 2400 baud modem to
  19. > another IRQ (not 5 anyway) because I have an ethernet board using that
  20. > IRQ (and it shouldn't be neccessary since at 2400bps, sharing an IRQ
  21. > shouldn't be a problem).
  22. > Can anybody point me to a solution?  Is anybody successfully using
  23. > COM1 and COM3 simultaneously?  Why is my internal modem not
  24. > recognised?  
  25.  
  26. Well, this seems to become a FAQ, so I try to give an answer here.
  27.  
  28. The problem with the PC hardware is that it uses an active high interrupt
  29. system with three-state outputs on the serial cards. That means that normally
  30. the interrupt line is pulled down to zero by the output transistor
  31. (if the interrupt is enabled on the serial card with OUT2). Now if two
  32. cards share the same interrupt line, suppose only one line is trying to
  33. send an interrupt. It then shuts off it's low-driving transistor and enables
  34. it's high driving transistor. Unfortunately the low fan out of the standard
  35. LS-TTL's is 8mA while the high fan out is only -400microA. You can think of
  36. the low driving transistor being about twenty times stronger than the high
  37. pulling one. So the single card trying to send out an interrupt doesn't
  38. have any chance to bring the interrupt line up above the minimum high level
  39. of approx. 2V because there is the low output of the other card. But that
  40. low-to-high-transition is required by the interrupt controller.
  41.  
  42. There is one way to solve that problem. The goal is to combine both output
  43. interrupt lines with a logical OR function. That means, wether one line or
  44. the other is going high, the interrupt controller sees the necessary level
  45. transition. To do this you can either use a 7432 or just a couple of diodes
  46. and resistors. The first solution is not very easy to implement since you
  47. need a lot of wiring. The latter is pretty easy to implement if you know
  48. a bit about digital electronics.
  49. In order to prevent the stronger low-driving transistors on each serial card
  50. to drive the IRQ line to low, it is necessary to insert a diode into each
  51. of the interrupt output lines in the reverse direction of the low current.
  52. Besides, this is the basic logical OR combination:
  53.  
  54.  
  55.         I1 -------->|--------+
  56.                              |
  57.         I2 -------->|--------+----------- O
  58.  
  59. I1 and I2 are the interrupt outputs of the serial cards and O is the output
  60. of the OR function which goes into the interrupt controller.
  61. This logic prevents the IRQ line from going to low. But if no interrupt is
  62. active, it must become low. So we have to simulate the strong pulldown-
  63. transistors of the output drivers by a weaker resistor:
  64.  
  65.         I1 -------->|--------+
  66.                              |
  67.         I2 -------->|--------+----------- O
  68.                              |
  69.                              R
  70.                              |
  71.                             GND
  72.  
  73. This resistor just has to be added onto one of the serial cards because it is
  74. only needed to compensate for the internal pullup-resistor of the interrupt
  75. controller and is thus only required once per IRQ line.
  76.  
  77. How to implement this all? Well on most serial cards and internal modems there
  78. is a jumper field to select the desired interrupt. Normally the output of the
  79. interrupt driver goes onto one side of that jumper, and the other side then
  80. goes directly to the system io bus. Instead of placing a real jumper there
  81. you have to solder in the diode. On one of the serial cards you have to find
  82. GND using a multimeter and then connect a resistor between that ground point
  83. and the output side of the jumper pins.
  84. As diodes I used 1N4148 which worked fine. But they have a pretty high voltage
  85. decrease, so if you have any troubles better use some shottky-diodes. For the
  86. resistors I used 470 ohm types.
  87. Still a problem might be if you don't have a jumper configuration as mentioned
  88. above. My old 2400Baud internal modem had a PAL driving the interrupt directly.
  89. I inserted the diodes between the PAL output and the IC socket. Some newer
  90. serial cards use SMD's. I think it's almost impossible to change anything on
  91. those.
  92.  
  93. Nevertheless there is still a software problem with the linux driver. At least
  94. my pl1 driver had those problems and I think they are still in the pl5 kernel.
  95. I don't know if there are any changes in version 0.99. Well, the problem is
  96. that the driver has to detect, which one of the serial cards issued the inter-
  97. rupt on the IRQ line. To do that it has to look up each serial controller's
  98. interrupt status in sequence. Suppose the driver didn't find anything on the
  99. first controller, it steps over to the second one. There it reads the ISR and
  100. finds exactly one interrupt pending. The serial controller only releases it's
  101. interrupt output AFTER the interrupt source (for example the input channel)
  102. has been processed. The driver finds the receiving interrupt and steps over to
  103. read the input buffer. At this time the first serial card gets a character and
  104. issues an interrupt. After reading the second controller's buffer, that one
  105. sets the IRQ to low, but in the meantime controller 1 pulls IRQ high and so
  106. the line stays active high (remember the logical OR combination). The interrupt
  107. gets only recognized if the line transitions from low to high, but there is no
  108. such transition. After checking out the second serial card the driver termi-
  109. nates and never gets called again for that interrupt: the hardware has blocked.
  110. I wrote a patch for this problem but never made it public because I think
  111. using two serial cards on one interrupt is not a common problem. Obviously
  112. I'm wrong :-) The patch is still for my pl1-kernel, but it should be possible
  113. to adapt it to the new serial driver (if it isn't in there already - but then
  114. it doesn't come from me :-). Send me a mail if you are interested.
  115.  
  116. Not to mention that the above configuration (with the kernel patch) worked
  117. perfectly well on my system. Unfortunately the patch adds some extra code to
  118. the serial driver which makes it a bit slower. I didn't use it at 14.4kBaud
  119. but it should be possible to use 9600Baud and 2400Baud at the same time. As
  120. far as I know the new driver is a bit faster so there shouldn't be any problem
  121. with your mentioned configuration.
  122.  
  123. gero.
  124. -- 
  125. Gero Kuhlmann            Zerberus:  G.KUHLMANN@A-LINK-H.ZER
  126. Donarweg 4            SubNet:    gero@gkminix.sub.org
  127. D-3000 Hannover 51              IN:        gero@gkminix.han.de
  128.