TNeo
v1.08
core
tn_cfg_dispatch.h
Go to the documentation of this file.
1
/*******************************************************************************
2
*
3
* TNeo: real-time kernel initially based on TNKernel
4
*
5
* TNKernel: copyright 2004, 2013 Yuri Tiomkin.
6
* PIC32-specific routines: copyright 2013, 2014 Anders Montonen.
7
* TNeo: copyright 2014 Dmitry Frank.
8
*
9
* TNeo was born as a thorough review and re-implementation of
10
* TNKernel. The new kernel has well-formed code, inherited bugs are fixed
11
* as well as new features being added, and it is tested carefully with
12
* unit-tests.
13
*
14
* API is changed somewhat, so it's not 100% compatible with TNKernel,
15
* hence the new name: TNeo.
16
*
17
* Permission to use, copy, modify, and distribute this software in source
18
* and binary forms and its documentation for any purpose and without fee
19
* is hereby granted, provided that the above copyright notice appear
20
* in all copies and that both that copyright notice and this permission
21
* notice appear in supporting documentation.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE DMITRY FRANK AND CONTRIBUTORS "AS IS"
24
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DMITRY FRANK OR CONTRIBUTORS BE
27
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
33
* THE POSSIBILITY OF SUCH DAMAGE.
34
*
35
******************************************************************************/
36
37
/**
38
* \file
39
*
40
* Dispatch configuration: set predefined options, include user-provided cfg
41
* file as well as default cfg file.
42
*
43
*/
44
45
#ifndef _TN_CFG_DISPATCH_H
46
#define _TN_CFG_DISPATCH_H
47
48
#include "../arch/tn_arch_detect.h"
49
50
//-- Configuration constants
51
/**
52
* In this case, you should use macro like this: `#TN_MAKE_ALIG(struct my_struct)`.
53
* This way is used in the majority of TNKernel ports. (actually, in all ports
54
* except the one by AlexB)
55
*/
56
#define TN_API_MAKE_ALIG_ARG__TYPE 1
57
58
/**
59
* In this case, you should use macro like this: `#TN_MAKE_ALIG(sizeof(struct
60
* my_struct))`. This way is stated in TNKernel docs and used in the port for
61
* dsPIC/PIC24/PIC32 by AlexB.
62
*/
63
#define TN_API_MAKE_ALIG_ARG__SIZE 2
64
65
66
//--- As a starting point, you might want to copy tn_cfg_default.h -> tn_cfg.h,
67
// and then edit it if you want to change default configuration.
68
// NOTE: the file tn_cfg.h is specified in .hgignore file, in order to not include
69
// project-specific configuration in the common TNKernel repository.
70
#include "tn_cfg.h"
71
72
//-- Probably a bit of hack, but anyway:
73
// tn_cfg.h might just be a modified copy from existing tn_cfg_default.h,
74
// and then, _TN_CFG_DEFAULT_H is probably defined there.
75
// But we need to set some defaults, so, let's undef it.
76
// Anyway, tn_cfg_default.h checks whether each particular option is already
77
// defined, so it works nice.
78
#undef _TN_CFG_DEFAULT_H
79
80
//--- default cfg file is included too, so that you are free to not set
81
// all available options in your tn_cfg.h file.
82
#include "
tn_cfg_default.h
"
83
84
//-- check that all options specified {{{
85
86
#if !defined(TN_CHECK_BUILD_CFG)
87
# error TN_CHECK_BUILD_CFG is not defined
88
#endif
89
90
#if !defined(TN_PRIORITIES_CNT)
91
# error TN_PRIORITIES_CNT is not defined
92
#endif
93
94
95
#if !defined(TN_CHECK_PARAM)
96
# error TN_CHECK_PARAM is not defined
97
#endif
98
99
#if !defined(TN_DEBUG)
100
# error TN_DEBUG is not defined
101
#endif
102
103
#if !defined(TN_OLD_TNKERNEL_NAMES)
104
# error TN_OLD_TNKERNEL_NAMES is not defined
105
#endif
106
107
#if !defined(TN_USE_MUTEXES)
108
# error TN_USE_MUTEXES is not defined
109
#endif
110
111
#if TN_USE_MUTEXES
112
# if !defined(TN_MUTEX_REC)
113
# error TN_MUTEX_REC is not defined
114
# endif
115
# if !defined(TN_MUTEX_DEADLOCK_DETECT)
116
# error TN_MUTEX_DEADLOCK_DETECT is not defined
117
# endif
118
#endif
119
120
#if !defined(TN_TICK_LISTS_CNT)
121
# error TN_TICK_LISTS_CNT is not defined
122
#endif
123
124
#if !defined(TN_API_MAKE_ALIG_ARG)
125
# error TN_API_MAKE_ALIG_ARG is not defined
126
#endif
127
128
#if !defined(TN_PROFILER)
129
# error TN_PROFILER is not defined
130
#endif
131
132
#if !defined(TN_PROFILER_WAIT_TIME)
133
# error TN_PROFILER_WAIT_TIME is not defined
134
#endif
135
136
#if !defined(TN_INIT_INTERRUPT_STACK_SPACE)
137
# error TN_INIT_INTERRUPT_STACK_SPACE is not defined
138
#endif
139
140
#if !defined(TN_STACK_OVERFLOW_CHECK)
141
# error TN_STACK_OVERFLOW_CHECK is not defined
142
#endif
143
144
#if defined (__TN_ARCH_PIC24_DSPIC__)
145
# if !defined(TN_P24_SYS_IPL)
146
# error TN_P24_SYS_IPL is not defined
147
# endif
148
#endif
149
150
#if !defined(TN_DYNAMIC_TICK)
151
# error TN_DYNAMIC_TICK is not defined
152
#endif
153
154
#if !defined(TN_OLD_EVENT_API)
155
# error TN_OLD_EVENT_API is not defined
156
#endif
157
158
#if !defined(TN_FORCED_INLINE)
159
# error TN_FORCED_INLINE is not defined
160
#endif
161
162
#if !defined(TN_MAX_INLINE)
163
# error TN_MAX_INLINE is not defined
164
#endif
165
166
167
// }}}
168
169
170
171
//-- check TN_P24_SYS_IPL: should be 1 .. 6.
172
#if defined (__TN_ARCH_PIC24_DSPIC__)
173
# if TN_P24_SYS_IPL >= 7
174
# error TN_P24_SYS_IPL must be less than 7
175
# endif
176
# if TN_P24_SYS_IPL <= 0
177
# error TN_P24_SYS_IPL must be more than 0
178
# endif
179
#endif
180
181
//-- NOTE: TN_TICK_LISTS_CNT is checked in tn_timer_static.c
182
//-- NOTE: TN_PRIORITIES_CNT is checked in tn_sys.c
183
//-- NOTE: TN_API_MAKE_ALIG_ARG is checked in tn_common.h
184
185
186
/**
187
* Internal kernel definition: set to non-zero if `_tn_sys_on_context_switch()`
188
* should be called on context switch.
189
*/
190
#if TN_PROFILER || TN_STACK_OVERFLOW_CHECK
191
# define _TN_ON_CONTEXT_SWITCH_HANDLER 1
192
#else
193
# define _TN_ON_CONTEXT_SWITCH_HANDLER 0
194
#endif
195
196
/**
197
* If `#TN_STACK_OVERFLOW_CHECK` is set, we have 1-word overhead for each
198
* task stack.
199
*/
200
#define _TN_STACK_OVERFLOW_SIZE_ADD (TN_STACK_OVERFLOW_CHECK ? 1 : 0)
201
202
#endif // _TN_CFG_DISPATCH_H
203
204
tn_cfg_default.h
TNeo default configuration file, to be copied as tn_cfg.h.
Generated on Sat Feb 25 2017 20:43:32 for TNeo by
1.8.14