home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / os9 / 1645 < prev    next >
Encoding:
Text File  |  1993-01-28  |  2.2 KB  |  55 lines

  1. Newsgroups: comp.os.os9
  2. Path: sparky!uunet!mcrware!dibble
  3. From: dibble@microware.com (Peter Dibble)
  4. Subject: Re: PROBLEM with my IRQ routines
  5. Message-ID: <1993Jan27.193853.27880@microware.com>
  6. Sender: news@microware.com
  7. Nntp-Posting-Host: seldon
  8. Organization: Microware Systems Corp., Des Moines, Iowa
  9. References: <105860@netnews.upenn.edu>
  10. Date: Wed, 27 Jan 1993 19:38:53 GMT
  11. Lines: 42
  12.  
  13. In article <105860@netnews.upenn.edu> mark@ginger.biophys.upenn.edu (Mark Elliott) writes:
  14. >---------------------THE QUESTION-----------------------------------------------
  15. >    Does anyone know how an Interrupt Service Routine loaded in the IRQ
  16. >table can find out the vector number of the interrupt which caused it to be
  17. >invoked?
  18. >--------------------------------------------------------------------------------
  19. >As it is now, I have as many ISRs as I do
  20. >boards, all of them almost identical.
  21. >---------------------------------------------------------------------------------
  22. >
  23. >Mark Elliott                       |     
  24.  
  25. The information you want is on the stack.
  26. The hardware puts the vector number in the interrupt stack frame 
  27. if you are using something more recent than a 68000, and the jump 
  28. table puts it on the stack for any processor.  
  29. Although the information you want is there, I recommend that you don't 
  30. look for it.  That kind of thing is undocumented and very subject to change.
  31.  
  32. You can improve your situation a lot with a little bit of entirely
  33. "front door" trickery.
  34.  
  35. Continue to set up a separate ISR for each vector, but do very little
  36. before you enter common code that is shared between all the devices.
  37. The most space-efficient way I know to do this is:
  38.  
  39. ISR1: addq.l #4,a3 kick port address 
  40. ISR2: addq.l #4,a3 kick port address 
  41. ISR3: addq.l #4,a3 kick port address 
  42. ISR4: addq.l #4,a3 kick port address 
  43. ISR5: addq.l #4,a3 kick port address 
  44. ISR6: addq.l #4,a3 kick port address 
  45. ISR7: common code
  46.  
  47. There'll be a loop somewhere else that F$IRQ's all 7 ISRs.
  48.  
  49. This is a bit space inefficient, but if the difference between
  50. your devices is just their port address, or something you can express
  51. in small amounts of static storage, it will let you fold a bunch of
  52. interrupt service routines into one with little overhead.
  53.  
  54. Peter
  55.