00001 /* 00002 * Copyright Droids Corporation, Microb Technology, Eirbot (2005) 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 * Revision : $Id: scheduler_private.h,v 1.5 2008-01-08 20:05:02 zer0 Exp $ 00019 * 00020 */ 00021 00022 #ifndef _SCHEDULER_PRIVATE_H_ 00023 #define _SCHEDULER_PRIVATE_H_ 00024 00025 /* sanity checks */ 00026 #if _SCHEDULER_CONFIG_VERSION_ != 4 00027 #warning "You are using an old version of scheduler_config.h file" 00028 #warning "_SCHEDULER_CONFIG_VERSION_ is != 4" 00029 #warning "Look in modules/base/scheduler/config directory to import changes" 00030 #warning "You should define SCHEDULER_NB_STACKING_MAX and SCHEDULER_CK" 00031 #endif 00032 00033 #include <stdint.h> 00034 00035 #include <aversive/queue.h> 00036 00038 enum event_state_t { 00039 SCHEDULER_EVENT_FREE, 00040 SCHEDULER_EVENT_ALLOCATED, 00041 SCHEDULER_EVENT_ACTIVE, 00042 SCHEDULER_EVENT_SCHEDULED, 00043 SCHEDULER_EVENT_DELETING, 00044 }; 00045 00047 struct event_t 00048 { 00049 void (*f)(void *); 00050 void * data; 00051 uint16_t period; 00052 uint16_t current_time; 00053 uint8_t priority; 00057 enum event_state_t state; 00059 SLIST_ENTRY(event_t) next; 00060 }; 00061 00062 extern struct event_t g_tab_event[SCHEDULER_NB_MAX_EVENT]; 00063 00064 00065 /* define dump_events() if we are in debug mode */ 00066 #ifdef SCHEDULER_DEBUG 00067 #define DUMP_EVENTS() dump_events() 00068 void dump_events(void); 00069 00070 #else /* SCHEDULER_DEBUG */ 00071 #define DUMP_EVENTS() do {} while(0) 00072 00073 #endif /* SCHEDULER_DEBUG */ 00074 00075 #endif /* _SCHEDULER_PRIVATE_H_ */