Hey,

Still looking for help with the below if anyone has any info?

>Does anyone have any simple example C code for using the one of the timer
>interrupts? I've been looking around for ages and I'm not getting anywhere
>with this! I'd be very grateful if someone could just post up the code that
>would enable the interrupt to execute a small isr function.

I also tried changing the HZ value in /gumstix-buildroot/build_arm_nofpu/linux-2.6.18gum/arch/arm/Kconfig to 1000 to see if I could make the scheduler swap tasks faster and therefore run my code often enough but when I compiled the new filesystem and reflashed the device it still seems to be running with the HZ value of 100. Heres the output of this program:

int main()
{
    struct sched_param sp;
    int periods;
    int ms;
    long i;   

    struct timespec ts;
    struct timeval tv;
   
    ts.tv_sec = 0;
    ts.tv_nsec = 10;
   
    sp.sched_priority = sched_get_priority_max( SCHED_FIFO ) - 1;
   
    if( sched_setscheduler( 0, SCHED_FIFO, &sp ) == -1 )
    {
        printf("Cannot set scheduler\n" );
        return(1);
    }

    for(i = 0; i < 10000000; i++)
     {
        nanosleep(&ts, NULL);
        gettimeofday(&tv, NULL);
        printf("%d\n", tv.tv_usec);
    }

    return(0);
}

Output:

870000
880000
890000
900000
910000
920000
930000
940000
950000
960000
970000

As can be seen it is still loosing processor time for 10ms at a time. Any ideas?

Thanks,
Brendan