Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!cbmvax!rsbx From: rsbx@cbmvax.commodore.com (Raymond S. Brand) Newsgroups: comp.sys.amiga.hardware Subject: Re: Shared Interrupts (was Parallel Port question) Keywords: interrupts Message-ID: <14434@cbmvax.commodore.com> Date: 14 Sep 90 02:53:38 GMT References: <28208@swrinde.nde.swri.edu> Organization: Commodore-Amiga Inc, West Chester, PA Lines: 112 In article <28208@swrinde.nde.swri.edu>, kent@swrinde.nde.swri.edu (Kent D. Polk) writes: > In article <1990Sep13.000531.15782@msuinfo.cl.msu.edu> wille@frith.msu.edu > (Jeffrey Wille) writes: > >I am currently working on a project which involves data acquisition. I need > >to read the parallel port at an average rate of every 35 microseconds. > ... > >data processing. What I would like to do, is put the data in a buffer, and > >have my A500 periodically empty the buffer in the tightest loop possible. > > This brings to mind some of my questions regarding PORTB shared interrupts. > Now shared interrupts are a bit new to me, so please forgive my ignorance... > > Anyway, I am using an open collector, inverted logic signal interrupt > hooked to the PORTB interrupt line on my A2500/30 so I can be nice and > share the interrupt with the three other tasks that typically are using > it. When I generate an interrupt, I hold the line low until I can read > my interrupt status register to determine if it was my board or not > that pulled the line low. If mine, I reset the interrupt line to high > and reenable my interrupt when leaving the isr. Note that I have my own > enable/disable interrupt control handling for this stuff. > > Questions regarding the proper use of shared interrupts: > > 1) Should I reset the interrupt line first thing in the isr, or hold it > low until I'm finished? My isr is pretty busy & takes about 600 us to Doesn't matter when you release the interrupt line; however, we recomend your interrupt code take less than 250 us. > complete its dirty work. (at least for now, since it is written in > 'C'). In case you were wondering, this is what Jeffrey's input buffer > question has to do with this whole discussion... > > 2) What about shared interrupts hitting at or near the same time: > a. Do the other PORTB isr's hold the line low until finished (2091 SCSI, > Keyboard * timer) ? > b. How are multiple interrupts hits (at the 'same time') recognized > by the system? > c. Guru's Guide indicates how one should exit a shared isr when you > determine it was your hardware which pulled the interrupt. - If > multiple hits at the same time aren't registered, how do I know that > I'm not stealing an interrupt when my hardware says it did it? As a > matter of fact, I can do just that - not hook up my interrupt line & still > process what are actually someone else's interrupts as if they were > mine. > d. Can I just say 'Not mine' to all of them? Does the system get confused > when no one claims a shared interrupt? I realize that might slow things > down a bit, but if it is safer then I can do it. Everytime a shared interrupt happens, everyone on the list gets to check for it's interrupt (unless someone short circuits the list). Exec takes care of the bits in _intena for you. If after processing the list of servers, an interrupt is (still) pending, the list is re-traversed. What this means is: if your box that drags the interrupt line needs to be tickled to release it and no-one tickles it, your Amiga will "busy wait" at the interrupt level. > 3) Do most shared interrupts incorporate a timeout - say - maybe 100 ms or > so? I plan on doing this as it is pretty easy, but am mainly curious. The > main reason is that when my program exits ungracefully, the interrupt doesn't > get serviced & poor Amy is left out in the cold, waiting for someone to > rescue her from the evil clutches of Dr. Loe :^) > > Right now Mr. Crowbar and I attack Dr. Loe in an effort to rescue the > fair lady. The idea is to make sure that there is an interrupt server for your box in the chain at any time that your box can generate an interrupt (see "busy wait" above). > (Ok, Ok, you would be this way too after spending a few weeks of 15 > hour days on this project) > > 4) My trigger circuits have a recovery time (tank circuit) of about 5 > ms. & the interrupt is tied to them. Right now, I don't need to > service interrupts any faster, & indeed seem to be able to do this > quite easily with the 2500. Problem is, every now and then, I seem to > be trashing the machine - trackdisk.device appears to be the culprit, > but I know better, so apparently I am trashing trackdisk.device. Debugging interrupt routines involves staring at the code for a long time, disassembling the code the processor is executing and staring at that for a long time, and the use of an analyzer if you have one. Check for race- conditions with the process part of your code. > I suspect this has something to do with how I am exiting my isr. Any > suggestions? (other than writing it in assembler - I know, some day > when I get around to it) > > > I looked at the hardware RKM for some help, but found it terse > >at best. If someone could answer my questions, or direct me to a book > >with decent information, it would be appreciated. > > Me too. The Guru's Guide is great, but doesn't answer all my questions. A good source of information on writing interrupt servers for the Amiga is the Amiga itself and a disassembler... :-) > >I would really appreciate getting some answers to these questions, or > >being directed to a book that has the info I'm looking for. Actually, > >a book would be best. I am writing this in behalf of my brother, whose > >machine is not on the net. > > Kent Polk: Southwest Research Institute (512) 522-2882 rsbx ------------------------------------------------------------------------ Raymond S. Brand rsbx@cbmvax.commodore.com Commodore-Amiga Engineering ...!uunet!cbmvax!rsbx 1200 Wilson Drive (215)-431-9100 West Chester PA 19380 "Looking" ------------------------------------------------------------------------