Rename myself
[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 Bernie Innocenti <bernie@codewiz.org>
31  *
32  * -->
33  *
34  * \brief Kernel configuration parameters
35  *
36  * \version $Id$
37  *
38  * \author Bernie Innocenti <bernie@codewiz.org>
39  */
40
41 #ifndef CFG_KERN_H
42 #define CFG_KERN_H
43
44 #include "cfg/cfg_arch.h"  /* ARCH_EMUL */
45
46 /**
47  * Multithreading kernel.
48  */
49 #define CONFIG_KERNEL 0
50
51 /**
52  * \name Modules activation
53  *
54  * \{
55  */
56 /*      Module/option          Active    Dependencies */
57 #define CONFIG_KERN_SCHED       (0)
58 #define CONFIG_KERN_SIGNALS     (0    && CONFIG_KERN_SCHED)
59 #define CONFIG_KERN_TIMER       (0)
60 #define CONFIG_KERN_HEAP        (0)
61 #define CONFIG_KERN_SEMAPHORES  (0    && CONFIG_KERN_SIGNALS)
62 #define CONFIG_KERN_MONITOR     (0    && CONFIG_KERN_SCHED)
63 /*\}*/
64
65 /* EXPERIMENTAL */
66 #define CONFIG_KERN_PREEMPTIVE  (0    && CONFIG_KERN_SCHED && CONFIG_KERN_TIMER)
67
68 #define CONFIG_KERN_QUANTUM     50    /**< Time sharing quantum in timer ticks. */
69
70 #if (ARCH & ARCH_EMUL)
71         /* We need a large stack because system libraries are bloated */
72         #define CONFIG_PROC_DEFSTACKSIZE  65536
73 #else
74         /**
75          * Default stack size for each thread, in bytes.
76          *
77          * The goal here is to allow a minimal task to save all of its
78          * registers twice, plus push a maximum of 32 variables on the
79          * stack.
80          *
81          * The actual size computed by the default formula is:
82          *   AVR:    102
83          *   i386:   156
84          *   ARM:    164
85          *   x86_64: 184
86          *
87          * Note that on most 16bit architectures, interrupts will also
88          * run on the stack of the currently running process.  Nested
89          * interrupts will greatly increases the amount of stack space
90          * required per process.  Use irqmanager to minimize stack
91          * usage.
92          */
93         #define CONFIG_PROC_DEFSTACKSIZE  \
94             (CPU_SAVED_REGS_CNT * 2 * sizeof(cpustack_t) \
95             + 32 * sizeof(int))
96 #endif
97
98 /* OBSOLETE */
99 #define CONFIG_KERN_DEFSTACKSIZE CONFIG_PROC_DEFSTACKSIZE
100
101 /* Memory fill codes to help debugging */
102 #if CONFIG_KERN_MONITOR
103         #include <cpu/types.h>
104         #if (SIZEOF_CPUSTACK_T == 1)
105                 /* 8bit cpustack_t */
106                 #define CONFIG_KERN_STACKFILLCODE  0xA5
107                 #define CONFIG_KERN_MEMFILLCODE    0xDB
108         #elif (SIZEOF_CPUSTACK_T == 2)
109                 /* 16bit cpustack_t */
110                 #define CONFIG_KERN_STACKFILLCODE  0xA5A5
111                 #define CONFIG_KERN_MEMFILLCODE    0xDBDB
112         #elif (SIZEOF_CPUSTACK_T == 4)
113                 /* 16bit cpustack_t */
114                 #define CONFIG_KERN_STACKFILLCODE  0xA5A5A5A5UL
115                 #define CONFIG_KERN_MEMFILLCODE    0xDBDBDBDBUL
116         #elif (SIZEOF_CPUSTACK_T == 8)
117                 /* 16bit cpustack_t */
118                 #define CONFIG_KERN_STACKFILLCODE  0xA5A5A5A5A5A5A5A5UL
119                 #define CONFIG_KERN_MEMFILLCODE    0xDBDBDBDBDBDBDBDBUL
120         #else
121                 #error No cpustack_t size supported!
122         #endif
123 #endif
124
125 #endif /*  CFG_KERN_H */