From bb42a06ea099afc1070c8421e2695bb037434e97 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 16 Apr 2016 10:25:03 +0000 Subject: More licensing checks. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9288 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/nil/include/ch.h | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) (limited to 'os/nil') diff --git a/os/nil/include/ch.h b/os/nil/include/ch.h index e517b9551..31ec8bfe3 100644 --- a/os/nil/include/ch.h +++ b/os/nil/include/ch.h @@ -30,8 +30,9 @@ #ifndef CH_H #define CH_H -#include "chconf.h" #include "chtypes.h" +#include "chconf.h" +#include "chlicense.h" /*===========================================================================*/ /* Module constants. */ @@ -353,6 +354,52 @@ /* Derived constants and error checks. */ /*===========================================================================*/ +#if CH_CUSTOMER_LICENSED_NIL == FALSE +#error "ChibiOS/NIL not licensed" +#endif + +#if (CH_LICENSE_FEATURES != CH_FEATURES_FULL) && \ + (CH_LICENSE_FEATURES != CH_FEATURES_INTERMEDIATE) && \ + (CH_LICENSE_FEATURES == CH_FEATURES_BASIC) +#error "invalid CH_LICENSE_FEATURES setting" +#endif + +/* Restrictions in basic and intermediate modes.*/ +#if (CH_LICENSE_FEATURES == CH_FEATURES_INTERMEDIATE) || \ + (CH_LICENSE_FEATURES == CH_FEATURES_BASIC) + +/* System tick limited to 1000hz.*/ +#if CH_CFG_ST_FREQUENCY > 1000 +#undef CH_CFG_ST_FREQUENCY +#define CH_CFG_ST_FREQUENCY 1000 +#endif + +/* Restricted subsystems.*/ +#undef CH_CFG_USE_MAILBOXES + +#define CH_CFG_USE_MAILBOXES FALSE + +#endif /* (CH_LICENSE_FEATURES == CH_FEATURES_INTERMEDIATE) || + (CH_LICENSE_FEATURES == CH_FEATURES_BASIC) */ + +/* Restrictions in basic mode.*/ +#if CH_LICENSE_FEATURES == CH_FEATURES_BASIC + +/* Tick-Less mode restricted.*/ +#undef CH_CFG_ST_TIMEDELTA +#define CH_CFG_ST_TIMEDELTA 0 + +/* Restricted subsystems.*/ +#undef CH_CFG_USE_MEMCORE +#undef CH_CFG_USE_MEMPOOLS +#undef CH_CFG_USE_HEAP + +#define CH_CFG_USE_MEMCORE FALSE +#define CH_CFG_USE_MEMPOOLS FALSE +#define CH_CFG_USE_HEAP FALSE + +#endif /* CH_LICENSE_FEATURES == CH_FEATURES_BASIC */ + #if !defined(_CHIBIOS_NIL_CONF_) #error "missing or wrong configuration file" #endif -- cgit v1.2.3