/* * Real Time Clock Driver Test/Example Program * * Copyright (C) 1996, Paul Gortmaker. * zaptel modifications (C) 2003 Junghanns.NET GmbH, Klaus-Peter Junghanns * * Released under the GNU General Public License, version 2, * included herein by reference. * */ #include #include #include #include #include #include #include #include int main(void) { int i, fd, retval, irqcount = 0; unsigned long tmp, data; struct rtc_time rtc_tm; fd = open ("/dev/rtc", O_RDONLY); if (fd == -1) { perror("/dev/rtc"); exit(errno); } /* Turn off update interrupts */ retval = ioctl(fd, RTC_UIE_OFF, 0); if (retval == -1) { perror("ioctl1"); exit(errno); } /* Disable alarm interrupts */ retval = ioctl(fd, RTC_AIE_OFF, 0); if (retval == -1) { perror("ioctl2"); exit(errno); } retval = ioctl(fd, RTC_IRQP_SET, 1000); if (retval == -1) { perror("ioctl3"); exit(errno); } /* Enable periodic interrupts */ retval = ioctl(fd, RTC_PIE_ON, 0); if (retval == -1) { perror("ioctl4"); exit(errno); } for (;;) { sleep(10000); } close(fd); return 0; } /* end main */