Rename and move kenel conf on cfg dir.
[bertos.git] / bertos / cfg / cfg_kern.h
1 /**
2  * \file
3  * <!--
4  * This file is part of BeRTOS.
5  *
6  * Bertos is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  * As a special exception, you may use this file as part of a free software
21  * library without restriction.  Specifically, if other files instantiate
22  * templates or use macros or inline functions from this file, or you compile
23  * this file and link it with other files to produce an executable, this
24  * file does not by itself cause the resulting executable to be covered by
25  * the GNU General Public License.  This exception does not however
26  * invalidate any other reasons why the executable file might be covered by
27  * the GNU General Public License.
28  *
29  * Copyright 2001,2004 Develer S.r.l. (http://www.develer.com/)
30  * Copyright 1999,2000,2001 Bernardo Innocenti <bernie@develer.com>
31  *
32  * -->
33  *
34  * \brief Kernel configuration parameters
35  *
36  * \version $Id$
37  *
38  * \author Bernardo Innocenti <bernie@develer.com>
39  */
40
41 #ifndef CONFIG_KERN_H
42 #define CONFIG_KERN_H
43
44 #include <cfg/arch_config.h>  /* ARCH_EMUL */
45
46 /**
47  * \name Modules activation
48  *
49  * \{
50  */
51 /*      Module/option          Active    Dependencies */
52 #define CONFIG_KERN_SCHED       (1)
53 #define CONFIG_KERN_SIGNALS     (1    && CONFIG_KERN_SCHED)
54 #define CONFIG_KERN_TIMER       (1)
55 #define CONFIG_KERN_HEAP        (0)
56 #define CONFIG_KERN_SEMAPHORES  (0    && CONFIG_KERN_SIGNALS)
57 #define CONFIG_KERN_MONITOR     (1    && CONFIG_KERN_SCHED)
58 /*\}*/
59
60 /* EXPERIMENTAL */
61 #define CONFIG_KERN_PREEMPTIVE  (0    && CONFIG_KERN_SCHED && CONFIG_KERN_TIMER)
62
63 #define CONFIG_KERN_QUANTUM     50    /**< Time sharing quantum in timer ticks. */
64
65 #if (ARCH & ARCH_EMUL)
66         /* We need a large stack because system libraries are bloated */
67         #define CONFIG_PROC_DEFSTACKSIZE  65536
68 #else
69         /**
70          * Default stack size for each thread, in bytes.
71          *
72          * The goal here is to allow a minimal task to save all of its
73          * registers twice, plus push a maximum of 32 variables on the
74          * stack.
75          *
76          * The actual size computed by the default formula is:
77          *   AVR:    102
78          *   i386:   156
79          *   ARM:    164
80          *   x86_64: 184
81          *
82          * Note that on most 16bit architectures, interrupts will also
83          * run on the stack of the currently running process.  Nested
84          * interrupts will greatly increases the amount of stack space
85          * required per process.  Use irqmanager to minimize stack
86          * usage.
87          */
88         #define CONFIG_PROC_DEFSTACKSIZE  \
89             (CPU_SAVED_REGS_CNT * 2 * sizeof(cpustack_t) \
90             + 32 * sizeof(int))
91 #endif
92
93 /* OBSOLETE */
94 #define CONFIG_KERN_DEFSTACKSIZE CONFIG_PROC_DEFSTACKSIZE
95
96 /* Memory fill codes to help debugging */
97 #if CONFIG_KERN_MONITOR
98         #include <cpu/types.h>
99         #if (SIZEOF_CPUSTACK_T == 1)
100                 /* 8bit cpustack_t */
101                 #define CONFIG_KERN_STACKFILLCODE  0xA5
102                 #define CONFIG_KERN_MEMFILLCODE    0xDB
103         #elif (SIZEOF_CPUSTACK_T == 2)
104                 /* 16bit cpustack_t */
105                 #define CONFIG_KERN_STACKFILLCODE  0xA5A5
106                 #define CONFIG_KERN_MEMFILLCODE    0xDBDB
107         #elif (SIZEOF_CPUSTACK_T == 4)
108                 /* 16bit cpustack_t */
109                 #define CONFIG_KERN_STACKFILLCODE  0xA5A5A5A5UL
110                 #define CONFIG_KERN_MEMFILLCODE    0xDBDBDBDBUL
111         #elif (SIZEOF_CPUSTACK_T == 8)
112                 /* 16bit cpustack_t */
113                 #define CONFIG_KERN_STACKFILLCODE  0xA5A5A5A5A5A5A5A5UL
114                 #define CONFIG_KERN_MEMFILLCODE    0xDBDBDBDBDBDBDBDBUL
115         #else
116                 #error No cpustack_t size supported!
117         #endif
118 #endif
119
120
121 #endif /*  CONFIG_KERN_H */