better cobboard commands in strat_event
[aversive.git] / projects / example1 / scheduler_config.h
1 /*  
2  *  Copyright Droids Corporation, Microb Technology, Eirbot (2005)
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: scheduler_config.h,v 1.1.2.1 2007-12-06 08:58:00 zer0 Exp $
19  *
20  */
21
22 #ifndef _SCHEDULER_CONFIG_H_
23 #define _SCHEDULER_CONFIG_H_
24
25 #define _SCHEDULER_CONFIG_VERSION_ 4
26
27 /** maximum number of allocated events */
28 #define SCHEDULER_NB_MAX_EVENT 5
29
30
31 /* define it only if CONFIG_MODULE_SCHEDULER_USE_TIMERS is enabled. In
32    this case, precaler is defined in timers_config.h in your project
33    directory. */
34 #ifdef CONFIG_MODULE_SCHEDULER_USE_TIMERS
35 /** the num of the timer to use for the scheduler */
36 #define SCHEDULER_TIMER_NUM 0
37
38 /* or set the prescaler manually (in this case, you use must TIMER0,
39    and the prescaler must be a correct value regarding the AVR device
40    you are using (look in include/aversive/parts.h). Obviously, the
41    values of SCHEDULER_CK and SCHEDULER_CLOCK_PRESCALER must also be
42    coherent (TIMER0_PRESCALER_DIV_VALUE and VALUE) */
43 #endif /* CONFIG_MODULE_SCHEDULER_USE_TIMERS */
44
45
46 #ifdef CONFIG_MODULE_SCHEDULER_TIMER0
47 /* The 2 values below MUST be coherent: 
48  * if  SCHEDULER_CK = TIMER0_PRESCALER_DIV_x, then 
49  * you must have SCHEDULER_CLOCK_PRESCALER = x too !!! */
50 #define SCHEDULER_CK TIMER0_PRESCALER_DIV_8
51 #define SCHEDULER_CLOCK_PRESCALER 8 
52
53 #endif /* CONFIG_MODULE_SCHEDULER_TIMER0 */
54
55 /* last case, the scheduler is called manually. The user has to
56    define the period here */
57 #ifdef CONFIG_MODULE_SCHEDULER_MANUAL
58
59 #define SCHEDULER_UNIT_FLOAT 1000.0
60 #define SCHEDULER_UNIT 1000UL
61
62 #endif /* CONFIG_MODULE_SCHEDULER_MANUAL */
63
64 /** number of allowed imbricated scheduler interrupts. The maximum
65  * should be SCHEDULER_NB_MAX_EVENT since we never need to imbricate
66  * more than once per event. If it is less, it can avoid to browse the
67  * event table, events are delayed (we loose precision) but it takes
68  * less CPU */
69 #define SCHEDULER_NB_STACKING_MAX SCHEDULER_NB_MAX_EVENT
70
71 /** define it for debug infos (not recommended, because very slow on
72  *  an AVR, it uses printf in an interrupt). It can be useful if
73  *  prescaler is very high, making the timer interrupt period very
74  *  long in comparison to printf() */
75 /* #define SCHEDULER_DEBUG */
76
77 #endif // _SCHEDULER_CONFIG_H_