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) |
Typedefs | |
| typedef uint32_t | cy_rslt_t |
| Provides the result of an operation as a structured bitfield. More... | |
| enum | cyhal_rslt_module_chip { CYHAL_RSLT_MODULE_CHIP_HWMGR = CY_RSLT_MODULE_ABSTRACTION_HAL_BASE, CYHAL_RSLT_MODULE_ADC, CYHAL_RSLT_MODULE_COMP, CYHAL_RSLT_MODULE_CRC, CYHAL_RSLT_MODULE_DAC, CYHAL_RSLT_MODULE_DMA, CYHAL_RSLT_MODULE_FLASH, CYHAL_RSLT_MODULE_GPIO, CYHAL_RSLT_MODULE_I2C, CYHAL_RSLT_MODULE_I2S, CYHAL_RSLT_MODULE_INTERCONNECT, CYHAL_RSLT_MODULE_OPAMP, CYHAL_RSLT_MODULE_PDMPCM, CYHAL_RSLT_MODULE_PWM, CYHAL_RSLT_MODULE_QSPI, CYHAL_RSLT_MODULE_RTC, CYHAL_RSLT_MODULE_SDHC, CYHAL_RSLT_MODULE_SDIO, CYHAL_RSLT_MODULE_SPI, CYHAL_RSLT_MODULE_SYSTEM, CYHAL_RSLT_MODULE_TIMER, CYHAL_RSLT_MODULE_TRNG, CYHAL_RSLT_MODULE_UART, CYHAL_RSLT_MODULE_USB, CYHAL_RSLT_MODULE_WDT } |
| Enum to specify module IDs for cy_rslt_t values returned from the HAL. 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 a warning. | |
| #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 corresonding to individual modules. | |
| #define | CY_RSLT_MODULE_DRIVERS_PDL_BASE (0x0000U) |
| #define | CY_RSLT_MODULE_DRIVERS_WHD_BASE (0x0080U) |
| #define | CY_RSLT_MODULE_ABSTRACTION_HAL_BASE (0x0100U) |
| #define | CY_RSLT_MODULE_ABSTRACTION_BSP (0x0180U) |
| #define | CY_RSLT_MODULE_ABSTRACTION_FS (0x0181U) |
| #define | CY_RSLT_MODULE_ABSTRACTION_RESOURCE (0x0182U) |
| #define | CY_RSLT_MODULE_ABSTRACTION_OS (0x0183U) |
| #define | CY_RSLT_MODULE_ABSTRACTION_ENV (0x0184U) |
| #define | CY_RSLT_MODULE_BOARD_LIB_BASE (0x01A0U) |
| #define | CY_RSLT_MODULE_BOARD_LIB_RETARGET_IO (0x1A0U) |
| #define | CY_RSLT_MODULE_BOARD_LIB_RGB_LED (0x01A1U) |
| #define | CY_RSLT_MODULE_BOARD_LIB_SERIAL_FLASH (0x01A2U) |
| #define | CY_RSLT_MODULE_MIDDLEWARE_BASE (0x0200U) |
| #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_DRIVERS_PDL_BASE (0x0000U) |
Base identifier for peripheral driver library modules (0x0000 - 0x007F)
| #define CY_RSLT_MODULE_DRIVERS_WHD_BASE (0x0080U) |
Base identifier for wireless host driver library modules (0x0080 - 0x00FF)
| #define CY_RSLT_MODULE_ABSTRACTION_HAL_BASE (0x0100U) |
Base identifier for HAL modules (0x0100 - 0x017F)
| #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 identifier for Board Library modules (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_MIDDLEWARE_BASE (0x0200U) |
Base identifier for Middleware module codes (0x0200 - 0x02FF)
| 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.
Enum to specify module IDs for cy_rslt_t values returned from the HAL.