![]() |
NTURT Zephyr v0.0.1
NTURT common library for Zephyr RTOS
|
Error passing and handling support. More...
Collaboration diagram for Error:Topics | |
| Error Codes | |
| Common error code definitions. | |
Data Structures | |
| struct | err |
| Error. More... | |
| struct | err_filter |
| Error filter for error callbacks. More... | |
| struct | err_callback |
| Error callback. More... | |
Macros | |
| #define | ERR_FLAG_DISABLED BIT(4) |
| Flag indicating the error is disabled, meaning setting or clearing the error will not have any effect. | |
| #define | ERR_FLAG_SET BIT(5) |
| Flag indicating the error is set. Can also be used in ERR_DEFINE to define an error that will be set after initialization. | |
| #define | ERR_FLAG_SEV_MASK (ERR_SEV_INFO | ERR_SEV_WARN | ERR_SEV_ERROR | ERR_SEV_FATAL) |
| Flag mask indicating the severity of the error. | |
| #define | ERR_DEFINE(_name, _errcode, _serverity, _desc, ...) |
| Define an error. | |
| #define | ERR_FILTER_CODE(...) |
| Error filter for error codes. | |
| #define | ERR_FILTER_SEV(...) |
| Error filter for severities. | |
| #define | ERR_CALLBACK_DEFINE_NAMED(_name, _handler, _user_data, ...) |
| Same as ERR_CALLBACK_DEFINE, but with a custom name for the callback. | |
| #define | ERR_CALLBACK_DEFINE(handler, user_data, ...) |
| Define an error callback. | |
| #define | ERR_FOREACH_SET(item) |
| Iterate over all set errors. | |
Typedefs | |
| typedef void(* | err_handler_t) (uint32_t errcode, bool set, void *user_data) |
| Error handler type. | |
Enumerations | |
| enum | err_sev { ERR_SEV_INFO = BIT(0) , ERR_SEV_WARN = BIT(1) , ERR_SEV_ERROR = BIT(2) , ERR_SEV_FATAL = BIT(3) } |
| Error severity. More... | |
| enum | err_filter_type { ERR_FILTER_TYPE_INVALID = 0 , ERR_FILTER_TYPE_CODE = 1 , ERR_FILTER_TYPE_SEV = 2 } |
| Error filter type. More... | |
Functions | |
| void | err_report (uint32_t errcode, bool set) |
| Set or clear error. | |
| bool | err_is_set (uint32_t errcode) |
| Check if the error is set. | |
Error passing and handling support.
| #define ERR_CALLBACK_DEFINE | ( | handler, | |
| user_data, | |||
| ... ) |
#include <nturt/err/err.h>
Define an error callback.
| [in] | handler | Handler of the error. |
| [in] | user_data | Pointer to custom data for the callback. |
| [in] | ... | Optional filters for the error callback. If multiple filters are specified, they are applied in the "and" manner. |
handler , if the same handler is used for multiple callbacks, ERR_CALLBACK_DEFINE_NAMED can be used instead to prevent linker errors. | #define ERR_CALLBACK_DEFINE_NAMED | ( | _name, | |
| _handler, | |||
| _user_data, | |||
| ... ) |
#include <nturt/err/err.h>
Same as ERR_CALLBACK_DEFINE, but with a custom name for the callback.
| #define ERR_DEFINE | ( | _name, | |
| _errcode, | |||
| _serverity, | |||
| _desc, | |||
| ... ) |
#include <nturt/err/err.h>
Define an error.
| [in] | _name | Name of the error. |
| [in] | _errcode | Code of the error. |
| [in] | _serverity | Serverity of the error, must be one of err_sev. |
| [in] | _desc | Description of the error. |
| [in] | ... | Optional flags of the error, multiple flags can be specified by using the bitwise OR operator (|). |
| #define ERR_FILTER_CODE | ( | ... | ) |
#include <nturt/err/err.h>
Error filter for error codes.
| [in] | ... | Error codes to filter. |
| #define ERR_FILTER_SEV | ( | ... | ) |
#include <nturt/err/err.h>
Error filter for severities.
| [in] | ... | Severities to filter. |
| #define ERR_FLAG_DISABLED BIT(4) |
#include <nturt/err/err.h>
Flag indicating the error is disabled, meaning setting or clearing the error will not have any effect.
| #define ERR_FLAG_SET BIT(5) |
#include <nturt/err/err.h>
Flag indicating the error is set. Can also be used in ERR_DEFINE to define an error that will be set after initialization.
| #define ERR_FLAG_SEV_MASK (ERR_SEV_INFO | ERR_SEV_WARN | ERR_SEV_ERROR | ERR_SEV_FATAL) |
#include <nturt/err/err.h>
Flag mask indicating the severity of the error.
| #define ERR_FOREACH_SET | ( | item | ) |
#include <nturt/err/err.h>
Iterate over all set errors.
| [out] | item | Error pointer to the set errors, NULL if the loop exits normally or no errors are set. |
| typedef void(* err_handler_t) (uint32_t errcode, bool set, void *user_data) |
#include <nturt/err/err.h>
Error handler type.
| [in] | errcode | Code of the error. |
| [in] | set | True if the error is set, false if the error is cleared. |
| [in,out] | user_data | Pointer to custom user data for the callback provided by ERR_CALLBACK_DEFINE. |
| enum err_filter_type |
#include <nturt/err/err.h>
Error filter type.
| Enumerator | |
|---|---|
| ERR_FILTER_TYPE_INVALID | Invalid filter, internal use only. |
| ERR_FILTER_TYPE_CODE | Filter for error codes. |
| ERR_FILTER_TYPE_SEV | Filter for severities. |
| enum err_sev |
#include <nturt/err/err.h>
Error severity.
| bool err_is_set | ( | uint32_t | errcode | ) |
#include <nturt/err/err.h>
Check if the error is set.
| [in] | errcode | Error code to check. |
| void err_report | ( | uint32_t | errcode, |
| bool | set ) |
#include <nturt/err/err.h>
Set or clear error.
| [in] | errcode | Error code to set or clear. |
| [in] | set | True to set error, false to clear error. |