ChibiOS  21.6.0
chlib.h
Go to the documentation of this file.
1 /*
2  ChibiOS - Copyright (C) 2006,2007,2008,2009,2010,2011,2012,2013,2014,
3  2015,2016,2017,2018,2019,2020,2021 Giovanni Di Sirio.
4 
5  This file is part of ChibiOS.
6 
7  ChibiOS is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation version 3 of the License.
10 
11  ChibiOS 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, see <http://www.gnu.org/licenses/>.
18 */
19 
20 /**
21  * @file oslib/include/chlib.h
22  * @brief ChibiOS/LIB main include file.
23  * @details This header includes all the required library headers. This file
24  * is meant do be included by @p ch.h not directly by user.
25  *
26  * @addtogroup oslib_info
27  * @details OS Library related info.
28  * @{
29  */
30 
31 #ifndef CHLIB_H
32 #define CHLIB_H
33 
34 /*===========================================================================*/
35 /* Module constants. */
36 /*===========================================================================*/
37 
38 /**
39  * @brief ChibiOS/LIB identification macro.
40  */
41 #define __CHIBIOS_OSLIB__
42 
43 /**
44  * @brief Stable release flag.
45  */
46 #define CH_OSLIB_STABLE 0
47 
48 /**
49  * @name ChibiOS/LIB version identification
50  * @{
51  */
52 /**
53  * @brief OS Library version string.
54  */
55 #define CH_OSLIB_VERSION "1.3.0"
56 
57 /**
58  * @brief OS Library version major number.
59  */
60 #define CH_OSLIB_MAJOR 1
61 
62 /**
63  * @brief OS Library version minor number.
64  */
65 #define CH_OSLIB_MINOR 3
66 
67 /**
68  * @brief OS Library version patch number.
69  */
70 #define CH_OSLIB_PATCH 0
71 /** @} */
72 
73 /*===========================================================================*/
74 /* Module pre-compile time settings. */
75 /*===========================================================================*/
76 
77 /*===========================================================================*/
78 /* Derived constants and error checks. */
79 /*===========================================================================*/
80 
81 /* Host OS checks.*/
82 #if !defined(__CHIBIOS_RT__) && !defined(__CHIBIOS_NIL__)
83 #error "OS check failed, must be included after ch.h"
84 #endif
85 
86 /* Configuration file checks.*/
87 #if !defined(CH_CFG_USE_MAILBOXES)
88 #error "CH_CFG_USE_MAILBOXES not defined in chconf.h"
89 #endif
90 
91 #if !defined(CH_CFG_USE_MEMCORE)
92 #error "CH_CFG_USE_MEMCORE not defined in chconf.h"
93 #endif
94 
95 #if !defined(CH_CFG_USE_HEAP)
96 #error "CH_CFG_USE_HEAP not defined in chconf.h"
97 #endif
98 
99 #if !defined(CH_CFG_USE_MEMPOOLS)
100 #error "CH_CFG_USE_MEMPOOLS not defined in chconf.h"
101 #endif
102 
103 #if !defined(CH_CFG_USE_OBJ_FIFOS)
104 #error "CH_CFG_USE_OBJ_FIFOS not defined in chconf.h"
105 #endif
106 
107 #if !defined(CH_CFG_USE_PIPES)
108 #error "CH_CFG_USE_PIPES not defined in chconf.h"
109 #endif
110 
111 #if !defined(CH_CFG_USE_OBJ_CACHES)
112 #error "CH_CFG_USE_OBJ_CACHES not defined in chconf.h"
113 #endif
114 
115 #if !defined(CH_CFG_USE_DELEGATES)
116 #error "CH_CFG_USE_DELEGATES not defined in chconf.h"
117 #endif
118 
119 #if !defined(CH_CFG_USE_JOBS)
120 #error "CH_CFG_USE_JOBS not defined in chconf.h"
121 #endif
122 
123 /* Objects factory options checks.*/
124 #if !defined(CH_CFG_USE_FACTORY)
125 #error "CH_CFG_USE_FACTORY not defined in chconf.h"
126 #endif
127 
128 #if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH)
129 #error "CH_CFG_FACTORY_MAX_NAMES_LENGTH not defined in chconf.h"
130 #endif
131 
132 #if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY)
133 #error "CH_CFG_FACTORY_OBJECTS_REGISTRY not defined in chconf.h"
134 #endif
135 
136 #if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
137 #error "CH_CFG_FACTORY_GENERIC_BUFFERS not defined in chconf.h"
138 #endif
139 
140 #if !defined(CH_CFG_FACTORY_SEMAPHORES)
141 #error "CH_CFG_FACTORY_SEMAPHORES not defined in chconf.h"
142 #endif
143 
144 #if !defined(CH_CFG_FACTORY_MAILBOXES)
145 #error "CH_CFG_FACTORY_MAILBOXES not defined in chconf.h"
146 #endif
147 
148 #if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
149 #error "CH_CFG_FACTORY_OBJ_FIFOS not defined in chconf.h"
150 #endif
151 
152 /* License checks.*/
153 #if !defined(CH_CUSTOMER_LIC_OSLIB) || !defined(CH_LICENSE_FEATURES)
154 #error "malformed chlicense.h"
155 #endif
156 
157 #if (CH_LICENSE_FEATURES != CH_FEATURES_FULL) && \
158  (CH_LICENSE_FEATURES != CH_FEATURES_INTERMEDIATE) && \
159  (CH_LICENSE_FEATURES != CH_FEATURES_BASIC)
160 #error "invalid CH_LICENSE_FEATURES setting"
161 #endif
162 
163 /* Restrictions in basic and intermediate modes.*/
164 #if (CH_CUSTOMER_LIC_OSLIB == FALSE) || \
165  (CH_LICENSE_FEATURES == CH_FEATURES_INTERMEDIATE) || \
166  (CH_LICENSE_FEATURES == CH_FEATURES_BASIC)
167 
168 /* Restricted subsystems.*/
169 #undef CH_CFG_USE_FACTORY
170 
171 #define CH_CFG_USE_FACTORY FALSE
172 
173 #endif /* (CH_CUSTOMER_LIC_OSLIB == FALSE) ||
174  (CH_LICENSE_FEATURES == CH_FEATURES_INTERMEDIATE) ||
175  (CH_LICENSE_FEATURES == CH_FEATURES_BASIC) */
176 
177 /* Restrictions in basic mode.*/
178 #if (CH_CUSTOMER_LIC_OSLIB == FALSE) || \
179  (CH_LICENSE_FEATURES == CH_FEATURES_BASIC)
180 
181 /* Restricted subsystems.*/
182 #undef CH_CFG_USE_HEAP
183 #undef CH_CFG_USE_MEMPOOLS
184 #undef CH_CFG_USE_OBJ_FIFOS
185 #undef CH_CFG_USE_PIPES
186 #undef CH_CFG_USE_OBJ_CACHES
187 #undef CH_CFG_USE_DELEGATES
188 #undef CH_CFG_USE_JOBS
189 
190 #define CH_CFG_USE_HEAP FALSE
191 #define CH_CFG_USE_MEMPOOLS FALSE
192 #define CH_CFG_USE_OBJ_FIFOS FALSE
193 #define CH_CFG_USE_PIPES FALSE
194 #define CH_CFG_USE_OBJ_CACHES FALSE
195 #define CH_CFG_USE_DELEGATES FALSE
196 #define CH_CFG_USE_JOBS FALSE
197 
198 #endif /* (CH_CUSTOMER_LIC_OSLIB == FALSE) ||
199  (CH_LICENSE_FEATURES == CH_FEATURES_BASIC) */
200 
201 /* Restrictions in unlicensed mode.*/
202 #if (CH_CUSTOMER_LIC_OSLIB == FALSE)
203 
204 /* Restricted subsystems.*/
205 #undef CH_CFG_USE_MAILBOXES
206 
207 #define CH_CFG_USE_MAILBOXES FALSE
208 
209 #endif /* CH_CUSTOMER_LIC_OSLIB == FALSE */
210 
211 /*===========================================================================*/
212 /* Module data structures and types. */
213 /*===========================================================================*/
214 
215 /*===========================================================================*/
216 /* Module macros. */
217 /*===========================================================================*/
218 
219 /*===========================================================================*/
220 /* External declarations. */
221 /*===========================================================================*/
222 
223 /*===========================================================================*/
224 /* Late inclusions. */
225 /*===========================================================================*/
226 
227 /* OS Library headers.*/
228 #include "chbsem.h"
229 #include "chmboxes.h"
230 #include "chmemcore.h"
231 #include "chmemheaps.h"
232 #include "chmempools.h"
233 #include "chobjfifos.h"
234 #include "chpipes.h"
235 #include "chobjcaches.h"
236 #include "chdelegates.h"
237 #include "chjobs.h"
238 #include "chfactory.h"
239 
240 /*===========================================================================*/
241 /* Module inline functions. */
242 /*===========================================================================*/
243 
244 /**
245  * @brief Initialization of all library modules.
246  *
247  * @notapi
248  */
249 static inline void __oslib_init(void) {
250 
251 #if CH_CFG_USE_MEMCORE == TRUE
252  __core_init();
253 #endif
254 #if CH_CFG_USE_HEAP == TRUE
255  __heap_init();
256 #endif
257 #if CH_CFG_USE_FACTORY == TRUE
258  __factory_init();
259 #endif
260 }
261 
262 #endif /* CHLIB_H */
263 
264 /** @} */
chdelegates.h
Delegate threads macros and structures.
chmemcore.h
Core memory manager macros and structures.
chfactory.h
ChibiOS objects factory structures and macros.
chbsem.h
Binary semaphores structures and macros.
chobjcaches.h
Objects Caches macros and structures.
chmemheaps.h
Memory heaps macros and structures.
chpipes.h
Pipes macros and structures.
chmboxes.h
Mailboxes macros and structures.
__core_init
void __core_init(void)
Low level memory manager initialization.
Definition: chmemcore.c:81
chmempools.h
Memory Pools macros and structures.
__factory_init
void __factory_init(void)
Initializes the objects factory.
Definition: chfactory.c:251
chjobs.h
Jobs Queues structures and macros.
__oslib_init
static void __oslib_init(void)
Initialization of all library modules.
Definition: chlib.h:249
chobjfifos.h
Objects FIFO structures and macros.
__heap_init
void __heap_init(void)
Initializes the default heap.
Definition: chmemheaps.c:107