ChibiOS 21.11.5
chlicense.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 chlicense.h
21 * @brief License Module macros and structures.
22 *
23 * @addtogroup chibios_license
24 * @details This module contains all the definitions required for defining
25 * a licensing scheme for customers or public releases.
26 * @{
27 */
28
29#ifndef CHLICENSE_H
30#define CHLICENSE_H
31
32/*===========================================================================*/
33/* Module constants. */
34/*===========================================================================*/
35
36/**
37 * @name Allowed Features Levels
38 * @{
39 */
40#define CH_FEATURES_BASIC 0
41#define CH_FEATURES_INTERMEDIATE 1
42#define CH_FEATURES_FULL 2
43/** @} */
44
45/**
46 * @name Deployment Options
47 * @{
48 */
49#define CH_DEPLOY_UNLIMITED -1
50#define CH_DEPLOY_NONE 0
51/** @} */
52
53/**
54 * @name Licensing Options
55 * @{
56 */
57#define CH_LICENSE_GPL 0
58#define CH_LICENSE_GPL_EXCEPTION 1
59#define CH_LICENSE_COMMERCIAL_FREE 2
60#define CH_LICENSE_COMMERCIAL_DEV_1000 3
61#define CH_LICENSE_COMMERCIAL_DEV_5000 4
62#define CH_LICENSE_COMMERCIAL_FULL 5
63#define CH_LICENSE_COMMERCIAL_RUNTIME 6
64#define CH_LICENSE_PARTNER 7
65/** @} */
66
67#include "chversion.h"
68#include "chcustomer.h"
69#if CH_LICENSE == CH_LICENSE_PARTNER
70#include "chpartner.h"
71#endif
72#if CH_LICENSE == CH_LICENSE_COMMERCIAL_RUNTIME
73#include "chruntime.h"
74#endif
75
76/*===========================================================================*/
77/* Module pre-compile time settings. */
78/*===========================================================================*/
79
80/*===========================================================================*/
81/* Derived constants and error checks. */
82/*===========================================================================*/
83
84/* Checks on chversion.h.*/
85#if !defined(__CHIBIOS__)
86 #error "__CHIBIOS__ not defined in chversion.h"
87#endif
88
89#if !defined(CH_VERSION_STABLE)
90 #error "CH_VERSION_STABLE not defined in chversion.h"
91#endif
92
93#if !defined(CH_VERSION_YEAR)
94 #error "CH_VERSION_YEAR not defined in chversion.h"
95#endif
96
97#if !defined(CH_VERSION_MONTH)
98 #error "CH_VERSION_MONTH not defined in chversion.h"
99#endif
100
101#if !defined(CH_VERSION_PATCH)
102 #error "CH_VERSION_PATCH not defined in chversion.h"
103#endif
104
105#if !defined(CH_VERSION_NICKNAME)
106 #error "CH_VERSION_NICKNAME not defined in chversion.h"
107#endif
108
109#if !defined(CH_VERSION_DATE)
110 #error "CH_VERSION_DATE not defined in chversion.h"
111#endif
112
113#if (CH_VERSION_STABLE < 0) || (CH_VERSION_STABLE > 1)
114 #error "invalid CH_VERSION_STABLE value in chversion.h"
115#endif
116
117#if (CH_VERSION_YEAR < 12) || (CH_VERSION_YEAR > 99)
118 #error "invalid CH_VERSION_YEAR value in chversion.h"
119#endif
120
121#if (CH_VERSION_MONTH < 1) || (CH_VERSION_MONTH > 12)
122 #error "invalid CH_VERSION_MONTH value in chversion.h"
123#endif
124
125#if (CH_VERSION_DATE < 201201) || (CH_VERSION_DATE > 209912)
126 #error "invalid CH_VERSION_DATE value in chversion.h"
127#endif
128
129/* Checks on chcustomer.h.*/
130#if !defined(CH_CUSTOMER_ID_STRING)
131#error "CH_CUSTOMER_ID_STRING not defined in chcustomer.h"
132#endif
133
134#if !defined(CH_CUSTOMER_ID_CODE)
135#error "CH_CUSTOMER_ID_CODE not defined in chcustomer.h"
136#endif
137
138#if !defined(CH_CUSTOMER_LICENSE_EOS_DATE)
139#error "CH_CUSTOMER_LICENSE_EOS_DATE not defined in chcustomer.h"
140#endif
141
142#if !defined(CH_CUSTOMER_LICENSE_VERSION_YEAR)
143#error "CH_CUSTOMER_LICENSE_VERSION_YEAR not defined in chcustomer.h"
144#endif
145
146#if !defined(CH_CUSTOMER_LICENSE_VERSION_MONTH)
147#error "CH_CUSTOMER_LICENSE_VERSION_MONTH not defined in chcustomer.h"
148#endif
149
150#if !defined(CH_CUSTOMER_LICENSE_VERSION_DATE)
151#error "CH_CUSTOMER_LICENSE_VERSION_DATE not defined in chcustomer.h"
152#endif
153
154#if !defined(CH_LICENSE)
155#error "CH_LICENSE not defined in chcustomer.h"
156#endif
157
158#if (CH_CUSTOMER_LICENSE_EOS_DATE < 201201) || \
159 (CH_CUSTOMER_LICENSE_EOS_DATE > 209912)
160#error "invalid CH_CUSTOMER_LICENSE_EOS_DATE value in chcustomer.h"
161#endif
162
163#if (CH_CUSTOMER_LICENSE_VERSION_YEAR < 12) || \
164 (CH_CUSTOMER_LICENSE_VERSION_YEAR > 99)
165#error "invalid CH_CUSTOMER_LICENSE_VERSION_YEAR value in chcustomer.h"
166#endif
167
168#if (CH_CUSTOMER_LICENSE_VERSION_MONTH < 1) || \
169 (CH_CUSTOMER_LICENSE_VERSION_MONTH > 12)
170#error "invalid CH_CUSTOMER_LICENSE_VERSION_MONTH value in chcustomer.h"
171#endif
172
173#if (CH_CUSTOMER_LICENSE_VERSION_DATE < 201201) || \
174 (CH_CUSTOMER_LICENSE_VERSION_DATE > 209912)
175 #error "invalid CH_CUSTOMER_LICENSE_VERSION_DATE value in chcustomer.h"
176#endif
177
178/* Checks on licensed versions.*/
179#if CH_VERSION_DATE > CH_CUSTOMER_LICENSE_VERSION_DATE
180#error "this ChibiOS version is newer than your license, see chcustomer.h"
181#endif
182
183/* Checks on end-of-support date.*/
184#if CH_VERSION_DATE > CH_CUSTOMER_LICENSE_EOS_DATE
185#error "this ChibiOS version is beyond your End-Of-Support date, see chcustomer.h"
186#endif
187
188/* Defaults for GPL license.*/
189#if (CH_LICENSE == CH_LICENSE_GPL) || defined(__DOXYGEN__)
190/**
191 * @brief License identification string.
192 * @details This string identifies the license in a machine-readable
193 * format.
194 */
195#define CH_LICENSE_TYPE_STRING "GNU General Public License 3 (GPL3)"
196
197/**
198 * @brief Customer identification string.
199 * @details This information is only available for registered commercial users.
200 */
201#define CH_LICENSE_ID_STRING "N/A"
202
203/**
204 * @brief Customer code.
205 * @details This information is only available for registered commercial users.
206 */
207#define CH_LICENSE_ID_CODE "N/A"
208
209/**
210 * @brief Code modifiability restrictions.
211 * @details This setting defines if the source code is user-modifiable or not.
212 */
213#define CH_LICENSE_MODIFIABLE_CODE TRUE
214
215/**
216 * @brief Code functionality restrictions.
217 */
218#define CH_LICENSE_FEATURES CH_FEATURES_FULL
219
220/**
221 * @brief Code deploy restrictions.
222 * @details This is the per-core deploy limit allowed under the current
223 * license scheme.
224 */
225#define CH_LICENSE_MAX_DEPLOY CH_DEPLOY_UNLIMITED
226
227#elif CH_LICENSE == CH_LICENSE_GPL_EXCEPTION
228#define CH_LICENSE_TYPE_STRING "GNU General Public License 3 (GPL3) + Exception"
229#define CH_LICENSE_ID_STRING "N/A"
230#define CH_LICENSE_ID_CODE "N/A"
231#define CH_LICENSE_MODIFIABLE_CODE FALSE
232#define CH_LICENSE_FEATURES CH_FEATURES_BASIC
233#define CH_LICENSE_MAX_DEPLOY CH_DEPLOY_UNLIMITED
234
235#elif CH_LICENSE == CH_LICENSE_COMMERCIAL_FREE
236#define CH_LICENSE_TYPE_STRING "Zero Cost Registered License for 500 Cores"
237#define CH_LICENSE_ID_STRING "N/A"
238#define CH_LICENSE_ID_CODE "2017-0000"
239#define CH_LICENSE_MODIFIABLE_CODE FALSE
240#define CH_LICENSE_FEATURES CH_FEATURES_INTERMEDIATE
241#define CH_LICENSE_MAX_DEPLOY 500
242
243#elif CH_LICENSE == CH_LICENSE_COMMERCIAL_DEV_1000
244#define CH_LICENSE_TYPE_STRING "Developer Commercial License for 1000 Cores"
245#define CH_LICENSE_ID_STRING CH_CUSTOMER_ID_STRING
246#define CH_LICENSE_ID_CODE CH_CUSTOMER_ID_CODE
247#define CH_LICENSE_MODIFIABLE_CODE TRUE
248#define CH_LICENSE_FEATURES CH_FEATURES_FULL
249#define CH_LICENSE_MAX_DEPLOY 1000
250
251#elif CH_LICENSE == CH_LICENSE_COMMERCIAL_DEV_5000
252#define CH_LICENSE_TYPE_STRING "Developer Commercial License for 5000 Cores"
253#define CH_LICENSE_ID_STRING CH_CUSTOMER_ID_STRING
254#define CH_LICENSE_ID_CODE CH_CUSTOMER_ID_CODE
255#define CH_LICENSE_MODIFIABLE_CODE TRUE
256#define CH_LICENSE_FEATURES CH_FEATURES_FULL
257#define CH_LICENSE_MAX_DEPLOY 5000
258
259#elif CH_LICENSE == CH_LICENSE_COMMERCIAL_FULL
260#define CH_LICENSE_TYPE_STRING "Full Commercial License for Unlimited Deployment"
261#define CH_LICENSE_ID_STRING CH_CUSTOMER_ID_STRING
262#define CH_LICENSE_ID_CODE CH_CUSTOMER_ID_CODE
263#define CH_LICENSE_MODIFIABLE_CODE TRUE
264#define CH_LICENSE_FEATURES CH_FEATURES_FULL
265#define CH_LICENSE_MAX_DEPLOY CH_DEPLOY_UNLIMITED
266
267#elif CH_LICENSE == CH_LICENSE_COMMERCIAL_RUNTIME
268#define CH_LICENSE_TYPE_STRING "Runtime Commercial License"
269#define CH_LICENSE_ID_STRING CH_CUSTOMER_ID_STRING
270#define CH_LICENSE_ID_CODE CH_CUSTOMER_ID_CODE
271#define CH_LICENSE_MODIFIABLE_CODE TRUE
272#define CH_LICENSE_FEATURES CH_FEATURES_FULL
273#define CH_LICENSE_MAX_DEPLOY CH_RUNTIME_MAX_DEPLOY
274
275#elif CH_LICENSE == CH_LICENSE_PARTNER
276#define CH_LICENSE_TYPE_STRING "Partners Special Commercial License"
277#define CH_LICENSE_ID_STRING CH_CUSTOMER_ID_STRING
278#define CH_LICENSE_ID_CODE CH_CUSTOMER_ID_CODE
279#define CH_LICENSE_MODIFIABLE_CODE CH_PARTNER_MODIFIABLE_CODE
280#define CH_LICENSE_FEATURES CH_PARTNER_FEATURES
281#define CH_LICENSE_MAX_DEPLOY CH_PARTNER_MAX_DEPLOY
282
283#else
284#error "invalid licensing option"
285#endif
286
287/*===========================================================================*/
288/* Module data structures and types. */
289/*===========================================================================*/
290
291/*===========================================================================*/
292/* Module macros. */
293/*===========================================================================*/
294
295/*===========================================================================*/
296/* External declarations. */
297/*===========================================================================*/
298
299/*===========================================================================*/
300/* Module inline functions. */
301/*===========================================================================*/
302
303#endif /* CHLICENSE_H */
304
305/** @} */
Customer-related info.
Version Module macros and structures.