TNeoKernel  v1.02
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros
tn_cfg_default.h File Reference

Detailed Description

TNeoKernel default configuration file, to be copied as tn_cfg.h.

This project is intended to be built as a library, separately from main project (although nothing prevents you from bundling things together, if you want to).

There are various options available which affects API and behavior of the kernel. But these options are specific for particular project, and aren't related to the kernel itself, so we need to keep them separately.

To this end, file tn.h (the main kernel header file) includes tn_cfg.h, which isn't included in the repository (even more, it is added to .hgignore list actually). Instead, default configuration file tn_cfg_default.h is provided, and when you just cloned the repository, you might want to copy it as tn_cfg.h. Or even better, if your filesystem supports symbolic links, copy it somewhere to your main project's directory (so that you can add it to your VCS there), and create symlink to it named tn_cfg.h in the TNeoKernel source directory, like this:

$ cd /path/to/tneokernel/src
$ cp ./tn_cfg_default.h /path/to/main/project/lib_cfg/tn_cfg.h
$ ln -s /path/to/main/project/lib_cfg/tn_cfg.h ./tn_cfg.h

Default configuration file contains detailed comments, so you can read them and configure behavior as you like.

Definition in file tn_cfg_default.h.

Go to the source code of this file.

Macros

#define TN_CHECK_PARAM   1
 Enables additional param checking for most of the system functions. More...
 
#define TN_DEBUG   0
 Allows additional internal self-checking, useful to catch internal TNeoKernel bugs as well as illegal kernel usage (e.g. More...
 
#define TN_OLD_TNKERNEL_NAMES   1
 Whether old TNKernel names (definitions, functions, etc) should be available. More...
 
#define TN_USE_MUTEXES   1
 Whether mutexes API should be available.
 
#define TN_MUTEX_REC   1
 Whether mutexes should allow recursive locking/unlocking.
 
#define TN_MUTEX_DEADLOCK_DETECT   1
 Whether RTOS should detect deadlocks and notify user about them via callback. More...
 
#define TN_TICK_LISTS_CNT   8
 Number of "tick" lists of timers, must be a power or two; minimum value: 2; typical values: 4, 8 or 16. More...
 
#define TN_API_MAKE_ALIG_ARG   TN_API_MAKE_ALIG_ARG__SIZE
 API option for MAKE_ALIG() macro. More...
 

Macro Definition Documentation

#define TN_CHECK_PARAM   1

Enables additional param checking for most of the system functions.

It's surely useful for debug, but probably better to remove in release. If it is set, most of the system functions are able to return two additional codes:

  • TN_RC_WPARAM if wrong params were given;
  • TN_RC_INVALID_OBJ if given pointer doesn't point to a valid object. Object validity is checked by means of the special ID field of type enum TN_ObjId.
See also
enum TN_ObjId

Definition at line 89 of file tn_cfg_default.h.

#define TN_DEBUG   0

Allows additional internal self-checking, useful to catch internal TNeoKernel bugs as well as illegal kernel usage (e.g.

sleeping in the idle task callback). Produces a couple of extra instructions which usually just causes debugger to stop if something goes wrong.

Definition at line 99 of file tn_cfg_default.h.

#define TN_OLD_TNKERNEL_NAMES   1

Whether old TNKernel names (definitions, functions, etc) should be available.

If you're porting your existing application written for TNKernel, it is definitely worth enabling. If you start new project with TNeoKernel from scratch, it's better to avoid old names.

Definition at line 109 of file tn_cfg_default.h.

#define TN_MUTEX_DEADLOCK_DETECT   1

Whether RTOS should detect deadlocks and notify user about them via callback.

See also
see tn_callback_deadlock_set()

Definition at line 133 of file tn_cfg_default.h.

#define TN_TICK_LISTS_CNT   8

Number of "tick" lists of timers, must be a power or two; minimum value: 2; typical values: 4, 8 or 16.

Refer to the Implementation of timers for details.

Shortly: this value represents number of elements in the array of struct TN_ListItem, on 32-bit system each element takes 8 bytes.

The larger value, the more memory is needed, and the faster system timer ISR works. If your application has a lot of timers and/or sleeping tasks, consider incrementing this value; otherwise, default value should work for you.

Definition at line 151 of file tn_cfg_default.h.

#define TN_API_MAKE_ALIG_ARG   TN_API_MAKE_ALIG_ARG__SIZE

API option for MAKE_ALIG() macro.

There is a terrible mess with MAKE_ALIG() macro: original TNKernel docs specify that the argument of it should be the size to align, but almost all ports, including "original" one, defined it so that it takes type, not size.

But the port by AlexB implemented it differently (i.e. accordingly to the docs)

When I was moving from the port by AlexB to another one, do you have any idea how much time it took me to figure out why do I have rare weird bug? :)

So, available options:

Definition at line 183 of file tn_cfg_default.h.