Re: [uCsimm] timing accuracy

From: Henk Hesselink (henk@anda.nl)
Date: Thu Aug 10 2000 - 07:24:08 EDT


Oops... Write 1000 times "I shall not reformat code before posting".

The BSP_gettimeoffset code I sent out has a bug causing it to ignore lost_ticks: the assignment in the last line before the return should read "+=" and not "=". Here's the revised code.

In kernel/sched.c:

unsigned long
get_lost_ticks(void)
{
        return lost_ticks;
}

In arch/m68knommu/platform/68EZ328/config.c:

unsigned long
BSP_gettimeoffset(void)
{
        unsigned short count;
        unsigned long lost_ticks;
        unsigned long deltat;

        /* pick this up as quickly as possible */
        count = TCN;

        lost_ticks = get_lost_ticks();

        /* take care to preserve accuracy and prevent overflow */
        /* NOTE: with TCMP set to 0xd7e4 (55268), HZ must be >= 16 */
        deltat = (lost_ticks * 1000000) / HZ;
        deltat += (count * (1000000 / HZ)) / TCMP;

        return deltat;
}

Cheers,

Henk Hesselink
Anda Consulting
This message resent by the ucsimm@uclinux.com list server http://www.uClinux.com/



This archive was generated by hypermail 2b30 : Sun Apr 07 2002 - 00:01:37 EST