1.6. types — Common types

Source code: src/kernel/types.h


Defines

UNUSED(v)
STRINGIFY(x)

Create a string of an identifier using the pre-processor.

STRINGIFY2(x)

Used internally by STRINGIFY().

TOKENPASTE(x, y)

Concatenate two tokens.

TOKENPASTE2(x, y)

Used internally by TOKENPASTE().

UNIQUE(x)

Create a unique token.

membersof(a)

Get the number of elements in an array.

As an example, the code below outputs number of members in foo = 10.

int foo[10];

std_printf(FSTR("number of members in foo = %d\\r\\n"),
           membersof(foo));

container_of(ptr, type, member)
DIV_CEIL(n, d)

Integer division that rounds the result up.

MIN(a, b)

Get the minimum value of the two.

MAX(a, b)

Get the maximum value of the two.

PRINT_FILE_LINE

Debug print of file and line.

STD_PRINTF_DEBUG(...)
_ASSERTFMT(fmt, ...)
ASSERTN(cond, n, ...)

Assert given condition and call the system on fatal callback with given value n on error.

ASSERT(cond, ...)

Assert given condition and call the system on fatal callback with value 1 on error.

BIT(pos)
BITFIELD_SET(name, value)
BITFIELD_GET(name, value)

Typedefs

typedef
typedef
typedef
typedef
typedef
typedef