Defines a type and related utilities for function result handling.
The cy_rslt_t type is a structured bitfield which encodes information about result type, the originating module, and a code for the specific error (or warning etc). In order to extract these individual fields from a cy_rslt_t value, the utility macros CY_RSLT_GET_TYPE, CY_RSLT_GET_MODULE, and CY_RSLT_GET_CODE are provided. For example:
Macros | |
#define | CY_RSLT_SUCCESS ((cy_rslt_t)0x00000000U) |
cy_rslt_t return value indicating success | |
Typedefs | |
typedef uint32_t | cy_rslt_t |
Provides the result of an operation as a structured bitfield. More... | |
Fields | |
Utility macros for constructing result values and extracting individual fields from existing results. | |
#define | CY_RSLT_GET_TYPE(x) (((x) >> CY_RSLT_TYPE_POSITION) & CY_RSLT_TYPE_MASK) |
Get the value of the result type field. More... | |
#define | CY_RSLT_GET_MODULE(x) (((x) >> CY_RSLT_MODULE_POSITION) & CY_RSLT_MODULE_MASK) |
Get the value of the module identifier field. More... | |
#define | CY_RSLT_GET_CODE(x) (((x) >> CY_RSLT_CODE_POSITION) & CY_RSLT_CODE_MASK) |
Get the value of the result code field. More... | |
#define | CY_RSLT_CREATE(type, module, code) |
Create a new cy_rslt_t value that encodes the specified type, module, and result code. More... | |
Result Types | |
#define | CY_RSLT_TYPE_INFO (0U) |
The result code is informational-only. | |
#define | CY_RSLT_TYPE_WARNING (1U) |
The result code is warning of a problem but will proceed. | |
#define | CY_RSLT_TYPE_ERROR (2U) |
The result code is an error. | |
#define | CY_RSLT_TYPE_FATAL (3U) |
The result code is a fatal error. | |
Modules | |
Defines codes to identify the module from which an error originated. For some large libraries, a range of module codes is defined here; see the library documentation for values corresponding to individual modules. Valid range is 0x0000-0x4000. | |
#define | CY_RSLT_MODULE_DRIVERS_PDL_BASE (0x0000U) |
Base module identifier for peripheral driver library drivers (0x0000 - 0x007F) | |
#define | CY_RSLT_MODULE_DRIVERS_WHD_BASE (0x0080U) |
Base module identifier for wireless host driver library modules (0x0080 - 0x00FF) | |
#define | CY_RSLT_MODULE_ABSTRACTION_HAL_BASE (0x0100U) |
Deprecated. More... | |
#define | CY_RSLT_MODULE_ABSTRACTION_HAL (0x0100U) |
Module identifier for the Hardware Abstraction Layer. | |
#define | CY_RSLT_MODULE_ABSTRACTION_BSP (0x0180U) |
Module identifier for board support package. | |
#define | CY_RSLT_MODULE_ABSTRACTION_FS (0x0181U) |
Module identifier for file system abstraction. | |
#define | CY_RSLT_MODULE_ABSTRACTION_RESOURCE (0x0182U) |
Module identifier for resource abstraction. | |
#define | CY_RSLT_MODULE_ABSTRACTION_OS (0x0183U) |
Module identifier for rtos abstraction. | |
#define | CY_RSLT_MODULE_ABSTRACTION_ENV (0x0184U) |
Base identifier for environment abstraction modules (0x0184 - 0x01FF) | |
#define | CY_RSLT_MODULE_BOARD_LIB_BASE (0x01A0U) |
Base module identifier for Board Libraries (0x01A0 - 0x01BF) | |
#define | CY_RSLT_MODULE_BOARD_LIB_RETARGET_IO (0x1A0U) |
Module identifier for the Retarget IO Board Library. | |
#define | CY_RSLT_MODULE_BOARD_LIB_RGB_LED (0x01A1U) |
Module identifier for the RGB LED Board Library. | |
#define | CY_RSLT_MODULE_BOARD_LIB_SERIAL_FLASH (0x01A2U) |
Module identifier for the Serial Flash Board Library. | |
#define | CY_RSLT_MODULE_BOARD_LIB_WHD_INTEGRATION (0x01A3U) |
Module identifier for the WiFi Host Driver + Board Support Integration Library. | |
#define | CY_RSLT_MODULE_BOARD_SHIELD_BASE (0x01B8U) |
Base module identifier for Shield Board Libraries (0x01B8 - 0x01BF) | |
#define | CY_RSLT_MODULE_BOARD_SHIELD_028_EPD (0x01B8U) |
Module identifier for Shield Board CY8CKIT-028-EPD. | |
#define | CY_RSLT_MODULE_BOARD_SHIELD_028_TFT (0x01B9U) |
Module identifier for Shield Board CY8CKIT-028-TFT. | |
#define | CY_RSLT_MODULE_BOARD_SHIELD_032 (0x01BAU) |
Module identifier for Shield Board CY8CKIT-032. | |
#define | CY_RSLT_MODULE_BOARD_HARDWARE_BASE (0x01C0U) |
Base module identifier for Board Hardware Libraries (0x01C0 - 0x01FF) | |
#define | CY_RSLT_MODULE_BOARD_HARDWARE_BMI160 (0x01C0U) |
Module identifier for the BMI160 Motion Sensor Library. | |
#define | CY_RSLT_MODULE_BOARD_HARDWARE_E2271CS021 (0x01C1U) |
Module identifier for the E2271CS021 E-Ink Controller Library. | |
#define | CY_RSLT_MODULE_BOARD_HARDWARE_THERMISTOR (0x01C2U) |
Module identifier for the NTC GPIO Thermistor Library. | |
#define | CY_RSLT_MODULE_BOARD_HARDWARE_SSD1306 (0x01C3U) |
Module identifier for the SSD1306 OLED Controller Library. | |
#define | CY_RSLT_MODULE_BOARD_HARDWARE_ST7789V (0x01C4U) |
Module identifier for the ST7789V TFT Controller Library. | |
#define | CY_RSLT_MODULE_BOARD_HARDWARE_LIGHT_SENSOR (0x01C5U) |
Module identifier for the Light Sensor Library. | |
#define | CY_RSLT_MODULE_BOARD_HARDWARE_AK4954A (0x01C6U) |
Module identifier for the AK4954A Audio Codec Library. | |
#define | CY_RSLT_MODULE_MIDDLEWARE_BASE (0x0200U) |
Base module identifier for Middleware Libraries (0x0200 - 0x02FF) | |
#define CY_RSLT_GET_TYPE | ( | x | ) | (((x) >> CY_RSLT_TYPE_POSITION) & CY_RSLT_TYPE_MASK) |
Get the value of the result type field.
x | the cy_rslt_t value from which to extract the result type |
#define CY_RSLT_GET_MODULE | ( | x | ) | (((x) >> CY_RSLT_MODULE_POSITION) & CY_RSLT_MODULE_MASK) |
Get the value of the module identifier field.
x | the cy_rslt_t value from which to extract the module id |
#define CY_RSLT_GET_CODE | ( | x | ) | (((x) >> CY_RSLT_CODE_POSITION) & CY_RSLT_CODE_MASK) |
Get the value of the result code field.
x | the cy_rslt_t value from which to extract the result code |
#define CY_RSLT_CREATE | ( | type, | |
module, | |||
code | |||
) |
Create a new cy_rslt_t value that encodes the specified type, module, and result code.
type | one of CY_RSLT_TYPE_INFO, CY_RSLT_TYPE_WARNING, CY_RSLT_TYPE_ERROR, CY_RSLT_TYPE_FATAL |
module | Identifies the module where this result originated; see Modules. |
code | a module-defined identifier to identify the specific situation that this result describes. |
#define CY_RSLT_MODULE_ABSTRACTION_HAL_BASE (0x0100U) |
Deprecated.
typedef uint32_t cy_rslt_t |
Provides the result of an operation as a structured bitfield.
See the General Description for more details on structure and usage.