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