1.1 --- a/stage2/board-nanonote.c Tue Jun 23 23:05:00 2015 +0200
1.2 +++ b/stage2/board-nanonote.c Tue Jun 23 23:08:19 2015 +0200
1.3 @@ -112,11 +112,12 @@
1.4 unsigned long lastdec;
1.5
1.6 /*
1.7 - * timer without interrupts
1.8 + * Timer without interrupts.
1.9 */
1.10
1.11 void timer_init(void)
1.12 {
1.13 + __tcu_disable_pwm_output(TIMER_CHAN);
1.14 __tcu_select_extalclk(TIMER_CHAN);
1.15 __tcu_select_clk_div256(TIMER_CHAN);
1.16 __tcu_set_count(TIMER_CHAN, 0);
1.17 @@ -128,10 +129,23 @@
1.18 __tcu_start_timer_clock(TIMER_CHAN);
1.19 __tcu_start_counter(TIMER_CHAN);
1.20
1.21 + __cpm_start_tcu();
1.22 +
1.23 lastdec = 0;
1.24 timestamp = 0;
1.25 }
1.26
1.27 +/* Timer interrupt activation. */
1.28 +
1.29 +void timer_init_irq(void)
1.30 +{
1.31 + __tcu_unmask_full_match_irq(TIMER_CHAN);
1.32 + __tcu_clear_full_match_flag(TIMER_CHAN);
1.33 + __intc_unmask_irq(TIMER_CHAN_IRQ);
1.34 +}
1.35 +
1.36 +/* Board startup detection. */
1.37 +
1.38 int is_started(void)
1.39 {
1.40 return REG_CPM_CLKGR != 0;