//------------------------------------------------------------------- // 2seconds.cpp // // This program opens the '/dev/nic' device-file created by our // our special 'nictimer.c' device-driver so that it will start // counting each timer-interrupt that is generated by the 8139; // then, after sleeping for two seconds, it closes tha file, to // stop any further timer-interrupts. The driver's outputs the // number of timer-interrupts that were triggered while asleep. // // programmer: ALLAN CRUSE // written on: 02 MAY 2005 //------------------------------------------------------------------- #include // for perror() #include // for open() #include // for exit() #include // for close() char devname[] = "/dev/nic"; int main( int argc, char **argv ) { int nic = open( devname, O_RDONLY ); if ( nic < 0 ) { perror( devname ); exit(1); } sleep( 2 ); close( nic ); }