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