Shared macros and headers for DIFs. More...
#include <stdbool.h>
#include "sw/device/lib/base/macros.h"
#include "sw/device/lib/base/multibits.h"
#include "sw/device/lib/base/internal/status.h"
Go to the source code of this file.
Macros | |
#define | USING_INTERNAL_STATUS |
#define | DIF_RETURN_IF_ERROR(expr_) |
Evaluate an expression and return if the result is an error. More... | |
Typedefs | |
typedef enum dif_result | dif_result_t |
The result of a DIF operation. More... | |
typedef enum dif_toggle | dif_toggle_t |
A toggle state: enabled, or disabled. More... | |
typedef enum dif_irq_type | dif_irq_type_t |
An interrupt type: event, or status. More... | |
Enumerations | |
enum | dif_result { kDifOk = kOk, kDifError = kInternal, kDifBadArg = kInvalidArgument, kDifLocked = kFailedPrecondition, kDifUnavailable = kUnavailable, kDifIpFifoFull = kResourceExhausted, kDifOutOfRange = kOutOfRange, kDifUnaligned = kUnimplemented } |
The result of a DIF operation. More... | |
enum | dif_toggle { kDifToggleDisabled = 0, kDifToggleEnabled = 1 } |
A toggle state: enabled, or disabled. More... | |
enum | dif_irq_type { kDifIrqTypeEvent = 0, kDifIrqTypeStatus = 1 } |
An interrupt type: event, or status. More... | |
Functions | |
OT_WARN_UNUSED_RESULT bool | dif_is_valid_toggle (dif_toggle_t val) |
Checks if a DIF toggle type is valid. More... | |
OT_WARN_UNUSED_RESULT bool | dif_toggle_to_bool (dif_toggle_t val) |
Converts a dif_toggle_t to a bool . More... | |
OT_WARN_UNUSED_RESULT dif_toggle_t | dif_bool_to_toggle (bool val) |
Converts a bool to a dif_toggle_t . More... | |
OT_WARN_UNUSED_RESULT dif_toggle_t | dif_multi_bit_bool_to_toggle (multi_bit_bool_t val) |
Converts a multi-bit bool to a dif_toggle_t . More... | |
OT_WARN_UNUSED_RESULT multi_bit_bool_t | dif_toggle_to_multi_bit_bool4 (dif_toggle_t val) |
Converts a dif_toggle_t to a multi_bit_bool_t of 4 bits. More... | |
OT_WARN_UNUSED_RESULT multi_bit_bool_t | dif_toggle_to_multi_bit_bool8 (dif_toggle_t val) |
Converts a dif_toggle_t to a multi_bit_bool_t of 8 bits. More... | |
OT_WARN_UNUSED_RESULT multi_bit_bool_t | dif_toggle_to_multi_bit_bool12 (dif_toggle_t val) |
Converts a dif_toggle_t to a multi_bit_bool_t of 12 bits. More... | |
OT_WARN_UNUSED_RESULT multi_bit_bool_t | dif_toggle_to_multi_bit_bool16 (dif_toggle_t val) |
Converts a dif_toggle_t to a multi_bit_bool_t of 16 bits. More... | |
Shared macros and headers for DIFs.
Definition in file dif_base.h.
#define DIF_RETURN_IF_ERROR | ( | expr_ | ) |
Evaluate an expression and return if the result is an error.
expr_ | An expression which results in an dif_result_t. |
Definition at line 31 of file dif_base.h.
typedef enum dif_irq_type dif_irq_type_t |
An interrupt type: event, or status.
This enum may be used instead when describing an interrupt type. Specifically, event interrupts require software to manually clear them by writing to the interrupt status register (after handling the root cause), while status interrupts clear immediately when the root cause of the iterrupt has been handled.
typedef enum dif_result dif_result_t |
The result of a DIF operation.
NOTE: additional result values can be defined in the manually-implemented header by creating an additional *_result_t enum type. See the Lifecycle Controller DIF for how this may be implemented.
typedef enum dif_toggle dif_toggle_t |
A toggle state: enabled, or disabled.
This enum may be used instead of a bool
when describing an enabled/disabled state.
enum dif_irq_type |
An interrupt type: event, or status.
This enum may be used instead when describing an interrupt type. Specifically, event interrupts require software to manually clear them by writing to the interrupt status register (after handling the root cause), while status interrupts clear immediately when the root cause of the iterrupt has been handled.
Enumerator | |
---|---|
kDifIrqTypeEvent | Event type interrupt. |
kDifIrqTypeStatus | Status type interrupt. |
Definition at line 116 of file dif_base.h.
enum dif_result |
The result of a DIF operation.
NOTE: additional result values can be defined in the manually-implemented header by creating an additional *_result_t enum type. See the Lifecycle Controller DIF for how this may be implemented.
Definition at line 46 of file dif_base.h.
enum dif_toggle |
A toggle state: enabled, or disabled.
This enum may be used instead of a bool
when describing an enabled/disabled state.
Enumerator | |
---|---|
kDifToggleDisabled | The "disabled" state. |
kDifToggleEnabled | The "enabled" state. |
Definition at line 96 of file dif_base.h.
|
inline |
Converts a bool to a dif_toggle_t
.
val | A bool value. |
Definition at line 170 of file dif_base.h.
|
inline |
Checks if a DIF toggle type is valid.
val | A potential dif_toggle_t value. |
Definition at line 134 of file dif_base.h.
|
inline |
Converts a multi-bit bool to a dif_toggle_t
.
val | A multi-bit bool value. |
Definition at line 181 of file dif_base.h.
|
inline |
Converts a dif_toggle_t
to a bool
.
val | A dif_toggle_t value. |
Definition at line 152 of file dif_base.h.
|
inline |
Converts a dif_toggle_t
to a multi_bit_bool_t
of 12 bits.
val | A dif_toggle_t value. |
multi_bit_bool_t
value. Invalid values resolve to "false". Definition at line 233 of file dif_base.h.
|
inline |
Converts a dif_toggle_t
to a multi_bit_bool_t
of 16 bits.
val | A dif_toggle_t value. |
multi_bit_bool_t
value. Invalid values resolve to "false". Definition at line 249 of file dif_base.h.
|
inline |
Converts a dif_toggle_t
to a multi_bit_bool_t
of 4 bits.
val | A dif_toggle_t value. |
multi_bit_bool_t
value. Invalid values resolve to "false". Definition at line 201 of file dif_base.h.
|
inline |
Converts a dif_toggle_t
to a multi_bit_bool_t
of 8 bits.
val | A dif_toggle_t value. |
multi_bit_bool_t
value. Invalid values resolve to "false". Definition at line 217 of file dif_base.h.