2 * Copyright Droids Corporation, Microb Technology, Eirbot (2005)
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: scheduler.c,v 1.9.4.6 2009-11-08 17:33:14 zer0 Exp $
26 #include <aversive/parts.h>
27 #include <aversive/pgmspace.h>
30 #include <scheduler.h>
31 #include <scheduler_private.h>
32 #include <scheduler_stats.h>
33 #include <scheduler_config.h>
36 /* this file is compiled for AVR version only */
38 /** declared in scheduler_host.c in case of host version */
39 struct event_t g_tab_event[SCHEDULER_NB_MAX_EVENT];
41 #ifdef CONFIG_MODULE_SCHEDULER_STATS
42 struct scheduler_stats sched_stats;
45 void scheduler_init(void)
47 memset(g_tab_event, 0, sizeof(g_tab_event));
49 #ifdef CONFIG_MODULE_SCHEDULER_USE_TIMERS
50 SCHEDULER_TIMER_REGISTER();
53 #ifdef CONFIG_MODULE_SCHEDULER_TIMER0
54 /* activation of corresponding interrupt */
55 TOIE0_REG |= (1<<TOIE0); /* TIMSK */
58 CS00_REG = SCHEDULER_CK; /* TCCR0 */
63 #ifdef CONFIG_MODULE_SCHEDULER_TIMER0
66 scheduler_interrupt();
68 #endif /* CONFIG_MODULE_SCHEDULER_USE_TIMERS */