Hello,

I'm using a RISCStation board with ARM Linux 2.2.17, and am having
problems using the Real Time Clock. I wanted to run a routine roughly
every second, and rather than continually polling gettimeofday() I
thought I could use the RTC (like it says in
linux/Documentation/rtc.txt). However although I can read the time from
it using ioctls, and doing things like 'cat /proc/rtc' and 'cat
/proc/interrupts' provide appropriate responses, the clock doesn't
appear to generate any interrupts. This means that when I call read(),
the program blocks forever.

Can anyone tell me what's going on here, or point me in the direction of
the file I need to fix?

Thanks in advance...

Chris West
[EMAIL PROTECTED]

PS. I've included a snippet from the code I'm using (just in case). It
works fine on my i386-pc-linux-gnu box, but blocks forever at the read()
call on the ARM.

    ...

    int io_status, rtc;
    unsigned long r_data;
    fd_set read_rtc;
    struct timeval timeout = { 0, 0 };

    rtc = open( "/dev/rtc", O_RDONLY );
    if( rtc == -1 ) exit(1);

    io_status = ioctl( rtc, RTC_UIE_ON, 0 );
    if( io_status == -1 ) exit(1);

    ...

    while( running ) {
        FD_ZERO( &read_rtc );
        FD_SET( rtc, &read_rtc );

        cerr << "selecting rtc..." << flush;
        io_status = select( rtc+1, &read_rtc, NULL, NULL, &timeout );
        if( io_status == -1 ) break;

        cerr << "reading rtc..." << flush;
        io_status = read( rtc, &r_data, sizeof(unsigned long) );
        if( io_status == -1 ) break;

        [ do stuff ]
    };

_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
Please visit the above address for information on this list.

Reply via email to