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. Alternatively, a newer cy_rslt_decode_t, union was created to help make the decoding process easier. The cy_rslt_decode_t also uses enums for the type and module to make decoding even easier. Example uses of both approaches are shown below:
Decoding cy_rslt_t directly:
Using cy_rslt_decode_t to decode:
Data Structures | |
| union | cy_rslt_decode_t |
| Provides the result of an operation as a structured bitfield. More... | |
| struct | cy_rslt_decode_t.__unnamed1__ |
| Anonymous struct breaking out each of the fields of the result type. More... | |
Macros | |
| #define | CY_RSLT_SUCCESS ((cy_rslt_t)0x00000000U) |
| cy_rslt_t return value indicating success | |
| #define | CY_RSLT_CREATE(type, module, code) |
| Create a new cy_rslt_t value that encodes the specified type, module, and result code. More... | |
| #define | CY_RSLT_CREATE_EX(type, module, submodule, code) |
| Create a new cy_rslt_t value that encodes the specified type, module and result code. More... | |
Typedefs | |
| typedef uint32_t | cy_rslt_t |
| Provides the result of an operation as a structured bitfield. More... | |
Result Types | |
| enum | cy_en_rslt_type_t { CY_RSLT_TYPE_INFO = 0U , CY_RSLT_TYPE_WARNING = 1U , CY_RSLT_TYPE_ERROR = 2U , CY_RSLT_TYPE_FATAL = 3U } |
| Defines codes to identify the type of result. 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... | |
| union cy_rslt_decode_t |
| Data Fields | ||
|---|---|---|
| cy_rslt_t | raw | The raw uint32/cy_rslt_t value. |
| struct cy_rslt_decode_t.__unnamed1__ | __unnamed__ | Anonymous struct breaking out each of the fields of the result type. |
| struct cy_rslt_decode_t.__unnamed1__ |
| Data Fields | ||
|---|---|---|
| uint16_t | code: CY_RSLT_CODE_WIDTH | The 16bit result code. |
| cy_en_rslt_type_t | type: CY_RSLT_TYPE_WIDTH | The 2bit result type. |
| cy_en_rslt_module_t | module: CY_RSLT_MODULE_WIDTH | The 14bit module id. |
| #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_CREATE_EX | ( | type, | |
| module, | |||
| submodule, | |||
| code | |||
| ) |
Create a new cy_rslt_t value that encodes the specified type, module and result code.
This is a variant of CY_RSLT_CREATE for result codes that need to handle submodules as well.
| 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. |
| submodule | An asset defined subset of the module. The submodule consumes part of the "code" section and thus the size of the valid code is then reduced. |
| code | a module-defined identifier to identify the specific situation that this result describes. |
| 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 cy_en_rslt_type_t |
| enum cy_en_rslt_module_t |
Define codes to identify the module from which an error originated.
| Enumerator | |
|---|---|
| CY_RSLT_MODULE_DRIVER_SAR | Module identifier for the SAR driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_DFU | Module identifier for the Device Firmware Update (DFU) driver. Asset(s): (dfu) |
| CY_RSLT_MODULE_DRIVER_CAPSENSE | Module identifier for the Capsense driver. Asset(s): (capsense) |
| CY_RSLT_MODULE_DRIVER_USB_DEV | Module identifier for the USB Device driver. Asset(s): (usbdev) |
| CY_RSLT_MODULE_DRIVER_CTB | Module identifier for the Continuous Time Block (CTB) driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_CRYPTO | Module identifier for the Crypto driver. Asset(s): (mtb-pdl-cat1) |
| CY_RSLT_MODULE_DRIVER_SYSPM | Module identifier for the SysPm driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_SYSLIB | Module identifier for the SysLib driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_SYSCLK | Module identifier for the SysClk driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_DMA | Module identifier for the DMA driver. Asset(s): (mtb-pdl-cat1) |
| CY_RSLT_MODULE_DRIVER_FLASH | Module identifier for the Flash driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_SYSINT | Module identifier for the SysInt driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_GPIO | Module identifier for the GPIO driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_SYSANALOG | Module identifier for the Programmable Analog Sub System (PASS) driver. Asset(s): (mtb-pdl-cat1) |
| CY_RSLT_MODULE_DRIVER_CTDAC | Module identifier for the Continuous Time DAC (CTDAC) driver. Asset(s): (mtb-pdl-cat1) |
| CY_RSLT_MODULE_DRIVER_EFUSE | Module identifier for the eFuse driver. Asset(s): (mtb-pdl-cat1) |
| CY_RSLT_MODULE_DRIVER_EM_EEPROM | Module identifier for the Emulated EEPROM driver. Asset(s): (em_eeprom) |
| CY_RSLT_MODULE_DRIVER_PROFILE | Module identifier for the Profile driver. Asset(s): (mtb-pdl-cat1) |
| CY_RSLT_MODULE_DRIVER_I2S | Module identifier for the I2S driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_IPC | Module identifier for the IPC driver. Asset(s): (mtb-pdl-cat1) |
| CY_RSLT_MODULE_DRIVER_LPCOMP | Module identifier for the Low Power Comparator (LPCOMP) driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_PDM_PCM | Module identifier for the PDM-PCM driver. Asset(s): (mtb-pdl-cat1) |
| CY_RSLT_MODULE_DRIVER_RTC | Module identifier for the RTC driver. Asset(s): (mtb-pdl-cat1) |
| CY_RSLT_MODULE_DRIVER_SCB | Module identifier for the Serial Communications Block (SCB) driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_SMIF | Module identifier for the Serial Memory Interface (SMIF) driver. Asset(s): (mtb-pdl-cat1) |
| CY_RSLT_MODULE_DRIVER_TCPWM | Module identifier for the Timer/Counter/PWM (TCPWM) driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_PROT | Module identifier for the Protection driver. Asset(s): (mtb-pdl-cat1) |
| CY_RSLT_MODULE_DRIVER_HVSS | Module identifier for the HVSS driver. Asset(s): (mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_CRWDT | Module identifier for the CRWDT driver. Asset(s): (mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_TRIGMUX | Module identifier for the TRIGMUX driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_WDT | Module identifier for the WDT driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_MCWDT | Module identifier for the (WDC / MCWDT) driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_LTC | Module identifier for the LTC driver. Asset(s): (mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_LIN | Module identifier for the LIN driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_LVD | Module identifier for the LVD driver. Asset(s): (mtb-pdl-cat1) |
| CY_RSLT_MODULE_DRIVER_SD_HOST | Module identifier for the SD_HOST driver. Asset(s): (mtb-pdl-cat1) |
| CY_RSLT_MODULE_DRIVER_USBFS | Module identifier for the USBFS driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_DMAC | Module identifier for the DMAC driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_SEGLCD | Module identifier for the SegLCD driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_CSD | Module identifier for the CSD driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_SMARTIO | Module identifier for the SmartIO driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_CSDIDAC | Module identifier for the CSDIDAC driver. Asset(s): (csdidac) |
| CY_RSLT_MODULE_DRIVER_CANFD | Module identifier for the CAN FD driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_PRA | Module identifier for the PRA driver. Asset(s): (mtb-pdl-cat1) |
| CY_RSLT_MODULE_DRIVER_MSC | Module identifier for the MSC driver. Asset(s): (mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_ADCMIC | Module identifier for the ADC Mic driver. Asset(s): (mtb-pdl-cat1) Module identifier for the USB PD driver. Asset(s): (mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_MSCLP | Module identifier for the MSC LP driver. Asset(s): (mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_EVTGEN | Module identifier for the Event Gen driver. Asset(s): (mtb-pdl-cat1) |
| CY_RSLT_MODULE_DRIVER_SAR2 | Module identifier for the SAR v2 driver. Asset(s): (mtb-pdl-cat1) |
| CY_RSLT_MODULE_DRIVER_DSADC | Module identifier for the delta-sigma ADC driver. Asset(s): (mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_CAN2B | Module identifier for the CAN2.0B driver. Asset(s): (mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_KEYSCAN | Module identifier for the Key Scan driver. Asset(s): (mtb-pdl-cat1) |
| CY_RSLT_MODULE_DRIVER_PDM_PCM2 | Module identifier for the PDM-PCM v2 driver. Asset(s): (mtb-pdl-cat1) |
| CY_RSLT_MODULE_DRIVER_CRYPTOLITE | Module identifier for the Crypto Lite driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_SYSFAULT | Module identifier for the SysFault driver. Asset(s): (mtb-pdl-cat1, mtb-pdl-cat2) |
| CY_RSLT_MODULE_DRIVER_LVD_HT | Module identifier for the LVD HT driver. Asset(s): (mtb-pdl-cat1) |
| CY_RSLT_MODULE_DRIVER_WHD | Module identifier for the WiFi Host Driver. Asset(s): (wifi-host-driver) |
| CY_RSLT_MODULE_ABSTRACTION_HAL | Module identifier for the Hardware Abstraction Layer. Asset(s): (mtb-hal-cat1, mtb-hal-cat2, ...) |
| CY_RSLT_MODULE_ABSTRACTION_BSP | Module identifier for board support package. Asset(s): (BSPs) |
| CY_RSLT_MODULE_ABSTRACTION_FS | Module identifier for file system abstraction. |
| CY_RSLT_MODULE_ABSTRACTION_RESOURCE | Module identifier for resource abstraction. Asset(s): (abstraction-resource) |
| CY_RSLT_MODULE_ABSTRACTION_OS | Module identifier for RTOS abstraction. Asset(s): (abstraction-rtos) |
| CY_RSLT_MODULE_ABSTRACTION_DATA_STREAMING | Module identifier for Data Streaming abstraction. Asset(s): (data-streaming) |
| CY_RSLT_MODULE_ABSTRACTION_BLOCK_STORAGE | Module identifier for Block storage abstraction. Asset(s): (block-storage) |
| CY_RSLT_MODULE_BOARD_LIB_RETARGET_IO | Module identifier for the Retarget IO Board Library. Asset(s): (retarget-io) |
| CY_RSLT_MODULE_BOARD_LIB_RGB_LED | Module identifier for the RGB LED Board Library. Asset(s): (rgb-led) |
| CY_RSLT_MODULE_BOARD_LIB_SERIAL_MEMORY | Module identifier for the Serial Memory Board Library. Asset(s): (serial-memory) |
| CY_RSLT_MODULE_BOARD_LIB_SERIAL_FLASH | Module identifier for the Serial Flash Board Library. Asset(s): (serial-flash) |
| CY_RSLT_MODULE_BOARD_LIB_WHD_INTEGRATION | Module identifier for the WiFi Host Driver + Board Support Integration Library. Asset(s): (whd-bsp-integration) |
| CY_RSLT_MODULE_BOARD_SHIELD_028_EPD | Module identifier for Shield Board CY8CKIT-028-EPD. Asset(s): (CY8CKIT-028-EPD) |
| CY_RSLT_MODULE_BOARD_SHIELD_028_TFT | Module identifier for Shield Board CY8CKIT-028-TFT. Asset(s): (CY8CKIT-028-TFT) |
| CY_RSLT_MODULE_BOARD_SHIELD_032 | Module identifier for Shield Board CY8CKIT-032. Asset(s): (CY8CKIT-032) |
| CY_RSLT_MODULE_BOARD_SHIELD_028_SENSE | Module identifier for Shield Board CY8CKIT-028-SENSE. Asset(s): (CY8CKIT-028-SENSE) |
| CY_RSLT_MODULE_BOARD_HARDWARE_BMI160 | Module identifier for the BMI160 Motion Sensor Library. Asset(s): (sensor-motion-bmi160) |
| CY_RSLT_MODULE_BOARD_HARDWARE_E2271CS021 | Module identifier for the E2271CS021 E-Ink Controller Library. Asset(s): (display-eink-e2271cs021) |
| CY_RSLT_MODULE_BOARD_HARDWARE_THERMISTOR | Module identifier for the NTC GPIO Thermistor Library. Asset(s): (thermistor) |
| CY_RSLT_MODULE_BOARD_HARDWARE_SSD1306 | Module identifier for the SSD1306 OLED Controller Library. Asset(s): (display-oled-ssd1306) |
| CY_RSLT_MODULE_BOARD_HARDWARE_ST7789V | Module identifier for the ST7789V TFT Controller Library. Asset(s): (display-tft-st7789v) |
| CY_RSLT_MODULE_BOARD_HARDWARE_LIGHT_SENSOR | Module identifier for the Light Sensor Library. Asset(s): (sensor-light) |
| CY_RSLT_MODULE_BOARD_HARDWARE_AK4954A | Module identifier for the AK4954A Audio Codec Library. Asset(s): (audio-codec-ak4954a) |
| CY_RSLT_MODULE_BOARD_HARDWARE_BMX160 | Module identifier for the BMI160 Motion Sensor Library. Asset(s): (sensor-orientation-bmx160) |
| CY_RSLT_MODULE_BOARD_HARDWARE_DPS3XX | Module identifier for the XENSIV™ DPS3XX Pressure Sensor Library. Asset(s): (sensor-xensiv-dps3xx) |
| CY_RSLT_MODULE_BOARD_HARDWARE_WM8960 | Module identifier for the WM8960 Audio Codec Library. Asset(s): (audio-codec-wm8960) |
| CY_RSLT_MODULE_BOARD_HARDWARE_XENSIV_PASCO2 | Module identifier for the XENSIV™ PAS CO2 Sensor Library. Asset(s): (sensor-xensiv-pasco2) |
| CY_RSLT_MODULE_BOARD_HARDWARE_XENSIV_BGT60TRXX | Module identifier for the XENSIV™ BGT60TRxx Sensor Library. Asset(s): (sensor-xensiv-bgt60trxx) |
| CY_RSLT_MODULE_BOARD_HARDWARE_LM49450 | Module identifier for the LM49450 Audio Codec Library. Asset(s): (audio-codec-lm49450) |
| CY_RSLT_MODULE_BOARD_HARDWARE_TLV320DAC3100 | Module identifier for the TLV320DAC3100 Audio Codec Library. Asset(s): (audio-codec-tlv320dac3100) |
| CY_RSLT_MODULE_MIDDLEWARE_MNDS | Module identifier for the MDNS library. Asset(s): (mdns) |
| CY_RSLT_MODULE_MIDDLEWARE_AWS | Module identifier for the ASW IoT library. Asset(s): (aws-iot) |
| CY_RSLT_MODULE_MIDDLEWARE_JSON | Module identifier for the JSON parser library. Asset(s): (connectivity-utilities) |
| CY_RSLT_MODULE_MIDDLEWARE_LINKED_LIST | Module identifier for the Linked List library. Asset(s): (connectivity-utilities) |
| CY_RSLT_MODULE_MIDDLEWARE_COMMAND_CONSOLE | Module identifier for the Command Console library. Asset(s): (command-console) |
| CY_RSLT_MODULE_MIDDLEWARE_HTTP_SERVER | Module identifier for the HTTP Server library. Asset(s): (http-server) |
| CY_RSLT_MODULE_MIDDLEWARE_ENTERPRISE_SECURITY | Module identifier for the Enterprise Security library. Asset(s): (enterprise-security) |
| CY_RSLT_MODULE_MIDDLEWARE_TCPIP | Module identifier for the TCP/IP library. Asset(s): (connectivity-utilities) |
| CY_RSLT_MODULE_MIDDLEWARE_MW | Module identifier for the Generic middleware library. Asset(s): (connectivity-utilities, wifi-mw-core) |
| CY_RSLT_MODULE_MIDDLEWARE_TLS | Module identifier for the TLS library. Asset(s): (cy-mbedtls) |
| CY_RSLT_MODULE_MIDDLEWARE_SECURE_SOCKETS | Module identifier for the Secure Sockets library. Asset(s): (secure-sockets) |
| CY_RSLT_MODULE_MIDDLEWARE_WCM | Module identifier for the WiFi Connection Manager library (WCM). Asset(s): (wifi-connection-manager) |
| CY_RSLT_MODULE_MIDDLEWARE_LWIP_WHD_PORT | Module identifier for the lwIP WHD port library. Asset(s): (wifi-mw-core) |
| CY_RSLT_MODULE_MIDDLEWARE_OTA_UPDATE | Module identifier for the OTA Update library. Asset(s): (anycloud-ota) |
| CY_RSLT_MODULE_MIDDLEWARE_HTTP_CLIENT | Module identifier for the HTTP Clinet library. Asset(s): (http-client) |
| CY_RSLT_MODULE_MIDDLEWARE_ML | Module identifier for the Machine Learning(ML) library. Asset(s): (ml-middleware) |
| CY_RSLT_MODULE_MIDDLEWARE_EM_EEPROM | Module identifier for the Emulated EEPROM Middleware Library. Asset(s): (emeeprom) |
| CY_RSLT_MODULE_MIDDLEWARE_KVSTORE | Module identifier for the KV Store Middleware Library. Asset(s): (kv-store) |
| CY_RSLT_MODULE_MIDDLEWARE_LIN | Module identifier for the LIN Middleware Library. Asset(s): (lin) |
| CY_RSLT_MODULE_MIDDLEWARE_UBM | Module identifier for the UBM Middleware Library. Asset(s): (ubm) |
| CY_RSLT_MODULE_MIDDLEWARE_KVSTORE_CAT5 | Module identifier for the KV Store CAT5 Middleware Library. Asset(s): (kv-store-cat5) |
| CY_RSLT_MODULE_MIDDLEWARE_MCDI | Module identifier for the Motor Control Driver Interface Middleware. Asset(s): (mtb-mcdi) |
| CY_RSLT_MODULE_MIDDLEWARE_PWRCONV | Module identifier for the Power Conversion Middleware. Asset(s): (mtb-pwrconv) |
| CY_RSLT_MODULE_MIDDLEWARE_ASYNC_TRANSFER | Module identifier for the Async Transfer Utility Library. Asset(s): (async-transfer) |
| CY_RSLT_MODULE_MIDDLEWARE_PMBUS | Module identifier for the MTB PMBus Middleware Library. Asset(s): (mtb-pmbus) |