linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* rtc: restoring of periodic irq freqeuncy to original state
@ 2012-05-02  8:10 dev
  0 siblings, 0 replies; only message in thread
From: dev @ 2012-05-02  8:10 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 545 bytes --]

Hi Kernel Folks,

Dont' know whether this is a bug or feature. sorry :(.

when the periodic irq's are enabled from the application through the 
ioctl, and when the application suddenly stops, the irq frequency was 
not reverted back to the original one.

say for ex..
            if my original freq was 1024, and i set it using IRQP_SET 
with 512.
            so when i stop my program the original freq was not set back 
and the program set frequency is appearing in the /proc/driver/rtc.

Attached is the test program.


Thanks,
Devendra C.


[-- Attachment #2: hwclock_freq_timer.c --]
[-- Type: text/x-csrc, Size: 865 bytes --]

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

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");
    }
    
}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-05-02  8:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-02  8:10 rtc: restoring of periodic irq freqeuncy to original state dev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).