Google
  Web www.spinics.net

Re: Read CCNT on PXA255

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Junaid Jamil wrote:
> Thanks Gilles,
> Well for PXA 25x it seems this 32 bit OSCR will overflow in about
> 19minutes. I think I have correctly done the math:
> 
> the max value this 32bit counter can have = power(2,32) = 4294967296
> In 1 sec this OSCR is increamented by 3686400.
> So, OSCR will overflow after 4294967296/3686400 = 1105.084444 sec
> In other words will overflow in 1105.084444/60 = 19.41807 minutes.
> 
> But how my program come to know when OSCR overflow? Any interrupt etc?

When an overflow occurs between two read, the second value you will read
will be smaller than the first one. If you compute the difference
between the two reads as an unsigned, it will do the right thing, and
you will not have to take care about overflows.

-- 
					    Gilles.

-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php

[Site Home]     [Linux ARM Kernel]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Tools]     [DDR & Rambus]     [Monitors]

Add to Google Google PageRank Checking tool