Sascha, > -----Original Message----- > From: Sascha Hauer [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 03, 2008 9:15 AM > To: Menon, Nishanth > Cc: u-boot-users@lists.sourceforge.net; Laurent Desnogues; [EMAIL PROTECTED]; > [EMAIL PROTECTED]; Gopinath, Thara; Kamat, Nishant; Syed Mohammed, Khasim > Subject: Re: [Patch 02/17] U-Boot-V2:Common:Clock Handle case ofclockrollover > for get_time_ns > > > Assumptions made: > > A) The bits masked out by cs->mask will remain constant. This may not be > > true. > > Eh? That's why they are masked out. For the sake of discussion: unsigned int now = 0x120; unsigned int last = 0x128; unsigned int mask = 0xFFF0; unsigned int delta1 = now - last; unsigned int delta2 = (now & mask) - (last & mask); printf ("delta1=0x%08X maskdelta1=0x%08X delta2=0x%08X\n",delta1, delta1 & mask, delta2);
Output will be: delta1=0xFFFFFFF8 maskdelta1=0x0000FFF0 delta2=0x00000000 What we will get now is maskdelta1, while delta2 is the right value. > > > B) Roll over assume the min is 0 and max is cs->mask. This need not be the > > case. > > It would be good to be explicit. > > Do you know any counter that does not start counting from zero? If you I do not. I am just being a paranoid idiot ;).. > have, noone prevents you from substracting the value in your clocksource > read function. Max however is assumed to be cs->mask then. We could have timers which can be configured for ticking till a configured max. probably my paranoia kicking in again? Regards, Nishanth Menon ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users