Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!pacbell.com!tandem!netcomsv!resnicks From: resnicks@netcom.COM (Steve Resnick) Newsgroups: comp.os.msdos.programmer Subject: Re: Handling interrupts in C Message-ID: <1991Jun7.171600.5002@netcom.COM> Date: 7 Jun 91 17:16:00 GMT References: <334@nazgul.UUCP> <15590004@hpfcso.FC.HP.COM> Organization: Netcom - Online Communication Services UNIX System {408 241-9760 guest} Lines: 50 In article <15590004@hpfcso.FC.HP.COM> pgt@hpfcso.FC.HP.COM (Paul Tobin) writes: >* Neat trick. :-) >* How does one pass arguments to an ISR? I would not think anything would >* be passed, unless you consider the registers "passed" to it. > >I suppose TC++ could actually catch the interrupt and generate a call >frame for your ISR, eh (what stack is in use at that time)? I wonder >what good that would do, though? It could pass in global variables, >but the ISR could get at those itself. Can anyone think of any other >ideas? In the Asynch driver I wrote, I have default ISR's for 4 comm ports. These ISR's look like: void interrupt IsrCOM1(void) { IsrHandler(0); } void interrupt IsrCOM2(void) { IsrHandler(1); } . . . void IsrHandler(int PortID) { . . . [Handle the interrupt and return] } This allows me to have one real ISR which gets called by the dummy ISR's identifying which UART needs serivce, rather than duplicating code for each serial port. The routine, IsrHandler(), is re-entrant, meaning that it doesn't modify global variables, nor does it have any static variables. Hope this helps... Steve -- ------------------------------------------------------------------------------- resnicks@netcom.com, steve@camphq, IFNA: 1:143/105.0, co moderator for comp.binaries.os2 Real life: Steve Resnick. Chief Software Architect, Process Scientific, Inc Flames, grammar and spelling errors >/dev/null The Asylum OS/2 BBS - (408)263-8017 12/2400,8,1 - Running Maximus CBCS 1.2 -------------------------------------------------------------------------------