Remove unused cctools code paths for old libusb and cp2103 ioctls.
[fw/altos] / cctools / target / timer / timer.c
1 /*
2  * Copyright © 2008 Keith Packard <keithp@keithp.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17  */
18
19 #include "cc1111.h"
20
21 unsigned char irqs;
22
23 void timer1_isr(void) interrupt 9 __reentrant
24 {
25         ++irqs;
26         if (irqs == 100) {
27                 P1 ^= 0x2;
28                 irqs = 0;
29         }
30 }
31
32 int
33 main (void) __reentrant
34 {
35         CLKCON = 0;
36         P1DIR = 0x2;
37         P1 = 0xff;
38
39         T1CTL = 0;
40
41         /* 30000 */
42         T1CC0H = 0x75;
43         T1CC0L = 0x30;
44         T1CCTL0 = T1CCTL_MODE_COMPARE;
45         T1CCTL1 = 0;
46         T1CCTL2 = 0;
47
48         /* clear timer value */
49         T1CNTL = 0;
50         OVFIM = 1;
51         T1CTL = T1CTL_MODE_MODULO | T1CTL_DIV_8;
52         T1IE = 1;
53         EA = 1;
54         for (;;);
55 }