/*============= Block IO access : blockio.c ======================= PURPOSE - show use of block IO and blocking interrupts with an IO enabling program. Usage is- ./iopl_start ./block_io NOTE - Put a CRO on pin 2 of the PP port to see 1 us data changes. Pins 3-9 act as high order bits of a counter and should also be examined. */ #include #include #include /* for IO access.*/ #define BASEPORT 0x378 /* data port of lp0 ( DOS LPT1) */ int main(int argc, char *argv[]) {/*--- tell user what is happening.*/ printf("\n This machine will hangup for about 8 seconds and toggle pins\n") ; printf(" 2-9 of the first printer port ( lp0). D0 ( pin 2) outputs\n") ; printf(" a 500kHz squarewave, D1 ( pin 3) 250 kHz down to D7 ( pin 9)\n") ; printf(" at about 3.9 kHz.\n\n") ; /*--- fill up a buffer, sent it out with interrupts off.*/ #define ITERATIONS 8000000 char buffer [ITERATIONS] ; int j ; for (j=0 ; j