cmdline: replace printf printf_P
[protos/xbee-avr.git] / timer_intr.c
1 /*  
2  *  Copyright Droids Corporation, Microb Technology, Eirbot (2006)
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,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  *
18  *  Revision : $Id: timer_intr.c,v 1.1.2.4 2009-01-30 20:18:36 zer0 Exp $
19  *
20  */
21
22 #include <stdint.h>
23 #include <string.h>
24
25 #include <aversive.h>
26 #include <aversive/parts.h>
27 #include <aversive/timers.h>
28
29 #include <timer.h>
30 #include <timer_definitions.h>
31 #include <timer_intr.h>
32
33 #include <timer_config.h>
34
35 volatile timer_callback_t timer_OV_callback_table[SIG_OVERFLOW_TOTAL_NUM];
36 volatile timer_callback_t timer_OC_callback_table[SIG_OUTPUT_COMPARE_TOTAL_NUM];
37
38 /*************************/
39
40 #if defined TIMER0_ENABLED && defined SIG_OVERFLOW0
41 DEFINE_OV_INTR(SIG_OVERFLOW0)
42 #endif
43
44 #if defined TIMER0_ENABLED && defined SIG_OUTPUT_COMPARE0
45 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE0)
46 #endif
47
48 #if defined TIMER0_ENABLED && defined SIG_OUTPUT_COMPARE0A
49 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE0A)
50 #endif
51
52 #if defined TIMER0_ENABLED && defined SIG_OUTPUT_COMPARE0B
53 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE0B)
54 #endif
55
56 /*************************/
57
58 #if defined TIMER1_ENABLED && defined SIG_OVERFLOW1
59 DEFINE_OV_INTR(SIG_OVERFLOW1)
60 #endif
61
62 #if defined TIMER1A_ENABLED && defined SIG_OUTPUT_COMPARE1A
63 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE1A)
64 #endif
65
66 #if defined TIMER1B_ENABLED && defined SIG_OUTPUT_COMPARE1B
67 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE1B)
68 #endif
69
70 #if defined TIMER1C_ENABLED && defined SIG_OUTPUT_COMPARE1C
71 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE1C)
72 #endif
73
74 /*************************/
75
76 #if defined TIMER2_ENABLED && defined SIG_OVERFLOW2
77 DEFINE_OV_INTR(SIG_OVERFLOW2)
78 #endif
79
80 #if defined TIMER2_ENABLED && defined SIG_OUTPUT_COMPARE2
81 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE2)
82 #endif
83
84 #if defined TIMER2_ENABLED && defined SIG_OUTPUT_COMPARE2A
85 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE2A)
86 #endif
87
88 #if defined TIMER2_ENABLED && defined SIG_OUTPUT_COMPARE2B
89 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE2B)
90 #endif
91
92 /*************************/
93
94 #if defined TIMER3_ENABLED && defined SIG_OVERFLOW3
95 DEFINE_OV_INTR(SIG_OVERFLOW3)
96 #endif
97
98 #if defined TIMER3A_ENABLED && defined SIG_OUTPUT_COMPARE3A
99 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE3A)
100 #endif
101
102 #if defined TIMER3B_ENABLED && defined SIG_OUTPUT_COMPARE3B
103 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE3B)
104 #endif
105
106 #if defined TIMER3C_ENABLED && defined SIG_OUTPUT_COMPARE3C
107 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE3C)
108 #endif
109
110 /*************************/
111
112 #if defined TIMER4_ENABLED && defined SIG_OVERFLOW4
113 DEFINE_OV_INTR(SIG_OVERFLOW4)
114 #endif
115
116 #if defined TIMER4A_ENABLED && defined SIG_OUTPUT_COMPARE4A
117 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE4A)
118 #endif
119
120 #if defined TIMER4B_ENABLED && defined SIG_OUTPUT_COMPARE4B
121 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE4B)
122 #endif
123
124 #if defined TIMER4C_ENABLED && defined SIG_OUTPUT_COMPARE4C
125 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE4C)
126 #endif
127
128 /*************************/
129
130 #if defined TIMER5_ENABLED && defined SIG_OVERFLOW5
131 DEFINE_OV_INTR(SIG_OVERFLOW5)
132 #endif
133
134 #if defined TIMER5A_ENABLED && defined SIG_OUTPUT_COMPARE5A
135 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE5A)
136 #endif
137
138 #if defined TIMER5B_ENABLED && defined SIG_OUTPUT_COMPARE5B
139 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE5B)
140 #endif
141
142 #if defined TIMER5C_ENABLED && defined SIG_OUTPUT_COMPARE5C
143 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE5C)
144 #endif
145
146 /*************************/
147
148 void timer_intr_init(void)
149 {
150         memset((void*)timer_OV_callback_table, 0, sizeof(timer_OV_callback_table));
151         memset((void*)timer_OC_callback_table, 0, sizeof(timer_OC_callback_table));
152 }
153
154