Choco OS  V.0.16.9.0
Join to the chocolate world
Configuration

Macros

#define ON   2
 Function is turned on.
 
#define OFF   1
 Function is turned off.
 
#define LEVEL(Lvl)   (Lvl)
 Function is set to LEVEL.
 
#define PERCENT(Percent)   ((float)Percent/(float)100)
 Number of percent.
 
#define B(Bytes)   (Bytes)
 Number of bytes.
 
#define kB(kBytes)   (kBytes * 1024)
 Number of kB.
 
#define MB(MBytes)   (MBytes * kB(1024))
 Number of MB.
 
#define GB(GBytes)   (GBytes * MB(1024ULL))
 Number of GB.
 
#define TB(TBytes)   (TBytes * GB(1024))
 Number of TB.
 
#define Hz(Freq)   (oC_Hz(Freq))
 Number of Hz.
 
#define kHz(Freq)   (oC_kHz(Freq))
 Number of kHz.
 
#define MHz(Freq)   (oC_MHz(Freq))
 Number of MHz.
 
#define GHz(Freq)   (oC_GHz(Freq))
 Number of GHz.
 
#define ns(time)   (oC_ns(time))
 Number of ns.
 
#define us(time)   (oC_us(time))
 Number of us.
 
#define ms(time)   (oC_ms(time))
 Number of ms.
 
#define s(time)   (oC_s(time))
 Number of s.
 
#define min(time)   (oC_min(time))
 Number of min.
 
#define hour(time)   (oC_hour(time))
 Number of hour.
 
#define day(time)   (oC_day(time))
 Number of day.
 
#define CFG_ENABLE_ASSERTIONS   ON
 enabling assertions More...
 
#define CFG_LEVEL_ASSERTIONS   LEVEL(0)
 definition of assertions level More...
 
#define CFG_ENABLE_DEBUG_PRINT   OFF
 enabling debug printing More...
 
#define CFG_ENABLE_IMPLEMENT_FAILURES   ON
 enabling implement failures More...
 
#define CFG_ENABLE_COMPILE_ASSERTS   OFF
 enabling compile assertions More...
 

Detailed Description

To see details check #CFG

The ChocoOS system contains many configure definitions, that can be set to some kind of variables by user. All configuration files are placed in the config directory.

There are many definitions to set, but following rules helps you to quickly learn how to use them. First of all note, that each configuration definition begins from CFG_ prefix, for example CFG_ENABLE_ASSERTIONS. This is easy way to distinguish the system configuration from other definitions. Second part of configuration names is a type of a definition, for example ENABLE in the CFG_ENABLE_DEBUG_PRINT definition. Thanks to that you will know, what values can you assign to the definition.
Here you have list of configuration types:

Type Values Description
ENABLE ON / OFF Enables or disables functionality.
LEVEL LEVEL( Lvl ) Determines level of a functionality. To set you should use macro LEVEL

Debug Configuration

Macro Definition Documentation

#define CFG_ENABLE_ASSERTIONS   ON

In computer programming, an assertion is a predicate (a true–false statement) placed in a program to indicate that the developer thinks that the predicate is always true at that place. If an assertion evaluates to false at run-time, an assertion failure results, which typically causes execution to abort.

To enable assertions that are placed in the system, set it to ON
OPTIONS:

VALUE Description
ON assertions are turned on
OFF assertions are turned off

Definition at line 58 of file oc_debug_cfg.h.

#define CFG_ENABLE_COMPILE_ASSERTS   OFF

Turns on assertions, that are checked during compile process. If the assertion condition is not true, then there will be compilation error
To enable compile assertions set it to ON

OPTIONS:

VALUE Description
ON compile assertions are turned on
OFF compile assertions are skipped

Definition at line 133 of file oc_debug_cfg.h.

#define CFG_ENABLE_DEBUG_PRINT   OFF

Turns on the oC_Debug function, that can be used to print messages visible only in this mode. Debug print is the similar function to printf but the most important difference between them is that oC_Debug will not be called, if this definition is set to OFF.
To enable debug messages, set it to ON

OPTIONS:

VALUE Description
ON Debug messages are printed
OFF all calls of #oC_Debug function are skipped

Definition at line 98 of file oc_debug_cfg.h.

#define CFG_ENABLE_IMPLEMENT_FAILURES   ON

Turns on the #oC_IMPLEMENT_FAILURE loops, that are for places in the code, that could not be achieved. The implement failure definition is just infinity loop, that can be turned off using this definition.

To enable implement failures, set it to ON

OPTIONS:

VALUE Description
ON Implement failures are turned on
OFF all calls of #oC_IMPLEMENT_FAILUIRE function are skipped

Definition at line 116 of file oc_debug_cfg.h.

#define CFG_LEVEL_ASSERTIONS   LEVEL(0)

In computer programming, an assertion is a predicate (a true–false statement) placed in a program to indicate that the developer thinks that the predicate is always true at that place. If an assertion evaluates to false at run-time, an assertion failure results, which typically causes execution to abort.

If assertions are turned on you can select a level of assertions, that should be used.

To turn on assertions use CFG_ENABLE_ASSERTIONS definition

OPTIONS:

VALUE Description
LEVEL(0) When some of assertions fails, a program will stack in infinite loop.
LEVEL(1) When some of assertions fails, a program will print information about it on the STDOUT

Definition at line 79 of file oc_debug_cfg.h.