X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=carlfw%2Finclude%2Ftimer.h;h=1b9d1c17f74f00f73eb92a57b5764555e43403f7;hb=dbb81597c39e9ecf9a76420ac374a179d5b94c91;hp=7e4cb4cd69a2a5a4bebac5a8f4b38f206b7e1fd9;hpb=7c60c5e57519144942267d382d3658c070bc89e7;p=carl9170fw.git diff --git a/carlfw/include/timer.h b/carlfw/include/timer.h index 7e4cb4c..1b9d1c1 100644 --- a/carlfw/include/timer.h +++ b/carlfw/include/timer.h @@ -47,7 +47,7 @@ static inline __inline uint32_t get_clock_counter(void) */ static inline __inline bool is_after_msecs(const uint32_t t0, const uint32_t msecs) { - return ((get_clock_counter() - t0) / 1000) > (msecs * fw.ticks_per_msec); + return ((get_clock_counter() - t0) / 1000) > (msecs * fw.ticks_per_usec); } /* @@ -60,7 +60,7 @@ static inline __inline void delay(const uint32_t msec) { uint32_t t1, t2, dt, wt; - wt = msec * fw.ticks_per_msec; + wt = msec * fw.ticks_per_usec; t1 = get_clock_counter(); while (1) { @@ -79,10 +79,13 @@ static inline __inline void udelay(const uint32_t usec) while (1) { t2 = get_clock_counter(); dt = (t2 - t1); - if (dt >= (usec * fw.ticks_per_msec)) + if (dt >= (usec * fw.ticks_per_usec)) break; } } void clock_set(enum cpu_clock_t _clock, bool on); +void handle_timer(void); +void timer_init(const unsigned int timer, const unsigned int interval); + #endif /* __CARL9170FW_TIMER_H */