Rename myself
[bertos.git] / bertos / cpu / i196 / drv / timer_i196.h
1 #error This code must be revised for the new timer API
2 /**
3  * \file
4  * <!--
5  * This file is part of BeRTOS.
6  *
7  * Bertos is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  *
21  * As a special exception, you may use this file as part of a free software
22  * library without restriction.  Specifically, if other files instantiate
23  * templates or use macros or inline functions from this file, or you compile
24  * this file and link it with other files to produce an executable, this
25  * file does not by itself cause the resulting executable to be covered by
26  * the GNU General Public License.  This exception does not however
27  * invalidate any other reasons why the executable file might be covered by
28  * the GNU General Public License.
29  *
30  * Copyright 2003,2004 Develer S.r.l. (http://www.develer.com/)
31  * Copyright 2000 Bernie Innocenti
32  *
33  * -->
34  *
35  * \version $Id$
36  *
37  * \author Bernie Innocenti <bernie@codewiz.org>
38  *
39  * \brief Low-level timer module for AVR
40  */
41
42 /*#*
43  *#* $Log$
44  *#* Revision 1.7  2006/07/19 12:56:26  bernie
45  *#* Convert to new Doxygen style.
46  *#*
47  *#* Revision 1.6  2006/02/21 21:28:02  bernie
48  *#* New time handling based on TIMER_TICKS_PER_SEC to support slow timers with ticks longer than 1ms.
49  *#*
50  *#* Revision 1.5  2005/11/04 16:20:02  bernie
51  *#* Fix reference to README.devlib in header.
52  *#*
53  *#* Revision 1.4  2004/12/13 11:51:08  bernie
54  *#* DISABLE_INTS/ENABLE_INTS: Convert to IRQ_DISABLE/IRQ_ENABLE.
55  *#*
56  *#* Revision 1.3  2004/08/25 14:12:08  rasky
57  *#* Aggiornato il comment block dei log RCS
58  *#*
59  *#* Revision 1.2  2004/06/03 11:27:09  bernie
60  *#* Add dual-license information.
61  *#*
62  *#* Revision 1.1  2004/05/23 18:23:30  bernie
63  *#* Import drv/timer module.
64  *#*
65  *#*/
66
67 #ifndef TIMER_I196_H
68 #define TIMER_I196_H
69
70 /**
71  * Retrigger TIMER2, adjusting the time to account for
72  * the interrupt prologue latency.
73  */
74 #define TIMER_RETRIGGER (TIMER2 -= TICKS_RATE)
75
76 #define TIMER_INIT \
77         TIMER2 = (65535 - TICKS_RATE); \
78         INT_MASK1 |= INT1F_T2OVF; \
79         ATOMIC( \
80                 WSR = 1; \
81                 IOC3 |= IOC3F_T2_ENA; \
82                 WSR = 0; \
83         )
84
85 #define DEFINE_TIMER_ISR \
86         INTERRUPT(0x38) void TM2_OVFL_interrupt(void);  \
87         INTERRUPT(0x38) void TM2_OVFL_interrupt(void)
88
89 #endif /* DRV_TIMER_I196_H */