User’s Manual
GSM35
30
RTD Finland Oy
Example on Interrupt vector table setup in C-code:
void far _interrupt new_IRQ1_handler(void );
/* ISR function */
#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();
}
|/*----------------------------------------------------------------------
| Function:
restore, do this before exiting program
| Inputs:
Nothing
| Returns:
Nothing
| Purpose:
Restore the interrupt vector table.
|----------------------------------------------------------------------*/
void restore(void)
{
/* Restore the old vectors */
_disable();
_dos_setvect(IRQ1_ 8, old_IRQ1_handler);
outp(0x21,Gi_old_mask);
_enable();
}