X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=carlfw%2Fsrc%2Ftimer.c;fp=carlfw%2Fsrc%2Ftimer.c;h=79fcc31ab2f45c795094ca85dd5f1bb81040a257;hb=1f52b1617d72cfa6909ebbfbdf7c264d487b28d8;hp=95058183cbd97245fa9b2ac793b81b578b861d62;hpb=e5ef38a8fa9ef524c3ef061083ce35d1529e5ea0;p=carl9170fw.git diff --git a/carlfw/src/timer.c b/carlfw/src/timer.c index 9505818..79fcc31 100644 --- a/carlfw/src/timer.c +++ b/carlfw/src/timer.c @@ -41,7 +41,7 @@ void timer_init(const unsigned int timer, const unsigned int interval) orl(AR9170_TIMER_REG_INTERRUPT, BIT(timer)); } -void clock_set(enum cpu_clock_t clock_, bool on) +void clock_set(const enum cpu_clock_t clock_, const bool on, const unsigned int div) { /* * Word of Warning! @@ -60,7 +60,8 @@ void clock_set(enum cpu_clock_t clock_, bool on) fw.ticks_per_usec = GET_VAL(AR9170_PWR_PLL_ADDAC_DIV, get(AR9170_PWR_REG_PLL_ADDAC)); - set(AR9170_PWR_REG_CLOCK_SEL, (uint32_t) ((on ? 0x70 : 0x600) | clock_)); + set(AR9170_PWR_REG_CLOCK_SEL, (uint32_t) ((on ? 0x70 : 0x600) | clock_ | + SET_CONSTVAL(AR9170_PWR_CLK_ADDAC_CLK160, div)))); switch (clock_) { case AHB_20_22MHZ: