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_private.h,v 1.1.2.8 2009-05-18 12:30:36 zer0 Exp $
22 #ifndef _SCHEDULER_PRIVATE_H_
23 #define _SCHEDULER_PRIVATE_H_
26 #if _SCHEDULER_CONFIG_VERSION_ != 4
27 #warning "You are using an old version of scheduler_config.h file"
28 #warning "_SCHEDULER_CONFIG_VERSION_ is != 4"
29 #warning "Look in modules/base/scheduler/config directory to import changes"
30 #warning "You should define SCHEDULER_NB_STACKING_MAX and SCHEDULER_CK"
35 #include <aversive/queue.h>
37 /** state of events */
39 SCHEDULER_EVENT_FREE, /**< event is free */
40 SCHEDULER_EVENT_ALLOCATED, /**< a place is reserved in the tab */
41 SCHEDULER_EVENT_ACTIVE, /**< fields are filled correctly, event can be scheduled */
42 SCHEDULER_EVENT_SCHEDULED, /**< event is inserted in a list to be running soon, or is running */
43 SCHEDULER_EVENT_DELETING, /**< event is scheduled but we asked to delete it */
46 /** The event structure */
49 void (*f)(void *); /**< a pointer to the scheduled function */
50 void * data; /**< a pointer to the data parameters */
51 uint16_t period; /**< interval between each call */
52 uint16_t current_time; /**< time remaining before next call */
53 uint8_t priority; /**< if many events occur at the
54 same time, the first to be executed
55 will be the one with the highest
57 enum event_state_t state; /**< (scheduled, active, allocated, free, deleting) */
59 SLIST_ENTRY(event_t) next;
62 extern struct event_t g_tab_event[SCHEDULER_NB_MAX_EVENT];
65 /* define dump_events() if we are in debug mode */
66 #ifdef SCHEDULER_DEBUG
67 #define DUMP_EVENTS() scheduler_dump_events()
69 #else /* SCHEDULER_DEBUG */
70 #define DUMP_EVENTS() do {} while(0)
72 #endif /* SCHEDULER_DEBUG */
74 #endif /* _SCHEDULER_PRIVATE_H_ */