#include #include #include #include #include #include main() { struct rtc_time rtc_time; int fd; char data[BUFSIZ]; int irqfre; int ret; fd = open("/dev/rtc", O_RDWR); if (fd < 0) { printf("can't open /dev/rtc\n"); return; } ret = ioctl(fd, RTC_IRQP_READ, &irqfre); if (ret == 0) { /* printf("Rate: %d\n", irqfre); */ irqfre = 1024; ret = ioctl(fd, RTC_IRQP_SET, irqfre); } if (ret < 0) { printf("Can't read periodic IRQ's\n"); } ret = ioctl(fd, RTC_PIE_ON, NULL); if (ret < 0) { printf("can't set the periodic irq\n"); close(fd); return; } while(read(fd, &data, sizeof(data)) > 0) { printf("Intr\n"); } }