X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Ftime.h;h=3b2ba091247030d8a440c524441dfde060ad2580;hb=6786ce1ce14feb4d02854a0c04bc0cce505be46e;hp=31d386729ef5b1f7fa4bf7b2eb857c3237f5546f;hpb=036a017f79f6c485605c555b3a8733debb72d995;p=platform%2Fkernel%2Fu-boot.git diff --git a/include/time.h b/include/time.h index 31d3867..3b2ba09 100644 --- a/include/time.h +++ b/include/time.h @@ -6,6 +6,8 @@ #include #include +ulong get_tbclk(void); + unsigned long get_timer(unsigned long base); /* @@ -15,6 +17,17 @@ unsigned long get_timer(unsigned long base); unsigned long timer_get_us(void); uint64_t get_timer_us(uint64_t base); +/** + * get_timer_us_long() - Get the number of elapsed microseconds + * + * This uses 32-bit arithmetic on 32-bit machines, which is enough to handle + * delays of over an hour. For 64-bit machines it uses a 64-bit value. + * + *@base: Base time to consider + *Return: elapsed time since @base + */ +unsigned long get_timer_us_long(unsigned long base); + /* * timer_test_add_offset() * @@ -70,11 +83,30 @@ uint64_t usec_to_tick(unsigned long usec); (time_after_eq(a,b) && \ time_before(a,c)) +/* Same as above, but does so with platform independent 64bit types. + * These must be used when utilizing jiffies_64 (i.e. return value of + * get_jiffies_64() */ +#define time_after64(a,b) \ + (typecheck(__u64, a) && \ + typecheck(__u64, b) && \ + ((__s64)((b) - (a)) < 0)) +#define time_before64(a,b) time_after64(b,a) + +#define time_after_eq64(a,b) \ + (typecheck(__u64, a) && \ + typecheck(__u64, b) && \ + ((__s64)((a) - (b)) >= 0)) +#define time_before_eq64(a,b) time_after_eq64(b,a) + +#define time_in_range64(a, b, c) \ + (time_after_eq64(a, b) && \ + time_before_eq64(a, c)) + /** * usec2ticks() - Convert microseconds to internal ticks * * @usec: Value of microseconds to convert - * @return Corresponding internal ticks value, calculated using get_tbclk() + * Return: Corresponding internal ticks value, calculated using get_tbclk() */ ulong usec2ticks(unsigned long usec); @@ -82,7 +114,7 @@ ulong usec2ticks(unsigned long usec); * ticks2usec() - Convert internal ticks to microseconds * * @ticks: Value of ticks to convert - * @return Corresponding microseconds value, calculated using get_tbclk() + * Return: Corresponding microseconds value, calculated using get_tbclk() */ ulong ticks2usec(unsigned long ticks); @@ -96,4 +128,21 @@ ulong ticks2usec(unsigned long ticks); */ void wait_ticks(unsigned long ticks); +/** + * timer_get_us() - Get monotonic microsecond timer + * + * Return: value of monotonic microsecond timer + */ +unsigned long timer_get_us(void); + +/** + * get_ticks() - Get the current tick value + * + * This is an internal value used by the timer on the system. Ticks increase + * monotonically at the rate given by get_tbclk(). + * + * Return: current tick value + */ +uint64_t get_ticks(void); + #endif /* _TIME_H */