1e48f9c067e8ea96ba9edb1ad2bb52555e1c8534
[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_callback_table[_VECTORS_SIZE/4];
34
35 /*************************/
36
37 #if defined TIMER0_ENABLED && defined TIMER0_OVF_vect
38 DEFINE_OV_INTR(TIMER0_OVF_vect)
39 #endif
40
41 #if defined TIMER0_ENABLED && defined TIMER0_COMP_vect
42 DEFINE_OC_INTR(TIMER0_COMP_vect)
43 #endif
44
45 #if defined TIMER0_ENABLED && defined TIMER0_COMPA_vect
46 DEFINE_OC_INTR(TIMER0_COMPA_vect)
47 #endif
48
49 #if defined TIMER0_ENABLED && defined TIMER0_COMPB_vect
50 DEFINE_OC_INTR(TIMER0_COMPB_vect)
51 #endif
52
53 /*************************/
54
55 #if defined TIMER1_ENABLED && defined TIMER1_OVF_vect
56 DEFINE_OV_INTR(TIMER1_OVF_vect)
57 #endif
58
59 #if defined TIMER1A_ENABLED && defined TIMER1_COMPA_vect
60 DEFINE_OC_INTR(TIMER1_COMPA_vect)
61 #endif
62
63 #if defined TIMER1B_ENABLED && defined TIMER1_COMPB_vect
64 DEFINE_OC_INTR(TIMER1_COMPB_vect)
65 #endif
66
67 #if defined TIMER1C_ENABLED && defined TIMER1_COMPC_vect
68 DEFINE_OC_INTR(TIMER1_COMPC_vect)
69 #endif
70
71 /*************************/
72
73 #if defined TIMER2_ENABLED && defined TIMER2_OVF_vect
74 DEFINE_OV_INTR(TIMER2_OVF_vect)
75 #endif
76
77 #if defined TIMER2_ENABLED && defined TIMER2_COMP_vect
78 DEFINE_OC_INTR(TIMER2_COMP_vect)
79 #endif
80
81 #if defined TIMER2_ENABLED && defined TIMER2_COMPA_vect
82 DEFINE_OC_INTR(TIMER2_COMPA_vect)
83 #endif
84
85 #if defined TIMER2_ENABLED && defined TIMER2_COMPB_vect
86 DEFINE_OC_INTR(TIMER2_COMPB_vect)
87 #endif
88
89 /*************************/
90
91 #if defined TIMER3_ENABLED && defined TIMER3_OVF_vect
92 DEFINE_OV_INTR(TIMER3_OVF_vect)
93 #endif
94
95 #if defined TIMER3A_ENABLED && defined TIMER3_COMPA_vect
96 DEFINE_OC_INTR(TIMER3_COMPA_vect)
97 #endif
98
99 #if defined TIMER3B_ENABLED && defined TIMER3_COMPB_vect
100 DEFINE_OC_INTR(TIMER3_COMPB_vect)
101 #endif
102
103 #if defined TIMER3C_ENABLED && defined TIMER3_COMPC_vect
104 DEFINE_OC_INTR(TIMER3_COMPC_vect)
105 #endif
106
107 /*************************/
108
109 #if defined TIMER4_ENABLED && defined TIMER4_OVF_vect
110 DEFINE_OV_INTR(TIMER4_OVF_vect)
111 #endif
112
113 #if defined TIMER4A_ENABLED && defined TIMER4_COMPA_vect
114 DEFINE_OC_INTR(TIMER4_COMPA_vect)
115 #endif
116
117 #if defined TIMER4B_ENABLED && defined TIMER4_COMPB_vect
118 DEFINE_OC_INTR(TIMER4_COMPB_vect)
119 #endif
120
121 #if defined TIMER4C_ENABLED && defined TIMER4_COMPC_vect
122 DEFINE_OC_INTR(TIMER4_COMPC_vect)
123 #endif
124
125 /*************************/
126
127 #if defined TIMER5_ENABLED && defined TIMER5_OVF_vect
128 DEFINE_OV_INTR(TIMER5_OVF_vect)
129 #endif
130
131 #if defined TIMER5A_ENABLED && defined TIMER5_COMPA_vect
132 DEFINE_OC_INTR(TIMER5_COMPA_vect)
133 #endif
134
135 #if defined TIMER5B_ENABLED && defined TIMER5_COMPB_vect
136 DEFINE_OC_INTR(TIMER5_COMPB_vect)
137 #endif
138
139 #if defined TIMER5C_ENABLED && defined TIMER5_COMPC_vect
140 DEFINE_OC_INTR(TIMER5_COMPC_vect)
141 #endif
142
143 /*************************/
144
145 void timer_intr_init(void)
146 {
147         memset((void*)timer_callback_table, 0, sizeof(timer_callback_table));
148 }