TNeoKernel
v1.01
|
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_API_MAKE_ALIG_ARG TN_API_MAKE_ALIG_ARG__SIZE |
API option for MAKE_ALIG() macro. More... | |
#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
.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.
tn_callback_deadlock_set()
Definition at line 133 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:
TN_API_MAKE_ALIG_ARG__TYPE
: In this case, you should use macro like this: TN_MAKE_ALIG(struct my_struct)
This way is used in the majority of TNKernel ports. (actually, in all ports except the one by AlexB)TN_API_MAKE_ALIG_ARG__SIZE
: In this case, you should use macro like this: TN_MAKE_ALIG(sizeof(struct my_struct))
This way is stated in TNKernel docs and used in the port for dsPIC/PIC24/PIC32 by AlexB. Definition at line 164 of file tn_cfg_default.h.