/* irq188.c * * Example for using IRQs on Intel 188eb based * Single Board Computers. * * This code has been cut from an existing program and may require * additional debugging to work stand alone. */ #include "188regs.h" /************************* IRQ Test ********************************/ /* global interrupt flags */ unsigned char int0, int1, int2, int3, int4; /***************************************************** Interrupt test *****************************************************/ void interrupt far isr0() /* IRQ4 */ { int0 = 1; outpw(EOI, 0x8000); /* non-specific EOI */ } void interrupt far isr1() /* IRQ5 */ { int1 = 1; outpw(EOI, 0x8000); /* non-specific EOI */ } void interrupt far isr2() /* IRQ6 */ { int2 = 1; outpw(EOI, 0x8000); /* non-specific EOI */ } void interrupt far isr3() /* IRQ7 */ { int3 = 1; outpw(EOI, 0x8000); /* non-specific EOI */ } void interrupt far isr4() /* Misc */ { int4 = 1; outpw(EOI, 0x8000); /* non-specific EOI */ } void IRQdebug(void) { unsigned char ch; printf("\nInterrupt test\n"); _disable(); outp(I0CON, 0x0F); outp(I1CON, 0x0F); outp(I2CON, 0x0F); outp(I3CON, 0x0F); outp(I4CON, 0x0F); _dos_setvect(12, isr0); /* INT0 */ _dos_setvect(13, isr1); /* INT1 */ _dos_setvect(14, isr2); /* INT2 */ _dos_setvect(15, isr3); /* INT3 */ _dos_setvect(17, isr4); /* INT4 */ _enable(); /******************** PC-104 source interrupts *********************/ outp(IMASK, 0x04); /* unmask IRQs */ printf("(PC104) Trigger IRQ4 "); int0 = 0; while(1) { if(int0) { printf("Passed\a\n"); break; } if (kbhit()) if (getch() == 27) { printf("******\a\n"); break; } } printf("(PC104) Trigger IRQ5 "); int1 = 0; while(1) { if(int1) { printf("Passed\a\n"); break; } if (kbhit()) if (getch() == 27) { printf("******\a\n"); break; } } printf("(PC104) Trigger IRQ6 "); int2 = 0; while(1) { if(int2) { printf("Passed\a\n"); break; } if (kbhit()) if (getch() == 27) { printf("******\a\n"); break; } } printf("(PC104) Trigger IRQ7 "); int3 = 0; while(1) { if(int3) { printf("Passed\a\n"); break; } if (kbhit()) if (getch() == 27) { printf("******\a\n"); break; } } printf("(PC104) Trigger INT4 "); outp(IMASK, 0xF4); /* Mask Other Interrupts */ int4 = 0; while(1) { if(int4) { printf("Passed\a\n"); break; } if (kbhit()) { ch = getch(); if (ch == 27) { printf("******\a\n"); break; } if (toupper(ch) == 'T') putch(0); } } outp(IMASK, 0xFC); /* Mask Interrupts */ printf("\nInterrupt Test Complete\n"); } main() { IRQdebug(); }