outp(wBase+5,0); | /* disable all interrupt */ | |
PIO_DriverClose(); |
|
|
} |
|
|
/* | */ | |
/* Use PC0 as external interrupt signal | */ | |
WORD init_low() |
|
|
{ |
|
|
DWORD dwVal; |
|
|
disable(); |
|
|
outp(wBase+5,0); | /* disable all interrupt */ | |
if (wIrq<8) |
|
|
{ |
|
|
irqmask=inp(A1_8259+1); |
| |
outp(A1_8259+1,irqmask & (0xff ^ (1 << wIrq))); | ||
setvect(wIrq+8, irq_service); |
| |
} |
|
|
else |
|
|
{ |
|
|
irqmask=inp(A1_8259+1); | /* IRQ2 */ | |
outp(A1_8259+1,irqmask & 0xfb); | ||
outp(A1_8259+1,irqmask & (0xff ^ (1 << wIrq))); |
irqmask=inp(A2_8259+1);
outp(A2_8259+1,irqmask & (0xff ^ (1 <<
}
outp(wBase+0x2a,0); | /* select the | |
now_int_state=0; | /* now int_signal is low | */ |
outp(wBase+5,1); | /* enable interrupt | */ |
enable(); |
|
|
} |
|
|
void interrupt irq_service() |
| |
{ |
|
|
if (now_int_state==0) |
|
|
{ | /* find a high_pulse | */ |
COUNT++; | ||
outp(wBase+0x2a,1); | /* select the inverte input */ | |
now_int_state=1; | /* now int_signal is High | */ |
} |
|
|
else |
|
|
{ |
|
|
outp(wBase+0x2a,0); | /* find a low_pulse here | */ |
/* select the | ||
now_int_state=0; | /* now int_signal is High | */ |
} |
|
|
if (wIrq>=8) outp(A2_8259,0x20); outp(A1_8259,0x20);
}
Refer to Sec. 2.5.1 for more information.
|