-Common Interrupt mistakes
Remember, hardware interrupts are from 8-15, IRQ's are numbered 0-7
Forgetting to clear the IRQ mask bit in the IMR
Forgetting to send the EOI command after ISR code. Disables further interrupts.
Example on Interrupt vector table setup in C-code:
void far _interrupt new_IRQ1_handler(void );
/* ISR function prototype */
#define IRQ1_VECTOR
3
/* Name for IRQ */
void (interrupt far *old_IRQ1_dispatcher)
(es,ds,di,si,bp,sp,bx,dx,cx,ax,ip,cs,flags);
/* Variable to store old IRQ_Vector */
void far _interrupt new_IRQ1_handler(void );
/*----------------------------------------------------------------------
| Function:
init_irq_handlers
| Inputs:
Nothing
| Returns:
Nothing
| Purpose:
Set the pointers in the interrupt table to point to
|
our funtions ie. setup for ISR's.
|----------------------------------------------------------------------*/
void init_irq_handlers(void)
{
_disable();
old_IRQ1_handler = _dos_getvect(IRQ1_ 8);
_dos_setvect(IRQ1_ 8, new_IRQ1_handler);
Gi_old_mask = inp(0x21);
outp(0x21,Gi_old_mask & ~(1 << IRQ1_VECTOR));
_enable();
}
DM5854HR/DM6854HR Page 40 (c) RTD Finland Oy 1996-2001