42: /* stop timer */
43: out_w(TI_OP, 0);
44:
45: /* choose clock */
46: out_w(TI0TIN_SEL, (in_w(TI0TIN_SEL) & ~3) | TITIN_PLL3);
47: d = in_w(DIVTIMTIN);
49: /* supply clock */
50: out_w(GCLKCTRL3ENA, in_w(GCLKCTRL3ENA) | TI0_TIN_GCK);
51: out_w(GCLKCTRL3, in_w(GCLKCTRL3) | TI0_TIN_GCK);
52:
53: /* enable timer */
54: out_w(TI_OP, TM_EN);
55: while ( (in_w(TI_SCLR) & TM_SCLR) != 0 );
59: n = (TIMER_PERIOD * TIN_CLK(d)) / 1000000 - 1;
60: out_w(TI_SET, n);
61:
62: /* start timer count */
63: out_w(TI_OP, TO_EN|TSTART|TM_EN);
64:
100: /* Mask the current interrupt to allow multiple interrupts */
101: out_w(IT0_IDS1, IRQM(IRQ_TIMER));
102:
103: /* Clear timer interrupt */
104: out_w(IT0_IIR, IRQM(IRQ_TIMER));
105: }
108: /* Enable the current interrupt */
109: out_w(IT0_IEN1, IRQM(IRQ_TIMER));
110: }
126: /* stop timer */
127: out_w(TI_OP, 0);
128:
129: /* stop clock */
130: out_w(GCLKCTRL3, in_w(GCLKCTRL3) & ~TI0_TIN_GCK);
131: