1.1 --- a/stage2/board-nanonote.c Wed Jun 10 18:45:28 2015 +0200
1.2 +++ b/stage2/board-nanonote.c Thu Jun 11 00:53:12 2015 +0200
1.3 @@ -117,14 +117,16 @@
1.4
1.5 int timer_init(void)
1.6 {
1.7 - REG_TCU_TCSR(TIMER_CHAN) = TCU_TCSR_PRESCALE256 | TCU_TCSR_EXT_EN;
1.8 - REG_TCU_TCNT(TIMER_CHAN) = 0;
1.9 - REG_TCU_TDHR(TIMER_CHAN) = 0;
1.10 - REG_TCU_TDFR(TIMER_CHAN) = TIMER_FDATA;
1.11 + __tcu_select_extalclk(TIMER_CHAN);
1.12 + __tcu_select_clk_div256(TIMER_CHAN);
1.13 + __tcu_set_count(TIMER_CHAN, 0);
1.14 + __tcu_set_half_data(TIMER_CHAN, 0);
1.15 + __tcu_set_full_data(TIMER_CHAN, TIMER_FDATA);
1.16
1.17 - REG_TCU_TMSR = (1 << TIMER_CHAN) | (1 << (TIMER_CHAN + 16)); /* mask irqs */
1.18 - REG_TCU_TSCR = (1 << TIMER_CHAN); /* enable timer clock */
1.19 - REG_TCU_TESR = (1 << TIMER_CHAN); /* start counting up */
1.20 + __tcu_mask_half_match_irq(TIMER_CHAN);
1.21 + __tcu_mask_full_match_irq(TIMER_CHAN);
1.22 + __tcu_start_timer_clock(TIMER_CHAN);
1.23 + __tcu_start_counter(TIMER_CHAN);
1.24
1.25 lastdec = 0;
1.26 timestamp = 0;