The friendly Operating System for the Internet of Things
Startup and Configuration

Configuration data and startup code for the kernel. More...

Detailed Description


file  kernel_defines.h
 Common macros and compiler attributes/pragmas configuration.
file  kernel_init.h
 prototypes for kernel intitialization


#define container_of(PTR, TYPE, MEMBER)   ((TYPE *) ((char *) (PTR) - offsetof(TYPE, MEMBER)))
 Returns the container of a pointer to a member. More...
#define NORETURN
 The NORETURN keyword tells the compiler to assume that the function cannot return.
#define CONST
 A function declared as CONST is PURE and also not allowed to examine global memory. More...
#define PURE
 The function has no effects except the return value and its return value depends only on the parameters and/or global variables. More...
#define UNREACHABLE()   do { /* nothing */ } while (1)
 Tell the compiler that this line of code cannot be reached. More...
#define ALIGN_OF(T)   (offsetof(struct { char c; T t; }, t))
 Calculate the minimal alignment for type T. More...


void kernel_init (void)
 Initializes scheduler and creates main and idle task.

Macro Definition Documentation

#define ALIGN_OF (   T)    (offsetof(struct { char c; T t; }, t))
[in]TType to examine
The minimal alignment of T.

Definition at line 115 of file kernel_defines.h.

#define CONST

I.e. a CONST function cannot even dereference a pointer parameter.

Definition at line 80 of file kernel_defines.h.

#define container_of (   PTR,
)    ((TYPE *) ((char *) (PTR) - offsetof(TYPE, MEMBER)))

For a struct TYPE with a member MEMBER, given a pointer PTR to TYPE::MEMBER this function returns a pointer to the instance of TYPE.

E.g. for struct my_struct_t { ...; something_t n; ... } my_struct;, &my_struct == container_of(&my_struct.n, struct my_struct_t, n).

[in]PTRpointer to a member
[in]TYPEa type name (a struct or union), container of PTR
[in]MEMBERname of the member of TYPE which PTR points to
Pointer to the container of PTR.

Definition at line 56 of file kernel_defines.h.

#define PURE

Such a function can be subject to common subexpression elimination and loop optimization just as an arithmetic operator would be.

Definition at line 93 of file kernel_defines.h.

#define UNREACHABLE ( )    do { /* nothing */ } while (1)

Most useful in junction with NORETURN. Use this if the compiler cannot tell that e.g. an assembler instruction causes a longjmp, or a write causes a reboot.

Definition at line 106 of file kernel_defines.h.