X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=carlfw%2Finclude%2Ftimer.h;h=1c1c6cd4fa6f0f30c9f539c0a110c8f78baed5ee;hb=e8d747355467293087e6818a19073627b0528fce;hp=7f6c491d87247cd5ce1461919db4ae852f82aff3;hpb=1765258283f5fc36987ae44cdd516163290629e0;p=carl9170fw.git diff --git a/carlfw/include/timer.h b/carlfw/include/timer.h index 7f6c491..1c1c6cd 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,22 +79,10 @@ 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; } } -static inline void clock_set(enum cpu_clock_t _clock, bool on) -{ - /* - * Word of Warning! - * This setting does more than just mess with the CPU Clock. - * So watch out, if you need _stable_ timer interrupts. - */ - - fw.ticks_per_msec = GET_VAL(AR9170_PWR_PLL_ADDAC_DIV, get(AR9170_PWR_REG_PLL_ADDAC)) >> 1; - - set(AR9170_PWR_REG_CLOCK_SEL, (uint32_t) ((on ? 0x70 : 0x600) | _clock)); -} - +void clock_set(enum cpu_clock_t _clock, bool on); #endif /* __CARL9170FW_TIMER_H */