Date: Fri, 11 Nov 1994 08:01:47 -0500 (EST) From: Long Doan Subject: Re: A question about writing interrupt handler in gcc To: ALAN L HIGHTOWER Cc: djgpp AT sun DOT soe DOT clarkson DOT edu On Wed, 9 Nov 1994, ALAN L HIGHTOWER wrote: > I have a handler that catches irqs off a Gravis UltraSound. My main > problem centers around the timer. Using MSC v6.0, the handler keeps up > with the UltraSound perfectly, even all the way up to the GUS's maximum > timer resolution of one tic per 80us, or 12500 times a second. However, > using djgpp I hit the max at about 100 times a second. Look at the fullscreen debugger (fsdb104.zip : oak.oakland.edu /SimTel/msdos/djgpp) The debugger's timer routine was designed to work (and has been tested with) timer setting at 1ms. > I'm using the dpmi chain pm int vector to establish the handler, > and doing nothing more than checking the type of int and calling the > appropriate function. In the timers case, simply incrementing a var. > As far as the functionality of the handler/irq, it works like a charm, > dma transfers are successfully done via an irq driven system, and voice > related functions are performed correctly, its just the response of the > irq or handler itself really lags. You might want to bypass the _..._chain_interrupt because there is a 'little' overhead involved. > I have also noticed an incredible performance hit when using the > outportb instructions to do just about anything. In the MSC version, a > simple function to inb a voices real linear position could be called > thousands of times a second and never skip a single address in its > reports of where the voice was. On djgpp, the same code takes a lot > longer to execute, and in a continuous loop, jumps speratically like it > isn't able to keep up its polling as fast as the same voice was running. > I am using cli/sti where needed. How much of a hit is reasonable to > expect? Instead of outportb, or whatever, try: asm("movl _portnum, %dx"); asm("movl _value, %al"); asm("out %al, %dl"); Hope that helps, Long. +--------------------------------------------------------+ | Long Doan ldoan1 AT mason1 DOT gmu DOT edu | | ld AT netrix DOT com | +--------------------------------------------------------+