2 * Copyright Droids Corporation, Microb Technology, Eirbot (2006)
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.
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.
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
18 * Revision : $Id: timer_intr.c,v 1.1.2.4 2009-01-30 20:18:36 zer0 Exp $
26 #include <aversive/parts.h>
27 #include <aversive/timers.h>
30 #include <timer_definitions.h>
31 #include <timer_intr.h>
33 #include <timer_config.h>
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];
38 /*************************/
40 #if defined TIMER0_ENABLED && defined SIG_OVERFLOW0
41 DEFINE_OV_INTR(SIG_OVERFLOW0)
44 #if defined TIMER0_ENABLED && defined SIG_OUTPUT_COMPARE0
45 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE0)
48 #if defined TIMER0_ENABLED && defined SIG_OUTPUT_COMPARE0A
49 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE0A)
52 #if defined TIMER0_ENABLED && defined SIG_OUTPUT_COMPARE0B
53 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE0B)
56 /*************************/
58 #if defined TIMER1_ENABLED && defined SIG_OVERFLOW1
59 DEFINE_OV_INTR(SIG_OVERFLOW1)
62 #if defined TIMER1A_ENABLED && defined SIG_OUTPUT_COMPARE1A
63 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE1A)
66 #if defined TIMER1B_ENABLED && defined SIG_OUTPUT_COMPARE1B
67 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE1B)
70 #if defined TIMER1C_ENABLED && defined SIG_OUTPUT_COMPARE1C
71 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE1C)
74 /*************************/
76 #if defined TIMER2_ENABLED && defined SIG_OVERFLOW2
77 DEFINE_OV_INTR(SIG_OVERFLOW2)
80 #if defined TIMER2_ENABLED && defined SIG_OUTPUT_COMPARE2
81 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE2)
84 #if defined TIMER2_ENABLED && defined SIG_OUTPUT_COMPARE2A
85 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE2A)
88 #if defined TIMER2_ENABLED && defined SIG_OUTPUT_COMPARE2B
89 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE2B)
92 /*************************/
94 #if defined TIMER3_ENABLED && defined SIG_OVERFLOW3
95 DEFINE_OV_INTR(SIG_OVERFLOW3)
98 #if defined TIMER3A_ENABLED && defined SIG_OUTPUT_COMPARE3A
99 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE3A)
102 #if defined TIMER3B_ENABLED && defined SIG_OUTPUT_COMPARE3B
103 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE3B)
106 #if defined TIMER3C_ENABLED && defined SIG_OUTPUT_COMPARE3C
107 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE3C)
110 /*************************/
112 #if defined TIMER4_ENABLED && defined SIG_OVERFLOW4
113 DEFINE_OV_INTR(SIG_OVERFLOW4)
116 #if defined TIMER4A_ENABLED && defined SIG_OUTPUT_COMPARE4A
117 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE4A)
120 #if defined TIMER4B_ENABLED && defined SIG_OUTPUT_COMPARE4B
121 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE4B)
124 #if defined TIMER4C_ENABLED && defined SIG_OUTPUT_COMPARE4C
125 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE4C)
128 /*************************/
130 #if defined TIMER5_ENABLED && defined SIG_OVERFLOW5
131 DEFINE_OV_INTR(SIG_OVERFLOW5)
134 #if defined TIMER5A_ENABLED && defined SIG_OUTPUT_COMPARE5A
135 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE5A)
138 #if defined TIMER5B_ENABLED && defined SIG_OUTPUT_COMPARE5B
139 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE5B)
142 #if defined TIMER5C_ENABLED && defined SIG_OUTPUT_COMPARE5C
143 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE5C)
146 /*************************/
148 void timer_intr_init(void)
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));