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 $
25 #include <aversive/timers.h>
28 #include <timer_definitions.h>
29 #include <timer_intr.h>
31 #include <timer_config.h>
33 volatile timer_callback_t timer_OV_callback_table[SIG_OVERFLOW_TOTAL_NUM];
34 volatile timer_callback_t timer_OC_callback_table[SIG_OUTPUT_COMPARE_TOTAL_NUM];
36 /*************************/
38 #if defined TIMER0_ENABLED && defined SIG_OVERFLOW0
39 DEFINE_OV_INTR(SIG_OVERFLOW0)
42 #if defined TIMER0_ENABLED && defined SIG_OUTPUT_COMPARE0
43 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE0)
46 #if defined TIMER0_ENABLED && defined SIG_OUTPUT_COMPARE0A
47 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE0A)
50 #if defined TIMER0_ENABLED && defined SIG_OUTPUT_COMPARE0B
51 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE0B)
54 /*************************/
56 #if defined TIMER1_ENABLED && defined SIG_OVERFLOW1
57 DEFINE_OV_INTR(SIG_OVERFLOW1)
60 #if defined TIMER1A_ENABLED && defined SIG_OUTPUT_COMPARE1A
61 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE1A)
64 #if defined TIMER1B_ENABLED && defined SIG_OUTPUT_COMPARE1B
65 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE1B)
68 #if defined TIMER1C_ENABLED && defined SIG_OUTPUT_COMPARE1C
69 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE1C)
72 /*************************/
74 #if defined TIMER2_ENABLED && defined SIG_OVERFLOW2
75 DEFINE_OV_INTR(SIG_OVERFLOW2)
78 #if defined TIMER2_ENABLED && defined SIG_OUTPUT_COMPARE2
79 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE2)
82 #if defined TIMER2_ENABLED && defined SIG_OUTPUT_COMPARE2A
83 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE2A)
86 #if defined TIMER2_ENABLED && defined SIG_OUTPUT_COMPARE2B
87 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE2B)
90 /*************************/
92 #if defined TIMER3_ENABLED && defined SIG_OVERFLOW3
93 DEFINE_OV_INTR(SIG_OVERFLOW3)
96 #if defined TIMER3A_ENABLED && defined SIG_OUTPUT_COMPARE3A
97 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE3A)
100 #if defined TIMER3B_ENABLED && defined SIG_OUTPUT_COMPARE3B
101 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE3B)
104 #if defined TIMER3C_ENABLED && defined SIG_OUTPUT_COMPARE3C
105 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE3C)
108 /*************************/
110 #if defined TIMER4_ENABLED && defined SIG_OVERFLOW4
111 DEFINE_OV_INTR(SIG_OVERFLOW4)
114 #if defined TIMER4A_ENABLED && defined SIG_OUTPUT_COMPARE4A
115 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE4A)
118 #if defined TIMER4B_ENABLED && defined SIG_OUTPUT_COMPARE4B
119 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE4B)
122 #if defined TIMER4C_ENABLED && defined SIG_OUTPUT_COMPARE4C
123 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE4C)
126 /*************************/
128 #if defined TIMER5_ENABLED && defined SIG_OVERFLOW5
129 DEFINE_OV_INTR(SIG_OVERFLOW5)
132 #if defined TIMER5A_ENABLED && defined SIG_OUTPUT_COMPARE5A
133 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE5A)
136 #if defined TIMER5B_ENABLED && defined SIG_OUTPUT_COMPARE5B
137 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE5B)
140 #if defined TIMER5C_ENABLED && defined SIG_OUTPUT_COMPARE5C
141 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE5C)
144 /*************************/
146 void timer_intr_init(void)
148 memset((void*)timer_OV_callback_table, 0, sizeof(timer_OV_callback_table));
149 memset((void*)timer_OC_callback_table, 0, sizeof(timer_OC_callback_table));