lkml.org 
[lkml]   [2012]   [May]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectrtc: restoring of periodic irq freqeuncy to original state
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.

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

}
\
 
 \ /
  Last update: 2012-05-02 10:41    [W:0.027 / U:1.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site