TNeoKernel  v1.04
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
tn_cfg_dispatch.h
Go to the documentation of this file.
1 /*******************************************************************************
2  *
3  * TNeoKernel: 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  * TNeoKernel: copyright © 2014 Dmitry Frank.
8  *
9  * TNeoKernel 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: TNeoKernel.
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_PRIORITIES_CNT)
87 # error TN_PRIORITIES_CNT is not defined
88 #endif
89 
90 #if !defined(TN_CHECK_PARAM)
91 # error TN_CHECK_PARAM is not defined
92 #endif
93 
94 #if !defined(TN_DEBUG)
95 # error TN_DEBUG is not defined
96 #endif
97 
98 #if !defined(TN_OLD_TNKERNEL_NAMES)
99 # error TN_OLD_TNKERNEL_NAMES is not defined
100 #endif
101 
102 #if !defined(TN_USE_MUTEXES)
103 # error TN_USE_MUTEXES is not defined
104 #endif
105 
106 #if TN_USE_MUTEXES
107 # if !defined(TN_MUTEX_REC)
108 # error TN_MUTEX_REC is not defined
109 # endif
110 # if !defined(TN_MUTEX_DEADLOCK_DETECT)
111 # error TN_MUTEX_DEADLOCK_DETECT is not defined
112 # endif
113 #endif
114 
115 #if !defined(TN_TICK_LISTS_CNT)
116 # error TN_TICK_LISTS_CNT is not defined
117 #endif
118 
119 #if !defined(TN_API_MAKE_ALIG_ARG)
120 # error TN_API_MAKE_ALIG_ARG is not defined
121 #endif
122 
123 #if defined (__TN_ARCH_PIC24_DSPIC__)
124 # if !defined(TN_P24_SYS_IPL)
125 # error TN_P24_SYS_IPL is not defined
126 # endif
127 
128 # if !defined(TN_P24_SYS_IPL_STR)
129 # error TN_P24_SYS_IPL_STR is not defined
130 # endif
131 #endif
132 
133 // }}}
134 
135 
136 
137 
138 #if defined (__TN_ARCH_PIC24_DSPIC__)
139 # if TN_P24_SYS_IPL >= 7
140 # error TN_P24_SYS_IPL must be less than 7
141 # endif
142 # if TN_P24_SYS_IPL <= 0
143 # error TN_P24_SYS_IPL must be more than 0
144 # endif
145 #endif
146 
147 
148 
149 
150 #endif // _TN_CFG_DISPATCH_H
151 
152 
TNeoKernel default configuration file, to be copied as tn_cfg.h.