Why doesn't rtc show interrupts in / proc / interrupts?

I wrote a simple application to enable rtc interrupts.

#include <stdio.h>
#include <fcntl.h>
#include <linux/rtc.h>
#include <sys/ioctl.h>   

int main() {
    int fd = open("/dev/rtc0",O_RDONLY);
    int hz = 64;

    if (ioctl(fd, RTC_IRQP_SET, hz) == -1){
        printf("ioctl(RTC_IRQP_SET) failed");
        return 1;
    }    
    if (ioctl(fd, RTC_PIE_ON) == -1){
        printf("ioctl(RTC_PIE_ON) failed");
        return 1;
    }    
}

      

Upon startup, I expected interrupts to appear at /proc/interrupts

under IRQ8.

From https://www.kernel.org/doc/Documentation/rtc.txt :

However, it can also be used to generate signals from a slow 2Hz to a relatively fast 8192Hz, in power-of-two increments. These signals are reported by interrupt # 8. (Oh! So that's what IRQ 8 is for ...) It can also function as a 24-hour alarm, raising IRQ 8 when the alarm goes off.

But there were no changes.

8: 0 1 IO-APIC-edge rtc0

remained passive. What am I missing here?

+3


source to share


1 answer


The answer is that Periodic Interrupts (PIE) are implemented using a timer or hrtimer (depending on your device) and not an RTC. You can watch:

http://lxr.free-electrons.com/source/drivers/rtc/interface.c#L574 and http://lxr.free-electrons.com/source/drivers/char/rtc.c#L445



Basically, you only get an interruption when you set your alarm.

+1


source







All Articles