1.7. types — Common types¶
A bunch of types and difinitions that didn’t fit anywhere else.
Source code: src/kernel/types.h
Defines
-
UNUSED(v)¶ Ignore unused function argument.
An example of a function that does not use it’s first argument
a:int foo(int a, int b) { UNUSED(a); return (b); }
-
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.
-
PRINT_FILE_LINE()¶ Debug print of file and line.
-
STD_PRINTF_DEBUG(...)¶
-
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));
-
indexof(e_p, a)¶ Get the index of given element in an array.
-
container_of(ptr, type, member)¶
-
DIV_CEIL(n, d)¶ Integer division that rounds the result up.
-
DIV_ROUND(n, d)¶ Integer division that rounds the result to the closest integer.
-
MIN(a, b)¶ Get the minimum value of the two.
-
MAX(a, b)¶ Get the maximum value of the two.
-
BIT(pos)¶
-
BITFIELD_SET(name, value)¶
-
BITFIELD_GET(name, value)¶
-
OSTR(string)¶
-
CSTR(string)¶
Typedefs
-
typedef uint8_t
u8_t¶
-
typedef int8_t
s8_t¶
-
typedef uint16_t
u16_t¶
-
typedef int16_t
s16_t¶
-
typedef uint32_t
u32_t¶
-
typedef int32_t
s32_t¶
Functions
-
static size_t
iov_uintptr_size(struct iov_uintptr_t *iov_p, size_t length)¶
-
struct
thrd_prio_list_elem_t¶
-
struct
thrd_prio_list_t¶ Public Members
-
struct thrd_prio_list_elem_t *
head_p¶
-
struct thrd_prio_list_elem_t *
-
struct
iov_t¶ - #include <types.h>
Input-output vector.
-
struct
iov_uintptr_t¶ - #include <types.h>
Input-output vector with address.