![]() |
NTURT Zephyr v0.0.1
NTURT common library for Zephyr RTOS
|
Utility macros and functions. More...
Collaboration diagram for Utility:Data Structures | |
| struct | work_ctx |
| Work context. More... | |
| struct | work_ctx_buf |
| Work context buffer. More... | |
Macros | |
| #define | DISCARD(...) |
Discards all arguments and expend to Zephyr EMPTY. | |
| #define | GET_ARG_N_FIXED(N, ...) |
Same as Zephyr GET_GET_ARG_N but accepts macro expansion for N . | |
| #define | N_FOR_EACH_IDX_FIXED_ARG(F, sep, fixed_arg, ...) |
Same as Zephyr FOR_EACH_IDX_FIXED_ARG, useful for nested FOR_EACH macros. | |
| #define | N_FOR_EACH_FIXED_ARG(F, sep, fixed_arg, ...) |
Same as Zephyr FOR_EACH_FIXED_ARG, useful for nested FOR_EACH macros. | |
| #define | N_FOR_EACH_IDX(F, sep, ...) |
Same as Zephyr FOR_EACH_IDX, useful for nested FOR_EACH macros. | |
| #define | N_FOR_EACH(F, sep, ...) |
Same as Zephyr FOR_EACH, useful for nested FOR_EACH macros. | |
| #define | DEREF_TYPE(type) |
| Get the deferenced type of a pointer type. | |
| #define | TYPEOF_FIELD(type, member) |
| Get the type of a member in a structure (struct or union). | |
| #define | XOR(a, b) |
| Logical XOR. | |
| #define | IS_MASK_SET(value, mask) |
Check if all bits in mask are set in value . | |
| #define | FLAG_SET_AND_CLEAR(num, flag) |
| Check if a flag is set and clear that flag if it so. | |
| #define | BIT_SET_AND_CLEAR(num, bit) |
| Check if a bit is set and clear that bit if it is so. | |
| #define | LOG_DBG_THROTTLE(min_separation, ...) |
| Writes a DEBUG level message to the log with throttling. | |
| #define | LOG_INF_THROTTLE(min_separation, ...) |
| Writes an INFO level message to the log with throttling. | |
| #define | LOG_WRN_THROTTLE(min_separation, ...) |
| Writes a WARNING level message to the log with throttling. | |
| #define | LOG_ERR_THROTTLE(min_separation, ...) |
| Writes an ERROR level message to the log with throttling. | |
| #define | PRI(x) |
Insert format string to print x . | |
| #define | SCN(x) |
Insert format string to scan x . | |
| #define | PRI_arg(x) |
Insert x to printf format. | |
| #define | WORK_CTX_BUF_DEFINE(_name, _size, _work_handler, _ctx, _args_type) |
| Define work context buffer for the bottom half of an ISR. | |
| #define | WORK_CTX(_work) |
| Get the context of the work. | |
| #define | WORK_CTX_ARGS(_work) |
| Get the arguments for the work. | |
Functions | |
| struct work_ctx * | work_ctx_buf_alloc (struct work_ctx_buf *buf) |
| Allocate a work context. Return NULL if all work context are in use. | |
Utility macros and functions.
| #define BIT_SET_AND_CLEAR | ( | num, | |
| bit ) |
#include <nturt/sys/util.h>
Check if a bit is set and clear that bit if it is so.
| [in] | num | Number to check. |
| [in] | bit | Bit to check. |
| #define DEREF_TYPE | ( | type | ) |
#include <nturt/sys/util.h>
Get the deferenced type of a pointer type.
| [in] | type | The pointer type. |
| type | points to. |
| #define DISCARD | ( | ... | ) |
#include <nturt/sys/util.h>
Discards all arguments and expend to Zephyr EMPTY.
| [in] | ... | Arguments to discard. |
EMPTY. | #define FLAG_SET_AND_CLEAR | ( | num, | |
| flag ) |
#include <nturt/sys/util.h>
Check if a flag is set and clear that flag if it so.
| [in] | num | Number to check. |
| [in] | flag | Flag to check. |
| #define GET_ARG_N_FIXED | ( | N, | |
| ... ) |
#include <nturt/sys/util.h>
Same as Zephyr GET_GET_ARG_N but accepts macro expansion for N .
| [in] | N | The index of argument to fetch. Count from 1. |
| [in] | ... | Arguments from which one argument is returned. |
| #define IS_MASK_SET | ( | value, | |
| mask ) |
#include <nturt/sys/util.h>
Check if all bits in mask are set in value .
| [in] | value | Value to check. |
| [in] | mask | Mask to check against. |
mask are set in value . | #define LOG_DBG_THROTTLE | ( | min_separation, | |
| ... ) |
#include <nturt/sys/util.h>
Writes a DEBUG level message to the log with throttling.
| [in] | min_separation | Minimum time between log messages. |
| [in] | ... | Same as Zephyr LOG_DBG. |
| #define LOG_ERR_THROTTLE | ( | min_separation, | |
| ... ) |
#include <nturt/sys/util.h>
Writes an ERROR level message to the log with throttling.
| [in] | min_separation | Minimum time between log messages. |
| [in] | ... | Same as Zephyr LOG_ERR. |
| #define LOG_INF_THROTTLE | ( | min_separation, | |
| ... ) |
#include <nturt/sys/util.h>
Writes an INFO level message to the log with throttling.
| [in] | min_separation | Minimum time between log messages. |
| [in] | ... | Same as Zephyr LOG_INF. |
| #define LOG_WRN_THROTTLE | ( | min_separation, | |
| ... ) |
#include <nturt/sys/util.h>
Writes a WARNING level message to the log with throttling.
| [in] | min_separation | Minimum time between log messages. |
| [in] | ... | Same as Zephyr LOG_WRN. |
| #define N_FOR_EACH | ( | F, | |
| sep, | |||
| ... ) |
#include <nturt/sys/util.h>
Same as Zephyr FOR_EACH, useful for nested FOR_EACH macros.
| #define N_FOR_EACH_FIXED_ARG | ( | F, | |
| sep, | |||
| fixed_arg, | |||
| ... ) |
#include <nturt/sys/util.h>
Same as Zephyr FOR_EACH_FIXED_ARG, useful for nested FOR_EACH macros.
| #define N_FOR_EACH_IDX | ( | F, | |
| sep, | |||
| ... ) |
#include <nturt/sys/util.h>
Same as Zephyr FOR_EACH_IDX, useful for nested FOR_EACH macros.
| #define N_FOR_EACH_IDX_FIXED_ARG | ( | F, | |
| sep, | |||
| fixed_arg, | |||
| ... ) |
#include <nturt/sys/util.h>
Same as Zephyr FOR_EACH_IDX_FIXED_ARG, useful for nested FOR_EACH macros.
| #define PRI | ( | x | ) |
#include <nturt/sys/util.h>
Insert format string to print x .
| [in] | x | The data to print. |
| #define PRI_arg | ( | x | ) |
#include <nturt/sys/util.h>
Insert x to printf format.
| [in] | x | The data to print. |
| #define SCN | ( | x | ) |
#include <nturt/sys/util.h>
Insert format string to scan x .
| [in] | x | The data to scan, NOT the pointer to it. |
| #define TYPEOF_FIELD | ( | type, | |
| member ) |
#include <nturt/sys/util.h>
Get the type of a member in a structure (struct or union).
| [in] | type | The structure containing the member. |
| [in] | member | The member of the structure. |
| #define WORK_CTX | ( | _work | ) |
#include <nturt/sys/util.h>
Get the context of the work.
| [in] | _work | Pointer to work passed to work handler. |
| #define WORK_CTX_ARGS | ( | _work | ) |
#include <nturt/sys/util.h>
Get the arguments for the work.
| [in] | _work | Pointer to work passed to the work handler. |
| #define WORK_CTX_BUF_DEFINE | ( | _name, | |
| _size, | |||
| _work_handler, | |||
| _ctx, | |||
| _args_type ) |
#include <nturt/sys/util.h>
Define work context buffer for the bottom half of an ISR.
| [in] | _name | Name of the buffer. |
| [in] | _size | Size of the buffer, i.e. the number of simultaneous works that can be submitted. |
| [in] | _work_handler | Work entry point. |
| [in] | _ctx | Context of the work. |
| [in] | _args_type | Type of the arguments for the work. |
| #define XOR | ( | a, | |
| b ) |
#include <nturt/sys/util.h>
Logical XOR.
| [in] | a | First operand. |
| [in] | b | Second operand. |
| struct work_ctx * work_ctx_buf_alloc | ( | struct work_ctx_buf * | buf | ) |
#include <nturt/sys/util.h>
Allocate a work context. Return NULL if all work context are in use.
| [in] | buf | Work context buffer to allocate from. |