merge
[aversive.git] / modules / hardware / timer / 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/timers.h>
26
27 #include <timer.h>
28 #include <timer_definitions.h>
29 #include <timer_intr.h>
30
31 #include <timer_config.h>
32
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];
35
36 /*************************/
37
38 #if defined TIMER0_ENABLED && defined SIG_OVERFLOW0
39 DEFINE_OV_INTR(SIG_OVERFLOW0)
40 #endif
41
42 #if defined TIMER0_ENABLED && defined SIG_OUTPUT_COMPARE0
43 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE0)
44 #endif
45
46 #if defined TIMER0_ENABLED && defined SIG_OUTPUT_COMPARE0A
47 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE0A)
48 #endif
49
50 #if defined TIMER0_ENABLED && defined SIG_OUTPUT_COMPARE0B
51 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE0B)
52 #endif
53
54 /*************************/
55
56 #if defined TIMER1_ENABLED && defined SIG_OVERFLOW1
57 DEFINE_OV_INTR(SIG_OVERFLOW1)
58 #endif
59
60 #if defined TIMER1A_ENABLED && defined SIG_OUTPUT_COMPARE1A
61 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE1A)
62 #endif
63
64 #if defined TIMER1B_ENABLED && defined SIG_OUTPUT_COMPARE1B
65 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE1B)
66 #endif
67
68 #if defined TIMER1C_ENABLED && defined SIG_OUTPUT_COMPARE1C
69 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE1C)
70 #endif
71
72 /*************************/
73
74 #if defined TIMER2_ENABLED && defined SIG_OVERFLOW2
75 DEFINE_OV_INTR(SIG_OVERFLOW2)
76 #endif
77
78 #if defined TIMER2_ENABLED && defined SIG_OUTPUT_COMPARE2
79 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE2)
80 #endif
81
82 #if defined TIMER2_ENABLED && defined SIG_OUTPUT_COMPARE2A
83 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE2A)
84 #endif
85
86 #if defined TIMER2_ENABLED && defined SIG_OUTPUT_COMPARE2B
87 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE2B)
88 #endif
89
90 /*************************/
91
92 #if defined TIMER3_ENABLED && defined SIG_OVERFLOW3
93 DEFINE_OV_INTR(SIG_OVERFLOW3)
94 #endif
95
96 #if defined TIMER3A_ENABLED && defined SIG_OUTPUT_COMPARE3A
97 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE3A)
98 #endif
99
100 #if defined TIMER3B_ENABLED && defined SIG_OUTPUT_COMPARE3B
101 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE3B)
102 #endif
103
104 #if defined TIMER3C_ENABLED && defined SIG_OUTPUT_COMPARE3C
105 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE3C)
106 #endif
107
108 /*************************/
109
110 #if defined TIMER4_ENABLED && defined SIG_OVERFLOW4
111 DEFINE_OV_INTR(SIG_OVERFLOW4)
112 #endif
113
114 #if defined TIMER4A_ENABLED && defined SIG_OUTPUT_COMPARE4A
115 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE4A)
116 #endif
117
118 #if defined TIMER4B_ENABLED && defined SIG_OUTPUT_COMPARE4B
119 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE4B)
120 #endif
121
122 #if defined TIMER4C_ENABLED && defined SIG_OUTPUT_COMPARE4C
123 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE4C)
124 #endif
125
126 /*************************/
127
128 #if defined TIMER5_ENABLED && defined SIG_OVERFLOW5
129 DEFINE_OV_INTR(SIG_OVERFLOW5)
130 #endif
131
132 #if defined TIMER5A_ENABLED && defined SIG_OUTPUT_COMPARE5A
133 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE5A)
134 #endif
135
136 #if defined TIMER5B_ENABLED && defined SIG_OUTPUT_COMPARE5B
137 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE5B)
138 #endif
139
140 #if defined TIMER5C_ENABLED && defined SIG_OUTPUT_COMPARE5C
141 DEFINE_OC_INTR(SIG_OUTPUT_COMPARE5C)
142 #endif
143
144 /*************************/
145
146 void timer_intr_init(void)
147 {
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));
150 }
151
152