X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=carlfw%2Finclude%2Ftimer.h;h=bf2f310ba07f4cf08c64b4083bf40fd8bc996d4f;hb=13859edfa20c4b84b575f8e872636fd8cdd81d7f;hp=8c3df1b224028eeab14a8c6ca449ce7cc9d8bdae;hpb=e72388a0aa23da8bc8e24a0cbe9d523c5a9ce294;p=carl9170fw.git diff --git a/carlfw/include/timer.h b/carlfw/include/timer.h index 8c3df1b..bf2f310 100644 --- a/carlfw/include/timer.h +++ b/carlfw/include/timer.h @@ -37,10 +37,6 @@ enum cpu_clock_t { #define AR9170_TICKS_PER_MICROSECOND 80 -void handle_timer(void); -void timer_init(const unsigned int timer, const unsigned int interval); -void clock_set(const bool on, const enum cpu_clock_t _clock); - static inline __inline uint32_t get_clock_counter(void) { return (get(AR9170_TIMER_REG_CLOCK_HIGH) << 16) | get(AR9170_TIMER_REG_CLOCK_LOW); @@ -77,4 +73,15 @@ static inline __inline void udelay(uint32_t usec) } } +static inline void clock_set(const bool on, const enum cpu_clock_t _clock) +{ + /* + * Word of Warning! + * This setting does more than just mess with the CPU Clock. + * So watch out, if you need _stable_ timer interrupts. + */ + + set(AR9170_PWR_REG_CLOCK_SEL, (uint32_t) ((on ? 0x70 : 0x600) | _clock)); +} + #endif /* __CARL9170FW_TIMER_H */